Skip to content

Commit

Permalink
Fixed support for alarms
Browse files Browse the repository at this point in the history
  • Loading branch information
benfortuna committed Dec 30, 2018
1 parent 1d1cd67 commit bc1ae0a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Expand Up @@ -131,7 +131,7 @@ public VAvailability(final PropertyList properties) {
* @param available a list of available components
*/
public VAvailability(final PropertyList properties, final ComponentList<Available> available) {
super(VEVENT, properties);
super(VAVAILABILITY, properties);
this.available = available;
}

Expand Down Expand Up @@ -259,7 +259,7 @@ public VAvailability createComponent(PropertyList properties) {

@Override
public VAvailability createComponent(PropertyList properties, ComponentList subComponents) {
throw new UnsupportedOperationException(String.format("%s does not support sub-components", VAVAILABILITY));
return new VAvailability(properties, subComponents);
}
}
}
9 changes: 7 additions & 2 deletions src/main/java/net/fortuna/ical4j/model/component/VToDo.java
Expand Up @@ -133,7 +133,7 @@ public class VToDo extends CalendarComponent {
methodValidators.put(Method.REQUEST, new VToDoRequestValidator());
}

private ComponentList<VAlarm> alarms = new ComponentList<VAlarm>();
private ComponentList<VAlarm> alarms = new ComponentList<>();

/**
* Default constructor.
Expand All @@ -157,6 +157,11 @@ public VToDo(final PropertyList properties) {
super(VTODO, properties);
}

public VToDo(PropertyList properties, ComponentList<VAlarm> alarms) {
super(VTODO, properties);
this.alarms = alarms;
}

/**
* Constructs a new VTODO instance starting at the specified time with the specified summary.
* @param start the start date of the new todo
Expand Down Expand Up @@ -488,7 +493,7 @@ public VToDo createComponent(PropertyList properties) {

@Override
public VToDo createComponent(PropertyList properties, ComponentList subComponents) {
throw new UnsupportedOperationException(String.format("%s does not support sub-components", VTODO));
return new VToDo(properties, subComponents);
}
}
}

0 comments on commit bc1ae0a

Please sign in to comment.