net.fortuna.ical4j.model.property.Attendee Java Examples
The following examples show how to use
net.fortuna.ical4j.model.property.Attendee.
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: ContextServiceExtensionsAdviceTest.java From cosmo with Apache License 2.0 | 6 votes |
private List<String> getAttendeesFrom(VEvent event) { List<String> addresses = new ArrayList<String>(); for(int i = 0; i < event.getProperties().size(); i++){ if(event.getProperties().get(i) instanceof Attendee){ Attendee attendee = (Attendee)event.getProperties().get(i); if(attendee.getCalAddress() != null){ String mailto[] = attendee.getCalAddress().toString().split(":"); addresses.add(mailto[mailto.length - 1]); } } } return addresses; }
Example #2
Source File: ICalendarService.java From axelor-open-suite with GNU Affero General Public License v3.0 | 6 votes |
public <T extends Property> T updateUser(T target, ICalendarUser user) { if (user == null || user.getEmail() == null) { return null; } String email = mailto(user.getEmail(), false); String name = user.getName(); if (target instanceof Organizer) { ((Organizer) target).setCalAddress(createUri(email)); } if (target instanceof Attendee) { ((Attendee) target).setCalAddress(createUri(email)); } if (name != null) { target.getParameters().add(new Cn(name)); } return target; }
Example #3
Source File: ICalUtils.java From camel-quarkus with Apache License 2.0 | 5 votes |
protected static Calendar createTestCalendar(ZonedDateTime start, ZonedDateTime end, String summary, String attendee) { // Create a TimeZone TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); String tzId = start.getZone().getId(); TimeZone timezone = registry.getTimeZone(tzId.equals("Z") ? "UTC" : tzId); VTimeZone tz = timezone.getVTimeZone(); // Create the event PropertyList propertyList = new PropertyList(); DateTime ts = new DateTime(true); ts.setTime(0); propertyList.add(new DtStamp(ts)); propertyList.add(new DtStart(toDateTime(start, registry))); propertyList.add(new DtEnd(toDateTime(end, registry))); propertyList.add(new Summary(summary)); VEvent meeting = new VEvent(propertyList); // add timezone info.. meeting.getProperties().add(tz.getTimeZoneId()); // generate unique identifier.. meeting.getProperties().add(new Uid("00000000")); // add attendees.. Attendee dev1 = new Attendee(URI.create("mailto:" + attendee)); dev1.getParameters().add(Role.REQ_PARTICIPANT); dev1.getParameters().add(new Cn(attendee)); meeting.getProperties().add(dev1); // Create a calendar net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar(); icsCalendar.getProperties().add(Version.VERSION_2_0); icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN")); icsCalendar.getProperties().add(CalScale.GREGORIAN); // Add the event and print icsCalendar.getComponents().add(meeting); return icsCalendar; }
Example #4
Source File: ExternalCalendaringServiceImpl.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Adds attendees to an existing event with a given role * Common logic for addAttendeesToEvent and addChairAttendeestoEvent * * @param vevent the VEvent to add the attendess too * @param attendees list of Users that have been invited to the event * @param role the role with which to add each user * @return the VEvent for the given event or null if there was an error */ protected VEvent addAttendeesToEventWithRole(VEvent vevent, Set<User> attendees, Role role) { if(!isIcsEnabled()) { log.debug("ExternalCalendaringService is disabled. Enable via calendar.ics.generation.enabled=true in sakai.properties"); return null; } //add attendees to event with 'required participant' role if(attendees != null){ for(User u: attendees) { Attendee a = new Attendee(createMailURI(u.getEmail())); a.getParameters().add(role); a.getParameters().add(new Cn(u.getDisplayName())); a.getParameters().add(PartStat.ACCEPTED); a.getParameters().add(Rsvp.FALSE); vevent.getProperties().add(a); } } if(log.isDebugEnabled()){ log.debug("VEvent with attendees:" + vevent); } return vevent; }
Example #5
Source File: ContextServiceExtensionsAdviceTest.java From cosmo with Apache License 2.0 | 5 votes |
private List<String> getAttendeesFrom(VEvent event) { List<String> addresses = new ArrayList<String>(); for(int i = 0; i < event.getProperties().size(); i++){ if(event.getProperties().get(i) instanceof Attendee){ Attendee attendee = (Attendee)event.getProperties().get(i); if(attendee.getCalAddress() != null){ String mailto[] = attendee.getCalAddress().toString().split(":"); addresses.add(mailto[mailto.length - 1]); } } } return addresses; }
Example #6
Source File: ContextServiceExtensionsAdviceTest.java From cosmo with Apache License 2.0 | 5 votes |
/** * Creates a simple item which will be checked with simpleCheckCallExpectedHandler. * * @param user * @return * @throws URISyntaxException */ private ContentItem createSimpleContentItem(User user) throws URISyntaxException { //call service ContentItem contentItem = testHelper.makeDummyContent(user); HibEventStamp eventStamp = new HibEventStamp(); VEvent vEvent = new VEvent(); vEvent.getProperties().add(Method.REQUEST); vEvent.getProperties().add(Version.VERSION_2_0); Attendee dev1 = new Attendee(URI.create("MAILTO:" + ATTENDEE_1)); dev1.getParameters().add(Role.REQ_PARTICIPANT); dev1.getParameters().add(PartStat.NEEDS_ACTION); dev1.getParameters().add(Rsvp.TRUE); vEvent.getProperties().add(dev1); Organizer organizer = new Organizer("MAILTO:" + ORGANIZER); vEvent.getProperties().add(organizer); vEvent.getProperties().add(Status.VEVENT_CONFIRMED); vEvent.getProperties().add(Transp.OPAQUE); Calendar calendar = new Calendar(); calendar.getComponents().add(vEvent); eventStamp.setEventCalendar(calendar); contentItem.addStamp(eventStamp); return contentItem; }
Example #7
Source File: ExternalCalendaringServiceImpl.java From sakai with Educational Community License v2.0 | 5 votes |
/** * Adds attendees to an existing event with a given role * Common logic for addAttendeesToEvent and addChairAttendeestoEvent * * @param vevent the VEvent to add the attendess too * @param attendees list of Users that have been invited to the event * @param role the role with which to add each user * @return the VEvent for the given event or null if there was an error */ protected VEvent addAttendeesToEventWithRole(VEvent vevent, Set<User> attendees, Role role) { if(!isIcsEnabled()) { log.debug("ExternalCalendaringService is disabled. Enable via calendar.ics.generation.enabled=true in sakai.properties"); return null; } //add attendees to event with 'required participant' role if(attendees != null){ for(User u: attendees) { Attendee a = new Attendee(createMailURI(u.getEmail())); a.getParameters().add(role); a.getParameters().add(new Cn(u.getDisplayName())); a.getParameters().add(PartStat.ACCEPTED); a.getParameters().add(Rsvp.FALSE); vevent.getProperties().add(a); } } if(log.isDebugEnabled()){ log.debug("VEvent with attendees:" + vevent); } return vevent; }
Example #8
Source File: ICalFormatTest.java From wildfly-camel with Apache License 2.0 | 5 votes |
private Calendar createTestCalendar() throws ParseException { // Create a TimeZone TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); TimeZone timezone = registry.getTimeZone("America/New_York"); VTimeZone tz = timezone.getVTimeZone(); // Start Date is on: April 1, 2013, 9:00 am java.util.Calendar startDate = new GregorianCalendar(); startDate.setTimeZone(timezone); startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL); startDate.set(java.util.Calendar.DAY_OF_MONTH, 1); startDate.set(java.util.Calendar.YEAR, 2013); startDate.set(java.util.Calendar.HOUR_OF_DAY, 17); startDate.set(java.util.Calendar.MINUTE, 0); startDate.set(java.util.Calendar.SECOND, 0); // End Date is on: April 1, 2013, 13:00 java.util.Calendar endDate = new GregorianCalendar(); endDate.setTimeZone(timezone); endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL); endDate.set(java.util.Calendar.DAY_OF_MONTH, 1); endDate.set(java.util.Calendar.YEAR, 2013); endDate.set(java.util.Calendar.HOUR_OF_DAY, 21); endDate.set(java.util.Calendar.MINUTE, 0); endDate.set(java.util.Calendar.SECOND, 0); // Create the event PropertyList propertyList = new PropertyList(); propertyList.add(new DtStamp("20130324T180000Z")); propertyList.add(new DtStart(new DateTime(startDate.getTime()))); propertyList.add(new DtEnd(new DateTime(endDate.getTime()))); propertyList.add(new Summary("Progress Meeting")); VEvent meeting = new VEvent(propertyList); // add timezone info.. meeting.getProperties().add(tz.getTimeZoneId()); // generate unique identifier.. meeting.getProperties().add(new Uid("00000000")); // add attendees.. Attendee dev1 = new Attendee(URI.create("mailto:[email protected]")); dev1.getParameters().add(Role.REQ_PARTICIPANT); dev1.getParameters().add(new Cn("Developer 1")); meeting.getProperties().add(dev1); Attendee dev2 = new Attendee(URI.create("mailto:[email protected]")); dev2.getParameters().add(Role.OPT_PARTICIPANT); dev2.getParameters().add(new Cn("Developer 2")); meeting.getProperties().add(dev2); // Create a calendar net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar(); icsCalendar.getProperties().add(Version.VERSION_2_0); icsCalendar.getProperties().add(new ProdId("-//Events Calendar//iCal4j 1.0//EN")); icsCalendar.getProperties().add(CalScale.GREGORIAN); // Add the event and print icsCalendar.getComponents().add(meeting); return icsCalendar; }
Example #9
Source File: ICalConverter.java From scipio-erp with Apache License 2.0 | 4 votes |
protected static Attendee createAttendee(GenericValue partyValue, Map<String, Object> context) { Attendee attendee = new Attendee(); loadPartyAssignment(attendee, partyValue, context); return attendee; }
Example #10
Source File: TestSendIcalMessage.java From openmeetings with Apache License 2.0 | 4 votes |
public void simpleInvitionIcalLink() { // Create a TimeZone TimeZoneRegistry registry = TimeZoneRegistryFactory.getInstance().createRegistry(); TimeZone timezone = registry.getTimeZone("America/Mexico_City"); VTimeZone tz = timezone.getVTimeZone(); // Start Date is on: April 1, 2008, 9:00 am java.util.Calendar startDate = new GregorianCalendar(); startDate.setTimeZone(timezone); startDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL); startDate.set(java.util.Calendar.DAY_OF_MONTH, 1); startDate.set(java.util.Calendar.YEAR, 2008); startDate.set(java.util.Calendar.HOUR_OF_DAY, 9); startDate.set(java.util.Calendar.MINUTE, 0); startDate.set(java.util.Calendar.SECOND, 0); // End Date is on: April 1, 2008, 13:00 java.util.Calendar endDate = new GregorianCalendar(); endDate.setTimeZone(timezone); endDate.set(java.util.Calendar.MONTH, java.util.Calendar.APRIL); endDate.set(java.util.Calendar.DAY_OF_MONTH, 1); endDate.set(java.util.Calendar.YEAR, 2008); endDate.set(java.util.Calendar.HOUR_OF_DAY, 13); endDate.set(java.util.Calendar.MINUTE, 0); endDate.set(java.util.Calendar.SECOND, 0); // Create the event String eventName = "Progress Meeting"; DateTime start = new DateTime(startDate.getTime()); DateTime end = new DateTime(endDate.getTime()); VEvent meeting = new VEvent(start, end, eventName); // add timezone info.. meeting.getProperties().add(tz.getTimeZoneId()); // generate unique identifier.. Uid uid = new Uid(randomUUID().toString()); meeting.getProperties().add(uid); // add attendees.. Attendee dev1 = new Attendee(URI.create("mailto:[email protected]")); dev1.getParameters().add(Role.REQ_PARTICIPANT); dev1.getParameters().add(new Cn("Developer 1")); meeting.getProperties().add(dev1); Attendee dev2 = new Attendee(URI.create("mailto:[email protected]")); dev2.getParameters().add(Role.OPT_PARTICIPANT); dev2.getParameters().add(new Cn("Developer 2")); meeting.getProperties().add(dev2); // Create a calendar net.fortuna.ical4j.model.Calendar icsCalendar = new net.fortuna.ical4j.model.Calendar(); icsCalendar.getProperties().add( new ProdId("-//Events Calendar//iCal4j 1.0//EN")); icsCalendar.getProperties().add(CalScale.GREGORIAN); icsCalendar.getProperties().add(Version.VERSION_2_0); // Add the event and print icsCalendar.getComponents().add(meeting); Organizer orger = new Organizer(URI.create("[email protected]")); orger.getParameters().add(new Cn("Sebastian Wagner")); meeting.getProperties().add(orger); icsCalendar.getProperties().add(Method.REQUEST); log.debug(icsCalendar.toString()); ByteArrayOutputStream bout = new ByteArrayOutputStream(); CalendarOutputter outputter = new CalendarOutputter(); try { outputter.output(icsCalendar, bout); iCalMimeBody = bout.toByteArray(); sendIcalMessage(); } catch (Exception e) { log.error("Error", e); } }
Example #11
Source File: ICalendarService.java From axelor-open-suite with GNU Affero General Public License v3.0 | 4 votes |
protected ICalendarUser findOrCreateUser(Property source, ICalendarEvent event) { URI addr = null; if (source instanceof Organizer) { addr = ((Organizer) source).getCalAddress(); } if (source instanceof Attendee) { addr = ((Attendee) source).getCalAddress(); } if (addr == null) { return null; } String email = mailto(addr.toString(), true); ICalendarUserRepository repo = Beans.get(ICalendarUserRepository.class); ICalendarUser user = null; if (source instanceof Organizer) { user = repo.all().filter("self.email = ?1", email).fetchOne(); } else { user = repo.all() .filter("self.email = ?1 AND self.event.id = ?2", email, event.getId()) .fetchOne(); } if (user == null) { user = new ICalendarUser(); user.setEmail(email); user.setName(email); EmailAddress emailAddress = Beans.get(EmailAddressRepository.class).findByAddress(email); if (emailAddress != null && emailAddress.getPartner() != null && emailAddress.getPartner().getUser() != null) { user.setUser(emailAddress.getPartner().getUser()); } } if (source.getParameter(Parameter.CN) != null) { user.setName(source.getParameter(Parameter.CN).getValue()); } if (source.getParameter(Parameter.PARTSTAT) != null) { String role = source.getParameter(Parameter.PARTSTAT).getValue(); if (role.equals("TENTATIVE")) { user.setStatusSelect(ICalendarUserRepository.STATUS_MAYBE); } else if (role.equals("ACCEPTED")) { user.setStatusSelect(ICalendarUserRepository.STATUS_YES); } else if (role.equals("DECLINED")) { user.setStatusSelect(ICalendarUserRepository.STATUS_NO); } } return user; }