Search in sources :

Example 1 with ZAttendee

use of com.zimbra.client.ZInvite.ZAttendee in project zm-mailbox by Zimbra.

the class ZAlarm method toElement.

public Element toElement(Element parent) {
    Element alarm = parent.addElement(MailConstants.E_CAL_ALARM);
    alarm.addAttribute(MailConstants.A_CAL_ALARM_ACTION, mAction.toString());
    Element trigger = alarm.addElement(MailConstants.E_CAL_ALARM_TRIGGER);
    if (ZTriggerType.ABSOLUTE.equals(mTriggerType)) {
        Element absolute = trigger.addElement(MailConstants.E_CAL_ALARM_ABSOLUTE);
        absolute.addAttribute(MailConstants.A_DATE, mTriggerAbsolute.toString());
    } else {
        Element relative = mTriggerRelative.toXml(trigger, MailConstants.E_CAL_ALARM_RELATIVE);
        if (mTriggerRelated != null)
            relative.addAttribute(MailConstants.A_CAL_ALARM_RELATED, mTriggerRelated.toString());
    }
    if (mRepeatDuration != null) {
        Element repeat = mRepeatDuration.toXml(alarm, MailConstants.E_CAL_ALARM_REPEAT);
        repeat.addAttribute(MailConstants.A_CAL_ALARM_COUNT, mRepeatCount);
    }
    if (!ZAction.AUDIO.equals(mAction) && mDescription != null) {
        Element desc = alarm.addElement(MailConstants.E_CAL_ALARM_DESCRIPTION);
        desc.setText(mDescription);
    }
    if (mAttach != null)
        mAttach.toXml(alarm);
    if (ZAction.EMAIL.equals(mAction) || ZAction.X_YAHOO_CALENDAR_ACTION_IM.equals(mAction) || ZAction.X_YAHOO_CALENDAR_ACTION_MOBILE.equals(mAction)) {
        Element summary = alarm.addElement(MailConstants.E_CAL_ALARM_SUMMARY);
        if (mSummary != null) {
            summary.setText(mSummary);
        }
        if (mAttendees != null) {
            for (ZAttendee attendee : mAttendees) {
                attendee.toElement(alarm);
            }
        }
    }
    return alarm;
}
Also used : Element(com.zimbra.common.soap.Element) ZAttendee(com.zimbra.client.ZInvite.ZAttendee)

Example 2 with ZAttendee

use of com.zimbra.client.ZInvite.ZAttendee in project zm-mailbox by Zimbra.

the class TestUtil method createAppointment.

public static ZAppointmentResult createAppointment(ZMailbox mailbox, String subject, String attendee, Date startDate, Date endDate) throws ServiceException {
    ZInvite invite = new ZInvite();
    ZInvite.ZComponent comp = new ZComponent();
    comp.setStatus(ZStatus.CONF);
    comp.setClassProp(ZClass.PUB);
    comp.setTransparency(ZTransparency.O);
    comp.setStart(new ZDateTime(startDate.getTime(), false, mailbox.getPrefs().getTimeZone()));
    comp.setEnd(new ZDateTime(endDate.getTime(), false, mailbox.getPrefs().getTimeZone()));
    comp.setName(subject);
    comp.setOrganizer(new ZOrganizer(mailbox.getName()));
    if (attendee != null) {
        attendee = addDomainIfNecessary(attendee);
        ZAttendee zattendee = new ZAttendee();
        zattendee.setAddress(attendee);
        zattendee.setRole(ZRole.REQ);
        zattendee.setParticipantStatus(ZParticipantStatus.NE);
        zattendee.setRSVP(true);
        comp.getAttendees().add(zattendee);
    }
    invite.getComponents().add(comp);
    ZOutgoingMessage m = null;
    if (attendee != null) {
        m = getOutgoingMessage(attendee, subject, "Test appointment", null);
    }
    return mailbox.createAppointment(ZFolder.ID_CALENDAR, null, m, invite, null);
}
Also used : ZComponent(com.zimbra.client.ZInvite.ZComponent) ZDateTime(com.zimbra.client.ZDateTime) ZOutgoingMessage(com.zimbra.client.ZMailbox.ZOutgoingMessage) ZInvite(com.zimbra.client.ZInvite) ZAttendee(com.zimbra.client.ZInvite.ZAttendee) ZOrganizer(com.zimbra.client.ZInvite.ZOrganizer) ZComponent(com.zimbra.client.ZInvite.ZComponent)

Aggregations

ZAttendee (com.zimbra.client.ZInvite.ZAttendee)2 ZDateTime (com.zimbra.client.ZDateTime)1 ZInvite (com.zimbra.client.ZInvite)1 ZComponent (com.zimbra.client.ZInvite.ZComponent)1 ZOrganizer (com.zimbra.client.ZInvite.ZOrganizer)1 ZOutgoingMessage (com.zimbra.client.ZMailbox.ZOutgoingMessage)1 Element (com.zimbra.common.soap.Element)1