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));
}
}
}
}
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;
}
Aggregations