Search in sources :

Example 1 with InvitationInfo

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

the class TestJaxb method testAcceptSeriesDeclineInstance.

/**
     * Bug 94018.  Accepting series, then declining single instance leads to inconsistent display of attendee
     * status for organizer copy for the declined instance.
     * Test steps:
     * 1.  Invite 2 users to a daily meeting.
     * 2.  User 1 replies, accepting the daily meeting.
     * 3.  User 1 replies again, declining one of the instances in the daily meeting.
     * 4.  User 2 replies tentatively accepting the daily meeting.
     *
     * At the end of this, check that an exception has been created.  Check that that exception registers
     * the decline from user 1 AND the tentative acceptance from user2 that arrived later.
     */
@Test
public void testAcceptSeriesDeclineInstance() throws Exception {
    TestUtil.createAccount(ORGANIZER);
    TestUtil.createAccount(ATTENDEE1);
    TestUtil.createAccount(ATTENDEE2);
    String subject = NAME_PREFIX + " Daily";
    ZMailbox organizerBox = TestUtil.getZMailbox(ORGANIZER);
    ZMailbox attendeeBox = TestUtil.getZMailbox(ATTENDEE1);
    ZMailbox attendee2Box = TestUtil.getZMailbox(ATTENDEE2);
    String organizerEmail = organizerBox.getName();
    // Create and send the daily meeting
    InviteComponent inviteComp = new InviteComponent();
    inviteComp.addAttendee(CalendarAttendee.createForAddressDisplaynameRolePartstatRsvp(attendeeBox.getName(), getCN(attendeeBox), "REQ", "NE", true));
    inviteComp.addAttendee(CalendarAttendee.createForAddressDisplaynameRolePartstatRsvp(attendee2Box.getName(), getCN(attendee2Box), "REQ", "NE", true));
    inviteComp.setStatus("CONF");
    inviteComp.setFreeBusy("B");
    inviteComp.setCalClass("PUB");
    inviteComp.setTransparency("O");
    inviteComp.setIsDraft(false);
    inviteComp.setIsAllDay(false);
    inviteComp.setDtStart(DtTimeInfo.createForDatetimeAndZone("20161008T130000", "Europe/London"));
    inviteComp.setDtEnd(DtTimeInfo.createForDatetimeAndZone("20161008T140000", "Europe/London"));
    inviteComp.setName(subject);
    inviteComp.setLocation("room 101");
    inviteComp.setOrganizer(CalOrganizer.createForAddress(organizerEmail));
    inviteComp.setRecurrence(RecurrenceInfo.create(AddRecurrenceInfo.create(SimpleRepeatingRule.createFromFrequencyAndInterval("DAI", IntervalRule.create(1)))));
    InvitationInfo invite = new InvitationInfo();
    invite.setInviteComponent(inviteComp);
    EmailAddrInfo attendeeAddr = EmailAddrInfo.createForAddressPersonalAndAddressType(attendeeBox.getName(), getCN(attendeeBox), "t");
    EmailAddrInfo attendeeAddr2 = EmailAddrInfo.createForAddressPersonalAndAddressType(attendee2Box.getName(), getCN(attendee2Box), "t");
    MimePartInfo mimePart = MimePartInfo.createForContentType("multipart/alternative");
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/plain", "invite body"));
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/html", "<html><body><p><b>invite</b> body</p></body></html>"));
    Msg msg = new Msg();
    msg.setFolderId("10");
    msg.setInvite(invite);
    msg.addEmailAddress(attendeeAddr);
    msg.addEmailAddress(attendeeAddr2);
    msg.setSubject(subject);
    msg.setMimePart(mimePart);
    CreateAppointmentRequest createSeriesRequest = CreateAppointmentRequest.create(msg);
    CreateAppointmentResponse caResp = organizerBox.invokeJaxb(createSeriesRequest);
    Assert.assertNotNull("JAXB CreateAppointmentResponse object", caResp);
    Assert.assertNotNull("JAXB CreateAppointmentResponse calItemId", caResp.getCalItemId());
    Assert.assertNotNull("JAXB CreateAppointmentResponse invId", caResp.getCalInvId());
    Assert.assertNotNull("JAXB CreateAppointmentResponse modified sequence ms", caResp.getModifiedSequence());
    Assert.assertNotNull("JAXB CreateAppointmentResponse rev", caResp.getRevision());
    ZMessage seriesInviteMsg = TestUtil.waitForMessage(attendeeBox, subject);
    Assert.assertNotNull("ZMessage for series invite", seriesInviteMsg);
    ZInvite seriesInvite = seriesInviteMsg.getInvite();
    Assert.assertNotNull("ZInvite for series invite", seriesInvite);
    // User 1 accepts the daily meeting
    ZMessage seriesAcceptMsg = sendInviteReplyToSeries(attendeeBox, organizerBox, seriesInviteMsg.getId(), subject, "ACCEPT");
    Assert.assertNotNull("ZMessage for series accept", seriesAcceptMsg);
    // User 1 declines one instance of the daily meeting
    SendInviteReplyRequest sirReq = new SendInviteReplyRequest(seriesInviteMsg.getId(), 0, /* componentNum */
    "DECLINE");
    sirReq.setIdentityId(attendeeBox.getAccountInfo(false).getId());
    sirReq.setExceptionId(DtTimeInfo.createForDatetimeAndZone("20161011T130000", "Europe/London"));
    sirReq.setUpdateOrganizer(true);
    attendeeAddr.setAddressType("f");
    mimePart = MimePartInfo.createForContentType("multipart/alternative");
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/plain", "I won't attend on Tuesday, October 11, 2016."));
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/html", "<html><body><p><b>I won't attend  on Tuesday, October 11, 2016</b></p></body></html>"));
    msg = new Msg();
    msg.setReplyType("r");
    msg.setIdentityId(attendeeBox.getAccountInfo(false).getId());
    EmailAddrInfo orgAddr = EmailAddrInfo.createForAddressPersonalAndAddressType(organizerBox.getName(), organizerBox.getName(), "t");
    msg.addEmailAddress(orgAddr);
    msg.addEmailAddress(attendeeAddr);
    String declineSubject = "Decline: " + subject;
    msg.setSubject(declineSubject);
    msg.setMimePart(mimePart);
    sirReq.setMsg(msg);
    SendInviteReplyResponse sirResp = attendeeBox.invokeJaxb(sirReq);
    Assert.assertNotNull("JAXB SendInviteReplyResponse object", sirResp);
    ZMessage instanceDeclineMsg = TestUtil.waitForMessage(organizerBox, String.format("subject:\"%s\"", declineSubject));
    Assert.assertNotNull("ZMessage for series accept", instanceDeclineMsg);
    seriesInviteMsg = TestUtil.waitForMessage(attendee2Box, subject);
    Assert.assertNotNull("ZMessage for series invite", seriesInviteMsg);
    seriesInvite = seriesInviteMsg.getInvite();
    Assert.assertNotNull("ZInvite for series invite", seriesInvite);
    // User 2 tentatively accepts the daily meeting
    ZMessage seriesTentativeMsg = sendInviteReplyToSeries(attendee2Box, organizerBox, seriesInviteMsg.getId(), subject, "TENTATIVE");
    Assert.assertNotNull("ZMessage for series tentative", seriesTentativeMsg);
    // Search for the organizer's calendar entry
    SearchRequest sReq = new SearchRequest();
    sReq.setSearchTypes(ZSearchParams.TYPE_APPOINTMENT);
    sReq.setCalItemExpandStart(ymdStringToDate("2016-10-09"));
    sReq.setCalItemExpandEnd(ymdStringToDate("2016-10-14"));
    sReq.setQuery((String.format("in:Calendar and subject:%s", subject)));
    SearchResponse sResp = organizerBox.invokeJaxb(sReq);
    List<SearchHit> hits = sResp.getSearchHits();
    Assert.assertNotNull("Organizer calendar Search hits at end", hits);
    Assert.assertEquals("Num Organizer calendar hits at end", 1, hits.size());
    SearchHit orgCalHit = hits.get(0);
    Assert.assertTrue(orgCalHit instanceof AppointmentHitInfo);
    AppointmentHitInfo orgApptHit = (AppointmentHitInfo) orgCalHit;
    String seriesInviteId = orgApptHit.getInvId();
    Assert.assertNotNull("Organizer Calendar at end - series invite id", seriesInviteId);
    List<InstanceDataInfo> instances = orgApptHit.getInstances();
    Assert.assertNotNull("Organizer Calendar at end - instances in expansion", instances);
    Assert.assertEquals("Organizer Calendar at end - number of instances in expansion", 5, instances.size());
    // The third entry in the list should be for the exception
    String exceptionInviteId = instances.get(2).getInvId();
    Assert.assertNotNull("Organizer Calendar at end - exception invite id", exceptionInviteId);
    String exceptionRidZ = instances.get(2).getRecurIdZ();
    Assert.assertNotNull("Organizer Calendar at end - exception invite RecurIdZ", exceptionRidZ);
    // Do a GetMsg for the exception in the Organizer's calendar
    MsgSpec gmeMsgSpec = new MsgSpec(exceptionInviteId);
    gmeMsgSpec.setRecurIdZ(exceptionRidZ);
    GetMsgRequest gmeReq = new GetMsgRequest(gmeMsgSpec);
    GetMsgResponse gmeResp = organizerBox.invokeJaxb(gmeReq);
    List<InviteComponentWithGroupInfo> eInviteComps = gmeResp.getMsg().getInvite().getInviteComponents();
    Assert.assertEquals("Organizer Calendar at end - number of components in exception", 1, eInviteComps.size());
    List<CalendarAttendeeWithGroupInfo> eAttendees = eInviteComps.get(0).getAttendees();
    Assert.assertEquals("Organizer Calendar at end - number of attendees in exception", 2, eAttendees.size());
    for (CalendarAttendeeWithGroupInfo eAttendee : eAttendees) {
        String addr = eAttendee.getAddress();
        String ptst = eAttendee.getPartStat();
        if (addr.equals(attendeeBox.getName())) {
            Assert.assertEquals("exception attendee1 partstat", "DE", ptst);
        } else if (addr.equals(attendee2Box.getName())) {
            Assert.assertEquals("exception attendee2 partstat", "TE", ptst);
        } else {
            Assert.fail(String.format("Unexpected attendee in exception [%s]", addr));
        }
    }
    // Do a GetMsg for the series in the Organizer's calendar
    MsgSpec gmsMsgSpec = new MsgSpec(seriesInviteId);
    GetMsgRequest gmsReq = new GetMsgRequest(gmsMsgSpec);
    GetMsgResponse gmsResp = organizerBox.invokeJaxb(gmsReq);
    List<InviteComponentWithGroupInfo> sInviteComps = gmsResp.getMsg().getInvite().getInviteComponents();
    Assert.assertEquals("Organizer Calendar at end - number of components in series", 1, sInviteComps.size());
    List<CalendarAttendeeWithGroupInfo> sAttendees = sInviteComps.get(0).getAttendees();
    Assert.assertEquals("Organizer Calendar at end - number of attendees in exception", 2, sAttendees.size());
    for (CalendarAttendeeWithGroupInfo sAttendee : sAttendees) {
        String addr = sAttendee.getAddress();
        String ptst = sAttendee.getPartStat();
        if (addr.equals(attendeeBox.getName())) {
            Assert.assertEquals("exception attendee1 partstat", "AC", ptst);
        } else if (addr.equals(attendee2Box.getName())) {
            Assert.assertEquals("exception attendee2 partstat", "TE", ptst);
        } else {
            Assert.fail(String.format("Unexpected attendee in exception [%s]", addr));
        }
    }
}
Also used : ZMessage(com.zimbra.client.ZMessage) SearchRequest(com.zimbra.soap.mail.message.SearchRequest) CreateAppointmentRequest(com.zimbra.soap.mail.message.CreateAppointmentRequest) ZInvite(com.zimbra.client.ZInvite) SearchHit(com.zimbra.soap.type.SearchHit) InvitationInfo(com.zimbra.soap.mail.type.InvitationInfo) CreateAppointmentResponse(com.zimbra.soap.mail.message.CreateAppointmentResponse) SendInviteReplyRequest(com.zimbra.soap.mail.message.SendInviteReplyRequest) CalendarAttendeeWithGroupInfo(com.zimbra.soap.mail.type.CalendarAttendeeWithGroupInfo) ZMailbox(com.zimbra.client.ZMailbox) EmailAddrInfo(com.zimbra.soap.mail.type.EmailAddrInfo) GetMsgResponse(com.zimbra.soap.mail.message.GetMsgResponse) MimePartInfo(com.zimbra.soap.mail.type.MimePartInfo) InstanceDataInfo(com.zimbra.soap.mail.type.InstanceDataInfo) InviteComponentWithGroupInfo(com.zimbra.soap.mail.type.InviteComponentWithGroupInfo) Msg(com.zimbra.soap.mail.type.Msg) SendInviteReplyResponse(com.zimbra.soap.mail.message.SendInviteReplyResponse) GetMsgRequest(com.zimbra.soap.mail.message.GetMsgRequest) MsgSpec(com.zimbra.soap.mail.type.MsgSpec) AppointmentHitInfo(com.zimbra.soap.mail.type.AppointmentHitInfo) InviteComponent(com.zimbra.soap.mail.type.InviteComponent) SearchResponse(com.zimbra.soap.mail.message.SearchResponse) Test(org.junit.Test)

