Example usage for org.dom4j DocumentHelper createElement

List of usage examples for org.dom4j DocumentHelper createElement

Introduction

In this page you can find the example usage for org.dom4j DocumentHelper createElement.

Prototype

public static Element createElement(String name) 

Source Link

Usage

From source file:com.zimbra.cs.client.soap.LmcConvActionRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(MailConstants.CONV_ACTION_REQUEST);
    Element a = DomUtil.add(request, MailConstants.E_ACTION, "");
    DomUtil.addAttr(a, MailConstants.A_ID, mIDList);
    DomUtil.addAttr(a, MailConstants.A_OPERATION, mOp);
    DomUtil.addAttr(a, MailConstants.A_TAG, mTag);
    DomUtil.addAttr(a, MailConstants.A_FOLDER, mFolder);
    if (mContent != null)
        DomUtil.add(a, MailConstants.E_CONTENT, mContent);
    return request;
}

From source file:com.zimbra.cs.client.soap.LmcCreateContactRequest.java

License:Open Source License

protected Element getRequestXML() throws LmcSoapClientException {
    Element request = DocumentHelper.createElement(MailConstants.CREATE_CONTACT_REQUEST);
    Element newCN = DomUtil.add(request, MailConstants.E_CONTACT, "");
    LmcSoapRequest.addAttrNotNull(newCN, MailConstants.A_FOLDER, mContact.getFolder());
    LmcSoapRequest.addAttrNotNull(newCN, MailConstants.A_TAGS, mContact.getTags());

    // emit contact attributes if any
    LmcContactAttr attrs[] = mContact.getAttrs();
    for (int i = 0; attrs != null && i < attrs.length; i++)
        addContactAttr(newCN, attrs[i]);

    return request;
}

From source file:com.zimbra.cs.client.soap.LmcCreateFolderRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(MailConstants.CREATE_FOLDER_REQUEST);
    Element f = DomUtil.add(request, MailConstants.E_FOLDER, "");
    DomUtil.addAttr(f, MailConstants.A_NAME, mName);
    DomUtil.addAttr(f, MailConstants.A_FOLDER, mParentID);
    if (mView != null) {
        DomUtil.addAttr(f, MailConstants.A_DEFAULT_VIEW, mView);
    }/*w ww  .  j a v a2 s. c  o  m*/
    return request;
}

From source file:com.zimbra.cs.client.soap.LmcCreateNoteRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(MailConstants.CREATE_NOTE_REQUEST);
    Element f = DomUtil.add(request, MailConstants.E_NOTE, "");
    Element c = DomUtil.add(f, MailConstants.E_CONTENT, mContent);
    addAttrNotNull(f, MailConstants.A_BOUNDS, mPosition);
    addAttrNotNull(f, MailConstants.A_FOLDER, mParentID);
    addAttrNotNull(f, MailConstants.A_COLOR, mColor);
    return request;
}

From source file:com.zimbra.cs.client.soap.LmcCreateTagRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(MailConstants.CREATE_TAG_REQUEST);
    Element t = DomUtil.add(request, MailConstants.E_TAG, "");
    DomUtil.addAttr(t, MailConstants.A_NAME, mName);
    DomUtil.addAttr(t, MailConstants.A_COLOR, mColor);
    return request;
}

From source file:com.zimbra.cs.client.soap.LmcDeleteAccountRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(AdminConstants.DELETE_ACCOUNT_REQUEST);
    DomUtil.add(request, AdminConstants.E_ID, mAccountId);
    return request;
}

From source file:com.zimbra.cs.client.soap.LmcFolderActionRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(MailConstants.FOLDER_ACTION_REQUEST);
    Element a = DomUtil.add(request, MailConstants.E_ACTION, "");
    if (mIDList != null)
        DomUtil.addAttr(a, MailConstants.A_ID, mIDList);
    if (mOp != null) {
        DomUtil.addAttr(a, MailConstants.A_OPERATION, mOp);
        if (mOp.equals("grant") || mOp.equals("!grant")) {
            Element grant = DomUtil.add(a, MailConstants.E_GRANT, "");
            if (mPerm != null)
                DomUtil.addAttr(grant, MailConstants.A_RIGHTS, mPerm);
            if (mGrantee != null)
                DomUtil.addAttr(grant, MailConstants.A_GRANT_TYPE, mGrantee);
            if (mD != null)
                DomUtil.addAttr(grant, MailConstants.A_DISPLAY, mD);
        }/*from ww w  . j a  va  2s.  com*/
    }
    if (mName != null)
        DomUtil.addAttr(a, MailConstants.A_NAME, mName);
    if (mTargetFolder != null)
        DomUtil.addAttr(a, MailConstants.A_FOLDER, mTargetFolder);
    return request;
}

From source file:com.zimbra.cs.client.soap.LmcGetContactsRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(MailConstants.GET_CONTACTS_REQUEST);

    // emit contact attributes if any
    for (int i = 0; mAttrs != null && i < mAttrs.length; i++)
        addContactAttr(request, mAttrs[i]);

    // emit specified contacts if any
    for (int i = 0; mIDList != null && i < mIDList.length; i++) {
        Element newCN = DomUtil.add(request, MailConstants.E_CONTACT, "");
        DomUtil.addAttr(newCN, MailConstants.A_ID, mIDList[i]);
    }//  www  .java2s. com

    return request;
}

From source file:com.zimbra.cs.client.soap.LmcGetConvRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(MailConstants.GET_CONV_REQUEST);

    // set the ID of the conversation to get
    Element convElement = DomUtil.add(request, MailConstants.E_CONV, "");
    DomUtil.addAttr(convElement, MailConstants.A_ID, mConvID);

    // add message elements within the conversation element if desired
    if (mMsgsToGet != null) {
        for (int i = 0; i < mMsgsToGet.length; i++) {
            Element m = DomUtil.add(convElement, MailConstants.E_MSG, "");
            DomUtil.addAttr(m, MailConstants.A_ID, mMsgsToGet[i]);
        }// w  ww  .  ja  v a  2  s.c  o m
    }

    return request;
}

From source file:com.zimbra.cs.client.soap.LmcGetFolderRequest.java

License:Open Source License

protected Element getRequestXML() {
    Element request = DocumentHelper.createElement(MailConstants.GET_FOLDER_REQUEST);
    if (mFolderID != null) {
        Element folder = DomUtil.add(request, MailConstants.E_FOLDER, "");
        DomUtil.addAttr(folder, MailConstants.A_FOLDER, mFolderID);
    }/*from  ww  w .  j a  va2s  . c  om*/
    return request;
}