Skip to content

Commit

Permalink
Merge pull request #39 from ical4j/develop
Browse files Browse the repository at this point in the history
Updated strategies to use supplier pattern
  • Loading branch information
benfortuna authored Sep 26, 2024
2 parents a4f772d + b57e0b8 commit 4c151e6
Show file tree
Hide file tree
Showing 73 changed files with 400 additions and 231 deletions.
1 change: 1 addition & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
tags:
- "ical4j-extensions-*"
- "!ical4j-extensions-*-pre"
- "!ical4j-extensions-*-alpha"

jobs:
build:
Expand Down
38 changes: 38 additions & 0 deletions .palantir/revapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,24 @@ acceptedBreaks:
new: "method net.fortuna.ical4j.extensions.caldav.property.Acknowledged net.fortuna.ical4j.extensions.caldav.property.Acknowledged.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String)"
justification: "major_version_update"
- code: "java.method.exception.checkedRemoved"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalEnd net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String) throws java.text.ParseException"
new: "method T net.fortuna.ical4j.model.PropertyFactory<T extends net.fortuna.ical4j.model.Property>::createProperty(java.lang.String)\
\ @ net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory"
justification: "original_start_fixed_generics"
- code: "java.method.exception.checkedRemoved"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalEnd net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String) throws java.text.ParseException"
new: "method net.fortuna.ical4j.extensions.outlook.OriginalEnd net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String)"
justification: "major_version_update"
- code: "java.method.exception.checkedRemoved"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalStart net.fortuna.ical4j.extensions.outlook.OriginalStart.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String) throws java.text.ParseException"
new: "method T net.fortuna.ical4j.model.PropertyFactory<T extends net.fortuna.ical4j.model.Property>::createProperty(java.lang.String)\
\ @ net.fortuna.ical4j.extensions.outlook.OriginalStart.Factory"
justification: "original_start_fixed_generics"
- code: "java.method.exception.checkedRemoved"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalStart net.fortuna.ical4j.extensions.outlook.OriginalStart.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String) throws java.text.ParseException"
Expand Down Expand Up @@ -416,6 +428,18 @@ acceptedBreaks:
new: "method net.fortuna.ical4j.model.Property net.fortuna.ical4j.model.Property::copy()\
\ @ net.fortuna.ical4j.extensions.property.CalStart"
justification: "major_version_update"
- code: "java.method.numberOfParametersChanged"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalEnd net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String) throws java.text.ParseException"
new: "method T net.fortuna.ical4j.model.PropertyFactory<T extends net.fortuna.ical4j.model.Property>::createProperty(java.lang.String)\
\ @ net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory"
justification: "original_start_fixed_generics"
- code: "java.method.numberOfParametersChanged"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalStart net.fortuna.ical4j.extensions.outlook.OriginalStart.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String) throws java.text.ParseException"
new: "method T net.fortuna.ical4j.model.PropertyFactory<T extends net.fortuna.ical4j.model.Property>::createProperty(java.lang.String)\
\ @ net.fortuna.ical4j.extensions.outlook.OriginalStart.Factory"
justification: "original_start_fixed_generics"
- code: "java.method.parameterTypeChanged"
old: "parameter void net.fortuna.ical4j.extensions.caldav.property.Acknowledged::<init>(===net.fortuna.ical4j.model.DateTime===)"
new: "parameter void net.fortuna.ical4j.extensions.caldav.property.Acknowledged::<init>(===java.time.Instant===)"
Expand Down Expand Up @@ -731,6 +755,20 @@ acceptedBreaks:
old: "method net.fortuna.ical4j.model.Parameter net.fortuna.ical4j.extensions.parameter.Filename.Factory::createParameter(java.lang.String)"
new: "method net.fortuna.ical4j.extensions.parameter.Filename net.fortuna.ical4j.extensions.parameter.Filename.Factory::createParameter(java.lang.String)"
justification: "implement_generics"
- code: "java.method.returnTypeTypeParametersChanged"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalEnd net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory::createProperty()"
new: "method net.fortuna.ical4j.extensions.outlook.OriginalEnd<?> net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory::createProperty()"
justification: "original_start_fixed_generics"
- code: "java.method.returnTypeTypeParametersChanged"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalEnd net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory::createProperty(net.fortuna.ical4j.model.ParameterList,\
\ java.lang.String) throws java.text.ParseException"
new: "method T net.fortuna.ical4j.model.PropertyFactory<T extends net.fortuna.ical4j.model.Property>::createProperty(java.lang.String)\
\ @ net.fortuna.ical4j.extensions.outlook.OriginalEnd.Factory"
justification: "original_start_fixed_generics"
- code: "java.method.returnTypeTypeParametersChanged"
old: "method net.fortuna.ical4j.extensions.outlook.OriginalStart net.fortuna.ical4j.extensions.outlook.OriginalStart.Factory::createProperty()"
new: "method net.fortuna.ical4j.extensions.outlook.OriginalStart<?> net.fortuna.ical4j.extensions.outlook.OriginalStart.Factory::createProperty()"
justification: "original_start_fixed_generics"
- code: "java.method.returnTypeTypeParametersChanged"
old: "method net.fortuna.ical4j.model.Property net.fortuna.ical4j.model.property.DateProperty::copy()\
\ throws java.io.IOException, java.net.URISyntaxException, java.text.ParseException\
Expand Down
25 changes: 19 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
[![Build Status](https://drone.io/github.com/ical4j/ical4j-extensions/status.png)](https://drone.io/github.com/ical4j/ical4j-extensions/latest)
# iCal4j Extensions

Extensions
==========
Java support for non-standard extensions to the iCalendar and vCard format specifications.

## Overview

iCal4j Extensions is a Java library that provides additional properties and parameters for iCalendar and vCard object models.
These model extensions are implemented via the custom registry support in iCal4j.

This library also includes a collection of strategies for object model construction using opinionated fields
designed to be more intuitive and easier to use.

iCal4j Extensions is a Java library that provides support for widely used non-standard iCalendar objects (i.e. properties and parameters). These model extensions are implemented via the custom object registry support in iCal4j.

## Usage

### Factory Support

To add support for extensions you may register the required factories with your CalendarBuilder instance:

CalendarParser parser = CalendarParserFactory.getInstance().createParser();
Expand All @@ -20,10 +28,15 @@ To add support for extensions you may register the required factories with your
TimeZoneRegistry tzRegistry = TimeZoneRegistryFactory.getInstance().createRegistry();
builder = new CalendarBuilder(parser, propertyFactoryRegistry, parameterFactoryRegistry, tzRegistry);

### Strategies

TBD.


## Minimum requirements

iCal4j Extensions requires a minimum of Java 5 due to the use of features introduced in this version.
iCal4j Extensions requires a minimum of Java 11.


## References:
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ical4jVersion=4.0.3
ical4jVCardVersion=2.0.0-rc1
ical4jVersion=4.0.4
ical4jVCardVersion=2.0.0-rc2

groovyVersion=3.0.21
log4jVersion=2.23.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ import net.fortuna.ical4j.model.PropertyFactoryWrapper
* @author fortuna
*
*/
public class ContentBuilder extends net.fortuna.ical4j.model.ContentBuilder {
class ContentBuilder extends net.fortuna.ical4j.model.ContentBuilder {

public ContentBuilder(boolean init = true) {
ContentBuilder(boolean init = true) {
super(init)
}

Expand Down
18 changes: 12 additions & 6 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,24 @@
requires org.threeten.extra;
requires static org.codehaus.groovy;

exports net.fortuna.ical4j.extensions.data;
exports net.fortuna.ical4j.extensions.model.alarm;
exports net.fortuna.ical4j.extensions.caldav.parameter;
exports net.fortuna.ical4j.extensions.caldav.property;
exports net.fortuna.ical4j.extensions.model.concept;
exports net.fortuna.ical4j.extensions.data;
exports net.fortuna.ical4j.extensions.groupwise;
exports net.fortuna.ical4j.extensions.model.link;
exports net.fortuna.ical4j.extensions.model.location;
exports net.fortuna.ical4j.extensions.lotus;
exports net.fortuna.ical4j.extensions.outlook;
exports net.fortuna.ical4j.extensions.model.parameter;
exports net.fortuna.ical4j.extensions.model.participant;
exports net.fortuna.ical4j.extensions.model.property;
exports net.fortuna.ical4j.extensions.caldav.parameter;
exports net.fortuna.ical4j.extensions.caldav.property;
exports net.fortuna.ical4j.extensions.groupwise;
exports net.fortuna.ical4j.extensions.lotus;
exports net.fortuna.ical4j.extensions.outlook;
exports net.fortuna.ical4j.extensions.validate;
exports net.fortuna.ical4j.extensions.strategy;
exports net.fortuna.ical4j.extensions.strategy.vavailability;
exports net.fortuna.ical4j.extensions.strategy.vtodo;
exports net.fortuna.ical4j.extensions.strategy.entity;
exports net.fortuna.ical4j.extensions.strategy.vevent;
exports net.fortuna.ical4j.extensions.strategy.vjournal;
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class AgentId extends Parameter {

public static final String PARAMETER_NAME = "AGENT-ID";

private String value;
private final String value;

/**
* @param aValue a string representation of a participation role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class CalendarServerAttendeeRef extends Parameter {

public static final String PARAMETER_NAME = "X-CALENDARSERVER-ATTENDEE-REF";

private String value;
private final String value;

/**
* @param aValue a string representation of a participation role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class CalendarServerDtStamp extends Parameter {

public static final String PARAMETER_NAME = "X-CALENDARSERVER-DTSTAMP";

private String value;
private final String value;

/**
* @param aValue a string representation of a participation role
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ public CalendarServerAttendeeComment createProperty() {
}

public CalendarServerAttendeeComment createProperty(ParameterList parameters, String value) {
CalendarServerAttendeeComment property = null;
property = new CalendarServerAttendeeComment(parameters, value);
return property;
return new CalendarServerAttendeeComment(parameters, value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public CalendarServerPrivateComment createProperty() {
}

public CalendarServerPrivateComment createProperty(ParameterList parameters, String value) {
CalendarServerPrivateComment property = null;
property = new CalendarServerPrivateComment(parameters, value);
return property;
return new CalendarServerPrivateComment(parameters, value);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public AutodateKey createProperty() {
}

public AutodateKey createProperty(ParameterList parameters, String value) {
AutodateKey property = new AutodateKey(parameters, value);
return property;
return new AutodateKey(parameters, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public MessageId createProperty() {
}

public MessageId createProperty(ParameterList parameters, String value) {
MessageId property = new MessageId(parameters, value);
return property;
return new MessageId(parameters, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public RecordId createProperty() {
}

public RecordId createProperty(ParameterList parameters, String value) {
RecordId property = new RecordId(parameters, value);
return property;
return new RecordId(parameters, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,7 @@ public UpdateSubject createProperty() {
}

public UpdateSubject createProperty(ParameterList parameters, String value) {
UpdateSubject property = new UpdateSubject(parameters, value);
return property;
return new UpdateSubject(parameters, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import net.fortuna.ical4j.model.component.VLocation;
import net.fortuna.ical4j.model.property.LocationType;
import net.fortuna.ical4j.model.property.Name;
import net.fortuna.ical4j.vcard.Entity;
import net.fortuna.ical4j.vcard.PropertyName;
import net.fortuna.ical4j.vcard.VCard;
import net.fortuna.ical4j.vcard.property.Fn;
import net.fortuna.ical4j.vcard.property.Geo;

Expand All @@ -15,12 +15,12 @@ public Office(String name) {
add(new Name(name));
}

public Office(VCard card) {
public Office(Entity entity) {
add(new LocationType(net.fortuna.ical4j.model.LocationType.office));
Fn fn = card.getRequiredProperty(PropertyName.FN.toString());
Fn fn = entity.getRequiredProperty(PropertyName.FN.toString());
add(new Name(fn.getValue()));

Geo geo = card.getRequiredProperty(PropertyName.GEO.toString());
Geo geo = entity.getRequiredProperty(PropertyName.GEO.toString());
add(new net.fortuna.ical4j.model.property.Geo(geo.getLatitude(), geo.getLongitude()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import net.fortuna.ical4j.model.component.VLocation;
import net.fortuna.ical4j.model.property.LocationType;
import net.fortuna.ical4j.model.property.Name;
import net.fortuna.ical4j.vcard.Entity;
import net.fortuna.ical4j.vcard.PropertyName;
import net.fortuna.ical4j.vcard.VCard;
import net.fortuna.ical4j.vcard.property.Fn;
import net.fortuna.ical4j.vcard.property.Geo;

Expand All @@ -15,12 +15,12 @@ public PublicPlace(String name) {
add(new Name(name));
}

public PublicPlace(VCard card) {
public PublicPlace(Entity entity) {
add(new LocationType(net.fortuna.ical4j.model.LocationType.public_));
Fn fn = card.getRequiredProperty(PropertyName.FN.toString());
Fn fn = entity.getRequiredProperty(PropertyName.FN.toString());
add(new Name(fn.getValue()));

Geo geo = card.getRequiredProperty(PropertyName.GEO.toString());
Geo geo = entity.getRequiredProperty(PropertyName.GEO.toString());
add(new net.fortuna.ical4j.model.property.Geo(geo.getLatitude(), geo.getLongitude()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import net.fortuna.ical4j.model.property.CalendarAddress;
import net.fortuna.ical4j.model.property.ParticipantType;
import net.fortuna.ical4j.model.property.StructuredData;
import net.fortuna.ical4j.vcard.Entity;
import net.fortuna.ical4j.vcard.PropertyName;
import net.fortuna.ical4j.vcard.VCard;
import net.fortuna.ical4j.vcard.property.CalAdrUri;
import net.fortuna.ical4j.vcard.property.Uid;

Expand All @@ -16,7 +16,7 @@ public AbstractRole(ParticipantType participantType) {
add(participantType);
}

public AbstractRole(VCard card, ParticipantType participantType) {
public AbstractRole(Entity card, ParticipantType participantType) {
add(participantType);

//XXX: if card is group (i.e. has members) add all members instead..
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package net.fortuna.ical4j.extensions.model.participant;

import net.fortuna.ical4j.model.property.immutable.ImmutableParticipantType;
import net.fortuna.ical4j.vcard.VCard;
import net.fortuna.ical4j.vcard.Entity;

public class Contact extends AbstractRole {

public Contact() {
super(ImmutableParticipantType.CONTACT);
}

public Contact(VCard card) {
super(card, ImmutableParticipantType.CONTACT);
public Contact(Entity entity) {
super(entity, ImmutableParticipantType.CONTACT);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public CalStart createProperty() {
}

public CalStart createProperty(ParameterList parameters, String value) {
CalStart property = new CalStart(parameters, value);
return property;
return new CalStart(parameters, value);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ public LicLocation createProperty() {
}

public LicLocation createProperty(ParameterList parameters, String value) {
LicLocation property = new LicLocation(parameters, value);
return property;
return new LicLocation(parameters, value);
}
}
}
Loading

0 comments on commit 4c151e6

Please sign in to comment.