Example 2 with InvitationInfo

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

the class TestJaxb method testProposeNewTimeWorkflow.

/**
     * Bug 96748:
     * 1. user1 sends meeting invite to user2
     * 2. user2 proposes new time
     * 3. user1 accepts the proposed new time and new invite is sent to user2
     * 4. user2 accepts the new invite
     * At step 4, no acceptance message was being generated
     */
@Test
public void testProposeNewTimeWorkflow() throws Exception {
    TestUtil.createAccount(ORGANIZER);
    TestUtil.createAccount(ATTENDEE1);
    String subject = NAME_PREFIX + " attendee will cause time to change";
    ZMailbox organizerBox = TestUtil.getZMailbox(ORGANIZER);
    ZMailbox attendeeBox = TestUtil.getZMailbox(ATTENDEE1);
    String organizerEmail = organizerBox.getName();
    // Create and send the meeting request
    InviteComponent inviteComp = new InviteComponent();
    inviteComp.addAttendee(CalendarAttendee.createForAddressDisplaynameRolePartstatRsvp(attendeeBox.getName(), getCN(attendeeBox), "REQ", "NE", true));
    inviteComp.setStatus("CONF");
    inviteComp.setFreeBusy("B");
    inviteComp.setCalClass("PUB");
    inviteComp.setTransparency("O");
    inviteComp.setIsDraft(false);
    inviteComp.setIsAllDay(false);
    Date startDate = new Date(System.currentTimeMillis() + Constants.MILLIS_PER_DAY);
    ZDateTime start = new ZDateTime(startDate.getTime(), false, organizerBox.getPrefs().getTimeZone());
    Date endDate = new Date(startDate.getTime() + Constants.MILLIS_PER_HOUR);
    ZDateTime end = new ZDateTime(endDate.getTime(), false, organizerBox.getPrefs().getTimeZone());
    Date newStartDate = new Date(System.currentTimeMillis() + 2 * Constants.MILLIS_PER_DAY);
    ZDateTime newStart = new ZDateTime(newStartDate.getTime(), false, organizerBox.getPrefs().getTimeZone());
    Date newEndDate = new Date(newStartDate.getTime() + Constants.MILLIS_PER_HOUR);
    ZDateTime newEnd = new ZDateTime(newEndDate.getTime(), false, organizerBox.getPrefs().getTimeZone());
    inviteComp.setDtStart(DtTimeInfo.createForDatetimeAndZone(start.getDateTime(), start.getTimeZoneId()));
    inviteComp.setDtEnd(DtTimeInfo.createForDatetimeAndZone(end.getDateTime(), end.getTimeZoneId()));
    inviteComp.setName(subject);
    inviteComp.setLocation("room 101");
    inviteComp.setOrganizer(CalOrganizer.createForAddress(organizerEmail));
    InvitationInfo invite = new InvitationInfo();
    invite.setInviteComponent(inviteComp);
    EmailAddrInfo attendeeAddr = EmailAddrInfo.createForAddressPersonalAndAddressType(attendeeBox.getName(), getCN(attendeeBox), "t");
    MimePartInfo mimePart = MimePartInfo.createForContentType("multipart/alternative");
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/plain", "invite body"));
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/html", "<html><body><p><b>invite</b> body</p></body></html>"));
    Msg msg = new Msg();
    msg.setFolderId("10");
    msg.setInvite(invite);
    msg.addEmailAddress(attendeeAddr);
    msg.setSubject(subject);
    msg.setMimePart(mimePart);
    CreateAppointmentRequest createApptReq = CreateAppointmentRequest.create(msg);
    CreateAppointmentResponse caResp = organizerBox.invokeJaxb(createApptReq);
    Assert.assertNotNull("JAXB CreateAppointmentResponse object", caResp);
    Assert.assertNotNull("JAXB CreateAppointmentResponse calItemId", caResp.getCalItemId());
    Assert.assertNotNull("JAXB CreateAppointmentResponse invId", caResp.getCalInvId());
    Assert.assertNotNull("JAXB CreateAppointmentResponse modified sequence ms", caResp.getModifiedSequence());
    Assert.assertNotNull("JAXB CreateAppointmentResponse rev", caResp.getRevision());
    ZMessage seriesInviteMsg = TestUtil.waitForMessage(attendeeBox, subject);
    Assert.assertNotNull("ZMessage for series invite", seriesInviteMsg);
    ZInvite seriesInvite = seriesInviteMsg.getInvite();
    Assert.assertNotNull("ZInvite for series invite", seriesInvite);
    AppointmentHitInfo hit = findMatchingAppointment(attendeeBox, startDate, endDate, subject);
    // User 1 proposes new time for meeting
    ZMessage propNewTimeMsg = attendeeProposeNewTimeForMeeting(attendeeBox, organizerBox, newStart, newEnd, hit, subject);
    Assert.assertNotNull("ZMessage for propose new time", propNewTimeMsg);
    hit = findMatchingAppointment(organizerBox, startDate, endDate, subject);
    // Organizer changes the meeting to the new proposed time
    // easier to find unique inbox entry
    subject = NAME_PREFIX + " attendee CAUSED time to change";
    ZMessage attendee2ndInvite = organizerChangeTimeForMeeting(attendeeBox, organizerBox, newStart, newEnd, hit, subject);
    Assert.assertNotNull("attendee 2nd invite", attendee2ndInvite);
    hit = findMatchingAppointment(attendeeBox, newStartDate, newEndDate, "inid:10");
    acceptInvite(attendeeBox, organizerBox, attendee2ndInvite, subject);
}
Also used : Msg(com.zimbra.soap.mail.type.Msg) ZMessage(com.zimbra.client.ZMessage) CreateAppointmentRequest(com.zimbra.soap.mail.message.CreateAppointmentRequest) ZInvite(com.zimbra.client.ZInvite) InvitationInfo(com.zimbra.soap.mail.type.InvitationInfo) CreateAppointmentResponse(com.zimbra.soap.mail.message.CreateAppointmentResponse) AppointmentHitInfo(com.zimbra.soap.mail.type.AppointmentHitInfo) Date(java.util.Date) InviteComponent(com.zimbra.soap.mail.type.InviteComponent) ZDateTime(com.zimbra.client.ZDateTime) ZMailbox(com.zimbra.client.ZMailbox) EmailAddrInfo(com.zimbra.soap.mail.type.EmailAddrInfo) MimePartInfo(com.zimbra.soap.mail.type.MimePartInfo) Test(org.junit.Test)

