All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.svws_nrw.davapi.util.icalendar.recurrence.RecurrencyLimit Maven / Gradle / Ivy

Go to download

Diese Bibliothek enthält die Java-Server-Definition der CalDAV und CardDAV-Schnittstelle für die Schulverwaltungssoftware in NRW

The newest version!
package de.svws_nrw.davapi.util.icalendar.recurrence;

import java.time.Instant;

import de.svws_nrw.davapi.util.icalendar.DateTimeUtil;

/**
 * Diese Klasse repräsentiert ein Limit, wie häufig oder bis wann ein
 * wiederkehrendes Ereignis auftritt.
* Vgl. * RFC * 5545
* The UNTIL rule part defines a DATE or DATE-TIME value that bounds
the recurrence rule in an inclusive manner. If the value
specified by UNTIL is synchronized with the specified recurrence,
this DATE or DATE-TIME becomes the last instance of the
recurrence. The value of the UNTIL rule part MUST have the same
value type as the "DTSTART" property. Furthermore, if the
"DTSTART" property is specified as a date with local time, then
the UNTIL rule part MUST also be specified as a date with local
time. If the "DTSTART" property is specified as a date with UTC
time or a date with local time and time zone reference, then the
UNTIL rule part MUST be specified as a date with UTC time. In the
case of the "STANDARD" and "DAYLIGHT" sub-components the UNTIL
rule part MUST always be specified as a date with UTC time. If
specified as a DATE-TIME value, then it MUST be specified in a UTC
time format. If not present, and the COUNT rule part is also not
present, the "RRULE" is considered to repeat forever.

The COUNT rule part defines the number of occurrences at which to
range-bound the recurrence. The "DTSTART" property value always
counts as the first occurrence.
*/ public class RecurrencyLimit { /** Die Anzahl, wie häufig ein wiederkehrendes Ereignis auftrittt */ private final int count; /** Der Zeitpunkt, bis zu dem das wiederkehrende Ereignis wiederholt wird */ private final Instant until; /** * Konstruktor für das Recurrnylimit mit einem Zeitpunkt für eine UNTIL-Regel * * @param until der Zeitpunkt, bis zu dem die Regel zulässig sein soll */ public RecurrencyLimit(final Instant until) { this.until = until; this.count = 0; } /** * Konstruktor für ein RecurrencyLimit anhand einer Anzahl für eine COUNT-Regel * * @param count die Anzahl der Wiederholungen */ public RecurrencyLimit(final int count) { this.count = count; this.until = null; } /** * getter für die Anzahl der Wiederholungen, 0 wenn es eine UNTIL-Regel ist * * @return die Anzahl der Wiederholungen dieser Limitierung */ public int getCount() { return count; } /** * getter für das Enddatum einer Regel, null wenn es eine COUNT-Regel ist * * @return das Enddatum dieser Limitierung */ public Instant getUntil() { return until; } /** * Serialisiert diese Limitierung und fügt sie dem gegebenen StringBuilder hinzu * * @param sb der Stringbuilder, dem dieses Limit als COUNT oder UNTIL Regel * zugefügt werden soll. */ public void append(final StringBuilder sb) { if (this.until != null) { sb.append("UNTIL="); sb.append(DateTimeUtil.toCalDavString(this.until)); } else { sb.append("COUNT="); sb.append(this.count); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy