Search in sources :

Example 1 with DefaultDocument

use of org.dom4j.tree.DefaultDocument in project zm-mailbox by Zimbra.

the class ExchangeMessage method createRequest.

public Document createRequest(FreeBusy fb) {
    Element root = DocumentHelper.createElement(EL_PROPERTYUPDATE);
    root.add(NS_XML);
    root.add(NS_MSFT);
    root.add(NS_WEB_FOLDERS);
    Element prop = root.addElement(EL_SET).addElement(EL_PROP);
    addElement(prop, PR_SUBJECT_A, PUBURL_SECOND_PART + getRcpt(LC.freebusy_exchange_cn2) + mCn);
    addElement(prop, PR_FREEBUSY_START_RANGE, minutesSinceMsEpoch(fb.getStartTime()));
    addElement(prop, PR_FREEBUSY_END_RANGE, minutesSinceMsEpoch(fb.getEndTime()));
    addElement(prop, PR_FREEBUSY_EMAIL_ADDRESS, mOu + getRcpt(LC.freebusy_exchange_cn3) + mCn);
    Element allMonths = addElement(prop, PR_FREEBUSY_ALL_MONTHS, null, ATTR_DT, MV_INT);
    Element allEvents = addElement(prop, PR_FREEBUSY_ALL_EVENTS, null, ATTR_DT, MV_BIN);
    Element busyMonths = addElement(prop, PR_FREEBUSY_BUSY_MONTHS, null, ATTR_DT, MV_INT);
    Element busyEvents = addElement(prop, PR_FREEBUSY_BUSY_EVENTS, null, ATTR_DT, MV_BIN);
    Element tentativeMonths = addElement(prop, PR_FREEBUSY_TENTATIVE_MONTHS, null, ATTR_DT, MV_INT);
    Element tentativeEvents = addElement(prop, PR_FREEBUSY_TENTATIVE_EVENTS, null, ATTR_DT, MV_BIN);
    Element oofMonths = addElement(prop, PR_FREEBUSY_OOF_MONTHS, null, ATTR_DT, MV_INT);
    Element oofEvents = addElement(prop, PR_FREEBUSY_OOF_EVENTS, null, ATTR_DT, MV_BIN);
    // XXX
    // some/all of these properties may not be necessary.
    // because we aren't sure about the purpose of these
    // properties, and the sample codes included them,
    // we'll just keep them in here.
    addElement(prop, PR_68410003, "0");
    addElement(prop, PR_6842000B, "1");
    addElement(prop, PR_6843000B, "1");
    addElement(prop, PR_6846000B, "1");
    addElement(prop, PR_684B000B, "1");
    addElement(prop, PR_PROCESS_MEETING_REQUESTS, "0");
    addElement(prop, PR_DECLINE_RECURRING_MEETING_REQUESTS, "0");
    addElement(prop, PR_DECLINE_CONFLICTING_MEETING_REQUESTS, "0");
    long startMonth, endMonth;
    startMonth = millisToMonths(fb.getStartTime());
    endMonth = millisToMonths(fb.getEndTime());
    IntervalList consolidated = new IntervalList(fb.getStartTime(), fb.getEndTime());
    encodeIntervals(fb, startMonth, endMonth, IcalXmlStrMap.FBTYPE_BUSY, busyMonths, busyEvents, consolidated);
    encodeIntervals(fb, startMonth, endMonth, IcalXmlStrMap.FBTYPE_BUSY_TENTATIVE, tentativeMonths, tentativeEvents, consolidated);
    encodeIntervals(fb, startMonth, endMonth, IcalXmlStrMap.FBTYPE_BUSY_UNAVAILABLE, oofMonths, oofEvents, consolidated);
    encodeIntervals(consolidated, startMonth, endMonth, IcalXmlStrMap.FBTYPE_BUSY, allMonths, allEvents, null);
    return new DefaultDocument(root);
}
Also used : IntervalList(com.zimbra.cs.fb.FreeBusy.IntervalList) Element(org.dom4j.Element) DefaultDocument(org.dom4j.tree.DefaultDocument)

Aggregations

IntervalList (com.zimbra.cs.fb.FreeBusy.IntervalList)1 Element (org.dom4j.Element)1 DefaultDocument (org.dom4j.tree.DefaultDocument)1