Class MailInvitationReader

java.lang.Object
org.exoplatform.agenda.util.MailInvitationReader

public final class MailInvitationReader extends Object
Reads the iCalendar object of an invitation received by mail into the event agenda lands (EXO-90866).

The object is the sender's. It came in a mail from outside, so it is bounded before ical4j reads it and narrowed after: the text's length, the number of components, of excluded dates and of overridden occurrences are capped, and an object over any cap is refused rather than read in part; the title, location and description are kept as plain text, capped as a subscribed feed's are (CalendarFeedParser); a rule that would cost agenda more to expand than a feed is allowed to is refused. Attendees are never read — the only person a landing acts for is the user who asked — and neither are alarms, attachments or conference properties. The organiser is read as a bare address, only to be compared with the organiser of an event the user already holds.

One event per object. An invitation is about one UID (RFC 5546): an object naming another UID than the one the reader showed, or several, is refused, and so is one carrying only an occurrence of a series.

Every refusal is an IllegalArgumentException: the sender's content, not an incident.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Longest object read, in characters.
    static final int
    Most VEVENT components an object may carry.
    static final int
    Most occurrences a series' EXDATEs may exclude.
    static final int
    Most occurrences an object may override.
    static final int
    Longest UID kept: it is stored beside the event and looked up by.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    An address as a landing compares it: trimmed, its ASCII letters lower-cased and every other character kept, refused when it does not look like a mail address.
    read(String icalendar, String expectedUid)
    Reads the event an invitation describes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MAX_CHARS

      public static final int MAX_CHARS
      Longest object read, in characters.
      See Also:
    • MAX_UID

      public static final int MAX_UID
      Longest UID kept: it is stored beside the event and looked up by.
      See Also:
    • MAX_COMPONENTS

      public static final int MAX_COMPONENTS
      Most VEVENT components an object may carry.
      See Also:
    • MAX_EXCLUSIONS

      public static final int MAX_EXCLUSIONS
      Most occurrences a series' EXDATEs may exclude.
      See Also:
    • MAX_OVERRIDES

      public static final int MAX_OVERRIDES
      Most occurrences an object may override.
      See Also:
  • Method Details

    • read

      public static MailInvitationEvent read(String icalendar, String expectedUid)
      Reads the event an invitation describes.
      Parameters:
      icalendar - the object, as text
      expectedUid - the UID the reader showed the user
      Returns:
      the event, its exclusions and its overrides
      Throws:
      IllegalArgumentException - when the object is over a cap, cannot be read, names another or more than one event, carries only an occurrence, has no start, or carries a rule agenda does not land
    • bareAddress

      public static String bareAddress(String address)
      An address as a landing compares it: trimmed, its ASCII letters lower-cased and every other character kept, refused when it does not look like a mail address. A full lower-casing turns some non-ASCII letters into ASCII ones (the Kelvin sign into k), so a look-alike ORGANIZER would compare equal to the held event's: the mail reader folds the From it checks against the ORGANIZER the same way.
      Parameters:
      address - the address, may be null
      Returns:
      the bare address, null when there is none