Search in sources :

Example 6 with InviteComponent

use of com.zimbra.soap.mail.type.InviteComponent 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 7 with InviteComponent

use of com.zimbra.soap.mail.type.InviteComponent 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 8 with InviteComponent

use of com.zimbra.soap.mail.type.InviteComponent 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

InviteComponent (com.zimbra.soap.mail.type.InviteComponent)8 ZMailbox (com.zimbra.client.ZMailbox)5 EmailAddrInfo (com.zimbra.soap.mail.type.EmailAddrInfo)5 InvitationInfo (com.zimbra.soap.mail.type.InvitationInfo)5 Msg (com.zimbra.soap.mail.type.Msg)5 ZMessage (com.zimbra.client.ZMessage)4 AppointmentHitInfo (com.zimbra.soap.mail.type.AppointmentHitInfo)4 Test (org.junit.Test)4 CreateAppointmentRequest (com.zimbra.soap.mail.message.CreateAppointmentRequest)3 CreateAppointmentResponse (com.zimbra.soap.mail.message.CreateAppointmentResponse)3 MimePartInfo (com.zimbra.soap.mail.type.MimePartInfo)3 ZDateTime (com.zimbra.client.ZDateTime)2 ZInvite (com.zimbra.client.ZInvite)2 GetMsgRequest (com.zimbra.soap.mail.message.GetMsgRequest)2 GetMsgResponse (com.zimbra.soap.mail.message.GetMsgResponse)2 SearchRequest (com.zimbra.soap.mail.message.SearchRequest)2 CalendarAttendeeWithGroupInfo (com.zimbra.soap.mail.type.CalendarAttendeeWithGroupInfo)2 InstanceDataInfo (com.zimbra.soap.mail.type.InstanceDataInfo)2 InviteComponentWithGroupInfo (com.zimbra.soap.mail.type.InviteComponentWithGroupInfo)2 MsgSpec (com.zimbra.soap.mail.type.MsgSpec)2