From 0031750c2ebf402b69bbc8e0f4b80262775a90a7 Mon Sep 17 00:00:00 2001 From: zihluwang Date: Tue, 25 Jun 2024 20:46:10 +0800 Subject: [PATCH] refactor: temporarily stopped developing The webcal module will be back in October 2024 in version 2.0.0 --- webcal/README.md | 93 ------ webcal/build.gradle.kts | 109 ------- .../icalendar/calendar/property/Method.java | 50 ---- .../calendar/property/ProductIdentifier.java | 69 ----- .../icalendar/calendar/property/Property.java | 23 -- .../icalendar/calendar/property/Scale.java | 37 --- .../icalendar/calendar/property/Version.java | 36 --- .../icalendar/component/Calendar.java | 111 ------- .../component/CalendarComponent.java | 37 --- .../onixbyte/icalendar/component/Event.java | 69 ----- .../component/property/Attachment.java | 55 ---- .../component/property/Attendee.java | 213 -------------- .../component/property/CalendarDuration.java | 30 -- .../component/property/Categories.java | 65 ----- .../component/property/Classification.java | 33 --- .../icalendar/component/property/Comment.java | 33 --- .../component/property/ComponentProperty.java | 23 -- .../component/property/DateTimeCompleted.java | 36 --- .../component/property/DateTimeCreated.java | 41 --- .../component/property/DateTimeDue.java | 41 --- .../component/property/DateTimeEnd.java | 41 --- .../component/property/DateTimeProperty.java | 61 ---- .../component/property/DateTimeStamp.java | 65 ----- .../component/property/DateTimeStart.java | 40 --- .../component/property/Description.java | 34 --- .../component/property/FreeBusyTime.java | 83 ------ .../component/property/GeoPosition.java | 42 --- .../component/property/LastModified.java | 40 --- .../component/property/Location.java | 33 --- .../component/property/PercentComplete.java | 35 --- .../component/property/Priority.java | 34 --- .../component/property/Resources.java | 86 ------ .../component/property/SequenceNumber.java | 11 - .../icalendar/component/property/Status.java | 58 ---- .../icalendar/component/property/Summary.java | 33 --- .../component/property/TextProperty.java | 59 ---- .../component/property/TimeTransparency.java | 15 - .../property/TimeZoneIdentifier.java | 19 -- .../component/property/TimeZoneName.java | 24 -- .../property/TimeZoneOffsetFrom.java | 30 -- .../component/property/TimeZoneOffsetTo.java | 30 -- .../component/property/TimeZoneUrl.java | 30 -- .../component/property/UniqueIdentifier.java | 31 -- .../onixbyte/icalendar/core/CalendarUtil.java | 32 -- .../icalendar/core/DateTimeFormatters.java | 42 --- .../datatype/CalendarUserAddress.java | 52 ---- .../onixbyte/icalendar/datatype/Period.java | 24 -- .../icalendar/datatype/PeriodExplicit.java | 43 --- .../icalendar/datatype/PeriodStart.java | 36 --- .../icalendar/datatype/UtcOffset.java | 28 -- .../com/onixbyte/icalendar/package-info.java | 23 -- .../icalendar/property/Resolvable.java | 24 -- .../parameter/AlarmTriggerRelationship.java | 37 --- .../parameter/AlternateRepresentation.java | 73 ----- .../property/parameter/CalendarUserType.java | 59 ---- .../property/parameter/CommonName.java | 62 ---- .../property/parameter/Delegatee.java | 89 ------ .../property/parameter/Delegator.java | 89 ------ .../parameter/DirectoryEntryReference.java | 66 ----- .../property/parameter/FormatType.java | 43 --- .../property/parameter/FreeBusyTimeType.java | 45 --- .../parameter/GroupOrListMembership.java | 89 ------ .../property/parameter/InlineEncoding.java | 44 --- .../property/parameter/Language.java | 273 ------------------ .../property/parameter/ParticipationRole.java | 45 --- .../parameter/ParticipationStatus.java | 62 ---- .../property/parameter/PropertyParameter.java | 23 -- .../parameter/RecurrenceIdentifierRange.java | 42 --- .../property/parameter/RelationshipType.java | 54 ---- .../property/parameter/RsvpExpectation.java | 39 --- .../icalendar/property/parameter/SentBy.java | 73 ----- .../parameter/TimeZoneIdentifier.java | 26 -- .../property/parameter/ValueDataType.java | 54 ---- webcal/src/main/resources/logback.xml | 31 -- 74 files changed, 3860 deletions(-) delete mode 100644 webcal/README.md delete mode 100644 webcal/build.gradle.kts delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Method.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/calendar/property/ProductIdentifier.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Property.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Scale.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Version.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/Calendar.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/CalendarComponent.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/Event.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Attachment.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Attendee.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/CalendarDuration.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Categories.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Classification.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Comment.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/ComponentProperty.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeCompleted.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeCreated.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeDue.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeEnd.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeProperty.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeStamp.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeStart.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Description.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/FreeBusyTime.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/GeoPosition.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/LastModified.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Location.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/PercentComplete.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Priority.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Resources.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/SequenceNumber.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Status.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/Summary.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/TextProperty.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeTransparency.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneIdentifier.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneName.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneOffsetFrom.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneOffsetTo.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneUrl.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/component/property/UniqueIdentifier.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/core/CalendarUtil.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/core/DateTimeFormatters.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/datatype/CalendarUserAddress.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/datatype/Period.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/datatype/PeriodExplicit.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/datatype/PeriodStart.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/datatype/UtcOffset.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/package-info.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/Resolvable.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/AlarmTriggerRelationship.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/AlternateRepresentation.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/CalendarUserType.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/CommonName.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Delegatee.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Delegator.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/DirectoryEntryReference.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/FormatType.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/FreeBusyTimeType.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/GroupOrListMembership.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/InlineEncoding.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Language.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ParticipationRole.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ParticipationStatus.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/PropertyParameter.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RecurrenceIdentifierRange.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RelationshipType.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RsvpExpectation.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/SentBy.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/TimeZoneIdentifier.java delete mode 100644 webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ValueDataType.java delete mode 100644 webcal/src/main/resources/logback.xml diff --git a/webcal/README.md b/webcal/README.md deleted file mode 100644 index 3ea4034..0000000 --- a/webcal/README.md +++ /dev/null @@ -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 `` node in the `` node, and add the following codes to `` node: - -```xml - - ${implementation-builder-group-id} - simple-jwt-${any-implementation} - ${simple-jwt-${any-implementation}.version} - - - cn.org.codecrafters - simple-jwt-spring-boot-starter - ${simple-jwt-spring-boot-starter.version} - -``` - -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). \ No newline at end of file diff --git a/webcal/build.gradle.kts b/webcal/build.gradle.kts deleted file mode 100644 index f4abccd..0000000 --- a/webcal/build.gradle.kts +++ /dev/null @@ -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("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() - } - } - } - } -} \ No newline at end of file diff --git a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Method.java b/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Method.java deleted file mode 100644 index 297e1d4..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Method.java +++ /dev/null @@ -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; - } - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/ProductIdentifier.java b/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/ProductIdentifier.java deleted file mode 100644 index e44e29e..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/ProductIdentifier.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Property.java b/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Property.java deleted file mode 100644 index b5e2196..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Property.java +++ /dev/null @@ -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 { -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Scale.java b/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Scale.java deleted file mode 100644 index 4fd3b71..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Scale.java +++ /dev/null @@ -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(); - } - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Version.java b/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Version.java deleted file mode 100644 index 77fd2e9..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/calendar/property/Version.java +++ /dev/null @@ -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"; - }; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/Calendar.java b/webcal/src/main/java/com/onixbyte/icalendar/component/Calendar.java deleted file mode 100644 index 032f347..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/Calendar.java +++ /dev/null @@ -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. - *

