net.fortuna.ical4j.model.property.Description Java Examples
The following examples show how to use
net.fortuna.ical4j.model.property.Description.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MockBaseEventStamp.java From cosmo with Apache License 2.0 | 6 votes |
/** * Gets display alarm description. * @return The alarm description. */ public String getDisplayAlarmDescription() { VAlarm alarm = getDisplayAlarm(); if (alarm == null) { return null; } Description description = (Description) alarm.getProperties() .getProperty(Property.DESCRIPTION); if (description == null) { return null; } return description.getValue(); }
Example #2
Source File: Util.java From openhab1-addons with Eclipse Public License 2.0 | 6 votes |
public static Calendar createCalendar(CalDavEvent calDavEvent, DateTimeZone timeZone) { TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); TimeZone timezone = registry.getTimeZone(timeZone.getID()); Calendar calendar = new Calendar(); calendar.getProperties().add(Version.VERSION_2_0); calendar.getProperties().add(new ProdId("openHAB")); VEvent vEvent = new VEvent(); vEvent.getProperties().add(new Summary(calDavEvent.getName())); vEvent.getProperties().add(new Description(calDavEvent.getContent())); final DtStart dtStart = new DtStart(new net.fortuna.ical4j.model.DateTime(calDavEvent.getStart().toDate())); dtStart.setTimeZone(timezone); vEvent.getProperties().add(dtStart); final DtEnd dtEnd = new DtEnd(new net.fortuna.ical4j.model.DateTime(calDavEvent.getEnd().toDate())); dtEnd.setTimeZone(timezone); vEvent.getProperties().add(dtEnd); vEvent.getProperties().add(new Uid(calDavEvent.getId())); vEvent.getProperties().add(Clazz.PUBLIC); vEvent.getProperties() .add(new LastModified(new net.fortuna.ical4j.model.DateTime(calDavEvent.getLastChanged().toDate()))); calendar.getComponents().add(vEvent); return calendar; }
Example #3
Source File: ICalConverter.java From scipio-erp with Apache License 2.0 | 5 votes |
protected static String fromDescription(PropertyList<Property> propertyList) { Description iCalObj = (Description) propertyList.getProperty(Description.DESCRIPTION); if (iCalObj == null) { return null; } return iCalObj.getValue(); }
Example #4
Source File: HibBaseEventStamp.java From cosmo with Apache License 2.0 | 5 votes |
public String getDisplayAlarmDescription() { VAlarm alarm = getDisplayAlarm(); if(alarm==null) { return null; } Description description = (Description) alarm.getProperties() .getProperty(Property.DESCRIPTION); if(description==null) { return null; } return description.getValue(); }
Example #5
Source File: ICalConverter.java From scipio-erp with Apache License 2.0 | 4 votes |
protected static Description toDescription(String javaObj) { if (javaObj == null) { return null; } return new Description(javaObj); }
Example #6
Source File: ExternalCalendaringServiceImpl.java From sakai with Educational Community License v2.0 | 4 votes |
/** * {@inheritDoc} */ public VEvent createEvent(CalendarEvent event, Set<User> attendees, boolean timeIsLocal) { if(!isIcsEnabled()) { log.debug("ExternalCalendaringService is disabled. Enable via calendar.ics.generation.enabled=true in sakai.properties"); return null; } VTimeZone tz = getTimeZone(timeIsLocal); //start and end date DateTime start = new DateTime(getStartDate(event.getRange()).getTime()); DateTime end = new DateTime(getEndDate(event.getRange()).getTime()); //create event incl title/summary VEvent vevent = new VEvent(start, end, event.getDisplayName()); //add timezone vevent.getProperties().add(tz.getTimeZoneId()); //add uid to event //could come from the vevent_uuid field in the calendar event, otherwise from event ID. String uuid = null; if(StringUtils.isNotBlank(event.getField("vevent_uuid"))) { uuid = event.getField("vevent_uuid"); } else { uuid = event.getId(); } vevent.getProperties().add(new Uid(uuid)); //add sequence to event //will come from the vevent_sequnece field in the calendar event, otherwise skip it String sequence = null; if(StringUtils.isNotBlank(event.getField("vevent_sequence"))) { sequence = event.getField("vevent_sequence"); vevent.getProperties().add(new Sequence(sequence)); } //add description to event vevent.getProperties().add(new Description(event.getDescription())); //add location to event vevent.getProperties().add(new Location(event.getLocation())); //add organiser to event if(StringUtils.isNotBlank(event.getCreator())) { String creatorEmail = sakaiProxy.getUserEmail(event.getCreator()); URI mailURI = createMailURI(creatorEmail); Cn commonName = new Cn(sakaiProxy.getUserDisplayName(event.getCreator())); Organizer organizer = new Organizer(mailURI); organizer.getParameters().add(commonName); vevent.getProperties().add(organizer); } //add attendees to event with 'required participant' role vevent = addAttendeesToEvent(vevent, attendees); //add URL to event, if present String url = null; if(StringUtils.isNotBlank(event.getField("vevent_url"))) { url = event.getField("vevent_url"); Url u = new Url(); try { u.setValue(url); vevent.getProperties().add(u); } catch (URISyntaxException e) { //it doesnt matter, ignore it } } if(log.isDebugEnabled()){ log.debug("VEvent:" + vevent); } return vevent; }
Example #7
Source File: TestHelper.java From cosmo with Apache License 2.0 | 4 votes |
/** * Makes dummy event. * @return The event. */ public VEvent makeDummyEvent() { String serial = Integer.toString(++eseq); String summary = "dummy" + serial; // tomorrow java.util.Calendar start = java.util.Calendar.getInstance(); start.add(java.util.Calendar.DAY_OF_MONTH, 1); start.set(java.util.Calendar.HOUR_OF_DAY, 9); start.set(java.util.Calendar.MINUTE, 30); // 1 hour duration Dur duration = new Dur(0, 1, 0, 0); VEvent event = new VEvent(new Date(start.getTime()), duration, summary); event.getProperties().add(new Uid(serial)); // add timezone information VTimeZone tz = TimeZoneRegistryFactory.getInstance().createRegistry(). getTimeZone("America/Los_Angeles").getVTimeZone(); String tzValue = tz.getProperties().getProperty(Property.TZID).getValue(); net.fortuna.ical4j.model.parameter.TzId tzParam = new net.fortuna.ical4j.model.parameter.TzId(tzValue); event.getProperties().getProperty(Property.DTSTART). getParameters().add(tzParam); // add an alarm for 5 minutes before the event with an xparam // on the description Dur trigger = new Dur(0, 0, -5, 0); VAlarm alarm = new VAlarm(trigger); alarm.getProperties().add(Action.DISPLAY); Description description = new Description("Meeting at 9:30am"); XParameter xparam = new XParameter("X-COSMO-TEST-PARAM", "deadbeef"); description.getParameters().add(xparam); alarm.getProperties().add(description); alarm.getProperties().add(new Description("Meeting at 9:30am")); event.getAlarms().add(alarm); // add an x-property with an x-param XProperty xprop = new XProperty("X-COSMO-TEST-PROP", "abc123"); xprop.getParameters().add(xparam); event.getProperties().add(xprop); return event; }
Example #8
Source File: ExternalCalendaringServiceImpl.java From sakai with Educational Community License v2.0 | 4 votes |
/** * {@inheritDoc} */ public VEvent createEvent(CalendarEvent event, Set<User> attendees, boolean timeIsLocal) { if(!isIcsEnabled()) { log.debug("ExternalCalendaringService is disabled. Enable via calendar.ics.generation.enabled=true in sakai.properties"); return null; } VTimeZone tz = getTimeZone(timeIsLocal); //start and end date DateTime start = new DateTime(getStartDate(event.getRange()).getTime()); DateTime end = new DateTime(getEndDate(event.getRange()).getTime()); //create event incl title/summary VEvent vevent = new VEvent(start, end, event.getDisplayName()); //add timezone vevent.getProperties().add(tz.getTimeZoneId()); //add uid to event //could come from the vevent_uuid field in the calendar event, otherwise from event ID. String uuid = null; if(StringUtils.isNotBlank(event.getField("vevent_uuid"))) { uuid = event.getField("vevent_uuid"); } else { uuid = event.getId(); } vevent.getProperties().add(new Uid(uuid)); //add sequence to event //will come from the vevent_sequnece field in the calendar event, otherwise skip it String sequence = null; if(StringUtils.isNotBlank(event.getField("vevent_sequence"))) { sequence = event.getField("vevent_sequence"); vevent.getProperties().add(new Sequence(sequence)); } //add description to event vevent.getProperties().add(new Description(event.getDescription())); //add location to event vevent.getProperties().add(new Location(event.getLocation())); //add organiser to event if(StringUtils.isNotBlank(event.getCreator())) { String creatorEmail = sakaiProxy.getUserEmail(event.getCreator()); URI mailURI = createMailURI(creatorEmail); Cn commonName = new Cn(sakaiProxy.getUserDisplayName(event.getCreator())); Organizer organizer = new Organizer(mailURI); organizer.getParameters().add(commonName); vevent.getProperties().add(organizer); } //add attendees to event with 'required participant' role vevent = addAttendeesToEvent(vevent, attendees); //add URL to event, if present String url = null; if(StringUtils.isNotBlank(event.getField("vevent_url"))) { url = event.getField("vevent_url"); Url u = new Url(); try { u.setValue(url); vevent.getProperties().add(u); } catch (URISyntaxException e) { //it doesnt matter, ignore it } } if(log.isDebugEnabled()){ log.debug("VEvent:" + vevent); } return vevent; }