Class IcsText

java.lang.Object
org.exoplatform.caldav.ics.IcsText

public final class IcsText extends Object
The small conversions the ICS engine needs, kept apart so the writer reads as the shape of a calendar object rather than as string handling.

Property-value escaping is deliberately absent: ical4j escapes on serialisation, and a second pass would double every backslash. What remains here is what no library can decide for us — what a fragment of HTML means as plain text, what an agenda response means as a PARTSTAT, and what a reminder means in minutes.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The PARTSTAT default, both what RFC 5545 assumes and what agenda calls NEEDS_ACTION.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    The agenda response an iCalendar PARTSTAT stands for — the exact inverse of partStat(String), needed since a copy became something the user can answer on (EXO-89681).
    static String
    A description as plain text: the structural tags become line breaks, the rest of the markup is dropped and the entities are resolved.
    static Instant
    An instant from the two shapes agenda supplies: an ISO instant, or a plain date which is read as midnight UTC.
    static String
    partStat(String response)
    The PARTSTAT token for an agenda attendee response.
    static Long
    reminderMinutes(org.exoplatform.caldav.model.IcsReminder reminder)
    One agenda reminder as minutes before the start.

    Methods inherited from class java.lang.Object

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

    • NEEDS_ACTION

      public static final String NEEDS_ACTION
      The PARTSTAT default, both what RFC 5545 assumes and what agenda calls NEEDS_ACTION.

      Public since EXO-89868, which has to recognise the token rather than the response name. The answer fan-out declines to write a reset, and partStat(String) maps anything unrecognised to this value — so a caller comparing against "NEEDS_ACTION" would let a response agenda grows tomorrow through, and fan a reset out to every copy in the name of an answer nobody gave. Comparing against what would actually be written cannot make that mistake.

      See Also:
  • Method Details

    • htmlToText

      public static String htmlToText(String html)
      A description as plain text: the structural tags become line breaks, the rest of the markup is dropped and the entities are resolved.

      The browser did this by assigning to innerHTML and reading textContent, which is a parser. There is none here, so the same three transformations are applied explicitly — break tags, closing block tags, then everything else — and entities are unescaped afterwards rather than before, so that an escaped < in the source does not become a tag that the tag removal then eats.

      Parameters:
      html - the description as agenda holds it
      Returns:
      the text, with paragraph breaks preserved and trimmed
    • partStat

      public static String partStat(String response)
      The PARTSTAT token for an agenda attendee response.

      Agenda's own values are the RFC 5545 tokens already, up to the underscore spelling the enum constant uses. Anything else becomes NEEDS-ACTION, the RFC default, rather than an invalid token a strict reader would reject.

      Parameters:
      response - the attendee's response as agenda holds it
      Returns:
      a valid PARTSTAT value
    • agendaResponse

      public static String agendaResponse(String partStat)
      The agenda response an iCalendar PARTSTAT stands for — the exact inverse of partStat(String), needed since a copy became something the user can answer on (EXO-89681).

      Deliberately narrower than the write direction. Writing maps anything unknown to the RFC default, because an object has to say something; reading maps only the four tokens agenda has a word for, and answers null for the rest — DELEGATED, or a vendor extension, is not an answer eXo can record, and guessing one would put words in the user's mouth.

      Parameters:
      partStat - the PARTSTAT token as the client wrote it
      Returns:
      the agenda response name (ACCEPTED, DECLINED, TENTATIVE or NEEDS_ACTION), or null when the token maps to nothing agenda can hold
    • reminderMinutes

      public static Long reminderMinutes(org.exoplatform.caldav.model.IcsReminder reminder)
      One agenda reminder as minutes before the start.
      Parameters:
      reminder - the reminder as agenda holds it
      Returns:
      the minutes, or null when the reminder is unusable
    • parseInstant

      public static Instant parseInstant(String value)
      An instant from the two shapes agenda supplies: an ISO instant, or a plain date which is read as midnight UTC.
      Parameters:
      value - the value to parse
      Returns:
      the instant, or null when the value is neither