public Property createProperty(final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Sequence(parameters, value); }
public Property createProperty() { return new Sequence(); } }
public Property createProperty(final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Sequence(parameters, value); }
public Property createProperty() { return new Sequence(); } }
public Property createProperty(final String name) { return new Sequence(); } };
public Property createProperty(final String name, final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Sequence(parameters, value); }
public Property createProperty(final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Sequence(parameters, value); }
public Property createProperty() { return new Sequence(); } }
public Property createProperty() { return new Sequence(); } }
public Property createProperty(final ParameterList parameters, final String value) throws IOException, URISyntaxException, ParseException { return new Sequence(parameters, value); }
@Override public Property toVEvent(final TeamEventDO event) { return new Sequence(event.getSequence() != null ? event.getSequence() : 0); }
@Override public int compare(Component o1, Component o2) { int retVal = 0; Sequence defaultSequence = new Sequence(0); Sequence sequence1 = Optional.ofNullable((Sequence) o1.getProperty(Property.SEQUENCE)).orElse(defaultSequence); Sequence sequence2 = Optional.ofNullable((Sequence) o2.getProperty(Property.SEQUENCE)).orElse(defaultSequence); retVal = sequence1.compareTo(sequence2); if (retVal == 0) { DtStamp defaultDtStamp = new DtStamp(new DateTime(0)); DtStamp dtStamp1 = Optional.ofNullable((DtStamp) o1.getProperty(Property.DTSTAMP)).orElse(defaultDtStamp); DtStamp dtStamp2 = Optional.ofNullable((DtStamp) o2.getProperty(Property.DTSTAMP)).orElse(defaultDtStamp); retVal = dtStamp1.compareTo(dtStamp2); } return retVal; } }
@Override public int compare(Component o1, Component o2) { int retVal = 0; Sequence defaultSequence = new Sequence(0); Sequence sequence1 = Optional.ofNullable((Sequence) o1.getProperty(Property.SEQUENCE)).orElse(defaultSequence); Sequence sequence2 = Optional.ofNullable((Sequence) o2.getProperty(Property.SEQUENCE)).orElse(defaultSequence); retVal = sequence1.compareTo(sequence2); if (retVal == 0) { DtStamp defaultDtStamp = new DtStamp(new DateTime(0)); DtStamp dtStamp1 = Optional.ofNullable((DtStamp) o1.getProperty(Property.DTSTAMP)).orElse(defaultDtStamp); DtStamp dtStamp2 = Optional.ofNullable((DtStamp) o2.getProperty(Property.DTSTAMP)).orElse(defaultDtStamp); retVal = dtStamp1.compareTo(dtStamp2); } return retVal; } }
@Override public CalendarComponent transform(CalendarComponent object) { PropertyList compProps = object.getProperties(); Sequence sequence = (Sequence) compProps .getProperty(Property.SEQUENCE); if (sequence == null) { compProps.add(new Sequence(0)); } else { compProps.remove(sequence); compProps.add(new Sequence(sequence.getSequenceNo() + 1)); } return object; } }
@Override public CalendarComponent transform(CalendarComponent object) { PropertyList compProps = object.getProperties(); Sequence sequence = (Sequence) compProps .getProperty(Property.SEQUENCE); if (sequence == null) { compProps.add(new Sequence(0)); } else { compProps.remove(sequence); compProps.add(new Sequence(sequence.getSequenceNo() + 1)); } return object; } }
/** * {@inheritDoc} */ public VEvent cancelEvent(VEvent vevent) { if(!isIcsEnabled()) { log.debug("ExternalCalendaringService is disabled. Enable via calendar.ics.generation.enabled=true in sakai.properties"); return null; } // You can only have one status so make sure we remove any previous ones. vevent.getProperties().removeAll(vevent.getProperties(Property.STATUS)); vevent.getProperties().add(Status.VEVENT_CANCELLED); // Must define a sequence for cancellations. If one was not defined when the event was created use 1 if (vevent.getProperties().getProperty(Property.SEQUENCE) == null) { vevent.getProperties().add(new Sequence("1")); } if(log.isDebugEnabled()){ log.debug("VEvent cancelled:" + vevent); } return vevent; }
/** * {@inheritDoc} */ public final Calendar transform(final Calendar calendar) { PropertyList calProps = calendar.getProperties(); Property method = calProps.getProperty(Property.METHOD); if (method != null) { calProps.remove(method); } calProps.add(Method.PUBLISH); // if a calendar component has already been published previously // update the sequence number.. for (Iterator i = calendar.getComponents().iterator(); i.hasNext();) { Component component = (Component) i.next(); PropertyList compProps = component.getProperties(); Sequence sequence = (Sequence) compProps .getProperty(Property.SEQUENCE); if (sequence == null) { compProps.add(new Sequence(0)); } else { compProps.remove(sequence); compProps.add(new Sequence(sequence.getSequenceNo() + 1)); } } return calendar; }
/** * {@inheritDoc} */ public final Calendar transform(final Calendar calendar) { PropertyList calProps = calendar.getProperties(); Property method = calProps.getProperty(Property.METHOD); if (method != null) { calProps.remove(method); } calProps.add(Method.PUBLISH); // if a calendar component has already been published previously // update the sequence number.. for (Component component : calendar.getComponents()) { PropertyList compProps = component.getProperties(); Sequence sequence = (Sequence) compProps .getProperty(Property.SEQUENCE); if (sequence == null) { compProps.add(new Sequence(0)); } else { compProps.remove(sequence); compProps.add(new Sequence(sequence.getSequenceNo() + 1)); } } return calendar; }
/** * {@inheritDoc} */ public final Calendar transform(final Calendar calendar) { PropertyList calProps = calendar.getProperties(); Property method = calProps.getProperty(Property.METHOD); if (method != null) { calProps.remove(method); } calProps.add(Method.PUBLISH); // if a calendar component has already been published previously // update the sequence number.. for (Component component : calendar.getComponents()) { PropertyList compProps = component.getProperties(); Sequence sequence = (Sequence) compProps .getProperty(Property.SEQUENCE); if (sequence == null) { compProps.add(new Sequence(0)); } else { compProps.remove(sequence); compProps.add(new Sequence(sequence.getSequenceNo() + 1)); } } return calendar; }
/** * @return * @throws ParseException */ public static TestSuite suite() { TestSuite suite = new TestSuite(); Sequence sequence = new Sequence(5); suite.addTest(new SequenceTest(sequence, "5")); suite.addTest(new SequenceTest("testValidation", sequence)); suite.addTest(new SequenceTest("testEquals", sequence)); return suite; }