Search in sources :

Example 1 with ExceptionInfoOverrideFlag

use of com.zimbra.cs.util.tnef.mapi.ExceptionInfoOverrideFlag in project zm-mailbox by Zimbra.

the class DefaultTnefToICalendar method addExceptions.

/**
     * 
     * @param icalOutput
     * @param recurDef
     * @param tzDef
     * @param sequenceNum
     * @param ownerApptId
     * @param seriesSummary
     * @param seriesLocation
     * @param seriesIsAllDay
     * @throws ParserException
     * @throws URISyntaxException
     * @throws IOException
     * @throws ParseException
     */
private void addExceptions(ContentHandler icalOutput, RecurrenceDefinition recurDef, TimeZoneDefinition tzDef, int sequenceNum, Integer ownerApptId, String seriesSummary, String seriesLocation, boolean seriesIsAllDay) throws ParserException, URISyntaxException, IOException, ParseException {
    if (method.equals(Method.REPLY) || method.equals(Method.CANCEL) || method.equals(Method.COUNTER)) {
        // By inference, don't want exceptions either.
        return;
    }
    if (recurDef == null) {
        return;
    }
    for (ChangedInstanceInfo cInst : recurDef.getChangedInstances()) {
        EnumSet<ExceptionInfoOverrideFlag> overrideFlags = cInst.getOverrideFlags();
        // in the ICALENDAR as an EXDATE/RDATE pair
        if ((overrideFlags == null) || (overrideFlags.isEmpty())) {
            continue;
        }
        icalOutput.startComponent(icalType.toString());
        Boolean exceptIsAllDayEvent = cInst.isAllDayEvent();
        if (exceptIsAllDayEvent == null) {
            exceptIsAllDayEvent = seriesIsAllDay;
        }
        String exceptSumm = cInst.getSummary();
        if (exceptSumm == null) {
            exceptSumm = seriesSummary;
        }
        IcalUtil.addProperty(icalOutput, Property.SUMMARY, exceptSumm, false);
        String exceptLocation = cInst.getLocation();
        if (exceptLocation == null) {
            exceptLocation = seriesLocation;
        }
        IcalUtil.addProperty(icalOutput, Property.LOCATION, exceptLocation, false);
        IcalUtil.addPropertyFromUtcTimeAndZone(icalOutput, Property.DTSTART, cInst.getStartDate(), tzDef, exceptIsAllDayEvent);
        IcalUtil.addPropertyFromUtcTimeAndZone(icalOutput, Property.DTEND, cInst.getEndDate(), tzDef, exceptIsAllDayEvent);
        IcalUtil.addProperty(icalOutput, Property.UID, uid);
        IcalUtil.addPropertyFromUtcTimeAndZone(icalOutput, Property.RECURRENCE_ID, cInst.getOriginalStartDate(), tzDef, seriesIsAllDay);
        IcalUtil.addProperty(icalOutput, dtstamp);
        BusyStatus exceptBusyStatus = cInst.getBusyStatus();
        addStatusProperty(icalOutput, exceptBusyStatus, null);
        addTranspProperty(icalOutput, exceptBusyStatus);
        IcalUtil.addProperty(icalOutput, Property.SEQUENCE, sequenceNum, false);
        if (method.equals(Method.REQUEST)) {
            IcalUtil.addProperty(icalOutput, "X-MICROSOFT-CDO-INTENDEDSTATUS", exceptBusyStatus, false);
        }
        IcalUtil.addProperty(icalOutput, "X-MICROSOFT-CDO-OWNERAPPTID", ownerApptId, false);
        IcalUtil.addProperty(icalOutput, "X-MICROSOFT-CDO-ALLDAYEVENT", exceptIsAllDayEvent ? "TRUE" : "FALSE");
        addAlarmComponent(icalOutput, cInst.getReminderDelta());
        icalOutput.endComponent(icalType.toString());
    }
}
Also used : BusyStatus(com.zimbra.cs.util.tnef.mapi.BusyStatus) ChangedInstanceInfo(com.zimbra.cs.util.tnef.mapi.ChangedInstanceInfo) ExceptionInfoOverrideFlag(com.zimbra.cs.util.tnef.mapi.ExceptionInfoOverrideFlag)

Aggregations

BusyStatus (com.zimbra.cs.util.tnef.mapi.BusyStatus)1 ChangedInstanceInfo (com.zimbra.cs.util.tnef.mapi.ChangedInstanceInfo)1 ExceptionInfoOverrideFlag (com.zimbra.cs.util.tnef.mapi.ExceptionInfoOverrideFlag)1