Search in sources :

Example 56 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class Connector$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Connector connector, RuntimeContext context) throws Exception {
    if (connector == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Connector.class != connector.getClass()) {
        context.unexpectedSubclass(writer, connector, Connector.class);
        return;
    }
    context.beforeMarshal(connector, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = connector.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(connector, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ATTRIBUTE: version
    final String versionRaw = connector.version;
    if (versionRaw != null) {
        String version = null;
        try {
            version = Adapters.collapsedStringAdapterAdapter.marshal(versionRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(connector, "version", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "version", version);
    }
    // ATTRIBUTE: metadataComplete
    final Boolean metadataComplete = connector.metadataComplete;
    if (metadataComplete != null) {
        writer.writeAttribute("", "", "metadata-complete", Boolean.toString(metadataComplete));
    }
    // ELEMENT: moduleName
    final String moduleNameRaw = connector.moduleName;
    String moduleName = null;
    try {
        moduleName = Adapters.collapsedStringAdapterAdapter.marshal(moduleNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(connector, "moduleName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (moduleName != null) {
        writer.writeStartElement(prefix, "module-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(moduleName);
        writer.writeEndElement();
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = connector.getDescriptions();
    } catch (final Exception e) {
        context.getterError(connector, "descriptions", Connector.class, "getDescriptions", e);
    }
    if (descriptions != null) {
        for (final Text descriptionsItem : descriptions) {
            if (descriptionsItem != null) {
                writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, descriptionsItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(connector, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = connector.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(connector, "displayNames", Connector.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(connector, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = connector.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(connector, "icon");
            }
        }
    }
    // ELEMENT: vendorName
    final String vendorNameRaw = connector.vendorName;
    String vendorName = null;
    try {
        vendorName = Adapters.collapsedStringAdapterAdapter.marshal(vendorNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(connector, "vendorName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (vendorName != null) {
        writer.writeStartElement(prefix, "vendor-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(vendorName);
        writer.writeEndElement();
    }
    // ELEMENT: eisType
    final String eisTypeRaw = connector.eisType;
    String eisType = null;
    try {
        eisType = Adapters.collapsedStringAdapterAdapter.marshal(eisTypeRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(connector, "eisType", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (eisType != null) {
        writer.writeStartElement(prefix, "eis-type", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(eisType);
        writer.writeEndElement();
    }
    // ELEMENT: resourceAdapterVersion
    final String resourceAdapterVersionRaw = connector.resourceAdapterVersion;
    String resourceAdapterVersion = null;
    try {
        resourceAdapterVersion = Adapters.collapsedStringAdapterAdapter.marshal(resourceAdapterVersionRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(connector, "resourceAdapterVersion", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (resourceAdapterVersion != null) {
        writer.writeStartElement(prefix, "resourceadapter-version", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(resourceAdapterVersion);
        writer.writeEndElement();
    }
    // ELEMENT: license
    final License license = connector.license;
    if (license != null) {
        writer.writeStartElement(prefix, "license", "http://java.sun.com/xml/ns/javaee");
        writeLicense(writer, license, context);
        writer.writeEndElement();
    }
    // ELEMENT: resourceAdapter
    final ResourceAdapter resourceAdapter = connector.resourceAdapter;
    if (resourceAdapter != null) {
        writer.writeStartElement(prefix, "resourceadapter", "http://java.sun.com/xml/ns/javaee");
        writeResourceAdapter(writer, resourceAdapter, context);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(connector, "resourceAdapter");
    }
    // ELEMENT: requiredWorkContext
    final List<String> requiredWorkContextRaw = connector.requiredWorkContext;
    if (requiredWorkContextRaw != null) {
        for (final String requiredWorkContextItem : requiredWorkContextRaw) {
            String requiredWorkContext = null;
            try {
                requiredWorkContext = Adapters.collapsedStringAdapterAdapter.marshal(requiredWorkContextItem);
            } catch (final Exception e) {
                context.xmlAdapterError(connector, "requiredWorkContext", CollapsedStringAdapter.class, List.class, List.class, e);
            }
            if (requiredWorkContext != null) {
                writer.writeStartElement(prefix, "required-work-context", "http://java.sun.com/xml/ns/javaee");
                writer.writeCharacters(requiredWorkContext);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(connector, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) License$JAXB.readLicense(org.apache.openejb.jee.License$JAXB.readLicense) License$JAXB.writeLicense(org.apache.openejb.jee.License$JAXB.writeLicense) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) ResourceAdapter$JAXB.readResourceAdapter(org.apache.openejb.jee.ResourceAdapter$JAXB.readResourceAdapter) ResourceAdapter$JAXB.writeResourceAdapter(org.apache.openejb.jee.ResourceAdapter$JAXB.writeResourceAdapter) ArrayList(java.util.ArrayList) List(java.util.List) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 57 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class FacesNavigationCase$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final FacesNavigationCase facesNavigationCase, RuntimeContext context) throws Exception {
    if (facesNavigationCase == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (FacesNavigationCase.class != facesNavigationCase.getClass()) {
        context.unexpectedSubclass(writer, facesNavigationCase, FacesNavigationCase.class);
        return;
    }
    context.beforeMarshal(facesNavigationCase, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = facesNavigationCase.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(facesNavigationCase, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = facesNavigationCase.getDescriptions();
    } catch (final Exception e) {
        context.getterError(facesNavigationCase, "descriptions", FacesNavigationCase.class, "getDescriptions", e);
    }
    if (descriptions != null) {
        for (final Text descriptionsItem : descriptions) {
            if (descriptionsItem != null) {
                writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, descriptionsItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesNavigationCase, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = facesNavigationCase.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(facesNavigationCase, "displayNames", FacesNavigationCase.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesNavigationCase, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = facesNavigationCase.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesNavigationCase, "icon");
            }
        }
    }
    // ELEMENT: fromAction
    final FacesFromAction fromAction = facesNavigationCase.fromAction;
    if (fromAction != null) {
        writer.writeStartElement(prefix, "from-action", "http://java.sun.com/xml/ns/javaee");
        writeFacesFromAction(writer, fromAction, context);
        writer.writeEndElement();
    }
    // ELEMENT: fromOutcome
    final String fromOutcomeRaw = facesNavigationCase.fromOutcome;
    String fromOutcome = null;
    try {
        fromOutcome = Adapters.collapsedStringAdapterAdapter.marshal(fromOutcomeRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(facesNavigationCase, "fromOutcome", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (fromOutcome != null) {
        writer.writeStartElement(prefix, "from-outcome", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(fromOutcome);
        writer.writeEndElement();
    }
    // ELEMENT: _if
    final String _ifRaw = facesNavigationCase._if;
    String _if = null;
    try {
        _if = Adapters.collapsedStringAdapterAdapter.marshal(_ifRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(facesNavigationCase, "_if", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (_if != null) {
        writer.writeStartElement(prefix, "if", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(_if);
        writer.writeEndElement();
    }
    // ELEMENT: toViewId
    final String toViewIdRaw = facesNavigationCase.toViewId;
    String toViewId = null;
    try {
        toViewId = Adapters.collapsedStringAdapterAdapter.marshal(toViewIdRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(facesNavigationCase, "toViewId", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (toViewId != null) {
        writer.writeStartElement(prefix, "to-view-id", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(toViewId);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(facesNavigationCase, "toViewId");
    }
    // ELEMENT: redirect
    final FacesRedirect redirect = facesNavigationCase.redirect;
    if (redirect != null) {
        writer.writeStartElement(prefix, "redirect", "http://java.sun.com/xml/ns/javaee");
        writeFacesRedirect(writer, redirect, context);
        writer.writeEndElement();
    }
    context.afterMarshal(facesNavigationCase, LifecycleCallback.NONE);
}
Also used : FacesRedirect$JAXB.writeFacesRedirect(org.apache.openejb.jee.FacesRedirect$JAXB.writeFacesRedirect) FacesRedirect$JAXB.readFacesRedirect(org.apache.openejb.jee.FacesRedirect$JAXB.readFacesRedirect) CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) FacesFromAction$JAXB.readFacesFromAction(org.apache.openejb.jee.FacesFromAction$JAXB.readFacesFromAction) FacesFromAction$JAXB.writeFacesFromAction(org.apache.openejb.jee.FacesFromAction$JAXB.writeFacesFromAction) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 58 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class FacesNavigationRule$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final FacesNavigationRule facesNavigationRule, RuntimeContext context) throws Exception {
    if (facesNavigationRule == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (FacesNavigationRule.class != facesNavigationRule.getClass()) {
        context.unexpectedSubclass(writer, facesNavigationRule, FacesNavigationRule.class);
        return;
    }
    context.beforeMarshal(facesNavigationRule, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = facesNavigationRule.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(facesNavigationRule, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = facesNavigationRule.getDescriptions();
    } catch (final Exception e) {
        context.getterError(facesNavigationRule, "descriptions", FacesNavigationRule.class, "getDescriptions", e);
    }
    if (descriptions != null) {
        for (final Text descriptionsItem : descriptions) {
            if (descriptionsItem != null) {
                writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, descriptionsItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesNavigationRule, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = facesNavigationRule.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(facesNavigationRule, "displayNames", FacesNavigationRule.class, "getDisplayNames", e);
    }
    if (displayNames != null) {
        for (final Text displayNamesItem : displayNames) {
            if (displayNamesItem != null) {
                writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
                writeText(writer, displayNamesItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesNavigationRule, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = facesNavigationRule.icon;
    if (icon != null) {
        for (final Icon iconItem : icon) {
            if (iconItem != null) {
                writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
                writeIcon(writer, iconItem, context);
                writer.writeEndElement();
            } else {
                context.unexpectedNullValue(facesNavigationRule, "icon");
            }
        }
    }
    // ELEMENT: fromViewId
    final String fromViewIdRaw = facesNavigationRule.fromViewId;
    String fromViewId = null;
    try {
        fromViewId = Adapters.collapsedStringAdapterAdapter.marshal(fromViewIdRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(facesNavigationRule, "fromViewId", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (fromViewId != null) {
        writer.writeStartElement(prefix, "from-view-id", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(fromViewId);
        writer.writeEndElement();
    }
    // ELEMENT: navigationCase
    final List<FacesNavigationCase> navigationCase = facesNavigationRule.navigationCase;
    if (navigationCase != null) {
        for (final FacesNavigationCase navigationCaseItem : navigationCase) {
            if (navigationCaseItem != null) {
                writer.writeStartElement(prefix, "navigation-case", "http://java.sun.com/xml/ns/javaee");
                writeFacesNavigationCase(writer, navigationCaseItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: navigationRuleExtension
    final List<FacesNavigationRuleExtension> navigationRuleExtension = facesNavigationRule.navigationRuleExtension;
    if (navigationRuleExtension != null) {
        for (final FacesNavigationRuleExtension navigationRuleExtensionItem : navigationRuleExtension) {
            if (navigationRuleExtensionItem != null) {
                writer.writeStartElement(prefix, "navigation-rule-extension", "http://java.sun.com/xml/ns/javaee");
                writeFacesNavigationRuleExtension(writer, navigationRuleExtensionItem, context);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(facesNavigationRule, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) FacesNavigationCase$JAXB.writeFacesNavigationCase(org.apache.openejb.jee.FacesNavigationCase$JAXB.writeFacesNavigationCase) FacesNavigationCase$JAXB.readFacesNavigationCase(org.apache.openejb.jee.FacesNavigationCase$JAXB.readFacesNavigationCase) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) FacesNavigationRuleExtension$JAXB.writeFacesNavigationRuleExtension(org.apache.openejb.jee.FacesNavigationRuleExtension$JAXB.writeFacesNavigationRuleExtension) FacesNavigationRuleExtension$JAXB.readFacesNavigationRuleExtension(org.apache.openejb.jee.FacesNavigationRuleExtension$JAXB.readFacesNavigationRuleExtension) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Example 59 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class FacesNavigationRule$JAXB method _read.

public static final FacesNavigationRule _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final FacesNavigationRule facesNavigationRule = new FacesNavigationRule();
    context.beforeUnmarshal(facesNavigationRule, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<FacesNavigationCase> navigationCase = null;
    List<FacesNavigationRuleExtension> navigationRuleExtension = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-navigation-ruleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesNavigationRule.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, facesNavigationRule);
            facesNavigationRule.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final Text descriptionsItem = readText(elementReader, context);
            if (descriptions == null) {
                descriptions = new ArrayList<Text>();
            }
            descriptions.add(descriptionsItem);
        } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: displayNames
            final Text displayNamesItem = readText(elementReader, context);
            if (displayNames == null) {
                displayNames = new ArrayList<Text>();
            }
            displayNames.add(displayNamesItem);
        } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: icon
            final Icon iconItem = readIcon(elementReader, context);
            if (icon == null) {
                icon = facesNavigationRule.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("from-view-id" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: fromViewId
            final String fromViewIdRaw = elementReader.getElementAsString();
            final String fromViewId;
            try {
                fromViewId = Adapters.collapsedStringAdapterAdapter.unmarshal(fromViewIdRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesNavigationRule.fromViewId = fromViewId;
        } else if (("navigation-case" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: navigationCase
            final FacesNavigationCase navigationCaseItem = readFacesNavigationCase(elementReader, context);
            if (navigationCase == null) {
                navigationCase = facesNavigationRule.navigationCase;
                if (navigationCase != null) {
                    navigationCase.clear();
                } else {
                    navigationCase = new ArrayList<FacesNavigationCase>();
                }
            }
            navigationCase.add(navigationCaseItem);
        } else if (("navigation-rule-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: navigationRuleExtension
            final FacesNavigationRuleExtension navigationRuleExtensionItem = readFacesNavigationRuleExtension(elementReader, context);
            if (navigationRuleExtension == null) {
                navigationRuleExtension = facesNavigationRule.navigationRuleExtension;
                if (navigationRuleExtension != null) {
                    navigationRuleExtension.clear();
                } else {
                    navigationRuleExtension = new ArrayList<FacesNavigationRuleExtension>();
                }
            }
            navigationRuleExtension.add(navigationRuleExtensionItem);
        } else {
        // just here ATM to not prevent users to get JSF 2.2 feature because we can't read it
        // TODO: handle it properly
        // context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "display-name"), new QName("http://java.sun.com/xml/ns/javaee", "icon"), new QName("http://java.sun.com/xml/ns/javaee", "from-view-id"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-case"), new QName("http://java.sun.com/xml/ns/javaee", "navigation-rule-extension"));
        }
    }
    if (descriptions != null) {
        try {
            facesNavigationRule.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesNavigationRule.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            facesNavigationRule.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesNavigationRule.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        facesNavigationRule.icon = icon;
    }
    if (navigationCase != null) {
        facesNavigationRule.navigationCase = navigationCase;
    }
    if (navigationRuleExtension != null) {
        facesNavigationRule.navigationRuleExtension = navigationRuleExtension;
    }
    context.afterUnmarshal(facesNavigationRule, LifecycleCallback.NONE);
    return facesNavigationRule;
}
Also used : Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) FacesNavigationCase$JAXB.writeFacesNavigationCase(org.apache.openejb.jee.FacesNavigationCase$JAXB.writeFacesNavigationCase) FacesNavigationCase$JAXB.readFacesNavigationCase(org.apache.openejb.jee.FacesNavigationCase$JAXB.readFacesNavigationCase) ArrayList(java.util.ArrayList) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) FacesNavigationRuleExtension$JAXB.writeFacesNavigationRuleExtension(org.apache.openejb.jee.FacesNavigationRuleExtension$JAXB.writeFacesNavigationRuleExtension) FacesNavigationRuleExtension$JAXB.readFacesNavigationRuleExtension(org.apache.openejb.jee.FacesNavigationRuleExtension$JAXB.readFacesNavigationRuleExtension) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 60 with Icon$JAXB.readIcon

use of org.apache.openejb.jee.Icon$JAXB.readIcon in project tomee by apache.

the class FacesProperty$JAXB method _read.

public static final FacesProperty _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final FacesProperty facesProperty = new FacesProperty();
    context.beforeUnmarshal(facesProperty, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<FacesPropertyExtension> propertyExtension = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesProperty.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, facesProperty);
            facesProperty.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final Text descriptionsItem = readText(elementReader, context);
            if (descriptions == null) {
                descriptions = new ArrayList<Text>();
            }
            descriptions.add(descriptionsItem);
        } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: displayNames
            final Text displayNamesItem = readText(elementReader, context);
            if (displayNames == null) {
                displayNames = new ArrayList<Text>();
            }
            displayNames.add(displayNamesItem);
        } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: icon
            final Icon iconItem = readIcon(elementReader, context);
            if (icon == null) {
                icon = facesProperty.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: propertyName
            final String propertyNameRaw = elementReader.getElementAsString();
            final String propertyName;
            try {
                propertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesProperty.propertyName = propertyName;
        } else if (("property-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: propertyClass
            final String propertyClassRaw = elementReader.getElementAsString();
            final String propertyClass;
            try {
                propertyClass = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyClassRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesProperty.propertyClass = propertyClass;
        } else if (("default-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: defaultValue
            final String defaultValueRaw = elementReader.getElementAsString();
            final String defaultValue;
            try {
                defaultValue = Adapters.collapsedStringAdapterAdapter.unmarshal(defaultValueRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesProperty.defaultValue = defaultValue;
        } else if (("suggested-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: suggestedValue
            final String suggestedValueRaw = elementReader.getElementAsString();
            final String suggestedValue;
            try {
                suggestedValue = Adapters.collapsedStringAdapterAdapter.unmarshal(suggestedValueRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesProperty.suggestedValue = suggestedValue;
        } else if (("property-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: propertyExtension
            final FacesPropertyExtension propertyExtensionItem = readFacesPropertyExtension(elementReader, context);
            if (propertyExtension == null) {
                propertyExtension = facesProperty.propertyExtension;
                if (propertyExtension != null) {
                    propertyExtension.clear();
                } else {
                    propertyExtension = new ArrayList<FacesPropertyExtension>();
                }
            }
            propertyExtension.add(propertyExtensionItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "display-name"), new QName("http://java.sun.com/xml/ns/javaee", "icon"), new QName("http://java.sun.com/xml/ns/javaee", "property-name"), new QName("http://java.sun.com/xml/ns/javaee", "property-class"), new QName("http://java.sun.com/xml/ns/javaee", "default-value"), new QName("http://java.sun.com/xml/ns/javaee", "suggested-value"), new QName("http://java.sun.com/xml/ns/javaee", "property-extension"));
        }
    }
    if (descriptions != null) {
        try {
            facesProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesProperty.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            facesProperty.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesProperty.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        facesProperty.icon = icon;
    }
    if (propertyExtension != null) {
        facesProperty.propertyExtension = propertyExtension;
    }
    context.afterUnmarshal(facesProperty, LifecycleCallback.NONE);
    return facesProperty;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) FacesPropertyExtension$JAXB.writeFacesPropertyExtension(org.apache.openejb.jee.FacesPropertyExtension$JAXB.writeFacesPropertyExtension) FacesPropertyExtension$JAXB.readFacesPropertyExtension(org.apache.openejb.jee.FacesPropertyExtension$JAXB.readFacesPropertyExtension) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Aggregations

Icon$JAXB.readIcon (org.apache.openejb.jee.Icon$JAXB.readIcon)74 Icon$JAXB.writeIcon (org.apache.openejb.jee.Icon$JAXB.writeIcon)74 RuntimeContext (org.metatype.sxc.jaxb.RuntimeContext)74 Text$JAXB.readText (org.apache.openejb.jee.Text$JAXB.readText)70 Text$JAXB.writeText (org.apache.openejb.jee.Text$JAXB.writeText)70 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)69 ArrayList (java.util.ArrayList)40 QName (javax.xml.namespace.QName)40 Attribute (org.metatype.sxc.util.Attribute)37 XoXMLStreamReader (org.metatype.sxc.util.XoXMLStreamReader)37 DataSource$JAXB.readDataSource (org.apache.openejb.jee.DataSource$JAXB.readDataSource)12 DataSource$JAXB.writeDataSource (org.apache.openejb.jee.DataSource$JAXB.writeDataSource)12 EjbLocalRef$JAXB.readEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef)12 EjbLocalRef$JAXB.writeEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef)12 EjbRef$JAXB.readEjbRef (org.apache.openejb.jee.EjbRef$JAXB.readEjbRef)12 EjbRef$JAXB.writeEjbRef (org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef)12 EnvEntry$JAXB.readEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry)12 EnvEntry$JAXB.writeEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry)12 MessageDestinationRef$JAXB.readMessageDestinationRef (org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef)12 MessageDestinationRef$JAXB.writeMessageDestinationRef (org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef)12