/** * Sets the timezone associated with this property. * * @param timezone a timezone to associate with this property */ public void setTimeZone(final TimeZone timezone) { if (dates == null) { throw new UnsupportedOperationException( "TimeZone is not applicable to current value"); } this.timeZone = timezone; if (timezone != null) { if (!Value.DATE_TIME.equals(getDates().getType())) { throw new UnsupportedOperationException( "TimeZone is not applicable to current value"); } dates.setTimeZone(timezone); getParameters().remove(getParameter(Parameter.TZID)); final TzId tzId = new TzId(timezone.getID()); getParameters().replace(tzId); } else { // use setUtc() to reset timezone.. setUtc(false); } }
/** * {@inheritDoc} */ public final void setTimeZone(TimeZone timezone) { if (periods != null) { periods.setTimeZone(timezone); } else { super.setTimeZone(timezone); } } }
/** * Resets the timezone associated with the property. If utc is true, any TZID parameters are removed and the Java * timezone is updated to UTC time. If utc is false, TZID parameters are removed and the Java timezone is set to the * default timezone (i.e. represents a "floating" local time) * * @param utc the UTC value */ public final void setUtc(final boolean utc) { if (dates == null || !Value.DATE_TIME.equals(dates.getType())) { throw new UnsupportedOperationException( "TimeZone is not applicable to current value"); } dates.setUtc(utc); getParameters().remove(getParameter(Parameter.TZID)); }
protected void setDateListPropertyValue(DateListProperty prop) { if (prop == null) { return; } Value value = (Value) prop.getParameters().getParameter(Parameter.VALUE); if (value != null) { prop.getParameters().remove(value); } value = prop.getDates().getType(); // set VALUE=DATE but not VALUE=DATE-TIME as its redundant if(value.equals(Value.DATE)) { prop.getParameters().add(value); } // update timezone for now because ical4j DateList doesn't Parameter param = (Parameter) prop.getParameters().getParameter( Parameter.TZID); if (param != null) { prop.getParameters().remove(param); } if(prop.getDates().getTimeZone()!=null) { prop.getParameters().add(new TzId(prop.getDates().getTimeZone().getID())); } }
dlp.getParameters().add(Value.DATE); } else if (tz != null) { dlp.setTimeZone(tz);
/** * @param val * @return Collection * @throws Throwable */ public static Collection<BwDateTime> makeDateTimes(final DateListProperty val) throws Throwable { DateList dl = val.getDates(); TreeSet<BwDateTime> ts = new TreeSet<BwDateTime>(); Parameter par = getParameter(val, "VALUE"); boolean isDateType = (par != null) && (par.equals(Value.DATE)); String tzidval = null; Parameter tzid = getParameter(val, "TZID"); if (tzid != null) { tzidval = tzid.getValue(); } Iterator it = dl.iterator(); while (it.hasNext()) { Date dt = (Date)it.next(); ts.add(BwDateTime.makeBwDateTime(isDateType, dt.toString(), tzidval)); } return ts; }
/** * @param name the property name * @param parameters property parameters * @param dates a list of initial dates for the property */ public DateListProperty(final String name, final ParameterList parameters, final DateList dates, PropertyFactory factory) { super(name, parameters, factory); this.dates = dates; if (dates != null && !Value.DATE_TIME.equals(dates.getType())) { getParameters().add(dates.getType()); } }
private void createDateProperty(Property property, Resource r_event, String rdfProperty) throws RDFParseException, RDFHandlerException { if(property != null) { if(property instanceof DateProperty) { DateProperty dateProperty = (DateProperty)property; URI p_dateprop = createURI(rdfProperty); Literal v_dateprop = valueFactory.createLiteral(getXMLCalendar(dateProperty.getDate(),dateProperty.getTimeZone())); rdfHandler.handleStatement(createStatement(r_event,p_dateprop,v_dateprop)); } else if(property instanceof DateListProperty) { DateListProperty dateProperty = (DateListProperty)property; URI p_dateprop = createURI(rdfProperty); for (Date date : (Iterable<Date>) dateProperty.getDates()) { Literal v_dateprop = valueFactory.createLiteral(getXMLCalendar(date, dateProperty.getTimeZone())); rdfHandler.handleStatement(createStatement(r_event, p_dateprop, v_dateprop)); } } } }
/** * {@inheritDoc} */ public final void setValue(final String aValue) throws ParseException { if (Value.PERIOD.equals(getParameter(Parameter.VALUE))) { periods = new PeriodList(aValue); } else { super.setValue(aValue); } }
/** * {@inheritDoc} */ public void setValue(final String aValue) throws ParseException { dates = new DateList(aValue, (Value) getParameter(Parameter.VALUE), timeZone); }
/** * {@inheritDoc} */ public final String getValue() { if (getPeriods() != null) { return Strings.valueOf(getPeriods()); } return super.getValue(); }
/** * Resets the timezone associated with the property. If utc is true, any TZID parameters are removed and the Java * timezone is updated to UTC time. If utc is false, TZID parameters are removed and the Java timezone is set to the * default timezone (i.e. represents a "floating" local time) * @param utc the UTC value */ public final void setUtc(final boolean utc) { if (dates == null || !Value.DATE_TIME.equals(dates.getType())) { throw new UnsupportedOperationException( "TimeZone is not applicable to current value"); } dates.setUtc(utc); getParameters().remove(getParameter(Parameter.TZID)); } }
protected void setDateListPropertyValue(DateListProperty prop) { if (prop == null) { return; } Value value = (Value) prop.getParameters().getParameter(Parameter.VALUE); if (value != null) { prop.getParameters().remove(value); } value = prop.getDates().getType(); // set VALUE=DATE but not VALUE=DATE-TIME as its redundant if(value.equals(Value.DATE)) { prop.getParameters().add(value); } // update timezone for now because ical4j DateList doesn't Parameter param = (Parameter) prop.getParameters().getParameter( Parameter.TZID); if (param != null) { prop.getParameters().remove(param); } if(prop.getDates().getTimeZone()!=null) { prop.getParameters().add(new TzId(prop.getDates().getTimeZone().getID())); } }
/** * @param name the property name * @param parameters property parameters * @param dates a list of initial dates for the property */ public DateListProperty(final String name, final ParameterList parameters, final DateList dates, PropertyFactoryImpl factory) { super(name, parameters, factory); this.dates = dates; if (dates != null && !Value.DATE_TIME.equals(dates.getType())) { getParameters().replace(dates.getType()); } }
/** * {@inheritDoc} */ public final void setValue(final String aValue) throws ParseException { if (Value.PERIOD.equals(getParameter(Parameter.VALUE))) { periods = new PeriodList(aValue); } else { super.setValue(aValue); } }
/** * {@inheritDoc} */ public void setValue(final String aValue) throws ParseException { dates = new DateList(aValue, (Value) getParameter(Parameter.VALUE), timeZone); }
/** * {@inheritDoc} */ public final String getValue() { if (periods != null && !(periods.isEmpty() && periods.isUnmodifiable())) { return Strings.valueOf(getPeriods()); } return super.getValue(); }
/** * Sets the timezone associated with this property. * @param timezone a timezone to associate with this property */ public void setTimeZone(final TimeZone timezone) { if (dates == null) { throw new UnsupportedOperationException( "TimeZone is not applicable to current value"); } this.timeZone = timezone; if (timezone != null) { if (!Value.DATE_TIME.equals(getDates().getType())) { throw new UnsupportedOperationException( "TimeZone is not applicable to current value"); } dates.setTimeZone(timezone); getParameters().remove(getParameter(Parameter.TZID)); final TzId tzId = new TzId(timezone.getID()); getParameters().replace(tzId); } else { // use setUtc() to reset timezone.. setUtc(false); } }