Example 3 with InvitationInfo

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

the class TestJaxb method organizerChangeTimeForMeeting.

/**
 * @param hit - From search response - represents the organizer's calendar copy
 * @throws ServiceException
 */
private ZMessage organizerChangeTimeForMeeting(ZMailbox attendeeBox, ZMailbox organizerBox, ZDateTime newStart, ZDateTime newEnd, AppointmentHitInfo hit, String subject) throws Exception {
    InviteComponent inviteComp = createInviteComponentSkeleton(subject, "room 101", organizerBox, attendeeBox);
    inviteComp.setDtStart(DtTimeInfo.createForDatetimeAndZone(newStart.getDateTime(), newStart.getTimeZoneId()));
    inviteComp.setDtEnd(DtTimeInfo.createForDatetimeAndZone(newEnd.getDateTime(), newEnd.getTimeZoneId()));
    InvitationInfo invite = new InvitationInfo();
    invite.setUid(hit.getUid());
    invite.setInviteComponent(inviteComp);
    Msg msg = new Msg();
    msg.setFolderId(hit.getFolderId());
    msg.setInvite(invite);
    EmailAddrInfo attendeeAddr = EmailAddrInfo.createForAddressPersonalAndAddressType(attendeeBox.getName(), getCN(attendeeBox), "t");
    msg.addEmailAddress(attendeeAddr);
    msg.setSubject(subject);
    msg.setMimePart(makeTextAndHtmlAlternatives(String.format("The following meeting has been modified:\n\n%s", subject)));
    ModifyAppointmentRequest maReq = ModifyAppointmentRequest.createForIdModseqRevCompnumMsg(hit.getInvId(), hit.getModifiedSequence(), hit.getRevision(), hit.getComponentNum(), msg);
    ModifyAppointmentResponse maResp = organizerBox.invokeJaxb(maReq);
    Assert.assertNotNull("JAXB ModifyAppointmentResponse", maResp);
    return waitForInvite(attendeeBox, subject);
}
Also used : Msg(com.zimbra.soap.mail.type.Msg) ModifyAppointmentRequest(com.zimbra.soap.mail.message.ModifyAppointmentRequest) InvitationInfo(com.zimbra.soap.mail.type.InvitationInfo) EmailAddrInfo(com.zimbra.soap.mail.type.EmailAddrInfo) ModifyAppointmentResponse(com.zimbra.soap.mail.message.ModifyAppointmentResponse) InviteComponent(com.zimbra.soap.mail.type.InviteComponent)