- * It allows users to create and customise calendar components and events and - * generate an iCalendar string containing all the calendar information. - *

- * Usage Example: - *

- * 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();
- * 
- *

- * 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 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(); - } - -} - diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/CalendarComponent.java b/webcal/src/main/java/com/onixbyte/icalendar/component/CalendarComponent.java deleted file mode 100644 index 0b2cf27..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/CalendarComponent.java +++ /dev/null @@ -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 - * event, a to-do item, or an alarm. It provides common properties and - * methods for all calendar components and events. - *

- * 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(); - -} - diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/Event.java b/webcal/src/main/java/com/onixbyte/icalendar/component/Event.java deleted file mode 100644 index 0f537db..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/Event.java +++ /dev/null @@ -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 ""; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Attachment.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Attachment.java deleted file mode 100644 index 4acfda0..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Attachment.java +++ /dev/null @@ -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(); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Attendee.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Attendee.java deleted file mode 100644 index 89c2744..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Attendee.java +++ /dev/null @@ -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 ""; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/CalendarDuration.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/CalendarDuration.java deleted file mode 100644 index 0026b82..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/CalendarDuration.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Categories.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Categories.java deleted file mode 100644 index 0a0c91f..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Categories.java +++ /dev/null @@ -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 value; - - private Categories(List value) { - this.value = value; - } - - public static class Builder { - private final List categories; - - private Builder() { - categories = new ArrayList<>(); - } - - public Builder addCategory(String category) { - if (!categories.contains(category)) { - categories.add(category); - } - return this; - } - - public Builder addCategories(List 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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Classification.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Classification.java deleted file mode 100644 index c7e501e..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Classification.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Comment.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Comment.java deleted file mode 100644 index f7c6e0f..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Comment.java +++ /dev/null @@ -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); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/ComponentProperty.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/ComponentProperty.java deleted file mode 100644 index bd83694..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/ComponentProperty.java +++ /dev/null @@ -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 { -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeCompleted.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeCompleted.java deleted file mode 100644 index 71b2481..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeCompleted.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeCreated.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeCreated.java deleted file mode 100644 index 53a873c..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeCreated.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeDue.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeDue.java deleted file mode 100644 index 7bfca58..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeDue.java +++ /dev/null @@ -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); - } - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeEnd.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeEnd.java deleted file mode 100644 index f3b991d..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeEnd.java +++ /dev/null @@ -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); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeProperty.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeProperty.java deleted file mode 100644 index 12768e4..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeProperty.java +++ /dev/null @@ -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 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(); - } - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeStamp.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeStamp.java deleted file mode 100644 index 3c20d27..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeStamp.java +++ /dev/null @@ -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. - *

