refactor: temporarily stopped developing
The webcal module will be back in October 2024 in version 2.0.0
This commit is contained in:
@@ -1,93 +0,0 @@
|
||||
# Module `webcal`
|
||||
|
||||
## Introduction
|
||||
|
||||
The module `webcal` is a Java library that facilitates the generation and resolution of iCalendar content for web-based calendar applications. It provides a flexible and easy-to-use API for creating web calendars with customisable settings and events.
|
||||
|
||||
### Key features
|
||||
|
||||
- Create and manage web calendars with events, including event details such as summary, description, location, and more.
|
||||
- Define event classifications and categories for better organisation and filtering of calendar data.
|
||||
- Set event start and end times, durations, and time zones to handle various scheduling scenarios.
|
||||
- Configure event priorities and completion percentages for visual representation in the calendar.
|
||||
- Generate iCalendar format output suitable for web calendar applications.
|
||||
|
||||
With the `webcal` module, developers can easily integrate calendar functionality into web applications, enabling users to view, add, and manage events in a structured and standardized format. It is designed to simplify calendar-related tasks and enhance the overall user experience when dealing with calendar data on the web.
|
||||
|
||||
Please note that the `webcal` module adheres to the iCalendar standard specified in RFC 5545, ensuring compatibility with other calendar applications that support this format.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- This whole `JDevKit` is developed by **JDK 17**, which means you have to use JDK 17 for better experience.
|
||||
|
||||
## Installation
|
||||
|
||||
### If you are using `Maven`
|
||||
|
||||
It is quite simple to install this module by `Maven`. The only thing you need to do is find your `pom.xml` file in the project, then find the `<dependencies>` node in the `<project>` node, and add the following codes to `<dependencies>` node:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>${implementation-builder-group-id}</groupId>
|
||||
<artifactId>simple-jwt-${any-implementation}</artifactId>
|
||||
<version>${simple-jwt-${any-implementation}.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.org.codecrafters</groupId>
|
||||
<artifactId>simple-jwt-spring-boot-starter</artifactId>
|
||||
<version>${simple-jwt-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
And run `mvn dependency:get` in your project root folder(i.e., if your `pom.xml` is located at `/path/to/your/project/pom.xml`, then your current work folder should be `/path/to/your/project`), then `Maven` will automatically download the `jar` archive from `Maven Central Repository`. This could be **MUCH EASIER** if you are using IDE(i.e., IntelliJ IDEA), the only thing you need to do is click the refresh button of `Maven`.
|
||||
|
||||
If you are restricted using the Internet, and have to make `Maven` offline, you could follow the following steps.
|
||||
|
||||
1. Download the `jar` file from any place you can get and transfer the `jar` files to your work computer.
|
||||
2. Move the `jar` files to your local `Maven` Repository as the path of `/path/to/maven_local_repo/cn/org/codecrafters/simple-jwt-spring-boot-starter/` and `/path/to/maven_local_repo/${implementation-builder-group-seperated-by-system-seperator}/${implementation_artifact_id}`.
|
||||
|
||||
### If you are using `Gradle`
|
||||
|
||||
Add this module to your project with `Gradle` is much easier than doing so with `Maven`.
|
||||
|
||||
Find `build.gradle` in the needed project, and add the following code to the `dependencies` closure in the build script:
|
||||
|
||||
```groovy
|
||||
implementation '${implementation-builder-group-id}:simple-jwt-${any-implementation}:${simple-jwt-${any-implementation}.version}'
|
||||
implementation 'cn.org.codecrafters:simple-jwt-spring-boot-starter:${simple-jwt-spring-boot-starter.version}'
|
||||
```
|
||||
|
||||
### If you are not using `Maven` or `Gradle`
|
||||
|
||||
1. Download the `jar` file from the Internet.
|
||||
2. Create a folder in your project and name it as a name you like(i.e., for me, I prefer `vendor`).
|
||||
3. Put the `jar` file to the folder you just created in Step 2.
|
||||
4. Add this folder to your project `classpath`.
|
||||
|
||||
## Create a web calendar
|
||||
|
||||
```java
|
||||
var calendar = new WebCalendar()
|
||||
// set the properties for web calendar here.
|
||||
;
|
||||
```
|
||||
|
||||
## Add a calendar node to this calendar
|
||||
|
||||
```java
|
||||
calendar.addNode(new WebCalendarNode()
|
||||
// set properties for this node here.
|
||||
);
|
||||
```
|
||||
|
||||
## Resolve this calendar.
|
||||
|
||||
```java
|
||||
var calendarString = calendar.resolve();
|
||||
```
|
||||
|
||||
## Contact
|
||||
|
||||
If you have any suggestions, ideas, don't hesitate contacting us via [GitHub Issues](https://github.com/CodeCraftersCN/jdevkit/issues/new) or [Discord Community](https://discord.gg/NQK9tjcBB8).
|
||||
|
||||
If you face any bugs while using our library and you are able to fix any bugs in our library, we would be happy to accept pull requests from you on [GitHub](https://github.com/CodeCraftersCN/jdevkit/compare).
|
||||
@@ -1,109 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
import java.net.URI
|
||||
|
||||
val buildGroupId: String by project
|
||||
val buildVersion: String by project
|
||||
val projectUrl: String by project
|
||||
val projectGithubUrl: String by project
|
||||
val licenseName: String by project
|
||||
val licenseUrl: String by project
|
||||
|
||||
group = buildGroupId
|
||||
version = buildVersion
|
||||
|
||||
dependencies {
|
||||
implementation(project(":devkit-core"))
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("webcal") {
|
||||
groupId = buildGroupId
|
||||
artifactId = "webcal"
|
||||
version = buildVersion
|
||||
|
||||
pom {
|
||||
name = "DevKit :: WebCal"
|
||||
description = "The web calendar module of JDevKit."
|
||||
url = projectUrl
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name = licenseName
|
||||
url = licenseUrl
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
connection = "scm:git:git://github.com:OnixByte/JDevKit.git"
|
||||
developerConnection = "scm:git:git://github.com:OnixByte/JDevKit.git"
|
||||
url = projectGithubUrl
|
||||
}
|
||||
|
||||
developers {
|
||||
developer {
|
||||
id = "zihluwang"
|
||||
name = "Zihlu Wang"
|
||||
email = "really@zihlu.wang"
|
||||
timezone = "Asia/Hong_Kong"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
from(components["java"])
|
||||
|
||||
signing {
|
||||
sign(publishing.publications["webcal"])
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "sonatypeNexus"
|
||||
url = URI(providers.gradleProperty("repo.maven-central.host").get())
|
||||
credentials {
|
||||
username = providers.gradleProperty("repo.maven-central.username").get()
|
||||
password = providers.gradleProperty("repo.maven-central.password").get()
|
||||
}
|
||||
}
|
||||
|
||||
maven {
|
||||
name = "githubPackages"
|
||||
url = URI(providers.gradleProperty("repo.github.host").get())
|
||||
credentials {
|
||||
username = providers.gradleProperty("repo.github.username").get()
|
||||
password = providers.gradleProperty("repo.github.password").get()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
public enum Method implements Property {
|
||||
|
||||
PUBLISH("PUBLISH"),
|
||||
REQUEST("REQUEST"),
|
||||
REPLY("REPLY"),
|
||||
ADD("ADD"),
|
||||
CANCEL("CANCEL"),
|
||||
REFRESH("REFRESH"),
|
||||
COUNTER("COUNTER"),
|
||||
DECLINE_COUNTER("DECLINECOUNTER"),
|
||||
;
|
||||
|
||||
private final String label;
|
||||
|
||||
private static final String PROPERTY_NAME = "METHOD";
|
||||
|
||||
Method(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return label;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + label;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
/**
|
||||
* ProductIdentifier
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class ProductIdentifier implements Property {
|
||||
|
||||
private final String value;
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + value + '\n';
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String productIdentifier;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder productIdentifier(String productIdentifier) {
|
||||
this.productIdentifier = productIdentifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder productIdentifier(String companyName, String productName) {
|
||||
this.productIdentifier = "-//" + companyName + "//" + productName + "//EN";
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder productIdentifier(String companyName, String productName, String languageTag) {
|
||||
this.productIdentifier = "-//" + companyName + "//" + productName + "//" + languageTag;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProductIdentifier build() {
|
||||
return new ProductIdentifier(productIdentifier);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
private static final String PROPERTY_NAME = "PRODID";
|
||||
|
||||
private ProductIdentifier(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.Resolvable;
|
||||
|
||||
public interface Property extends Resolvable {
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
/**
|
||||
* Scale
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum Scale implements Property {
|
||||
|
||||
GREGORIAN,
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "CALSCALE";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ':' + this.name();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.calendar.property;
|
||||
|
||||
/**
|
||||
* Version
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum Version implements Property {
|
||||
|
||||
VERSION_2_0,
|
||||
;
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "VERSION:" + switch (this) {
|
||||
case VERSION_2_0 -> "2.0";
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component;
|
||||
|
||||
import com.onixbyte.icalendar.calendar.property.Scale;
|
||||
import com.onixbyte.icalendar.calendar.property.Method;
|
||||
import com.onixbyte.icalendar.calendar.property.ProductIdentifier;
|
||||
import com.onixbyte.icalendar.calendar.property.Version;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* {@code WebCalendar} class represents a web calendar in iCalendar format.
|
||||
* <p>
|
||||
* It allows users to create and customise calendar components and events and
|
||||
* generate an <b>iCalendar</b> string containing all the calendar information.
|
||||
* <p>
|
||||
* Usage Example:
|
||||
* <pre>
|
||||
* WebCalendar calendar = new WebCalendar()
|
||||
* .setName("My Web Calendar")
|
||||
* .setCompanyName("CodeCrafters Inc.")
|
||||
* .setProductName("WebCal")
|
||||
* .setDomainName("codecrafters.org.cn")
|
||||
* .setMethod("PUBLISH")
|
||||
* .addEvent(event1)
|
||||
* .addEvent(event2);
|
||||
* String iCalendarString = calendar.resolve();
|
||||
* </pre>
|
||||
* <p>
|
||||
* The {@code WebCalendar} class is designed to generate an iCalendar string
|
||||
* conforming to the iCalendar specification, which can be used to share
|
||||
* calendar data with other calendar applications or services.
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
* @version 1.1.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public final class Calendar {
|
||||
|
||||
private static final String COMPONENT_NAME = "VCALENDAR";
|
||||
|
||||
/**
|
||||
* This property are OPTIONAL, but MUST NOT occur more than once.
|
||||
*/
|
||||
private Scale scale;
|
||||
|
||||
/**
|
||||
* This property are OPTIONAL, but MUST NOT occur more than once.
|
||||
*/
|
||||
private Method method;
|
||||
|
||||
/**
|
||||
* This property are REQUIRED, but MUST NOT occur more than once.
|
||||
*/
|
||||
private ProductIdentifier productIdentifier;
|
||||
|
||||
/**
|
||||
* This property are REQUIRED, but MUST NOT occur more than once.
|
||||
*/
|
||||
private final Version version = Version.VERSION_2_0;
|
||||
|
||||
private String calendarName;
|
||||
|
||||
private final List<CalendarComponent> components = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Generate and resolve the iCalendar string for the web calendar.
|
||||
*
|
||||
* @return the resolved iCalendar string
|
||||
*/
|
||||
public String resolve() {
|
||||
var calendarBuilder = new StringBuilder();
|
||||
calendarBuilder.append("BEGIN:").append(COMPONENT_NAME).append('\n');
|
||||
|
||||
calendarBuilder.append(version.resolve()).append('\n');
|
||||
calendarBuilder.append(productIdentifier.resolve()).append('\n');
|
||||
calendarBuilder.append("X-WR-CALNAME:").append(calendarName).append('\n');
|
||||
|
||||
Optional.ofNullable(scale)
|
||||
.ifPresent((_scale) -> calendarBuilder.append(_scale.resolve()).append('\n'));
|
||||
Optional.ofNullable(method)
|
||||
.ifPresent((_method) -> calendarBuilder.append(_method.resolve()).append('\n'));
|
||||
|
||||
if (!components.isEmpty()) {
|
||||
components.forEach(((component) -> calendarBuilder.append(component.resolve()).append('\n')));
|
||||
}
|
||||
|
||||
calendarBuilder.append("END:").append(COMPONENT_NAME).append('\n');
|
||||
return calendarBuilder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component;
|
||||
|
||||
/**
|
||||
* The abstract sealed class {@code WebCalendarNode} represents a node in a web calendar, such as an
|
||||
* <a href="some_link">event</a>, a to-do item, or an alarm. It provides common properties and
|
||||
* methods for all calendar components and events.
|
||||
* <p>
|
||||
* Subclasses of {@code WebCalendarNode} should implement the {@link #resolve()} method to generate
|
||||
* the corresponding iCalendar content for the specific calendar component or event.
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
* @version 1.1.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public abstract class CalendarComponent {
|
||||
|
||||
public abstract String resolve();
|
||||
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component;
|
||||
|
||||
import com.onixbyte.icalendar.component.property.Classification;
|
||||
import com.onixbyte.icalendar.component.property.DateTimeStamp;
|
||||
import com.onixbyte.icalendar.component.property.UniqueIdentifier;
|
||||
|
||||
/**
|
||||
* Event
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class Event extends CalendarComponent {
|
||||
|
||||
/*
|
||||
* The following properties are REQUIRED, but MUST NOT occur more than once.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private DateTimeStamp dtStamp;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private UniqueIdentifier uid;
|
||||
|
||||
/*
|
||||
* The following property is REQUIRED if the component appears in an iCalendar object that
|
||||
* doesn't specify the "METHOD" property; otherwise, it is OPTIONAL; in any case, it MUST NOT
|
||||
* occur more than once.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
// private DateTimeStamp dtStart;
|
||||
|
||||
/*
|
||||
* The following properties are OPTIONAL, but MUST NOT occur more than once.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Classification classification;
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.FormatType;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Attachment
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public record Attachment(FormatType formatType,
|
||||
URI uri,
|
||||
String content) implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "ATTACH";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
if (Objects.isNull(uri) && (Objects.isNull(content) || content.isBlank())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final var attachmentBuilder = new StringBuilder(PROPERTY_NAME);
|
||||
|
||||
Optional.ofNullable(formatType)
|
||||
.ifPresent((fmtType) -> attachmentBuilder.append(";").append(fmtType.resolve()));
|
||||
|
||||
Optional.ofNullable(uri).ifPresentOrElse(
|
||||
(_uri) -> attachmentBuilder.append(":").append(_uri),
|
||||
() -> attachmentBuilder.append(";ENCODING=BASE64;VALUE=BINARY:").append(content));
|
||||
attachmentBuilder.append("\n");
|
||||
|
||||
return attachmentBuilder.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,213 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.datatype.CalendarUserAddress;
|
||||
import com.onixbyte.icalendar.property.parameter.*;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public final class Attendee implements ComponentProperty {
|
||||
|
||||
public static final String PROPERTY_NAME = "ATTENDEE";
|
||||
|
||||
private final CalendarUserType calendarUserType;
|
||||
|
||||
private final GroupOrListMembership groupOrListMembership;
|
||||
|
||||
private final ParticipationRole role;
|
||||
|
||||
private final ParticipationStatus status;
|
||||
|
||||
private final RsvpExpectation rsvp;
|
||||
|
||||
private final Delegatee delegatee;
|
||||
|
||||
private final Delegator delegator;
|
||||
|
||||
private final SentBy sentBy;
|
||||
|
||||
private final CommonName commonName;
|
||||
|
||||
private final DirectoryEntryReference directory;
|
||||
|
||||
private final Language language;
|
||||
|
||||
private final CalendarUserAddress value;
|
||||
|
||||
private Attendee(CalendarUserType calendarUserType,
|
||||
GroupOrListMembership groupOrListMembership,
|
||||
ParticipationRole role,
|
||||
ParticipationStatus status,
|
||||
RsvpExpectation rsvp,
|
||||
Delegatee delegatee,
|
||||
Delegator delegator,
|
||||
SentBy sentBy,
|
||||
CommonName commonName,
|
||||
DirectoryEntryReference directory,
|
||||
Language language,
|
||||
CalendarUserAddress value) {
|
||||
this.calendarUserType = calendarUserType;
|
||||
this.groupOrListMembership = groupOrListMembership;
|
||||
this.role = role;
|
||||
this.status = status;
|
||||
this.rsvp = rsvp;
|
||||
this.delegatee = delegatee;
|
||||
this.delegator = delegator;
|
||||
this.sentBy = sentBy;
|
||||
this.commonName = commonName;
|
||||
this.directory = directory;
|
||||
this.language = language;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private CalendarUserType calendarUserType;
|
||||
|
||||
private GroupOrListMembership groupOrListMembership;
|
||||
|
||||
private ParticipationRole role;
|
||||
|
||||
private ParticipationStatus status;
|
||||
|
||||
private RsvpExpectation rsvp;
|
||||
|
||||
private Delegatee delegatee;
|
||||
|
||||
private Delegator delegator;
|
||||
|
||||
private SentBy sentBy;
|
||||
|
||||
private CommonName commonName;
|
||||
|
||||
private DirectoryEntryReference directory;
|
||||
|
||||
private Language language;
|
||||
|
||||
private CalendarUserAddress attendee;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder calendarUserType(CalendarUserType calendarUserType) {
|
||||
this.calendarUserType = calendarUserType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder groupOrListMembership(GroupOrListMembership groupOrListMembership) {
|
||||
this.groupOrListMembership = groupOrListMembership;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder role(ParticipationRole role) {
|
||||
this.role = role;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder status(ParticipationStatus status) {
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder rsvp(RsvpExpectation rsvp) {
|
||||
this.rsvp = rsvp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder delegatee(Delegatee delegatee) {
|
||||
this.delegatee = delegatee;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder delegator(Delegator delegator) {
|
||||
this.delegator = delegator;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder sentBy(SentBy sentBy) {
|
||||
this.sentBy = sentBy;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder commonName(CommonName commonName) {
|
||||
this.commonName = commonName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder directory(DirectoryEntryReference directory) {
|
||||
this.directory = directory;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder language(Language language) {
|
||||
this.language = language;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder attendee(CalendarUserAddress calendarUserAddress) {
|
||||
this.attendee = calendarUserAddress;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Attendee build() {
|
||||
return new Attendee(calendarUserType, groupOrListMembership, role, status, rsvp,
|
||||
delegatee, delegator, sentBy, commonName, directory, language, attendee);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
var builder = new StringBuilder(PROPERTY_NAME);
|
||||
|
||||
builder.append(Optional.ofNullable(calendarUserType)
|
||||
.map(CalendarUserType::resolve)
|
||||
.orElse(""))
|
||||
.append(Optional.ofNullable(groupOrListMembership)
|
||||
.map(GroupOrListMembership::resolve)
|
||||
.orElse(""))
|
||||
.append(Optional.ofNullable(role)
|
||||
.map(ParticipationRole::resolve)
|
||||
.orElse(""))
|
||||
.append(Optional.ofNullable(status)
|
||||
.map(ParticipationStatus::resolve)
|
||||
.orElse(""))
|
||||
.append(Optional.ofNullable(rsvp)
|
||||
.map(RsvpExpectation::resolve)
|
||||
.orElse(""))
|
||||
.append(Optional.ofNullable(delegatee)
|
||||
.map(Delegatee::resolve)
|
||||
.orElse(""))
|
||||
.append(Optional.ofNullable(delegator)
|
||||
.map(Delegator::resolve)
|
||||
.orElse(""))
|
||||
.append(Optional.ofNullable(sentBy)
|
||||
.map(SentBy::resolve)
|
||||
.orElse(""))
|
||||
.append(Optional.ofNullable(commonName)
|
||||
.map(CommonName::resolve)
|
||||
.orElse(""));
|
||||
// .append()
|
||||
|
||||
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
public record CalendarDuration(Duration duration) implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "DURATION";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + duration.toString() + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class Categories implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "CATEGORIES";
|
||||
|
||||
private final List<String> value;
|
||||
|
||||
private Categories(List<String> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final List<String> categories;
|
||||
|
||||
private Builder() {
|
||||
categories = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Builder addCategory(String category) {
|
||||
if (!categories.contains(category)) {
|
||||
categories.add(category);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addCategories(List<String> categories) {
|
||||
categories.forEach(this::addCategory);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Categories build() {
|
||||
return new Categories(categories);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + String.join(",", value) + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
public enum Classification implements ComponentProperty {
|
||||
|
||||
PUBLIC,
|
||||
PRIVATE,
|
||||
CONFIDENTIAL,
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "CLASS";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + name() + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.AlternateRepresentation;
|
||||
import com.onixbyte.icalendar.property.parameter.Language;
|
||||
|
||||
public record Comment(AlternateRepresentation altRep,
|
||||
Language language,
|
||||
String value) implements TextProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "COMMENT";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return TextProperty.composeResolution(PROPERTY_NAME, altRep, language, value);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.Resolvable;
|
||||
|
||||
public interface ComponentProperty extends Resolvable {
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.core.DateTimeFormatters;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
|
||||
public record DateTimeCompleted(LocalDateTime value) implements DateTimeProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "COMPLETED";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + value
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.withZoneSameInstant(ZoneId.of("UTC"))
|
||||
.format(DateTimeFormatters.utcDateTimeFormatter()) + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.core.DateTimeFormatters;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
|
||||
/**
|
||||
* DateTimeCreated
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public record DateTimeCreated(LocalDateTime created) implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "CREATED";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + created
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.withZoneSameInstant(ZoneId.of("UTC"))
|
||||
.format(DateTimeFormatters.utcDateTimeFormatter()) + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.ValueDataType;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
public record DateTimeDue(ValueDataType valueDataType,
|
||||
LocalDateTime localDateTime) implements DateTimeProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "DUE";
|
||||
|
||||
public DateTimeDue {
|
||||
if (Objects.nonNull(valueDataType) && !SUPPORTED_VALUES.contains(valueDataType)) {
|
||||
throw new IllegalArgumentException("ValueDateType only accepts DATE and DATE-TIME");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return DateTimeProperty.composeResolution(PROPERTY_NAME, valueDataType, localDateTime);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.ValueDataType;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public record DateTimeEnd(ValueDataType valueDataType,
|
||||
LocalDateTime localDateTime) implements DateTimeProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "DTEND";
|
||||
|
||||
public DateTimeEnd {
|
||||
if (Objects.nonNull(valueDataType) && !SUPPORTED_VALUES.contains(valueDataType)) {
|
||||
throw new IllegalArgumentException("ValueDateType only accepts DATE and DATE-TIME");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return DateTimeProperty.composeResolution(PROPERTY_NAME, valueDataType, localDateTime);
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.core.DateTimeFormatters;
|
||||
import com.onixbyte.icalendar.property.parameter.ValueDataType;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public interface DateTimeProperty {
|
||||
|
||||
List<ValueDataType> SUPPORTED_VALUES = List.of(
|
||||
ValueDataType.DATE,
|
||||
ValueDataType.DATE_TIME
|
||||
);
|
||||
|
||||
static String composeResolution(String propertyName,
|
||||
ValueDataType valueDataType,
|
||||
LocalDateTime localDateTime) {
|
||||
var dateTimeEndBuilder = new StringBuilder(propertyName);
|
||||
|
||||
Optional.ofNullable(valueDataType)
|
||||
.filter(SUPPORTED_VALUES::contains)
|
||||
.ifPresent((value) -> dateTimeEndBuilder.append(";").append(value.resolve()));
|
||||
|
||||
var dateTimeFormatter = switch (Optional.ofNullable(valueDataType)
|
||||
.filter(SUPPORTED_VALUES::contains)
|
||||
.orElse(ValueDataType.DATE_TIME)) {
|
||||
case DATE -> DateTimeFormatters.dateFormatter();
|
||||
case BINARY, UTC_OFFSET, BOOLEAN, CAL_ADDRESS, DURATION, FLOAT, INTEGER, PERIOD,
|
||||
RECURRENCE_RULE, TEXT, URI, DATE_TIME -> DateTimeFormatters.utcDateTimeFormatter();
|
||||
};
|
||||
|
||||
dateTimeEndBuilder.append(":")
|
||||
.append(localDateTime.atZone(ZoneId.systemDefault())
|
||||
.withZoneSameInstant(ZoneId.of("UTC"))
|
||||
.format(dateTimeFormatter))
|
||||
.append("\n");
|
||||
return dateTimeEndBuilder.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.calendar.property.Method;
|
||||
import com.onixbyte.icalendar.core.DateTimeFormatters;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
|
||||
/**
|
||||
* In the case of an {@link com.onixbyte.icalendar.component.Calendar iCalendar} object that
|
||||
* specifies a "{@link Method Method}" property, this property specifies the date and time that the
|
||||
* instance of the {@link com.onixbyte.icalendar.component.Calendar iCalendar} object was created.
|
||||
* In the case of an {@link com.onixbyte.icalendar.component.Calendar iCalendar} object that doesn't
|
||||
* specify a "{@link Method Method}" property, this property specifies the date and time that
|
||||
* the information associated with the calendar component was last revised in the calendar store.
|
||||
* <p>
|
||||
* The value MUST be specified in the UTC time format.
|
||||
* <p>
|
||||
* This property is also useful to protocols such as [2447bis] that have inherent latency issues
|
||||
* with the delivery of content. This property will assist in the proper sequencing of messages
|
||||
* containing {@link com.onixbyte.icalendar.component.Calendar iCalendar} objects.
|
||||
* <p>
|
||||
* In the case of an {@link com.onixbyte.icalendar.component.Calendar iCalendar} object that
|
||||
* specifies a "{@link Method Method}" property, this property differs from the
|
||||
* "{@link DateTimeCreated CREATED}" and "{@link LastModified LAST-MODIFIED}" properties. These two
|
||||
* properties are used to specify when the particular calendar data in the calendar store was
|
||||
* created and last modified. This is different from when the {@link
|
||||
* com.onixbyte.icalendar.component.Calendar iCalendar} object representation of the calendar
|
||||
* service information was created or last modified.
|
||||
* <p>
|
||||
* In the case of an {@link com.onixbyte.icalendar.component.Calendar iCalendar} object that
|
||||
* specifies a "{@link Method METHOD}" property, this property is equivalent to the "{@link
|
||||
* LastModified LAST-MODIFIED}" property.
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public record DateTimeStamp(LocalDateTime dateTimeStamp) implements DateTimeProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "DTSTAMP";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + dateTimeStamp
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.withZoneSameInstant(ZoneId.of("UTC"))
|
||||
.format(DateTimeFormatters.utcDateTimeFormatter()) + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.ValueDataType;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
public record DateTimeStart(ValueDataType valueDataType,
|
||||
LocalDateTime localDateTime) implements DateTimeProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "DTSTART";
|
||||
|
||||
public DateTimeStart {
|
||||
if (Objects.nonNull(valueDataType) && !SUPPORTED_VALUES.contains(valueDataType)) {
|
||||
throw new IllegalArgumentException("ValueDateType only accepts DATE and DATE-TIME");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return DateTimeProperty.composeResolution(PROPERTY_NAME, valueDataType, localDateTime);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.AlternateRepresentation;
|
||||
import com.onixbyte.icalendar.property.parameter.Language;
|
||||
|
||||
public record Description(AlternateRepresentation altRep,
|
||||
Language language,
|
||||
String value) implements TextProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "DESCRIPTION";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return TextProperty.composeResolution(PROPERTY_NAME, altRep, language, value);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.datatype.Period;
|
||||
import com.onixbyte.icalendar.property.parameter.FreeBusyTimeType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class FreeBusyTime implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "FREEBUSY";
|
||||
|
||||
private final FreeBusyTimeType freeBusyType;
|
||||
|
||||
private final List<Period> freeBusyValue;
|
||||
|
||||
public static class Builder {
|
||||
public Builder freeBusyType(FreeBusyTimeType freeBusyType) {
|
||||
this.freeBusyType = freeBusyType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addFreeBusyValue(Period period) {
|
||||
this.freeBusyValue.add(period);
|
||||
return this;
|
||||
}
|
||||
|
||||
public FreeBusyTime build() {
|
||||
return new FreeBusyTime(freeBusyType, freeBusyValue);
|
||||
}
|
||||
|
||||
private FreeBusyTimeType freeBusyType;
|
||||
|
||||
private final List<Period> freeBusyValue;
|
||||
|
||||
private Builder() {
|
||||
this.freeBusyValue = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
var freeBusyBuilder = new StringBuilder(PROPERTY_NAME);
|
||||
|
||||
Optional.ofNullable(freeBusyType)
|
||||
.ifPresent((type) -> freeBusyBuilder.append(";").append(type.resolve()));
|
||||
|
||||
freeBusyBuilder.append(":").append(String.join(",", freeBusyValue
|
||||
.stream()
|
||||
.map(Period::resolve)
|
||||
.toList()))
|
||||
.append("\n");
|
||||
|
||||
return freeBusyBuilder.toString();
|
||||
}
|
||||
|
||||
private FreeBusyTime(FreeBusyTimeType freeBusyType, List<Period> freeBusyValue) {
|
||||
this.freeBusyType = freeBusyType;
|
||||
this.freeBusyValue = freeBusyValue;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
public record GeoPosition(double latitude,
|
||||
double longitude) implements ComponentProperty {
|
||||
|
||||
public GeoPosition {
|
||||
if (latitude < -90 || latitude > 90) {
|
||||
throw new IllegalArgumentException(
|
||||
"Latitude (%f) should greater than -90 and less than 90.".formatted(latitude));
|
||||
}
|
||||
|
||||
if (longitude < -180 || longitude > 180) {
|
||||
throw new IllegalArgumentException(
|
||||
"Longitude (%f) should greater than -180 and less than 180."
|
||||
.formatted(longitude));
|
||||
}
|
||||
}
|
||||
|
||||
private static final String PROPERTY_NAME = "GEO";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + latitude + ";" + longitude + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.core.DateTimeFormatters;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
|
||||
/**
|
||||
* LastModified
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public record LastModified(LocalDateTime value) implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "LAST-MODIFIED";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + value.atZone(ZoneId.systemDefault())
|
||||
.withZoneSameInstant(ZoneId.of("UTC"))
|
||||
.format(DateTimeFormatters.utcDateTimeFormatter()) + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.AlternateRepresentation;
|
||||
import com.onixbyte.icalendar.property.parameter.Language;
|
||||
|
||||
public record Location(AlternateRepresentation altRep,
|
||||
Language language,
|
||||
String value) implements TextProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "LOCATION";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return TextProperty.composeResolution(PROPERTY_NAME, altRep, language, value);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
public record PercentComplete(int value) implements ComponentProperty {
|
||||
|
||||
public PercentComplete {
|
||||
if (value < 0 || value > 100) {
|
||||
throw new IllegalArgumentException("PercentComplete only accept value from 0 to 100, the given value %d is not acceptable."
|
||||
.formatted(value));
|
||||
}
|
||||
}
|
||||
|
||||
private static final String PROPERTY_NAME = "PERCENT-COMPLETE";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + value + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
public record Priority(int value) implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "PRIORITY";
|
||||
|
||||
public Priority {
|
||||
if (value < 0 || value > 9) {
|
||||
throw new IllegalArgumentException("Priority %d is exceeded the range of 0-9.".formatted(value));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + value + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.AlternateRepresentation;
|
||||
import com.onixbyte.icalendar.property.parameter.Language;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class Resources implements TextProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "RESOURCES";
|
||||
|
||||
private final AlternateRepresentation altRep;
|
||||
|
||||
private final Language language;
|
||||
|
||||
private final List<String> value;
|
||||
|
||||
private Resources(AlternateRepresentation altRep, Language language, List<String> value) {
|
||||
this.altRep = altRep;
|
||||
this.language = language;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final List<String> value;
|
||||
|
||||
private AlternateRepresentation altRep;
|
||||
|
||||
private Language language;
|
||||
|
||||
private Builder() {
|
||||
this.value = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Builder altRep(AlternateRepresentation altRep) {
|
||||
this.altRep = altRep;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder language(Language language) {
|
||||
this.language = language;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addResource(String resource) {
|
||||
value.add(resource);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addResources(List<String> resources) {
|
||||
value.addAll(resources);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Resources build() {
|
||||
return new Resources(altRep, language, value);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return TextProperty.composeResolution(PROPERTY_NAME, altRep, language, () -> String.join(",", value));
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
public record SequenceNumber(Integer sequence) implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "SEQUENCE";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + sequence + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public enum Status implements ComponentProperty {
|
||||
|
||||
TENTATIVE("TENTATIVE"),
|
||||
CONFIRMED("CONFIRMED"),
|
||||
CANCELLED("CANCELLED"),
|
||||
NEEDS_ACTION("NEEDS-ACTION"),
|
||||
COMPLETED("COMPLETED"),
|
||||
IN_PROGRESS("IN-PROGRESS"),
|
||||
DRAFT("DRAFT"),
|
||||
FINAL("FINAL"),
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "STATUS";
|
||||
|
||||
private final String tag;
|
||||
|
||||
Status(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + tag + "\n";
|
||||
}
|
||||
|
||||
public static List<Status> eventStatus() {
|
||||
return List.of(TENTATIVE, CONFIRMED, CANCELLED);
|
||||
}
|
||||
|
||||
public static List<Status> todoStatus() {
|
||||
return List.of(NEEDS_ACTION, COMPLETED, IN_PROGRESS, CANCELLED);
|
||||
}
|
||||
|
||||
public static List<Status> journalStatus() {
|
||||
return List.of(DRAFT, FINAL, CANCELLED);
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.AlternateRepresentation;
|
||||
import com.onixbyte.icalendar.property.parameter.Language;
|
||||
|
||||
public record Summary(AlternateRepresentation altRep,
|
||||
Language language,
|
||||
String value) implements TextProperty, ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "SUMMARY";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return TextProperty.composeResolution(PROPERTY_NAME, altRep, language, value);
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.AlternateRepresentation;
|
||||
import com.onixbyte.icalendar.property.parameter.Language;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public interface TextProperty {
|
||||
|
||||
static String composeResolution(String propertyName,
|
||||
AlternateRepresentation altRep,
|
||||
Language language,
|
||||
String value) {
|
||||
if (Objects.isNull(value) || value.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var resolutionBuilder = new StringBuilder(propertyName);
|
||||
|
||||
Optional.ofNullable(altRep)
|
||||
.ifPresent((_altRep) -> resolutionBuilder.append(";").append(_altRep.resolve()));
|
||||
|
||||
Optional.ofNullable(language)
|
||||
.ifPresent((lang) -> resolutionBuilder.append(";").append(lang.resolve()));
|
||||
|
||||
resolutionBuilder.append(":")
|
||||
.append(value)
|
||||
.append("\n");
|
||||
|
||||
return resolutionBuilder.toString();
|
||||
}
|
||||
|
||||
static String composeResolution(String propertyName,
|
||||
AlternateRepresentation altRep,
|
||||
Language language,
|
||||
Supplier<String> valueSupplier) {
|
||||
return composeResolution(propertyName, altRep, language, valueSupplier.get());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
public enum TimeTransparency implements ComponentProperty {
|
||||
|
||||
OPAQUE,
|
||||
TRANSPARENT,
|
||||
;
|
||||
|
||||
private static final String PROPERTY_NAME = "TRANSP";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + name() + "\n";
|
||||
}
|
||||
}
|
||||
-19
@@ -1,19 +0,0 @@
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import java.time.ZoneId;
|
||||
|
||||
public final class TimeZoneIdentifier implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "TZID";
|
||||
|
||||
private final ZoneId timeZoneIdentifier;
|
||||
|
||||
public TimeZoneIdentifier(String timeZoneIdentifier) {
|
||||
this.timeZoneIdentifier = ZoneId.of(timeZoneIdentifier);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + timeZoneIdentifier + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.Language;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public record TimeZoneName(Language language, String value) implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "TZNAME";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
var builder = new StringBuilder(PROPERTY_NAME);
|
||||
|
||||
Optional.ofNullable(language)
|
||||
.ifPresent((lang) -> builder.append(";").append(lang.resolve()));
|
||||
|
||||
builder.append(":")
|
||||
.append(value)
|
||||
.append("\n");
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
}
|
||||
-30
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.datatype.UtcOffset;
|
||||
|
||||
public record TimeZoneOffsetFrom(UtcOffset offset) implements ComponentProperty {
|
||||
|
||||
private static final String PROPERTY_NAME = "TZOFFSETFROM";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + offset.resolve() + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import com.onixbyte.icalendar.datatype.UtcOffset;
|
||||
|
||||
public record TimeZoneOffsetTo(UtcOffset offset) implements ComponentProperty {
|
||||
|
||||
public static final String PROPERTY_NAME = "TZOFFSETTO";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + offset.resolve() + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public record TimeZoneUrl(URI uri) implements ComponentProperty {
|
||||
|
||||
public static final String PROPERTY_NAME = "TZURL";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PROPERTY_NAME + ":" + uri + "\n";
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.component.property;
|
||||
|
||||
/**
|
||||
* UniqueIdentifier
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public record UniqueIdentifier(String value) implements ComponentProperty {
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "uid:" + this.value + '\n';
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.core;
|
||||
|
||||
/**
|
||||
* CalendarUtil
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class CalendarUtil {
|
||||
|
||||
private CalendarUtil() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.onixbyte.icalendar.core;
|
||||
|
||||
import com.onixbyte.icalendar.property.parameter.ValueDataType;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
public final class DateTimeFormatters {
|
||||
|
||||
private DateTimeFormatters() {
|
||||
}
|
||||
|
||||
private static DateTimeFormatter utcDateTimeFormatter;
|
||||
|
||||
private static DateTimeFormatter dateFormatter;
|
||||
|
||||
private static DateTimeFormatter localDateTimeFormatter;
|
||||
|
||||
public static DateTimeFormatter utcDateTimeFormatter() {
|
||||
if (Objects.isNull(utcDateTimeFormatter)) {
|
||||
utcDateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'");
|
||||
}
|
||||
return utcDateTimeFormatter;
|
||||
}
|
||||
|
||||
public static DateTimeFormatter dateFormatter() {
|
||||
if (Objects.isNull(dateFormatter)) {
|
||||
dateFormatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
||||
}
|
||||
return dateFormatter;
|
||||
}
|
||||
|
||||
public static DateTimeFormatter localDateTimeFormatter() {
|
||||
if (Objects.isNull(localDateTimeFormatter)) {
|
||||
localDateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss");
|
||||
}
|
||||
return localDateTimeFormatter;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.datatype;
|
||||
|
||||
import com.onixbyte.icalendar.property.Resolvable;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
public final class CalendarUserAddress implements Resolvable {
|
||||
|
||||
private URI value;
|
||||
|
||||
public CalendarUserAddress(URI value) {
|
||||
if (!"mailto".equalsIgnoreCase(value.getScheme())) {
|
||||
throw new IllegalArgumentException("Calendar User Address (CAL-ADDRESS) only accept mailto URI.");
|
||||
}
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public CalendarUserAddress(String value) {
|
||||
var uri = URI.create(value);
|
||||
if (!"mailto".equalsIgnoreCase(uri.getScheme())) {
|
||||
throw new IllegalArgumentException("Calendar User Address (CAL-ADDRESS) only accept mailto URI.");
|
||||
}
|
||||
this.value = uri;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.datatype;
|
||||
|
||||
import com.onixbyte.icalendar.property.Resolvable;
|
||||
|
||||
public interface Period extends Resolvable {
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.datatype;
|
||||
|
||||
import com.onixbyte.icalendar.core.DateTimeFormatters;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public final class PeriodExplicit implements Period {
|
||||
|
||||
private final LocalDateTime startTime;
|
||||
|
||||
private final LocalDateTime endTime;
|
||||
|
||||
public PeriodExplicit(LocalDateTime startTime, LocalDateTime endTime) {
|
||||
if (startTime.isAfter(endTime)) {
|
||||
throw new IllegalArgumentException("Period start must not after than period end.");
|
||||
}
|
||||
this.startTime = startTime;
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return startTime.format(DateTimeFormatters.utcDateTimeFormatter()) + "/" +
|
||||
endTime.format(DateTimeFormatters.utcDateTimeFormatter());
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.datatype;
|
||||
|
||||
import com.onixbyte.icalendar.component.property.DateTimeProperty;
|
||||
import com.onixbyte.icalendar.core.DateTimeFormatters;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public final class PeriodStart implements Period {
|
||||
|
||||
private LocalDateTime start;
|
||||
|
||||
private Duration duration;
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return start.format(DateTimeFormatters.utcDateTimeFormatter()) + "/" + duration;
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.datatype;
|
||||
|
||||
import com.onixbyte.icalendar.property.Resolvable;
|
||||
|
||||
public record UtcOffset(char sign, int hour, int minute) implements Resolvable {
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return "%c%02d%02d".formatted(sign, hour, minute);
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
package com.onixbyte.icalendar;
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property;
|
||||
|
||||
public interface Resolvable {
|
||||
|
||||
String resolve();
|
||||
|
||||
}
|
||||
-37
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* AlarmTriggerRelationship
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum AlarmTriggerRelationship implements PropertyParameter {
|
||||
|
||||
START,
|
||||
END
|
||||
;
|
||||
|
||||
private static final String PARAMETER_NAME = "RELATED";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + name();
|
||||
}
|
||||
}
|
||||
-73
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* Alternate Text Representation specifies a URI that points to an alternate representation for a
|
||||
* textual property value. A property specifying this parameter MUST also include a value that
|
||||
* reflects the default representation of the text value. The URI parameter value MUST be specified
|
||||
* in a quoted-string.
|
||||
* <p>
|
||||
* <b>Note</b>: While there is no restriction imposed on the URI schemes allowed for this
|
||||
* parameter, Content Identifier (CID) [RFC 2392], HTTP [RFC 2616], and HTTPS [RFC 2818] are the
|
||||
* URI schemes most commonly used by current implementations.
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
*/
|
||||
public final class AlternateRepresentation implements PropertyParameter {
|
||||
|
||||
private static final String PARAMETER_NAME = "ALTREP";
|
||||
|
||||
private final URI value;
|
||||
|
||||
private AlternateRepresentation(URI value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=\"" + value.toString() + "\"";
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private URI uri;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder uri(String uri) {
|
||||
this.uri = URI.create(uri);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder uri(URI uri) {
|
||||
this.uri = uri;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AlternateRepresentation build() {
|
||||
return new AlternateRepresentation(uri);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* UserType
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum CalendarUserType implements PropertyParameter {
|
||||
|
||||
/**
|
||||
* An individual.
|
||||
*/
|
||||
INDIVIDUAL,
|
||||
|
||||
/**
|
||||
* A group of individuals.
|
||||
*/
|
||||
GROUP,
|
||||
|
||||
/**
|
||||
* A physical resource.
|
||||
*/
|
||||
RESOURCE,
|
||||
|
||||
/**
|
||||
* A room resource.
|
||||
*/
|
||||
ROOM,
|
||||
|
||||
/**
|
||||
* Otherwise not known.
|
||||
*/
|
||||
UNKNOWN,
|
||||
;
|
||||
|
||||
private static final String PARAMETER_NAME = "CUTYPE";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + this.name();
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* Common Name can be specified on properties with a CAL-ADDRESS value type. The parameter
|
||||
* specifies the common name to be associated with the calendar user specified by the property.
|
||||
* The parameter value is text. The parameter value can be used for display text to be associated
|
||||
* with the calendar address specified by the property.
|
||||
*
|
||||
* @author Zihlu Wang
|
||||
*/
|
||||
public final class CommonName implements PropertyParameter {
|
||||
|
||||
private static final String PARAMETER_NAME = "CN";
|
||||
|
||||
private final String value;
|
||||
|
||||
private CommonName(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private String value;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public Builder commonName(String commonName) {
|
||||
this.value = commonName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public CommonName build() {
|
||||
return new CommonName(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=\"" + this.value + "\"";
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Delegate
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class Delegatee implements PropertyParameter {
|
||||
|
||||
private static final String PARAMETER_NAME = "DELEGATED-TO";
|
||||
|
||||
private final List<CalendarUserAddress> value;
|
||||
|
||||
private Delegatee(List<CalendarUserAddress> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private List<CalendarUserAddress> value;
|
||||
|
||||
private Builder() {
|
||||
this.value = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Builder addDelegatee(CalendarUserAddress delegatee) {
|
||||
value.add(delegatee);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addDelegatee(URI delegatee) {
|
||||
value.add(new CalendarUserAddress(delegatee));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addDelegatee(String delegatee) {
|
||||
value.add(new CalendarUserAddress(delegatee));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addDelegatees(List<CalendarUserAddress> delegatees) {
|
||||
value.addAll(delegatees);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addDelegatees(Supplier<List<CalendarUserAddress>> delegatees) {
|
||||
value.addAll(delegatees.get());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Delegatee build() {
|
||||
return new Delegatee(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + String.join(",", value.stream()
|
||||
.map((_value) -> "\"" + _value + "\"")
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Delegator
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class Delegator implements PropertyParameter {
|
||||
|
||||
private static final String PARAMETER_NAME = "DELEGATED-FROM";
|
||||
|
||||
private List<CalendarUserAddress> value;
|
||||
|
||||
private Delegator(List<CalendarUserAddress> value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private List<CalendarUserAddress> value;
|
||||
|
||||
private Builder() {
|
||||
value = new ArrayList<>();
|
||||
}
|
||||
|
||||
public Builder addDelegator(CalendarUserAddress delegator) {
|
||||
value.add(delegator);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addDelegator(String delegator) {
|
||||
value.add(new CalendarUserAddress(delegator));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addDelegator(URI delegator) {
|
||||
value.add(new CalendarUserAddress(delegator));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addDelegators(List<CalendarUserAddress> delegators) {
|
||||
value.addAll(delegators);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder addDelegators(Supplier<List<CalendarUserAddress>> delegators) {
|
||||
value.addAll(delegators.get());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Delegator build() {
|
||||
return new Delegator(value);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=\"" + String.join(",", value.stream()
|
||||
.map((_value) -> "\"" + _value + "\"")
|
||||
.toList()) + "\"";
|
||||
}
|
||||
}
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* DirectoryEntryReference
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class DirectoryEntryReference implements PropertyParameter {
|
||||
|
||||
private static final String PARAMETER_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 PARAMETER_NAME + "=\"" + value + "\"";
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* FormatType
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum FormatType implements PropertyParameter {
|
||||
|
||||
JSON("application/json"),
|
||||
|
||||
;
|
||||
|
||||
private static final String PARAMETER_NAME = "FMTTYPE";
|
||||
|
||||
private final String ianaRegistry;
|
||||
|
||||
FormatType(String ianaRegistry) {
|
||||
this.ianaRegistry = ianaRegistry;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + this.ianaRegistry;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* FreeBusyTimeType
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum FreeBusyTimeType implements PropertyParameter {
|
||||
|
||||
FREE("FREE"),
|
||||
BUSY("BUSY"),
|
||||
BUSY_UNAVAILABLE("BUSY-UNAVAILABLE"),
|
||||
BUSY_TENTATIVE("BUSY-TENTATIVE")
|
||||
;
|
||||
|
||||
private static final String PARAMETER_NAME = "FBTYPE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
FreeBusyTimeType(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
-89
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
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 final class GroupOrListMembership implements PropertyParameter {
|
||||
|
||||
private static final String PARAMETER_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 PARAMETER_NAME + "=" + String.join(",", value.stream()
|
||||
.map((_value) -> "\"" + _value + "\"")
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* InlineEncoding
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
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 PARAMETER_NAME = "ENCODING";
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
@@ -1,273 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* Language
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum Language implements PropertyParameter {
|
||||
|
||||
AFRIKAANS("af"),
|
||||
SOUTH_AFRICA_AFRIKAANS("af-ZA"),
|
||||
ARABIC("ar"),
|
||||
UAE_ARABIC("ar-AE"),
|
||||
BAHRAIN_ARABIC("ar-BH"),
|
||||
ALGERIA_ARABIC("ar-DZ"),
|
||||
EGYPT_ARABIC("ar-EG"),
|
||||
IRAQ_ARABIC("ar-IQ"),
|
||||
JORDAN_ARABIC("ar-JO"),
|
||||
KUWAIT_ARABIC("ar-KW"),
|
||||
LEBANON_ARABIC("ar-LB"),
|
||||
LIBYA_ARABIC("ar-LY"),
|
||||
MOROCCO_ARABIC("ar-MA"),
|
||||
OMAN_ARABIC("ar-OM"),
|
||||
QATAR_ARABIC("ar-QA"),
|
||||
SAUDI_ARABIA_ARABIC_("ar-SA"),
|
||||
SYRIA_ARABIC("ar-SY"),
|
||||
TUNISIA_ARABIC("ar-TN"),
|
||||
YEMEN_ARABIC("ar-YE"),
|
||||
LATIN_AZERI("az"),
|
||||
AZERBAIJAN_LATIN_AZERI("az-AZ"),
|
||||
AZERBAIJAN_CYRILLIC_AZERI("az-Cyrl-AZ"),
|
||||
BELARUSIAN("be"),
|
||||
BELARUS_BELARUSIAN("be-BY"),
|
||||
BULGARIAN("bg"),
|
||||
BULGARIA_BULGARIAN("bg-BG"),
|
||||
BOSNIA_AND_HERZEGOVINA_BOSNIAN("bs-BA"),
|
||||
CATALAN("ca"),
|
||||
SPAIN_CATALAN("ca-ES"),
|
||||
CZECH("cs"),
|
||||
CZECH_REPUBLIC_CZECH("cs-CZ"),
|
||||
WELSH("cy"),
|
||||
UNITED_KINGDOM_WELSH("cy-GB"),
|
||||
DANISH("da"),
|
||||
DENMARK_DANISH("da-DK"),
|
||||
GERMAN("de"),
|
||||
AUSTRIA_GERMAN("de-AT"),
|
||||
SWITZERLAND_GERMAN("de-CH"),
|
||||
GERMANY_GERMAN("de-DE"),
|
||||
LIECHTENSTEIN_GERMAN("de-LI"),
|
||||
LUXEMBOURG_GERMAN("de-LU"),
|
||||
DIVEHI("dv"),
|
||||
MALDIVES_DIVEHI("dv-MV"),
|
||||
GREEK("el"),
|
||||
GREECE_GREEK("el-GR"),
|
||||
ENGLISH("en"),
|
||||
AUSTRALIA_ENGLISH("en-AU"),
|
||||
BELIZE_ENGLISH("en-BZ"),
|
||||
CANADA_ENGLISH("en-CA"),
|
||||
CARIBBEAN_ENGLISH("en-CB"),
|
||||
UNITED_KINGDOM_ENGLISH("en-GB"),
|
||||
IRELAND_ENGLISH("en-IE"),
|
||||
JAMAICA_ENGLISH("en-JM"),
|
||||
NEW_ZEALAND_ENGLISH("en-NZ"),
|
||||
PHILIPPINES_ENGLISH("en-PH"),
|
||||
TRINIDAD_AND_TOBAGO_ENGLISH("en-TT"),
|
||||
UNITED_STATES_ENGLISH("en-US"),
|
||||
SOUTH_AFRICA_ENGLISH("en-ZA"),
|
||||
ZIMBABWE_ENGLISH("en-ZW"),
|
||||
ESPERANTO("eo"),
|
||||
SPANISH("es"),
|
||||
ARGENTINA_SPANISH("es-AR"),
|
||||
BOLIVIA_SPANISH("es-BO"),
|
||||
CHILE_SPANISH("es-CL"),
|
||||
COLOMBIA_SPANISH("es-CO"),
|
||||
COSTA_RICA_SPANISH("es-CR"),
|
||||
DOMINICAN_REPUBLIC_SPANISH("es-DO"),
|
||||
ECUADOR_SPANISH("es-EC"),
|
||||
SPAIN_SPANISH("es-ES"),
|
||||
GUATEMALA_SPANISH("es-GT"),
|
||||
HONDURAS_SPANISH("es-HN"),
|
||||
MEXICO_SPANISH("es-MX"),
|
||||
NICARAGUA_SPANISH("es-NI"),
|
||||
PANAMA_SPANISH("es-PA"),
|
||||
PERU_SPANISH("es-PE"),
|
||||
PUERTO_RICO_SPANISH("es-PR"),
|
||||
PARAGUAY_SPANISH("es-PY"),
|
||||
EL_SALVADOR_SPANISH("es-SV"),
|
||||
URUGUAY_SPANISH("es-UY"),
|
||||
VENEZUELA_SPANISH("es-VE"),
|
||||
ESTONIAN("et"),
|
||||
ESTONIA_ESTONIAN("et-EE"),
|
||||
BASQUE("eu"),
|
||||
SPAIN_BASQUE("eu-ES"),
|
||||
FARSI("fa"),
|
||||
IRAN_FARSI("fa-IR"),
|
||||
FINNISH("fi"),
|
||||
FINLAND_FINNISH("fi-FI"),
|
||||
FAROESE("fo"),
|
||||
FAROE_ISLANDS_FAROESE("fo-FO"),
|
||||
FRENCH("fr"),
|
||||
BELGIUM_FRENCH("fr-BE"),
|
||||
CANADA_FRENCH("fr-CA"),
|
||||
SWITZERLAND_FRENCH("fr-CH"),
|
||||
FRANCE_FRENCH("fr-FR"),
|
||||
LUXEMBOURG_FRENCH("fr-LU"),
|
||||
MONACO_FRENCH("fr-MC"),
|
||||
GALICIAN("gl"),
|
||||
SPAIN_GALICIAN("gl-ES"),
|
||||
GUJARATI("gu"),
|
||||
INDIA_GUJARATI("gu-IN"),
|
||||
HEBREW("he"),
|
||||
ISRAEL_HEBREW("he-IL"),
|
||||
HINDI("hi"),
|
||||
INDIA_HINDI("hi-IN"),
|
||||
CROATIAN("hr"),
|
||||
BOSNIA_AND_HERZEGOVINA_CROATIAN("hr-BA"),
|
||||
CROATIA_CROATIAN("hr-HR"),
|
||||
HUNGARIAN("hu"),
|
||||
HUNGARY_HUNGARIAN("hu-HU"),
|
||||
ARMENIAN("hy"),
|
||||
ARMENIA_ARMENIAN("hy-AM"),
|
||||
INDONESIAN("id"),
|
||||
INDONESIA_INDONESIAN("id-ID"),
|
||||
ICELANDIC("is"),
|
||||
ICELAND_ICELANDIC("is-IS"),
|
||||
ITALIAN("it"),
|
||||
SWITZERLAND_ITALIAN("it-CH"),
|
||||
ITALY_ITALIAN("it-IT"),
|
||||
JAPANESE("ja"),
|
||||
JAPAN_JAPANESE("ja-JA"),
|
||||
GEORGIAN("ka"),
|
||||
GEORGIA_GEORGIAN("ka-GE"),
|
||||
KAZAKH("kk"),
|
||||
KAZAKHSTAN_KAZAKH("kk-KZ"),
|
||||
KANNADA("kn"),
|
||||
INDIA_KANNADA("kn-IN"),
|
||||
KOREAN("ko"),
|
||||
KOREA_KOREAN("ko-KR"),
|
||||
KONKANI("kok"),
|
||||
INDIA_KONKANI("kok-IN"),
|
||||
KYRGYZ("ky"),
|
||||
KYRGYZSTAN_KYRGYZ("ky-KG"),
|
||||
LITHUANIAN("lt"),
|
||||
LITHUANIA_LITHUANIAN("lt-LT"),
|
||||
LATVIAN("lv"),
|
||||
LATVIA_LATVIAN("lv-LV"),
|
||||
MAORI("mi"),
|
||||
NEW_ZEALAND_MAORI("mi-NZ"),
|
||||
FYRO_MACEDONIAN("mk"),
|
||||
MACEDONIA_FYRO_MACEDONIAN("mk-MK"),
|
||||
MONGOLIAN("mn"),
|
||||
MONGOLIA_MONGOLIAN("mn-MN"),
|
||||
MARATHI("mr"),
|
||||
INDIA_MARATHI("mr-IN"),
|
||||
MALAY("ms"),
|
||||
BRUNEI_DARUSSALAM_MALAY("ms-BN"),
|
||||
MALAYSIA_MALAY("ms-MY"),
|
||||
MALTESE("mt"),
|
||||
MALTA_MALTESE("mt-MT"),
|
||||
NORWEGIAN("nb"),
|
||||
NORWAY_NORWEGIAN("nb-NO"),
|
||||
DUTCH("nl"),
|
||||
BELGIUM_DUTCH("nl-BE"),
|
||||
NETHERLANDS_DUTCH("nl-NL"),
|
||||
NORWAY_NYNORSK_NORWEGIAN("nn-NO"),
|
||||
NORTHERN_SOTHO("ns"),
|
||||
SOUTH_AFRICA_NORTHERN_SOTHO("ns-ZA"),
|
||||
PUNJABI("pa"),
|
||||
INDIA_PUNJABI("pa-IN"),
|
||||
POLISH("pl"),
|
||||
POLAND_POLISH("pl-PL"),
|
||||
PASHTO("pt"),
|
||||
AFGHANISTAN_PASHTO("ps-AR"),
|
||||
PORTUGUESE("pt"),
|
||||
BRAZIL_PORTUGUESE("pt-BR"),
|
||||
PORTUGAL_PORTUGUESE("pt-PT"),
|
||||
QUECHUA("qu"),
|
||||
BOLIVIA_QUECHUA("qu-BO"),
|
||||
ECUADOR_QUECHUA("qu-EC"),
|
||||
PERU_QUECHUA("qu-PE"),
|
||||
ROMANIAN("ro"),
|
||||
ROMANIA_ROMANIAN("ro-RO"),
|
||||
RUSSIAN("ru"),
|
||||
RUSSIA_RUSSIAN("ru-RU"),
|
||||
SANSKRIT("sa"),
|
||||
INDIA_SANSKRIT("sa-IN"),
|
||||
SAMI("se"),
|
||||
FINLAND_SAMI("se-FI"),
|
||||
NORWAY_SAMI("se-NO"),
|
||||
SWEDEN_SAMI("se-SE"),
|
||||
SLOVAK("sk"),
|
||||
SLOVAKIA_SLOVAK("sk-SK"),
|
||||
SLOVENIAN("sl"),
|
||||
SLOVENIA_SLOVENIAN("sl-SI"),
|
||||
ALBANIAN("sq"),
|
||||
ALBANIA_ALBANIAN("sq-AL"),
|
||||
BOSNIA_AND_HERZEGOVINA_LATIN_SERBIAN("sr-BA"),
|
||||
BOSNIA_AND_HERZEGOVINA_CYRILLIC_SERBIAN("sr-Cyrl-BA"),
|
||||
SERBIA_AND_MONTENEGRO_LATIN_SERBIAN("sr-SP"),
|
||||
SERBIA_AND_MONTENEGRO_CYRILLIC_SERBIAN("sr-Cyrl-SP"),
|
||||
SWEDISH("sv"),
|
||||
FINLAND_SWEDISH("sv-FI"),
|
||||
SWEDEN_SWEDISH("sv-SE"),
|
||||
SWAHILI("sw"),
|
||||
KENYA_SWAHILI("sw-KE"),
|
||||
SYRIAC("syr"),
|
||||
SYRIA_SYRIAC("syr-SY"),
|
||||
TAMIL("ta"),
|
||||
INDIA_TAMIL("ta-IN"),
|
||||
TELUGU("te"),
|
||||
INDIA_TELUGU("te-IN"),
|
||||
THAI("th"),
|
||||
THAILAND_THAI("th-TH"),
|
||||
TAGALOG("tl"),
|
||||
PHILIPPINES_TAGALOG("tl-PH"),
|
||||
TSWANA("tn"),
|
||||
SOUTH_AFRICA_TSWANA("tn-ZA"),
|
||||
TURKISH("tr"),
|
||||
TURKEY_TURKISH("tr-TR"),
|
||||
TATAR("tt"),
|
||||
RUSSIA_TATAR("tt-RU"),
|
||||
TSONGA("ts"),
|
||||
UKRAINIAN("uk"),
|
||||
UKRAINE_UKRAINIAN("uk-UA"),
|
||||
URDU("ur"),
|
||||
PAKISTAN_URDU("ur-PK"),
|
||||
UZBEK("uz"),
|
||||
UZBEKISTAN_UZBEK("uz-UZ"),
|
||||
UZBEKISTAN_CYRILLIC_UZBEK("uz-Cyrl-UZ"),
|
||||
VIETNAMESE("vi"),
|
||||
VIETNAM_VIETNAMESE("vi-VN"),
|
||||
XHOSA("xh"),
|
||||
SOUTH_AFRICA_XHOSA("xh-ZA"),
|
||||
CHINESE("zh"),
|
||||
SIMPLIFIED_CHINESE("zh-CN"),
|
||||
HONG_KONG_CHINESE("zh-HK"),
|
||||
MACAU_CHINESE("zh-MO"),
|
||||
SINGAPORE_CHINESE("zh-SG"),
|
||||
TRADITIONAL_CHINESE("zh-TW"),
|
||||
ZULU("zu"),
|
||||
SOUTH_AFRICA_ZULU("zu-ZA")
|
||||
;
|
||||
|
||||
private static final String PARAMETER_NAME = "LANGUAGE";
|
||||
|
||||
private final String value;
|
||||
|
||||
Language(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + value;
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* ParticipationRole
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum ParticipationRole implements PropertyParameter {
|
||||
|
||||
CHAIR("CHAIR"),
|
||||
REQ_PARTICIPANT("REQ-PARTICIPANT"),
|
||||
OPT_PARTICIPANT("OPT-PARTICIPANT"),
|
||||
NON_PARTICIPANT("NON-PARTICIPANT"),
|
||||
;
|
||||
|
||||
private static final String PARAMETER_NAME = "ROLE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
ParticipationRole(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
-62
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ParticipationStatus
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
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 PARAMETER_NAME = "PARTSTAT";
|
||||
|
||||
private final String tag;
|
||||
|
||||
ParticipationStatus(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.property.Resolvable;
|
||||
|
||||
public interface PropertyParameter extends Resolvable {
|
||||
}
|
||||
-42
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* RecurrenceIdentifierRange
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum RecurrenceIdentifierRange implements PropertyParameter {
|
||||
|
||||
THIS_AND_FUTURE("THISANDFUTURE")
|
||||
;
|
||||
|
||||
private static final String PARAMETER_NAME = "RANGE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
RecurrenceIdentifierRange(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* RelationshipType
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
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 PARAMETER_NAME = "RELTYPE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
RelationshipType(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* RsvpExpectation
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class RsvpExpectation implements PropertyParameter {
|
||||
|
||||
private static final String PARAMETER_NAME = "RSVP";
|
||||
|
||||
private final boolean value;
|
||||
|
||||
public RsvpExpectation(boolean value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + String.valueOf(value).toUpperCase();
|
||||
}
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
import com.onixbyte.icalendar.datatype.CalendarUserAddress;
|
||||
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* SentBy
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public final class SentBy implements PropertyParameter {
|
||||
|
||||
private static final String PARAMETER_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 PARAMETER_NAME + "=\"" + value + "\"";
|
||||
}
|
||||
}
|
||||
-26
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* TimeZoneIdentifier
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public class TimeZoneIdentifier {
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024-2024 OnixByte.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.onixbyte.icalendar.property.parameter;
|
||||
|
||||
/**
|
||||
* ValueDataType
|
||||
*
|
||||
* @author Zihlu WANG
|
||||
*/
|
||||
public enum ValueDataType implements PropertyParameter {
|
||||
|
||||
BINARY("BINARY"),
|
||||
BOOLEAN("BOOLEAN"),
|
||||
CAL_ADDRESS("CAL-ADDRESS"),
|
||||
DATE("DATE"),
|
||||
DATE_TIME("DATE-TIME"),
|
||||
DURATION("DURATION"),
|
||||
FLOAT("FLOAT"),
|
||||
INTEGER("INTEGER"),
|
||||
PERIOD("PERIOD"),
|
||||
RECURRENCE_RULE("RECUR"),
|
||||
TEXT("TEXT"),
|
||||
URI("URI"),
|
||||
UTC_OFFSET("UTC-OFFSET"),
|
||||
;
|
||||
|
||||
private static final String PARAMETER_NAME = "VALUE";
|
||||
|
||||
private final String tag;
|
||||
|
||||
ValueDataType(String tag) {
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String resolve() {
|
||||
return PARAMETER_NAME + "=" + tag;
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2024-2024 OnixByte.
|
||||
~
|
||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
~ you may not use this file except in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing, software
|
||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
~
|
||||
~ See the License for the specific language governing permissions and
|
||||
~ limitations under the License.
|
||||
-->
|
||||
<configuration>
|
||||
<property name="COLOURFUL_OUTPUT" value="%black(%date{'dd MMM, yyyy HH:mm:ss', Asia/Hong_Kong, en-UK}) %highlight(%-5level) %black(---) %black([%15.15t]) %cyan(%-39.39logger{39}) %black(:) %msg%n"/>
|
||||
<property name="STANDARD_OUTPUT" value="%date{'dd MMM, yyyy HH:mm:ss', Asia/Hong_Kong, en-UK} %-5level %black(---) [%10.10t] %-20.20logger{20} : %msg%n"/>
|
||||
|
||||
<statusListener class="ch.qos.logback.core.status.NopStatusListener" />
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${COLOURFUL_OUTPUT}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user