Example 4 with InvitationInfo

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

the class TestJaxb method attendeeProposeNewTimeForMeeting.

/**
 * @param hit - From search response - represents the attendee's calendar copy
 * @return Message representing the Organizer's intray copy of the new proposal, once it has arrived
 */
private ZMessage attendeeProposeNewTimeForMeeting(ZMailbox attendeeBox, ZMailbox organizerBox, ZDateTime newStart, ZDateTime newEnd, AppointmentHitInfo hit, String subjectSuffix) throws Exception {
    EmailAddrInfo orgAddr = EmailAddrInfo.createForAddressPersonalAndAddressType(organizerBox.getName(), organizerBox.getName(), "t");
    String subject = "New Time Proposed: " + subjectSuffix;
    Msg msg = new Msg();
    InviteComponent compo = new InviteComponent();
    compo.setName(subjectSuffix);
    compo.setUid(hit.getUid());
    compo.setIsAllDay(hit.getAllDay());
    compo.setOrganizer(CalOrganizer.createForAddress(organizerBox.getName()));
    compo.setDtStart(DtTimeInfo.createForDatetimeAndZone(newStart.getDateTime(), newStart.getTimeZoneId()));
    compo.setDtEnd(DtTimeInfo.createForDatetimeAndZone(newEnd.getDateTime(), newEnd.getTimeZoneId()));
    InvitationInfo invite = InvitationInfo.create(compo);
    msg.addEmailAddress(orgAddr);
    /* replying to the organizer */
    msg.setSubject(subject);
    msg.setMimePart(makeTextAndHtmlAlternatives("New Time Proposed."));
    msg.setInvite(invite);
    CounterAppointmentResponse sirResp = attendeeBox.invokeJaxb(CounterAppointmentRequest.createForMsgModseqRevIdCompnum(msg, hit.getModifiedSequence(), hit.getRevision(), hit.getInvId(), hit.getComponentNum()));
    Assert.assertNotNull("JAXB CounterAppointmentResponse object", sirResp);
    return waitForInvite(organizerBox, subject);
}
Also used : Msg(com.zimbra.soap.mail.type.Msg) InvitationInfo(com.zimbra.soap.mail.type.InvitationInfo) EmailAddrInfo(com.zimbra.soap.mail.type.EmailAddrInfo) InviteComponent(com.zimbra.soap.mail.type.InviteComponent) CounterAppointmentResponse(com.zimbra.soap.mail.message.CounterAppointmentResponse)

