Class ICal4JDateCodec


  • @Technical
    @Bean
    @Singleton
    public class ICal4JDateCodec
    extends Object
    A decoder/encoder of iCal4J dates with Silverpeas dates.
    • Constructor Detail

      • ICal4JDateCodec

        public ICal4JDateCodec()
    • Method Detail

      • isEventDateToBeEncodedIntoUtc

        public boolean isEventDateToBeEncodedIntoUtc​(boolean eventRecurrent,
                                                     CalendarComponent component)
        Indicates if the date of an component must be encoded in UTC.
        Parameters:
        eventRecurrent - true if event is recurrent, false otherwise.
        component - the component data from which to verify the conditions.
        Returns:
        true if dates must be encoded into UTC, false otherwise.
      • encode

        public net.fortuna.ical4j.model.Date encode​(boolean eventRecurrent,
                                                    CalendarComponent component,
                                                    Temporal aTemporal)
        Encodes a temporal data into an iCal4J date.
        Parameters:
        eventRecurrent - true if event is recurrent, false otherwise.
        component - the component data to use to encode the given temporal.
        aTemporal - the temporal data to encode which have to be extracted from the given component.
        Returns:
        an iCal4J date.
        Throws:
        SilverpeasRuntimeException - if the encoding fails.
      • encode

        public net.fortuna.ical4j.model.Date encode​(Temporal aTemporal)
        Encodes a temporal data into an iCal4J date.
        Parameters:
        aTemporal - the temporal data to encode.
        Returns:
        an iCal4J date.
        Throws:
        IllegalArgumentException - if the encoding fails.
      • encode

        public net.fortuna.ical4j.model.DateList encode​(Collection<? extends Temporal> temporals)
        Encodes a temporal data set into an iCal4J date.
        Parameters:
        temporals - the temporal data set to encode.
        Returns:
        an iCal4J date.
        Throws:
        SilverpeasRuntimeException - if the encoding fails.
      • encode

        public net.fortuna.ical4j.model.DateTime encode​(OffsetDateTime dateTime)
        Encodes a datetime into an iCal4J date set in UTC.
        Parameters:
        dateTime - the datetime to encode.
        Returns:
        an iCal4J date.
        Throws:
        SilverpeasRuntimeException - if the encoding fails.
      • encode

        public net.fortuna.ical4j.model.DateTime encode​(ZonedDateTime dateTime)
        Encodes a datetime into an iCal4J date that takes into account the time zone of the specified datetime.
        Parameters:
        dateTime - the datetime with timezone to encode.
        Returns:
        an iCal4J date.
        Throws:
        SilverpeasRuntimeException - if the encoding fails.
      • encode

        public net.fortuna.ical4j.model.Date encode​(LocalDate date)
        Encodes a date into an iCal4J date.
        Parameters:
        date - a date.
        Returns:
        an iCal4J date.
        Throws:
        SilverpeasRuntimeException - if the encoding fails.
      • getTimeZone

        public net.fortuna.ical4j.model.TimeZone getTimeZone​(ZoneId zoneId)
      • decode

        public final Temporal decode​(net.fortuna.ical4j.model.Date aDate)
        Decodes an iCal4J Date or DateTime into a Temporal.
        Parameters:
        aDate - the Date or DateTime to decode.
        Returns:
        a temporal instance. If the temporal contains time data, then UTC timezone is set.
        Throws:
        SilverpeasRuntimeException - if the decoding fails.