use of com.zimbra.common.calendar.ZCalendar.ZProperty in project zm-mailbox by Zimbra.
the class Invite method newToICalendar.
public ZVCalendar newToICalendar(boolean useOutlookCompatMode, boolean includePrivateData) throws ServiceException {
ZVCalendar vcal = new ZVCalendar();
vcal.addVersionAndProdId();
vcal.addProperty(new ZProperty(ICalTok.METHOD, mMethod.toString()));
// timezones
if (!isAllDayEvent() || useOutlookCompatMode) {
// Don't write any VTIMEZONE for all-day appointments.
for (Iterator<ICalTimeZone> iter = mTzMap.tzIterator(); iter.hasNext(); ) {
ICalTimeZone cur = iter.next();
vcal.addComponent(cur.newToVTimeZone());
}
}
vcal.addComponent(newToVComponent(useOutlookCompatMode, includePrivateData));
return vcal;
}
use of com.zimbra.common.calendar.ZCalendar.ZProperty in project zm-mailbox by Zimbra.
the class Invite method toVComponents.
public static ZComponent[] toVComponents(Invite[] invites, boolean includePrivateData, boolean useOutlookCompatAllDayEvents, boolean convertCanceledInstancesToExdates, boolean includeAttaches) throws ServiceException {
List<ZComponent> comps = new ArrayList<ZComponent>(invites.length);
if (!convertCanceledInstancesToExdates || invites.length <= 1) {
for (Invite inv : invites) {
ZComponent comp = inv.newToVComponent(useOutlookCompatAllDayEvents, includePrivateData, includeAttaches);
comps.add(comp);
}
} else {
// Activate the hack that converts standalone VEVENT/VTODO components with STATUS:CANCELLED
// into EXDATEs on the series component. (bug 36434)
Invite seriesInv = null;
ZComponent seriesComp = null;
// Find the series invite.
for (Invite inv : invites) {
if (inv.isRecurrence()) {
ZComponent comp = inv.newToVComponent(useOutlookCompatAllDayEvents, includePrivateData, includeAttaches);
seriesComp = comp;
comps.add(seriesComp);
seriesInv = inv;
break;
}
}
for (Invite inv : invites) {
if (inv != seriesInv) {
// We already handled the series invite in the previous loop.
if (inv.hasRecurId() && inv.isCancel()) {
// as a standalone component.
if (seriesComp != null) {
RecurId rid = inv.getRecurId();
ZProperty ridProp = rid.toProperty(false);
// EXDATE and RECURRENCE-ID have same value types and parameter list. Just copy over.
ZProperty exdateProp = new ZProperty(ICalTok.EXDATE, ridProp.getValue());
for (Iterator<ZParameter> paramsIter = ridProp.parameterIterator(); paramsIter.hasNext(); ) {
ZParameter param = paramsIter.next();
exdateProp.addParameter(param);
}
seriesComp.addProperty(exdateProp);
} else {
// But if there is no series component, let the canceled instance be a component.
ZComponent comp = inv.newToVComponent(useOutlookCompatAllDayEvents, includePrivateData, includeAttaches);
if (comp != null)
comps.add(comp);
}
} else {
// Modified instances are added as standalone components.
ZComponent comp = inv.newToVComponent(useOutlookCompatAllDayEvents, includePrivateData, includeAttaches);
if (comp != null)
comps.add(comp);
}
}
}
}
return comps.toArray(new ZComponent[0]);
}
use of com.zimbra.common.calendar.ZCalendar.ZProperty in project zm-mailbox by Zimbra.
the class RecurId method toProperty.
public ZProperty toProperty(boolean useOutlookCompatMode) {
// ZProperty toRet = new ZProperty(ICalTok.RECURRENCE_ID, toString());
// return toRet;
ZProperty toRet = mDateTime.toProperty(ICalTok.RECURRENCE_ID, useOutlookCompatMode);
String range = getRangeStr();
if (range != null)
toRet.addParameter(new ZParameter(ICalTok.RANGE, range));
return toRet;
}
use of com.zimbra.common.calendar.ZCalendar.ZProperty in project zm-mailbox by Zimbra.
the class Invite method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{ ");
sb.append("mboxid: ").append(this.mMailboxId);
sb.append(", mailitem: ").append(this.mMailItemId);
sb.append(", compnum: ").append(this.mComponentNum);
sb.append(", uid: ").append(this.mUid);
sb.append(", status: ").append(getStatus());
sb.append(", partStat: ").append(getPartStat());
sb.append(", rsvp: ").append(getRsvp());
sb.append(", freeBusy: ").append(mFreeBusy);
sb.append(", transp: ").append(getTransparency());
sb.append(", class: ").append(getClassProp());
sb.append(", classSetByMe: ").append(classPropSetByMe());
sb.append(", sentByMe: ").append(sentByMe());
sb.append(", start: ").append(this.mStart);
sb.append(", end: ").append(this.mEnd);
sb.append(", duration: ").append(this.mDuration);
sb.append(", organizer: ");
if (hasOrganizer())
sb.append(getOrganizer().getAddress());
else
sb.append("(not specified)");
sb.append(", name: ").append(this.mName);
sb.append(", location: ").append(this.mLocation);
sb.append(", allDay: ").append(isAllDayEvent());
sb.append(", otherAts: ").append(hasOtherAttendees());
sb.append(", hasAlarm: ").append(hasAlarm());
sb.append(", isRecur: ").append(isRecurrence());
sb.append(", recurId: ").append(getRecurId());
sb.append(", DTStamp: ").append(mDTStamp);
sb.append(", lastMod: ").append(mLastModified);
sb.append(", mSeqNo ").append(mSeqNo);
sb.append(", mLastFullSeqNo ").append(mLastFullSeqNo);
if (isDraft())
sb.append(", draft: ").append(true);
if (isNeverSent())
sb.append(", neverSent: ").append(true);
for (Alarm alarm : mAlarms) {
sb.append(", alarm: ").append(alarm.toString());
}
for (ZProperty xprop : mXProps) {
sb.append(", ").append(xprop.toString());
}
sb.append("}");
return sb.toString();
}
Aggregations