Search in sources :

Example 6 with Msg

use of com.zimbra.soap.mail.type.Msg 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");
    MimePartInfo mimePart = MimePartInfo.createForContentType("multipart/alternative");
    String plainText = "New Time Proposed.";
    String subject = "New Time Proposed: " + subjectSuffix;
    String htmlText = String.format("<html><body><p><b>%s</b></p></body></html>", plainText);
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/plain", plainText));
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/html", htmlText));
    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(mimePart);
    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 TestUtil.waitForMessage(organizerBox, String.format("subject:\"%s\"", subject));
}
Also used : Msg(com.zimbra.soap.mail.type.Msg) InvitationInfo(com.zimbra.soap.mail.type.InvitationInfo) EmailAddrInfo(com.zimbra.soap.mail.type.EmailAddrInfo) MimePartInfo(com.zimbra.soap.mail.type.MimePartInfo) InviteComponent(com.zimbra.soap.mail.type.InviteComponent) CounterAppointmentResponse(com.zimbra.soap.mail.message.CounterAppointmentResponse)

Example 7 with Msg

use of com.zimbra.soap.mail.type.Msg 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 {
    String organizerEmail = organizerBox.getName();
    InviteComponent inviteComp = new InviteComponent();
    inviteComp.addAttendee(CalendarAttendee.createForAddressDisplaynameRolePartstatRsvp(attendeeBox.getName(), getCN(attendeeBox), "REQ", "NE", true));
    /* Note Tentative, not Needs action */
    inviteComp.setStatus("CONF");
    inviteComp.setFreeBusy("B");
    inviteComp.setCalClass("PUB");
    inviteComp.setTransparency("O");
    inviteComp.setIsDraft(false);
    inviteComp.setIsAllDay(false);
    inviteComp.setDtStart(DtTimeInfo.createForDatetimeAndZone(newStart.getDateTime(), newStart.getTimeZoneId()));
    inviteComp.setDtEnd(DtTimeInfo.createForDatetimeAndZone(newEnd.getDateTime(), newEnd.getTimeZoneId()));
    inviteComp.setName(subject);
    inviteComp.setLocation("room 101");
    inviteComp.setOrganizer(CalOrganizer.createForAddress(organizerEmail));
    InvitationInfo invite = new InvitationInfo();
    invite.setUid(hit.getUid());
    invite.setInviteComponent(inviteComp);
    MimePartInfo mimePart = MimePartInfo.createForContentType("multipart/alternative");
    String bodyText = String.format("The following meeting has been modified:\n\n%s", subject);
    mimePart.addMimePart(MimePartInfo.createForContentTypeAndContent("text/plain", bodyText));
    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(mimePart);
    ModifyAppointmentRequest maReq = ModifyAppointmentRequest.createForIdModseqRevCompnumMsg(hit.getInvId(), hit.getModifiedSequence(), hit.getRevision(), hit.getComponentNum(), msg);
    ModifyAppointmentResponse maResp = organizerBox.invokeJaxb(maReq);
    Assert.assertNotNull("JAXB ModifyAppointmentResponse", maResp);
    return TestUtil.waitForMessage(attendeeBox, String.format("subject:\"%s\"", 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) MimePartInfo(com.zimbra.soap.mail.type.MimePartInfo) InviteComponent(com.zimbra.soap.mail.type.InviteComponent)

Aggregations

EmailAddrInfo (com.zimbra.soap.mail.type.EmailAddrInfo)7 MimePartInfo (com.zimbra.soap.mail.type.MimePartInfo)7 Msg (com.zimbra.soap.mail.type.Msg)7 InvitationInfo (com.zimbra.soap.mail.type.InvitationInfo)5 InviteComponent (com.zimbra.soap.mail.type.InviteComponent)5 ZMessage (com.zimbra.client.ZMessage)3 CreateAppointmentRequest (com.zimbra.soap.mail.message.CreateAppointmentRequest)3 CreateAppointmentResponse (com.zimbra.soap.mail.message.CreateAppointmentResponse)3 SendInviteReplyRequest (com.zimbra.soap.mail.message.SendInviteReplyRequest)3 SendInviteReplyResponse (com.zimbra.soap.mail.message.SendInviteReplyResponse)3 ZInvite (com.zimbra.client.ZInvite)2 ZMailbox (com.zimbra.client.ZMailbox)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