- * The value MUST be specified in the UTC time format. - *

- * 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. - *

- * 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. - *

- * 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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeStart.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeStart.java deleted file mode 100644 index 0807bbd..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/DateTimeStart.java +++ /dev/null @@ -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); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Description.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Description.java deleted file mode 100644 index fced46c..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Description.java +++ /dev/null @@ -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); - } - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/FreeBusyTime.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/FreeBusyTime.java deleted file mode 100644 index 43e2549..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/FreeBusyTime.java +++ /dev/null @@ -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 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 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 freeBusyValue) { - this.freeBusyType = freeBusyType; - this.freeBusyValue = freeBusyValue; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/GeoPosition.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/GeoPosition.java deleted file mode 100644 index 0952337..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/GeoPosition.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/LastModified.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/LastModified.java deleted file mode 100644 index b243ffd..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/LastModified.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Location.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Location.java deleted file mode 100644 index eebdf9a..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Location.java +++ /dev/null @@ -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); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/PercentComplete.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/PercentComplete.java deleted file mode 100644 index 57748a6..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/PercentComplete.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Priority.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Priority.java deleted file mode 100644 index 8caeb61..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Priority.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Resources.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Resources.java deleted file mode 100644 index 3e8fe8a..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Resources.java +++ /dev/null @@ -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 value; - - private Resources(AlternateRepresentation altRep, Language language, List value) { - this.altRep = altRep; - this.language = language; - this.value = value; - } - - public static class Builder { - private final List 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 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)); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/SequenceNumber.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/SequenceNumber.java deleted file mode 100644 index 4722dea..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/SequenceNumber.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Status.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Status.java deleted file mode 100644 index e3379b1..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Status.java +++ /dev/null @@ -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 eventStatus() { - return List.of(TENTATIVE, CONFIRMED, CANCELLED); - } - - public static List todoStatus() { - return List.of(NEEDS_ACTION, COMPLETED, IN_PROGRESS, CANCELLED); - } - - public static List journalStatus() { - return List.of(DRAFT, FINAL, CANCELLED); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Summary.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/Summary.java deleted file mode 100644 index 53e4bf6..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/Summary.java +++ /dev/null @@ -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); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TextProperty.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/TextProperty.java deleted file mode 100644 index ad45e3e..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TextProperty.java +++ /dev/null @@ -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 valueSupplier) { - return composeResolution(propertyName, altRep, language, valueSupplier.get()); - } - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeTransparency.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeTransparency.java deleted file mode 100644 index f353610..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeTransparency.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneIdentifier.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneIdentifier.java deleted file mode 100644 index eeed356..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneIdentifier.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneName.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneName.java deleted file mode 100644 index 8294566..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneName.java +++ /dev/null @@ -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(); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneOffsetFrom.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneOffsetFrom.java deleted file mode 100644 index ae2cf38..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneOffsetFrom.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneOffsetTo.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneOffsetTo.java deleted file mode 100644 index 0067add..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneOffsetTo.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneUrl.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneUrl.java deleted file mode 100644 index 781690e..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/TimeZoneUrl.java +++ /dev/null @@ -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"; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/component/property/UniqueIdentifier.java b/webcal/src/main/java/com/onixbyte/icalendar/component/property/UniqueIdentifier.java deleted file mode 100644 index 607e6ab..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/component/property/UniqueIdentifier.java +++ /dev/null @@ -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'; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/core/CalendarUtil.java b/webcal/src/main/java/com/onixbyte/icalendar/core/CalendarUtil.java deleted file mode 100644 index 392c4dd..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/core/CalendarUtil.java +++ /dev/null @@ -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() { - } - - - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/core/DateTimeFormatters.java b/webcal/src/main/java/com/onixbyte/icalendar/core/DateTimeFormatters.java deleted file mode 100644 index 258f57d..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/core/DateTimeFormatters.java +++ /dev/null @@ -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; - } - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/datatype/CalendarUserAddress.java b/webcal/src/main/java/com/onixbyte/icalendar/datatype/CalendarUserAddress.java deleted file mode 100644 index 8204876..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/datatype/CalendarUserAddress.java +++ /dev/null @@ -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(); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/datatype/Period.java b/webcal/src/main/java/com/onixbyte/icalendar/datatype/Period.java deleted file mode 100644 index 218e410..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/datatype/Period.java +++ /dev/null @@ -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 { - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/datatype/PeriodExplicit.java b/webcal/src/main/java/com/onixbyte/icalendar/datatype/PeriodExplicit.java deleted file mode 100644 index e9325f1..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/datatype/PeriodExplicit.java +++ /dev/null @@ -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()); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/datatype/PeriodStart.java b/webcal/src/main/java/com/onixbyte/icalendar/datatype/PeriodStart.java deleted file mode 100644 index 835e5ed..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/datatype/PeriodStart.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/datatype/UtcOffset.java b/webcal/src/main/java/com/onixbyte/icalendar/datatype/UtcOffset.java deleted file mode 100644 index aad2537..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/datatype/UtcOffset.java +++ /dev/null @@ -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); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/package-info.java b/webcal/src/main/java/com/onixbyte/icalendar/package-info.java deleted file mode 100644 index 01ac937..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/package-info.java +++ /dev/null @@ -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; \ No newline at end of file diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/Resolvable.java b/webcal/src/main/java/com/onixbyte/icalendar/property/Resolvable.java deleted file mode 100644 index 08e95a1..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/Resolvable.java +++ /dev/null @@ -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(); - -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/AlarmTriggerRelationship.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/AlarmTriggerRelationship.java deleted file mode 100644 index d1b5afc..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/AlarmTriggerRelationship.java +++ /dev/null @@ -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(); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/AlternateRepresentation.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/AlternateRepresentation.java deleted file mode 100644 index ed64831..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/AlternateRepresentation.java +++ /dev/null @@ -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. - *

