int i = 0;
for(EventVO event : events)
{
VEvent vevent = new VEvent();
if(!event.isAllDay()){
vevent.getProperties().add(new DtStart(new DateTime(event.getStartDate())));
vevent.getProperties().add(new DtEnd(new DateTime(event.getEndDate().getTime())));
}
else
{
vevent.getProperties().add(new DtStart(new Date(event.getStartDate())));
vevent.getProperties().getProperty(Property.DTSTART).getParameters().add(Value.DATE);
vevent.getProperties().add(new DtEnd(new Date(event.getEndDate().getTime())));
vevent.getProperties().getProperty(Property.DTEND).getParameters().add(Value.DATE);
}
if(event.isOccupied())
vevent.getProperties().add(new Transp("OPAQUE"));
else
vevent.getProperties().add(new Transp("TRANSPARENT"));
vevent.getProperties().add(new Summary(event.getTitle()));
vevent.getProperties().add(new Created(new DateTime(event.getCreateDate())));
vevent.getProperties().add(new DtStamp(new DateTime(event.getModifyDate())));
vevent.getProperties().add(new LastModified(new DateTime(event.getModifyDate())));
vevent.getProperties().add(new Description(event.getDescription()));
vevent.getProperties().add(new Uid(event.getId().toString() + "@opencustomer"));
vevent.getProperties().add(new XProperty("X-OC-ID",event.getId().toString()));
if(event.getRecurrenceType() != EventVO.RecurrenceType.NONE)
vevent.getProperties().add(getRRule(event));