Example 5 with InvitationInfo

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

the class TestExpandGroupInfo method createAppt.

private String createAppt(Account authAcct, String toAddress, String subject, String content) throws Exception {
    SoapTransport transport = authUser(authAcct.getName());
    Msg msg = new Msg();
    EmailAddrInfo toAddr = new EmailAddrInfo(toAddress);
    toAddr.setAddressType(EmailType.TO.toString());
    msg.addEmailAddress(toAddr);
    msg.setSubject(subject);
    MimePartInfo mp = new MimePartInfo();
    mp.setContentType("multipart/alternative");
    MimePartInfo mpSub = new MimePartInfo();
    mpSub.setContent(content);
    mp.addMimePart(mpSub);
    msg.setMimePart(mp);
    InvitationInfo invite = new InvitationInfo();
    InviteComponent invComp = new InviteComponent(ZCalendar.ICalTok.REQUEST.name(), 0, false);
    CalOrganizer organizer = new CalOrganizer();
    organizer.setAddress(authAcct.getName());
    CalendarAttendee attendee = new CalendarAttendee();
    attendee.setAddress(toAddress);
    invComp.setOrganizer(organizer);
    invComp.addAttendee(attendee);
    invComp.setDtStart(new DtTimeInfo("20120101"));
    invComp.setDtEnd(new DtTimeInfo("20120102"));
    invite.setInviteComponent(invComp);
    msg.setInvite(invite);
    CreateAppointmentRequest req = new CreateAppointmentRequest();
    req.setMsg(msg);
    CreateAppointmentResponse resp = invokeJaxb(transport, req);
    /*
        String calItemId = resp.getCalItemId();
        return calItemId;
        */
    String invId = resp.getCalInvId();
    return invId;
/*
           <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
           <soap:Header>
               <context xmlns="urn:zimbra">
               <userAgent xmlns="" name="ZimbraWebClient - FF10 (Mac)" version="0.0"/>
               <session xmlns="" id="14"/>
               <account xmlns="" by="name">user1@phoebe.mbp</account>
               <format xmlns="" type="js"/>
               </context>
           </soap:Header>

           <soap:Body>
           <CreateAppointmentRequest xmlns="urn:zimbraMail">
               <m xmlns="" l="10">
                   <inv>
                       <comp status="CONF" fb="B" class="PUB" transp="O" draft="0" allDay="0" name="test" loc="">
                           <at role="REQ" ptst="NE" rsvp="1" a="user2@phoebe.mbp"/>
                           <at role="REQ" ptst="NE" rsvp="1" a="user3@phoebe.mbp"/>
                           <s tz="America/Los_Angeles" d="20120227T080000"/>
                           <e tz="America/Los_Angeles" d="20120227T083000"/>
                           <or a="user1@phoebe.mbp" d="Demo User One"/>
                           <alarm action="DISPLAY">
                               <trigger>
                                   <rel m="5" related="START" neg="1"/>
                               </trigger>
                           </alarm>
                       </comp>
                   </inv>

                   <e a="user2@phoebe.mbp" t="t"/>
                   <e a="user3@phoebe.mbp" t="t"/>

                   <su>test</su>

                   <mp ct="multipart/alternative">
                       <mp ct="text/plain">
                           <content>The following is a new meeting request: Subject: test Organizer: "Demo User One" &lt;user1@phoebe.mbp&gt; Time: Monday, February 27, 2012, 8:00:00 AM - 8:30:00 AM GMT -08:00 US/Canada Pacific Invitees: user2@phoebe.mbp; user3@phoebe.mbp *~*~*~*~*~*~*~*~*~* </content></mp><mp ct="text/html"><content>&lt;html&gt;&lt;body&gt;&lt;h3&gt;The following is a new meeting request:&lt;/h3&gt; &lt;p&gt; &lt;table border='0'&gt; &lt;tr&gt;&lt;th align=left&gt;Subject:&lt;/th&gt;&lt;td&gt;test &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;th align=left&gt;Organizer:&lt;/th&gt;&lt;td&gt;"Demo User One" &amp;lt;user1@phoebe.mbp&amp;gt; &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;p&gt; &lt;table border='0'&gt; &lt;tr&gt;&lt;th align=left&gt;Time:&lt;/th&gt;&lt;td&gt;Monday, February 27, 2012, 8:00:00 AM - 8:30:00 AM GMT -08:00 US/Canada Pacific &lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; &lt;p&gt; &lt;table border='0'&gt; &lt;tr&gt;&lt;th align=left&gt;Invitees:&lt;/th&gt;&lt;td&gt;user2@phoebe.mbp; user3@phoebe.mbp &lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;div&gt;*~*~*~*~*~*~*~*~*~*&lt;/div&gt;&lt;br&gt;&lt;/body&gt;&lt;/html&gt;</content>
                       </mp>
                   </mp>
               </m>
           </CreateAppointmentRequest>
           </soap:Body></soap:Envelope>

         */
}
Also used : Msg(com.zimbra.soap.mail.type.Msg) CreateAppointmentRequest(com.zimbra.soap.mail.message.CreateAppointmentRequest) InvitationInfo(com.zimbra.soap.mail.type.InvitationInfo) CalendarAttendee(com.zimbra.soap.mail.type.CalendarAttendee) EmailAddrInfo(com.zimbra.soap.mail.type.EmailAddrInfo) CreateAppointmentResponse(com.zimbra.soap.mail.message.CreateAppointmentResponse) MimePartInfo(com.zimbra.soap.mail.type.MimePartInfo) CalOrganizer(com.zimbra.soap.mail.type.CalOrganizer) DtTimeInfo(com.zimbra.soap.mail.type.DtTimeInfo) SoapTransport(com.zimbra.common.soap.SoapTransport) InviteComponent(com.zimbra.soap.mail.type.InviteComponent)

