use of com.google.api.services.calendar.model.Event.Creator in project jbpm-work-items by kiegroup.
the class AddEventWorkitemHandler method createNewEvent.
private static Event createNewEvent(String paramEventSummary, String paramEventStart, String paramEventEnd, String paramEventAttendees, String paramEventCreator) throws Exception {
Event event = new Event();
event.setSummary(paramEventSummary);
DateFormat format = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss z", Locale.ENGLISH);
if (paramEventStart != null) {
DateTime startDateTime = new DateTime(format.parse(paramEventStart));
event.setStart(new EventDateTime().setDateTime(startDateTime));
}
if (paramEventEnd != null) {
DateTime endDateTime = new DateTime(format.parse(paramEventEnd));
event.setEnd(new EventDateTime().setDateTime(endDateTime));
}
if (paramEventAttendees != null) {
List<String> attendees = Arrays.asList(paramEventAttendees.split(","));
List<EventAttendee> attendiesList = new ArrayList<>();
for (String attendee : attendees) {
EventAttendee newAttendee = new EventAttendee();
newAttendee.setEmail(attendee);
attendiesList.add(newAttendee);
}
event.setAttendees(attendiesList);
}
if (paramEventCreator != null) {
Creator creator = new Creator();
creator.setEmail(paramEventCreator);
event.setCreator(creator);
}
return event;
}
Aggregations