/** * @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; }
if (Value.DATE.equals(dlp.getDates().getType())) { return DataType.DATE;
/** * 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); } }
/** * 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); } }
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())); } }
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())); } }
/** * 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); } }
/** * 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); } }
/** * 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); } }
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)); } } } }