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;
}
Aggregations