Search in sources :

Example 61 with Icon$JAXB.readIcon

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

the class FacesRenderKit$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final FacesRenderKit facesRenderKit, RuntimeContext context) throws Exception {
    if (facesRenderKit == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (FacesRenderKit.class != facesRenderKit.getClass()) {
        context.unexpectedSubclass(writer, facesRenderKit, FacesRenderKit.class);
        return;
    }
    context.beforeMarshal(facesRenderKit, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = facesRenderKit.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(facesRenderKit, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = facesRenderKit.getDescriptions();
    } catch (final Exception e) {
        context.getterError(facesRenderKit, "descriptions", FacesRenderKit.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(facesRenderKit, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = facesRenderKit.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(facesRenderKit, "displayNames", FacesRenderKit.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(facesRenderKit, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = facesRenderKit.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(facesRenderKit, "icon");
            }
        }
    }
    // ELEMENT: renderKitId
    final String renderKitIdRaw = facesRenderKit.renderKitId;
    String renderKitId = null;
    try {
        renderKitId = Adapters.collapsedStringAdapterAdapter.marshal(renderKitIdRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(facesRenderKit, "renderKitId", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (renderKitId != null) {
        writer.writeStartElement(prefix, "render-kit-id", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(renderKitId);
        writer.writeEndElement();
    }
    // ELEMENT: renderKitClass
    final String renderKitClassRaw = facesRenderKit.renderKitClass;
    String renderKitClass = null;
    try {
        renderKitClass = Adapters.collapsedStringAdapterAdapter.marshal(renderKitClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(facesRenderKit, "renderKitClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (renderKitClass != null) {
        writer.writeStartElement(prefix, "render-kit-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(renderKitClass);
        writer.writeEndElement();
    }
    // ELEMENT: renderer
    final List<FacesRenderer> renderer = facesRenderKit.renderer;
    if (renderer != null) {
        for (final FacesRenderer rendererItem : renderer) {
            writer.writeStartElement(prefix, "renderer", "http://java.sun.com/xml/ns/javaee");
            if (rendererItem != null) {
                writeFacesRenderer(writer, rendererItem, context);
            } else {
                writer.writeXsiNil();
            }
            writer.writeEndElement();
        }
    }
    // ELEMENT: clientBehaviorRenderer
    final List<FacesClientBehaviorRenderer> clientBehaviorRenderer = facesRenderKit.clientBehaviorRenderer;
    if (clientBehaviorRenderer != null) {
        for (final FacesClientBehaviorRenderer clientBehaviorRendererItem : clientBehaviorRenderer) {
            if (clientBehaviorRendererItem != null) {
                writer.writeStartElement(prefix, "client-behavior-renderer", "http://java.sun.com/xml/ns/javaee");
                writeFacesClientBehaviorRenderer(writer, clientBehaviorRendererItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: renderKitExtension
    final List<FacesRenderKitExtension> renderKitExtension = facesRenderKit.renderKitExtension;
    if (renderKitExtension != null) {
        for (final FacesRenderKitExtension renderKitExtensionItem : renderKitExtension) {
            if (renderKitExtensionItem != null) {
                writer.writeStartElement(prefix, "render-kit-extension", "http://java.sun.com/xml/ns/javaee");
                writeFacesRenderKitExtension(writer, renderKitExtensionItem, context);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(facesRenderKit, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) FacesRenderKitExtension$JAXB.writeFacesRenderKitExtension(org.apache.openejb.jee.FacesRenderKitExtension$JAXB.writeFacesRenderKitExtension) FacesRenderKitExtension$JAXB.readFacesRenderKitExtension(org.apache.openejb.jee.FacesRenderKitExtension$JAXB.readFacesRenderKitExtension) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) FacesClientBehaviorRenderer$JAXB.writeFacesClientBehaviorRenderer(org.apache.openejb.jee.FacesClientBehaviorRenderer$JAXB.writeFacesClientBehaviorRenderer) FacesClientBehaviorRenderer$JAXB.readFacesClientBehaviorRenderer(org.apache.openejb.jee.FacesClientBehaviorRenderer$JAXB.readFacesClientBehaviorRenderer) 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) FacesRenderer$JAXB.writeFacesRenderer(org.apache.openejb.jee.FacesRenderer$JAXB.writeFacesRenderer) FacesRenderer$JAXB.readFacesRenderer(org.apache.openejb.jee.FacesRenderer$JAXB.readFacesRenderer)

Example 62 with Icon$JAXB.readIcon

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

the class FacesRenderer$JAXB method _read.

public static final FacesRenderer _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final FacesRenderer facesRenderer = new FacesRenderer();
    context.beforeUnmarshal(facesRenderer, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<FacesFacet> facet = null;
    List<FacesAttribute> attribute1 = null;
    List<FacesRendererExtension> rendererExtension = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("faces-config-rendererType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, FacesRenderer.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, facesRenderer);
            facesRenderer.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 = facesRenderer.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("component-family" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: componentFamily
            final String componentFamilyRaw = elementReader.getElementAsString();
            final String componentFamily;
            try {
                componentFamily = Adapters.collapsedStringAdapterAdapter.unmarshal(componentFamilyRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesRenderer.componentFamily = componentFamily;
        } else if (("renderer-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: rendererType
            final String rendererTypeRaw = elementReader.getElementAsString();
            final String rendererType;
            try {
                rendererType = Adapters.collapsedStringAdapterAdapter.unmarshal(rendererTypeRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesRenderer.rendererType = rendererType;
        } else if (("renderer-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: rendererClass
            final String rendererClassRaw = elementReader.getElementAsString();
            final String rendererClass;
            try {
                rendererClass = Adapters.collapsedStringAdapterAdapter.unmarshal(rendererClassRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            facesRenderer.rendererClass = rendererClass;
        } else if (("facet" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: facet
            final FacesFacet facetItem = readFacesFacet(elementReader, context);
            if (facet == null) {
                facet = facesRenderer.facet;
                if (facet != null) {
                    facet.clear();
                } else {
                    facet = new ArrayList<FacesFacet>();
                }
            }
            facet.add(facetItem);
        } else if (("attribute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: attribute
            final FacesAttribute attributeItem = readFacesAttribute(elementReader, context);
            if (attribute1 == null) {
                attribute1 = facesRenderer.attribute;
                if (attribute1 != null) {
                    attribute1.clear();
                } else {
                    attribute1 = new ArrayList<FacesAttribute>();
                }
            }
            attribute1.add(attributeItem);
        } else if (("renderer-extension" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: rendererExtension
            final FacesRendererExtension rendererExtensionItem = readFacesRendererExtension(elementReader, context);
            if (rendererExtension == null) {
                rendererExtension = facesRenderer.rendererExtension;
                if (rendererExtension != null) {
                    rendererExtension.clear();
                } else {
                    rendererExtension = new ArrayList<FacesRendererExtension>();
                }
            }
            rendererExtension.add(rendererExtensionItem);
        } 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", "component-family"), new QName("http://java.sun.com/xml/ns/javaee", "renderer-type"), new QName("http://java.sun.com/xml/ns/javaee", "renderer-class"), new QName("http://java.sun.com/xml/ns/javaee", "facet"), new QName("http://java.sun.com/xml/ns/javaee", "attribute"), new QName("http://java.sun.com/xml/ns/javaee", "renderer-extension"));
        }
    }
    if (descriptions != null) {
        try {
            facesRenderer.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesRenderer.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            facesRenderer.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, FacesRenderer.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        facesRenderer.icon = icon;
    }
    if (facet != null) {
        facesRenderer.facet = facet;
    }
    if (attribute1 != null) {
        facesRenderer.attribute = attribute1;
    }
    if (rendererExtension != null) {
        facesRenderer.rendererExtension = rendererExtension;
    }
    context.afterUnmarshal(facesRenderer, LifecycleCallback.NONE);
    return facesRenderer;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) FacesAttribute$JAXB.readFacesAttribute(org.apache.openejb.jee.FacesAttribute$JAXB.readFacesAttribute) FacesAttribute$JAXB.writeFacesAttribute(org.apache.openejb.jee.FacesAttribute$JAXB.writeFacesAttribute) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) FacesAttribute$JAXB.readFacesAttribute(org.apache.openejb.jee.FacesAttribute$JAXB.readFacesAttribute) FacesAttribute$JAXB.writeFacesAttribute(org.apache.openejb.jee.FacesAttribute$JAXB.writeFacesAttribute) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) FacesRendererExtension$JAXB.readFacesRendererExtension(org.apache.openejb.jee.FacesRendererExtension$JAXB.readFacesRendererExtension) FacesRendererExtension$JAXB.writeFacesRendererExtension(org.apache.openejb.jee.FacesRendererExtension$JAXB.writeFacesRendererExtension) FacesFacet$JAXB.readFacesFacet(org.apache.openejb.jee.FacesFacet$JAXB.readFacesFacet) FacesFacet$JAXB.writeFacesFacet(org.apache.openejb.jee.FacesFacet$JAXB.writeFacesFacet) 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 63 with Icon$JAXB.readIcon

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

the class Filter$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Filter filter, RuntimeContext context) throws Exception {
    if (filter == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Filter.class != filter.getClass()) {
        context.unexpectedSubclass(writer, filter, Filter.class);
        return;
    }
    context.beforeMarshal(filter, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = filter.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(filter, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = filter.getDescriptions();
    } catch (final Exception e) {
        context.getterError(filter, "descriptions", Filter.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(filter, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = filter.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(filter, "displayNames", Filter.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(filter, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = filter.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(filter, "icon");
            }
        }
    }
    // ELEMENT: filterName
    final String filterNameRaw = filter.filterName;
    String filterName = null;
    try {
        filterName = Adapters.collapsedStringAdapterAdapter.marshal(filterNameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(filter, "filterName", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (filterName != null) {
        writer.writeStartElement(prefix, "filter-name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(filterName);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(filter, "filterName");
    }
    // ELEMENT: filterClass
    final String filterClassRaw = filter.filterClass;
    String filterClass = null;
    try {
        filterClass = Adapters.collapsedStringAdapterAdapter.marshal(filterClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(filter, "filterClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (filterClass != null) {
        writer.writeStartElement(prefix, "filter-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(filterClass);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(filter, "filterClass");
    }
    // ELEMENT: asyncSupported
    final Boolean asyncSupported = filter.asyncSupported;
    writer.writeStartElement(prefix, "async-supported", "http://java.sun.com/xml/ns/javaee");
    writer.writeCharacters(Boolean.toString(asyncSupported));
    writer.writeEndElement();
    // ELEMENT: initParam
    final List<ParamValue> initParam = filter.initParam;
    if (initParam != null) {
        for (final ParamValue initParamItem : initParam) {
            if (initParamItem != null) {
                writer.writeStartElement(prefix, "init-param", "http://java.sun.com/xml/ns/javaee");
                writeParamValue(writer, initParamItem, context);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(filter, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) ParamValue$JAXB.readParamValue(org.apache.openejb.jee.ParamValue$JAXB.readParamValue) ParamValue$JAXB.writeParamValue(org.apache.openejb.jee.ParamValue$JAXB.writeParamValue) 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 64 with Icon$JAXB.readIcon

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

the class Filter$JAXB method _read.

public static final Filter _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final Filter filter = new Filter();
    context.beforeUnmarshal(filter, LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    List<ParamValue> initParam = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("filterType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, Filter.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, filter);
            filter.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 = filter.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("filter-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: filterName
            final String filterNameRaw = elementReader.getElementAsString();
            final String filterName;
            try {
                filterName = Adapters.collapsedStringAdapterAdapter.unmarshal(filterNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            filter.filterName = filterName;
        } else if (("filter-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: filterClass
            final String filterClassRaw = elementReader.getElementAsString();
            final String filterClass;
            try {
                filterClass = Adapters.collapsedStringAdapterAdapter.unmarshal(filterClassRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            filter.filterClass = filterClass;
        } else if (("async-supported" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: asyncSupported
            final Boolean asyncSupported = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
            filter.asyncSupported = asyncSupported;
        } else if (("init-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: initParam
            final ParamValue initParamItem = readParamValue(elementReader, context);
            if (initParam == null) {
                initParam = filter.initParam;
                if (initParam != null) {
                    initParam.clear();
                } else {
                    initParam = new ArrayList<ParamValue>();
                }
            }
            initParam.add(initParamItem);
        } 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", "filter-name"), new QName("http://java.sun.com/xml/ns/javaee", "filter-class"), new QName("http://java.sun.com/xml/ns/javaee", "async-supported"), new QName("http://java.sun.com/xml/ns/javaee", "init-param"));
        }
    }
    if (descriptions != null) {
        try {
            filter.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, Filter.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            filter.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, Filter.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        filter.icon = icon;
    }
    if (initParam != null) {
        filter.initParam = initParam;
    }
    context.afterUnmarshal(filter, LifecycleCallback.NONE);
    return filter;
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) Attribute(org.metatype.sxc.util.Attribute) QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) ParamValue$JAXB.readParamValue(org.apache.openejb.jee.ParamValue$JAXB.readParamValue) ParamValue$JAXB.writeParamValue(org.apache.openejb.jee.ParamValue$JAXB.writeParamValue) 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) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader)

Example 65 with Icon$JAXB.readIcon

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

the class Function$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final Function function, RuntimeContext context) throws Exception {
    if (function == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (Function.class != function.getClass()) {
        context.unexpectedSubclass(writer, function, Function.class);
        return;
    }
    context.beforeMarshal(function, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = function.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(function, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: descriptions
    Text[] descriptions = null;
    try {
        descriptions = function.getDescriptions();
    } catch (final Exception e) {
        context.getterError(function, "descriptions", Function.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(function, "descriptions");
            }
        }
    }
    // ELEMENT: displayNames
    Text[] displayNames = null;
    try {
        displayNames = function.getDisplayNames();
    } catch (final Exception e) {
        context.getterError(function, "displayNames", Function.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(function, "displayNames");
            }
        }
    }
    // ELEMENT: icon
    final LocalCollection<Icon> icon = function.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(function, "icon");
            }
        }
    }
    // ELEMENT: name
    final String nameRaw = function.name;
    String name = null;
    try {
        name = Adapters.collapsedStringAdapterAdapter.marshal(nameRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(function, "name", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (name != null) {
        writer.writeStartElement(prefix, "name", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(name);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(function, "name");
    }
    // ELEMENT: functionClass
    final String functionClassRaw = function.functionClass;
    String functionClass = null;
    try {
        functionClass = Adapters.collapsedStringAdapterAdapter.marshal(functionClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(function, "functionClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (functionClass != null) {
        writer.writeStartElement(prefix, "function-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(functionClass);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(function, "functionClass");
    }
    // ELEMENT: functionSignature
    final String functionSignatureRaw = function.functionSignature;
    String functionSignature = null;
    try {
        functionSignature = Adapters.collapsedStringAdapterAdapter.marshal(functionSignatureRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(function, "functionSignature", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (functionSignature != null) {
        writer.writeStartElement(prefix, "function-signature", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(functionSignature);
        writer.writeEndElement();
    } else {
        context.unexpectedNullValue(function, "functionSignature");
    }
    // ELEMENT: example
    final String exampleRaw = function.example;
    String example = null;
    try {
        example = Adapters.collapsedStringAdapterAdapter.marshal(exampleRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(function, "example", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (example != null) {
        writer.writeStartElement(prefix, "example", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(example);
        writer.writeEndElement();
    }
    // ELEMENT: functionExtension
    final List<TldExtension> functionExtension = function.functionExtension;
    if (functionExtension != null) {
        for (final TldExtension functionExtensionItem : functionExtension) {
            if (functionExtensionItem != null) {
                writer.writeStartElement(prefix, "function-extension", "http://java.sun.com/xml/ns/javaee");
                writeTldExtension(writer, functionExtensionItem, context);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(function, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) TldExtension$JAXB.readTldExtension(org.apache.openejb.jee.TldExtension$JAXB.readTldExtension) TldExtension$JAXB.writeTldExtension(org.apache.openejb.jee.TldExtension$JAXB.writeTldExtension) 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)

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