Search in sources :

Example 1 with JaxbPseudoNodeChoiceInfo

use of com.zimbra.soap.util.JaxbPseudoNodeChoiceInfo in project zm-mailbox by Zimbra.

the class XmlElementDescription method addXmlInfo.

/**
     * Populate {@link desc} with value, attribute and sub-element information
     */
private static void addXmlInfo(XmlElementDescription desc, JaxbInfo jaxbInfo) {
    JaxbValueInfo valueInfo = jaxbInfo.getElementValue();
    if (valueInfo != null) {
        desc.valueFieldName = valueInfo.getFieldName();
        desc.valueType = ValueDescription.create(desc.valueFieldName, valueInfo.getAtomClass());
        desc.elementText = desc.valueType.getRepresentation();
    }
    for (JaxbAttributeInfo attrInfo : jaxbInfo.getAttributes()) {
        desc.attribs.add(XmlAttributeDescription.create(desc, attrInfo));
    }
    for (JaxbNodeInfo nodeInfo : jaxbInfo.getJaxbNodeInfos()) {
        if (nodeInfo instanceof WrappedElementInfo) {
            desc.children.add(XmlElementDescription.createForWrappedElement(desc, (WrappedElementInfo) nodeInfo));
        } else if (nodeInfo instanceof JaxbElementInfo) {
            desc.children.add(XmlElementDescription.createForElement(desc, (JaxbElementInfo) nodeInfo));
        } else if (nodeInfo instanceof JaxbPseudoNodeChoiceInfo) {
            JaxbPseudoNodeChoiceInfo jaxbChoice = (JaxbPseudoNodeChoiceInfo) nodeInfo;
            ChoiceNode choiceNode = new ChoiceNode(jaxbChoice.isMultiElement());
            desc.children.add(choiceNode);
            for (JaxbElementInfo choice : jaxbChoice.getElements()) {
                choiceNode.addChild(XmlElementDescription.createForElement(desc, choice));
            }
        }
    }
}
Also used : JaxbPseudoNodeChoiceInfo(com.zimbra.soap.util.JaxbPseudoNodeChoiceInfo) JaxbAttributeInfo(com.zimbra.soap.util.JaxbAttributeInfo) JaxbValueInfo(com.zimbra.soap.util.JaxbValueInfo) JaxbNodeInfo(com.zimbra.soap.util.JaxbNodeInfo) JaxbElementInfo(com.zimbra.soap.util.JaxbElementInfo) WrappedElementInfo(com.zimbra.soap.util.WrappedElementInfo)

Example 2 with JaxbPseudoNodeChoiceInfo

use of com.zimbra.soap.util.JaxbPseudoNodeChoiceInfo in project zm-mailbox by Zimbra.

the class XmlElementDescription method createForWrappedElement.

private static XmlElementDescription createForWrappedElement(DescriptionNode parent, WrappedElementInfo nodeInfo) {
    XmlElementDescription desc = new XmlElementDescription(true, true, false);
    desc.parent = parent;
    desc.minOccurs = 1;
    desc.targetNamespace = nodeInfo.getNamespace();
    desc.name = nodeInfo.getName();
    desc.isInnerRecursionElement = false;
    desc.jaxbClass = null;
    desc.typeName = "";
    desc.typeIdString = "";
    desc.elementText = "";
    desc.fieldName = null;
    for (JaxbNodeInfo child : nodeInfo.getElements()) {
        if (child instanceof JaxbElementInfo) {
            desc.children.add(XmlElementDescription.createForElement(desc, (JaxbElementInfo) child));
        } else if (child instanceof JaxbPseudoNodeChoiceInfo) {
            JaxbPseudoNodeChoiceInfo jaxbChoice = (JaxbPseudoNodeChoiceInfo) child;
            ChoiceNode choiceNode = new ChoiceNode(jaxbChoice.isMultiElement());
            desc.children.add(choiceNode);
            for (JaxbElementInfo choice : jaxbChoice.getElements()) {
                choiceNode.addChild(XmlElementDescription.createForElement(desc, choice));
            }
        }
    }
    return desc;
}
Also used : JaxbPseudoNodeChoiceInfo(com.zimbra.soap.util.JaxbPseudoNodeChoiceInfo) JaxbNodeInfo(com.zimbra.soap.util.JaxbNodeInfo) JaxbElementInfo(com.zimbra.soap.util.JaxbElementInfo)

Aggregations

JaxbElementInfo (com.zimbra.soap.util.JaxbElementInfo)2 JaxbNodeInfo (com.zimbra.soap.util.JaxbNodeInfo)2 JaxbPseudoNodeChoiceInfo (com.zimbra.soap.util.JaxbPseudoNodeChoiceInfo)2 JaxbAttributeInfo (com.zimbra.soap.util.JaxbAttributeInfo)1 JaxbValueInfo (com.zimbra.soap.util.JaxbValueInfo)1 WrappedElementInfo (com.zimbra.soap.util.WrappedElementInfo)1