Search in sources :

Example 1 with DurationInfo

use of com.zimbra.soap.mail.type.DurationInfo in project zm-mailbox by Zimbra.

the class Alarm method toJaxb.

public AlarmInfo toJaxb() {
    Action action;
    List<ZProperty> useXprops = xProps;
    if ((Action.AUDIO.equals(mAction) || Action.PROCEDURE.equals(mAction)) && DebugConfig.calendarConvertNonDisplayAlarm) {
        action = Action.DISPLAY;
        useXprops = xpropsWithoutXWRAlarmUID();
    } else {
        action = mAction;
    }
    AlarmInfo alarm = new AlarmInfo(action.toString());
    AlarmTriggerInfo trigger = new AlarmTriggerInfo();
    alarm.setTrigger(trigger);
    if (TriggerType.ABSOLUTE.equals(mTriggerType)) {
        trigger.setAbsolute(new DateAttr(mTriggerAbsolute.getDateTimePartString(false)));
    } else {
        DurationInfo relative = new DurationInfo(mTriggerRelative);
        trigger.setRelative(relative);
        if (mTriggerRelated != null)
            relative.setRelated(mTriggerRelated.toString());
    }
    if (mRepeatDuration != null) {
        DurationInfo repeat = new DurationInfo(mRepeatDuration);
        alarm.setRepeat(repeat);
        repeat.setRepeatCount(mRepeatCount);
    }
    if (!Action.AUDIO.equals(action)) {
        alarm.setDescription(mDescription);
    }
    if (!Action.DISPLAY.equals(action) && mAttach != null)
        alarm.setAttach(new CalendarAttach(mAttach));
    if (Action.EMAIL.equals(mAction) || Action.X_YAHOO_CALENDAR_ACTION_IM.equals(mAction) || Action.X_YAHOO_CALENDAR_ACTION_MOBILE.equals(mAction)) {
        alarm.setSummary(mSummary);
        if (mAttendees != null) {
            for (ZAttendee attendee : mAttendees) {
                alarm.addAttendee(attendee.toJaxb());
            }
        }
    }
    // x-prop
    alarm.setXProps(ToXML.jaxbXProps(useXprops.iterator()));
    return alarm;
}
Also used : CalendarAttach(com.zimbra.soap.mail.type.CalendarAttach) DateAttr(com.zimbra.soap.mail.type.DateAttr) ZProperty(com.zimbra.common.calendar.ZCalendar.ZProperty) AlarmInfo(com.zimbra.soap.mail.type.AlarmInfo) AlarmTriggerInfo(com.zimbra.soap.mail.type.AlarmTriggerInfo) DurationInfo(com.zimbra.soap.mail.type.DurationInfo)

Aggregations

ZProperty (com.zimbra.common.calendar.ZCalendar.ZProperty)1 AlarmInfo (com.zimbra.soap.mail.type.AlarmInfo)1 AlarmTriggerInfo (com.zimbra.soap.mail.type.AlarmTriggerInfo)1 CalendarAttach (com.zimbra.soap.mail.type.CalendarAttach)1 DateAttr (com.zimbra.soap.mail.type.DateAttr)1 DurationInfo (com.zimbra.soap.mail.type.DurationInfo)1