- * Note: 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(); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/CalendarUserType.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/CalendarUserType.java deleted file mode 100644 index a7c56c9..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/CalendarUserType.java +++ /dev/null @@ -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(); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/CommonName.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/CommonName.java deleted file mode 100644 index 61d33da..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/CommonName.java +++ /dev/null @@ -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 + "\""; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Delegatee.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Delegatee.java deleted file mode 100644 index efcf09f..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Delegatee.java +++ /dev/null @@ -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 value; - - private Delegatee(List value) { - this.value = value; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private List 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 delegatees) { - value.addAll(delegatees); - return this; - } - - public Builder addDelegatees(Supplier> 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()); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Delegator.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Delegator.java deleted file mode 100644 index 74a9342..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Delegator.java +++ /dev/null @@ -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 value; - - private Delegator(List value) { - this.value = value; - } - - public static Builder builder() { - return new Builder(); - } - - public static class Builder { - private List 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 delegators) { - value.addAll(delegators); - return this; - } - - public Builder addDelegators(Supplier> 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()) + "\""; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/DirectoryEntryReference.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/DirectoryEntryReference.java deleted file mode 100644 index 49fb0ff..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/DirectoryEntryReference.java +++ /dev/null @@ -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 + "\""; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/FormatType.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/FormatType.java deleted file mode 100644 index 112732b..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/FormatType.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/FreeBusyTimeType.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/FreeBusyTimeType.java deleted file mode 100644 index 874ff51..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/FreeBusyTimeType.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/GroupOrListMembership.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/GroupOrListMembership.java deleted file mode 100644 index 9b8f798..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/GroupOrListMembership.java +++ /dev/null @@ -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 value; - - private GroupOrListMembership(List value) { - this.value = value; - } - - public static class Builder { - private final List 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 memberships) { - value.addAll(memberships); - return this; - } - - public Builder addMemberships(Supplier> 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()); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/InlineEncoding.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/InlineEncoding.java deleted file mode 100644 index c2a7dcc..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/InlineEncoding.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Language.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Language.java deleted file mode 100644 index ce08efc..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/Language.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ParticipationRole.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ParticipationRole.java deleted file mode 100644 index 7ce0e82..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ParticipationRole.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ParticipationStatus.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ParticipationStatus.java deleted file mode 100644 index edc4ac5..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ParticipationStatus.java +++ /dev/null @@ -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 eventStatues() { - return List.of(NEEDS_ACTION, ACCEPTED, DECLINED, TENTATIVE, DELEGATED); - } - - public static List todoStatues() { - return List.of(NEEDS_ACTION, ACCEPTED, DECLINED, TENTATIVE, DELEGATED, COMPLETED, IN_PROGRESS); - } - - public static List 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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/PropertyParameter.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/PropertyParameter.java deleted file mode 100644 index ef5c6e5..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/PropertyParameter.java +++ /dev/null @@ -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 { -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RecurrenceIdentifierRange.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RecurrenceIdentifierRange.java deleted file mode 100644 index d4d46b7..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RecurrenceIdentifierRange.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RelationshipType.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RelationshipType.java deleted file mode 100644 index e146b89..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RelationshipType.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RsvpExpectation.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RsvpExpectation.java deleted file mode 100644 index 59cb763..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/RsvpExpectation.java +++ /dev/null @@ -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(); - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/SentBy.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/SentBy.java deleted file mode 100644 index 42a0cb5..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/SentBy.java +++ /dev/null @@ -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 + "\""; - } -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/TimeZoneIdentifier.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/TimeZoneIdentifier.java deleted file mode 100644 index a24c837..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/TimeZoneIdentifier.java +++ /dev/null @@ -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 { -} diff --git a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ValueDataType.java b/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ValueDataType.java deleted file mode 100644 index bdc27e2..0000000 --- a/webcal/src/main/java/com/onixbyte/icalendar/property/parameter/ValueDataType.java +++ /dev/null @@ -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; - } -} diff --git a/webcal/src/main/resources/logback.xml b/webcal/src/main/resources/logback.xml deleted file mode 100644 index 1882442..0000000 --- a/webcal/src/main/resources/logback.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ${COLOURFUL_OUTPUT} - - - - - - \ No newline at end of file