Search in sources :

Example 1 with CounterAppointmentResponse

use of com.zimbra.soap.mail.message.CounterAppointmentResponse 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)

Aggregations

CounterAppointmentResponse (com.zimbra.soap.mail.message.CounterAppointmentResponse)1 EmailAddrInfo (com.zimbra.soap.mail.type.EmailAddrInfo)1 InvitationInfo (com.zimbra.soap.mail.type.InvitationInfo)1 InviteComponent (com.zimbra.soap.mail.type.InviteComponent)1 MimePartInfo (com.zimbra.soap.mail.type.MimePartInfo)1 Msg (com.zimbra.soap.mail.type.Msg)1