feat: added some property parameters
This commit is contained in:
+12
-1
@@ -22,5 +22,16 @@ package com.onixbyte.icalendar.property.parameter;
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class AlarmTriggerRelationship {
|
||||
public enum AlarmTriggerRelationship implements PropertyParameter {
|
||||
|
||||
START,
|
||||
END
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "RELATED";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ public final class Delegatee implements PropertyParameter {
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + String.join(",", value
|
||||
.stream()
|
||||
return PROPERTY_NAME + "=" + String.join(",", value.stream()
|
||||
.map((_value) -> "\"" + _value + "\"")
|
||||
.toList());
|
||||
}
|
||||
|
||||
@@ -83,8 +83,7 @@ public final class Delegator implements PropertyParameter {
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=\"" + String.join(",", value
|
||||
.stream()
|
||||
return PROPERTY_NAME + "=\"" + String.join(",", value.stream()
|
||||
.map((_value) -> "\"" + _value + "\"")
|
||||
.toList()) + "\"";
|
||||
}
|
||||
|
||||
+41
-1
@@ -17,10 +17,50 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* DirectoryEntryReference
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class DirectoryEntryReference {
|
||||
public final class DirectoryEntryReference implements PropertyParameter {
|
||||
|
||||
private static final String PROPERTY_NAME = "DIR";
|
||||
|
||||
private final URI value;
|
||||
|
||||
private DirectoryEntryReference(URI value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private URI value;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder directoryEntryReference(URI value) {
|
||||
this.value = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder directoryEntryReference(String value) {
|
||||
this.value = URI.create(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DirectoryEntryReference build() {
|
||||
return new DirectoryEntryReference(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=\"" + value + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ public enum FormatType implements PropertyParameter {
|
||||
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "FMTTYPE";
|
||||
|
||||
private final String ianaRegistry;
|
||||
|
||||
FormatType(String ianaRegistry) {
|
||||
@@ -38,6 +40,6 @@ public enum FormatType implements PropertyParameter {
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "FMTTYPE:" + this.ianaRegistry;
|
||||
return PROPERTY_NAME + "=" + this.ianaRegistry;
|
||||
}
|
||||
}
|
||||
|
||||
+20
-1
@@ -22,5 +22,24 @@ package com.onixbyte.icalendar.property.parameter;
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class FreeBusyTimeType {
|
||||
public enum FreeBusyTimeType implements PropertyParameter {
|
||||
|
||||
FREE("FREE"),
|
||||
BUSY("BUSY"),
|
||||
BUSY_UNAVAILABLE("BUSY-UNAVAILABLE"),
|
||||
BUSY_TENTATIVE("BUSY-TENTATIVE")
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "FBTYPE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
FreeBusyTimeType(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
|
||||
+64
-1
@@ -17,10 +17,73 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.datatype.CalendarUserAddress;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* GroupOrListMembership
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class GroupOrListMembership {
|
||||
public final class GroupOrListMembership implements PropertyParameter {
|
||||
|
||||
private static final String PROPERTY_NAME = "MEMBER";
|
||||
|
||||
private final List<CalendarUserAddress> value;
|
||||
|
||||
private GroupOrListMembership(List<CalendarUserAddress> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final List<CalendarUserAddress> value;
|
||||
|
||||
private Builder() {
|
||||
this.value = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Builder addMembership(CalendarUserAddress membership) {
|
||||
value.add(membership);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addMembership(String membership) {
|
||||
value.add(new CalendarUserAddress(membership));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addMembership(URI membership) {
|
||||
value.add(new CalendarUserAddress(membership));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addMemberships(List<CalendarUserAddress> memberships) {
|
||||
value.addAll(memberships);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addMemberships(Supplier<List<CalendarUserAddress>> memberships) {
|
||||
value.addAll(memberships.get());
|
||||
return this;
|
||||
}
|
||||
|
||||
public GroupOrListMembership build() {
|
||||
return new GroupOrListMembership(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + String.join(",", value.stream()
|
||||
.map((_value) -> "\"" + _value + "\"")
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,5 +22,23 @@ package com.onixbyte.icalendar.property.parameter;
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class InlineEncoding {
|
||||
public enum InlineEncoding implements PropertyParameter {
|
||||
|
||||
EIGHT_BIT("8BIT"),
|
||||
|
||||
BASE_64("BASE64"),
|
||||
;
|
||||
|
||||
private final String tag;
|
||||
|
||||
InlineEncoding(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
private static final String PROPERTY_NAME = "ENCODING";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,6 +260,8 @@ public enum Language implements PropertyParameter {
|
||||
SOUTH_AFRICA_ZULU("zu-ZA")
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "LANGUAGE";
|
||||
|
||||
private final String value;
|
||||
|
||||
Language(String value) {
|
||||
@@ -268,6 +270,6 @@ public enum Language implements PropertyParameter {
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "LANGUAGE=" + value;
|
||||
return PROPERTY_NAME + "=" + value;
|
||||
}
|
||||
}
|
||||
|
||||
+20
-1
@@ -22,5 +22,24 @@ package com.onixbyte.icalendar.property.parameter;
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class ParticipationRole {
|
||||
public enum ParticipationRole implements PropertyParameter {
|
||||
|
||||
CHAIR("CHAIR"),
|
||||
REQ_PARTICIPANT("REQ-PARTICIPANT"),
|
||||
OPT_PARTICIPANT("OPT-PARTICIPANT"),
|
||||
NON_PARTICIPANT("NON-PARTICIPANT"),
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "ROLE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
ParticipationRole(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
|
||||
+37
-1
@@ -17,10 +17,46 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ParticipationStatus
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class ParticipationStatus {
|
||||
public enum ParticipationStatus implements PropertyParameter {
|
||||
|
||||
ACCEPTED("ACCEPTED"),
|
||||
DECLINED("DECLINED"),
|
||||
TENTATIVE("TENTATIVE"),
|
||||
DELEGATED("DELEGATED"),
|
||||
COMPLETED("COMPLETED"),
|
||||
IN_PROGRESS("IN-PROGRESS"),
|
||||
NEEDS_ACTION("NEEDS-ACTION")
|
||||
;
|
||||
|
||||
public static List<ParticipationStatus> eventStatues() {
|
||||
return List.of(NEEDS_ACTION, ACCEPTED, DECLINED, TENTATIVE, DELEGATED);
|
||||
}
|
||||
|
||||
public static List<ParticipationStatus> todoStatues() {
|
||||
return List.of(NEEDS_ACTION, ACCEPTED, DECLINED, TENTATIVE, DELEGATED, COMPLETED, IN_PROGRESS);
|
||||
}
|
||||
|
||||
public static List<ParticipationStatus> journalStatues() {
|
||||
return List.of(NEEDS_ACTION, ACCEPTED, DECLINED);
|
||||
}
|
||||
|
||||
private static final String PROPERTY_NAME = "PARTSTAT";
|
||||
|
||||
private final String tag;
|
||||
|
||||
ParticipationStatus(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-1
@@ -22,5 +22,21 @@ package com.onixbyte.icalendar.property.parameter;
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class RecurrenceIdentifierRange {
|
||||
public enum RecurrenceIdentifierRange implements PropertyParameter {
|
||||
|
||||
THIS_AND_FUTURE("THISANDFUTURE")
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "RANGE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
RecurrenceIdentifierRange(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
|
||||
+29
-1
@@ -22,5 +22,33 @@ package com.onixbyte.icalendar.property.parameter;
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class RelationshipType {
|
||||
public enum RelationshipType implements PropertyParameter {
|
||||
|
||||
PARENT("PARENT"),
|
||||
CHILD("CHILD"),
|
||||
SIBLING("SIBLING"),
|
||||
SNOOZE("SNOOZE"),
|
||||
CONCEPT("CONCEPT"),
|
||||
DEPENDS_ON("DEPENDS-ON"),
|
||||
FINISH_TO_FINISH("FINISHTOFINISH"),
|
||||
FINISH_TO_START("FINISHTOSTART"),
|
||||
FIRST("FIRST"),
|
||||
NEXT("NEXT"),
|
||||
REF_ID("REFID"),
|
||||
START_TO_FINISH("STARTTOFINISH"),
|
||||
START_TO_START("STARTTOSTART")
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "RELTYPE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
RelationshipType(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
|
||||
+14
-1
@@ -22,5 +22,18 @@ package com.onixbyte.icalendar.property.parameter;
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class RsvpExpectation {
|
||||
public final class RsvpExpectation implements PropertyParameter {
|
||||
|
||||
private static final String PROPERTY_NAME = "RSVP";
|
||||
|
||||
private final boolean value;
|
||||
|
||||
public RsvpExpectation(boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=" + String.valueOf(value).toUpperCase();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,57 @@
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.datatype.CalendarUserAddress;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* SentBy
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class SentBy {
|
||||
public final class SentBy implements PropertyParameter {
|
||||
|
||||
private static final String PROPERTY_NAME = "SENT-BY";
|
||||
|
||||
private final CalendarUserAddress value;
|
||||
|
||||
private SentBy(CalendarUserAddress value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private CalendarUserAddress sentBy;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder sentBy(CalendarUserAddress sentBy) {
|
||||
this.sentBy = sentBy;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder sentBy(String sentBy) {
|
||||
this.sentBy = new CalendarUserAddress(sentBy);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder sentBy(URI sentBy) {
|
||||
this.sentBy = new CalendarUserAddress(sentBy);
|
||||
return this;
|
||||
}
|
||||
|
||||
public SentBy build() {
|
||||
return new SentBy(sentBy);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + "=\"" + value + "\"";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user