Aggregations

EmailAddrInfo (com.zimbra.soap.mail.type.EmailAddrInfo)5 InvitationInfo (com.zimbra.soap.mail.type.InvitationInfo)5 InviteComponent (com.zimbra.soap.mail.type.InviteComponent)5 Msg (com.zimbra.soap.mail.type.Msg)5 CreateAppointmentRequest (com.zimbra.soap.mail.message.CreateAppointmentRequest)3 CreateAppointmentResponse (com.zimbra.soap.mail.message.CreateAppointmentResponse)3 MimePartInfo (com.zimbra.soap.mail.type.MimePartInfo)3 ZInvite (com.zimbra.client.ZInvite)2 ZMailbox (com.zimbra.client.ZMailbox)2 ZMessage (com.zimbra.client.ZMessage)2 AppointmentHitInfo (com.zimbra.soap.mail.type.AppointmentHitInfo)2 Test (org.junit.Test)2 ZDateTime (com.zimbra.client.ZDateTime)1 SoapTransport (com.zimbra.common.soap.SoapTransport)1 CounterAppointmentResponse (com.zimbra.soap.mail.message.CounterAppointmentResponse)1 GetMsgRequest (com.zimbra.soap.mail.message.GetMsgRequest)1 GetMsgResponse (com.zimbra.soap.mail.message.GetMsgResponse)1 ModifyAppointmentRequest (com.zimbra.soap.mail.message.ModifyAppointmentRequest)1 ModifyAppointmentResponse (com.zimbra.soap.mail.message.ModifyAppointmentResponse)1 SearchRequest (com.zimbra.soap.mail.message.SearchRequest)1