net.fortuna.ical4j.model.property.Location Java Examples
The following examples show how to use
net.fortuna.ical4j.model.property.Location.
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: ICalConverter.java From scipio-erp with Apache License 2.0 | 5 votes |
protected static String fromLocation(PropertyList<Property> propertyList) { Location iCalObj = (Location) propertyList.getProperty(Location.LOCATION); if (iCalObj == null) { return null; } return iCalObj.getValue(); }
Example #2
Source File: ICalConverter.java From scipio-erp with Apache License 2.0 | 4 votes |
protected static Location toLocation(String javaObj) { if (javaObj == null) { return null; } return new Location(javaObj); }
Example #3
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 #4
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; }