calendar.getProperties().add(Method.REQUEST);
break;
case REJECTION:
calendar.getProperties().add(Method.CANCEL);
}
final VEvent vEvent = ICal4JUtils.createVEvent(teamEvent.getStartDate(), teamEvent.getEndDate(), teamEvent.getUid(), teamEvent.getSubject(), teamEvent.isAllDay());
vEvent.getProperties().add(new Sequence(teamEvent.getSequence()));
if (teamEvent.hasRecurrence() == true) {
vEvent.getProperties().add(new RRule(teamEvent.getRecurrenceObject()));
}
if (StringUtils.isNotBlank(teamEvent.getLocation()) == true) {
vEvent.getProperties().add(new Location(teamEvent.getLocation()));
}
if (StringUtils.isNotBlank(teamEvent.getNote()) == true) {
vEvent.getProperties().add(new Comment(teamEvent.getNote()));
}
final PFUserDO user = PFUserContext.getUser();
String s = user.getFullname();
if (user.getOrganization() != null) {
s += "\n" + user.getOrganization();
}
if (user.getPersonalPhoneIdentifiers() != null) {
s += "\n" + user.getPersonalPhoneIdentifiers();
}
vEvent.getProperties().add(new Contact(s));
try {
if (StringUtils.isNotBlank(user.getEmail()) == true) {
final ParameterList organizerParams = new ParameterList();
organizerParams.add(new Cn(user.getFullname()));
final Organizer organizer = new Organizer(organizerParams, "mailto:" + user.getEmail());
vEvent.getProperties().add(organizer);
}
} catch (final Exception e) {
log.error("Cant't build organizer " + e.getMessage());
}
if (teamEvent.getAttendees() != null) {
for (final TeamEventAttendeeDO attendee : teamEvent.getAttendees() ) {
final ParameterList attendeeParams = new ParameterList();
if (attendee.getUser() != null) {
try {
attendeeParams.add(new Cn(attendee.getUser().getFullname()));
// attendeeParams.add(new SentBy(attendee.getUser().getEmail()));
attendeeParams.add(new PartStat(attendee.getStatus().name()));
if (attendee.getStatus().equals(TeamAttendeeStatus.NEEDS_ACTION) == true) {
attendeeParams.add(Role.REQ_PARTICIPANT);
attendeeParams.add(Rsvp.TRUE);
}
vEvent.getProperties().add(new Attendee(attendeeParams, "mailto:" + attendee.getUser().getEmail()));
} catch (final Exception e) {
log.error("Cant't build attendee " + e.getMessage());
}
} else {
try {
// attendeeParams.add(new SentBy(attendee.getUrl()));
attendeeParams.add(new PartStat(attendee.getStatus().name()));
if (attendee.getStatus().equals(TeamAttendeeStatus.NEEDS_ACTION) == true) {
attendeeParams.add(Role.REQ_PARTICIPANT);
attendeeParams.add(Rsvp.TRUE);
}
vEvent.getProperties().add(new Attendee(attendeeParams, "mailto:" + attendee.getUrl()));
} catch (final Exception e) {
log.error("Cant't build attendee " + e.getMessage());
}
}
}