Search in sources :

Example 1 with ZComponent

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

the class ZAppointmentHit method modifyNotification.

@Override
public void modifyNotification(ZModifyEvent event) throws ServiceException {
    if (event instanceof ZModifyAppointmentEvent) {
        ZModifyAppointmentEvent mevent = (ZModifyAppointmentEvent) event;
        ZAppointment appt = (ZAppointment) mevent.getItem();
        mFlags = getStr(appt.getFlags(), mFlags);
        mTags = getStr(appt.getTagIds(), mTags);
        mFolderId = getStr(appt.getFolderId(), mFolderId);
        List<ZInvite> invites = appt.getInvites();
        if (invites.size() > 0) {
            ZInvite inv = invites.get(0);
            ZComponent comp = inv.getComponent();
            if (comp != null) {
                // just do task-related ones for now, as appts are handled differently
                ZStatus stat = comp.getStatus();
                if (stat != null)
                    mStatus = stat.name();
                mPercentComplete = getStr(comp.getPercentCompleted(), mPercentComplete);
                mPriority = getStr(comp.getPriority(), mPriority);
                mName = getStr(comp.getName(), mName);
                mLocation = getStr(comp.getLocation(), mLocation);
                if (comp.getCategories() != null)
                    mCategories = comp.getCategories();
                if (comp.getGeo() != null)
                    mGeo = comp.getGeo();
            }
        }
    }
}
Also used : ZComponent(com.zimbra.client.ZInvite.ZComponent) ZModifyAppointmentEvent(com.zimbra.client.event.ZModifyAppointmentEvent) ZStatus(com.zimbra.client.ZInvite.ZStatus)

Example 2 with ZComponent

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

the class TestSearchTask method init.

@BeforeClass
public static void init() throws ServiceException {
    TestUtil.deleteAccountIfExists(USER_NAME);
    TestUtil.createAccount(USER_NAME);
    mbox = TestUtil.getZMailbox(USER_NAME);
    for (int i = 0; i < numTasks; i++) {
        ZOutgoingMessage msg = TestUtil.getOutgoingMessage(USER_NAME, null, String.format("task body %d", i), null);
        ZInvite inv = new ZInvite();
        ZInvite.ZComponent comp = new ZComponent();
        comp.setIsAllDay(true);
        comp.setStatus(ZStatus.NEED);
        comp.setLocation("mount erebor");
        comp.setPercentCompleted("0");
        comp.setPriority("0");
        comp.setName(String.format("destroy the one ring %d", i));
        comp.setOrganizer(new ZOrganizer(mbox.getName()));
        inv.getComponents().add(comp);
        ZAppointmentResult resp = mbox.createTask("15", null, msg, inv, null);
        ids.add(resp.getInviteId());
    }
}
Also used : ZComponent(com.zimbra.client.ZInvite.ZComponent) ZOutgoingMessage(com.zimbra.client.ZMailbox.ZOutgoingMessage) ZInvite(com.zimbra.client.ZInvite) ZAppointmentResult(com.zimbra.client.ZMailbox.ZAppointmentResult) ZOrganizer(com.zimbra.client.ZInvite.ZOrganizer) ZComponent(com.zimbra.client.ZInvite.ZComponent) BeforeClass(org.junit.BeforeClass)

Example 3 with ZComponent

use of com.zimbra.client.ZInvite.ZComponent 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

ZComponent (com.zimbra.client.ZInvite.ZComponent)3 ZInvite (com.zimbra.client.ZInvite)2 ZOrganizer (com.zimbra.client.ZInvite.ZOrganizer)2 ZOutgoingMessage (com.zimbra.client.ZMailbox.ZOutgoingMessage)2 ZDateTime (com.zimbra.client.ZDateTime)1 ZAttendee (com.zimbra.client.ZInvite.ZAttendee)1 ZStatus (com.zimbra.client.ZInvite.ZStatus)1 ZAppointmentResult (com.zimbra.client.ZMailbox.ZAppointmentResult)1 ZModifyAppointmentEvent (com.zimbra.client.event.ZModifyAppointmentEvent)1 BeforeClass (org.junit.BeforeClass)1