Search in sources :

Example 1 with SoapApiWrapperElement

use of com.zimbra.doc.soap.apidesc.SoapApiWrapperElement in project zm-mailbox by Zimbra.

the class CommandChanges method elementChangesWhereBaseIsWrapper.

private void elementChangesWhereBaseIsWrapper(Ancestry ancestry, SoapApiWrapperElement baseWrapper, SoapApiNamedElement currElem) {
    Map<String, SoapApiNamedElement> baseSubElems = makeSubElemMap(baseWrapper.getSubElements());
    if (currElem instanceof SoapApiWrapperElement) {
        // Both "base" and "curr" are wrappers.
        SoapApiWrapperElement currWrapper = (SoapApiWrapperElement) currElem;
        Map<String, SoapApiNamedElement> currSubElems = makeSubElemMap(currWrapper.getSubElements());
        findSubElementChanges(ancestry, baseSubElems, currSubElems);
    } else if (currElem instanceof SoapApiSimpleElement) {
        // "base" was a wrapper.
        SoapApiSimpleElement simpleCurr = (SoapApiSimpleElement) currElem;
        String currJaxbClass = simpleCurr.getJaxb();
        if (currJaxbClass == null) {
            // New class doesn't have children, so, have deleted elements which used to come under wrapper
            for (Entry<String, SoapApiNamedElement> entry : baseSubElems.entrySet()) {
                deletedElems.add(new NamedElem(ancestry.getXpath(), entry.getValue()));
            }
        } else {
            SoapApiType currType = currentTypes.get(currJaxbClass);
            // "base" is a wrapper, so any attributes in "curr" are new
            if (currType.getAttributes() != null) {
                for (SoapApiAttribute attr : currType.getAttributes()) {
                    newAttrs.add(new NamedAttr(ancestry.getXpath(), attr));
                }
            }
            Map<String, SoapApiNamedElement> currSubElems = makeSubElemMap(currType.getSubElements());
            findSubElementChanges(ancestry, baseSubElems, currSubElems);
        }
    }
}
Also used : SoapApiSimpleElement(com.zimbra.doc.soap.apidesc.SoapApiSimpleElement) SoapApiAttribute(com.zimbra.doc.soap.apidesc.SoapApiAttribute) Entry(java.util.Map.Entry) SoapApiNamedElement(com.zimbra.doc.soap.apidesc.SoapApiNamedElement) SoapApiWrapperElement(com.zimbra.doc.soap.apidesc.SoapApiWrapperElement) SoapApiType(com.zimbra.doc.soap.apidesc.SoapApiType) Map(java.util.Map)

Aggregations

SoapApiAttribute (com.zimbra.doc.soap.apidesc.SoapApiAttribute)1 SoapApiNamedElement (com.zimbra.doc.soap.apidesc.SoapApiNamedElement)1 SoapApiSimpleElement (com.zimbra.doc.soap.apidesc.SoapApiSimpleElement)1 SoapApiType (com.zimbra.doc.soap.apidesc.SoapApiType)1 SoapApiWrapperElement (com.zimbra.doc.soap.apidesc.SoapApiWrapperElement)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1