cal.getProperties().add(
net.fortuna.ical4j.model.property.Method.REQUEST);
CompatibilityHints.setHintEnabled(
CompatibilityHints.KEY_OUTLOOK_COMPATIBILITY, true);
VEvent meeting = new VEvent();
meeting.getProperties().add(new Summary(subject));
meeting.getProperties().add(new Description(content));
meeting.getProperties().add(new DtStart(new DateTime(start)));
meeting.getProperties().add(new DtEnd(new DateTime(end)));
if (location != null) {
meeting.getProperties().add(new Location(location));
}
// generate unique identifier..
UidGenerator ug = new UidGenerator("3pillar");
Uid uid = ug.generateUid();
meeting.getProperties().add(uid);
// add organizer..
Organizer organizer = new Organizer(URI.create("mailto:"
+ from.getEmail()));
meeting.getProperties().add(organizer);
// add attendees..
Attendee attn = new Attendee(URI.create("mailto:" + from.getEmail()));
if (ParticipantType.REQUIRED.equals(from.getType())) {
attn.getParameters().add(Role.REQ_PARTICIPANT);
} else if (ParticipantType.REQUIRED.equals(from.getType())) {
attn.getParameters().add(Role.OPT_PARTICIPANT);
} else {
attn.getParameters().add(Role.NON_PARTICIPANT);
}
attn.getParameters().add(new Cn("3Pillar Labs"));
meeting.getProperties().add(attn);
for (Participant attendee : attendees) {
Attendee dev2 = new Attendee(URI.create("mailto:"
+ attendee.getEmail()));
if (ParticipantType.REQUIRED.equals(attendee.getType())) {
dev2.getParameters().add(Role.REQ_PARTICIPANT);
} else if (ParticipantType.REQUIRED.equals(attendee.getType())) {
dev2.getParameters().add(Role.OPT_PARTICIPANT);
} else {
dev2.getParameters().add(Role.NON_PARTICIPANT);
}
dev2.getParameters().add(new Cn("3Pillar Labs"));
meeting.getProperties().add(dev2);
}
cal.getComponents().add(meeting);
}