use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.
the class FacesProperty$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final FacesProperty facesProperty, RuntimeContext context) throws Exception {
if (facesProperty == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (FacesProperty.class != facesProperty.getClass()) {
context.unexpectedSubclass(writer, facesProperty, FacesProperty.class);
return;
}
context.beforeMarshal(facesProperty, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = facesProperty.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesProperty, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = facesProperty.getDescriptions();
} catch (final Exception e) {
context.getterError(facesProperty, "descriptions", FacesProperty.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(facesProperty, "descriptions");
}
}
}
// ELEMENT: displayNames
Text[] displayNames = null;
try {
displayNames = facesProperty.getDisplayNames();
} catch (final Exception e) {
context.getterError(facesProperty, "displayNames", FacesProperty.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(facesProperty, "displayNames");
}
}
}
// ELEMENT: icon
final LocalCollection<Icon> icon = facesProperty.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(facesProperty, "icon");
}
}
}
// ELEMENT: propertyName
final String propertyNameRaw = facesProperty.propertyName;
String propertyName = null;
try {
propertyName = Adapters.collapsedStringAdapterAdapter.marshal(propertyNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesProperty, "propertyName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (propertyName != null) {
writer.writeStartElement(prefix, "property-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(propertyName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesProperty, "propertyName");
}
// ELEMENT: propertyClass
final String propertyClassRaw = facesProperty.propertyClass;
String propertyClass = null;
try {
propertyClass = Adapters.collapsedStringAdapterAdapter.marshal(propertyClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesProperty, "propertyClass", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (propertyClass != null) {
writer.writeStartElement(prefix, "property-class", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(propertyClass);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesProperty, "propertyClass");
}
// ELEMENT: defaultValue
final String defaultValueRaw = facesProperty.defaultValue;
String defaultValue = null;
try {
defaultValue = Adapters.collapsedStringAdapterAdapter.marshal(defaultValueRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesProperty, "defaultValue", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (defaultValue != null) {
writer.writeStartElement(prefix, "default-value", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(defaultValue);
writer.writeEndElement();
}
// ELEMENT: suggestedValue
final String suggestedValueRaw = facesProperty.suggestedValue;
String suggestedValue = null;
try {
suggestedValue = Adapters.collapsedStringAdapterAdapter.marshal(suggestedValueRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesProperty, "suggestedValue", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (suggestedValue != null) {
writer.writeStartElement(prefix, "suggested-value", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(suggestedValue);
writer.writeEndElement();
}
// ELEMENT: propertyExtension
final List<FacesPropertyExtension> propertyExtension = facesProperty.propertyExtension;
if (propertyExtension != null) {
for (final FacesPropertyExtension propertyExtensionItem : propertyExtension) {
if (propertyExtensionItem != null) {
writer.writeStartElement(prefix, "property-extension", "http://java.sun.com/xml/ns/javaee");
writeFacesPropertyExtension(writer, propertyExtensionItem, context);
writer.writeEndElement();
}
}
}
context.afterMarshal(facesProperty, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.
the class Handler$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final Handler handler, RuntimeContext context) throws Exception {
if (handler == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (Handler.class != handler.getClass()) {
context.unexpectedSubclass(writer, handler, Handler.class);
return;
}
context.beforeMarshal(handler, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = handler.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(handler, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = handler.getDescriptions();
} catch (final Exception e) {
context.getterError(handler, "descriptions", Handler.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(handler, "descriptions");
}
}
}
// ELEMENT: displayNames
Text[] displayNames = null;
try {
displayNames = handler.getDisplayNames();
} catch (final Exception e) {
context.getterError(handler, "displayNames", Handler.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(handler, "displayNames");
}
}
}
// ELEMENT: icon
final LocalCollection<Icon> icon = handler.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();
}
}
}
// ELEMENT: handlerName
final String handlerNameRaw = handler.handlerName;
String handlerName = null;
try {
handlerName = Adapters.collapsedStringAdapterAdapter.marshal(handlerNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(handler, "handlerName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (handlerName != null) {
writer.writeStartElement(prefix, "handler-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(handlerName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(handler, "handlerName");
}
// ELEMENT: handlerClass
final String handlerClassRaw = handler.handlerClass;
String handlerClass = null;
try {
handlerClass = Adapters.collapsedStringAdapterAdapter.marshal(handlerClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(handler, "handlerClass", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (handlerClass != null) {
writer.writeStartElement(prefix, "handler-class", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(handlerClass);
writer.writeEndElement();
} else {
context.unexpectedNullValue(handler, "handlerClass");
}
// ELEMENT: initParam
final List<ParamValue> initParam = handler.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();
}
}
}
// ELEMENT: soapHeader
final List<QName> soapHeader = handler.soapHeader;
if (soapHeader != null) {
for (final QName soapHeaderItem : soapHeader) {
if (soapHeaderItem != null) {
writer.writeStartElement(prefix, "soap-header", "http://java.sun.com/xml/ns/javaee");
writer.writeQName(soapHeaderItem);
writer.writeEndElement();
}
}
}
// ELEMENT: soapRole
final List<String> soapRoleRaw = handler.soapRole;
if (soapRoleRaw != null) {
for (final String soapRoleItem : soapRoleRaw) {
String soapRole = null;
try {
soapRole = Adapters.collapsedStringAdapterAdapter.marshal(soapRoleItem);
} catch (final Exception e) {
context.xmlAdapterError(handler, "soapRole", CollapsedStringAdapter.class, List.class, List.class, e);
}
if (soapRole != null) {
writer.writeStartElement(prefix, "soap-role", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(soapRole);
writer.writeEndElement();
}
}
}
// ELEMENT: portName
final List<String> portNameRaw = handler.portName;
if (portNameRaw != null) {
for (final String portNameItem : portNameRaw) {
String portName = null;
try {
portName = Adapters.collapsedStringAdapterAdapter.marshal(portNameItem);
} catch (final Exception e) {
context.xmlAdapterError(handler, "portName", CollapsedStringAdapter.class, List.class, List.class, e);
}
if (portName != null) {
writer.writeStartElement(prefix, "port-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(portName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(handler, "portName");
}
}
}
context.afterMarshal(handler, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.
the class FacesReferencedBean$JAXB method _read.
public static final FacesReferencedBean _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final FacesReferencedBean facesReferencedBean = new FacesReferencedBean();
context.beforeUnmarshal(facesReferencedBean, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
ArrayList<Text> displayNames = null;
LocalCollection<Icon> icon = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("faces-config-referenced-beanType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesReferencedBean.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, facesReferencedBean);
facesReferencedBean.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 = facesReferencedBean.icon;
if (icon != null) {
icon.clear();
} else {
icon = new LocalCollection<Icon>();
}
}
icon.add(iconItem);
} else if (("referenced-bean-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: referencedBeanName
final String referencedBeanNameRaw = elementReader.getElementAsString();
final String referencedBeanName;
try {
referencedBeanName = Adapters.collapsedStringAdapterAdapter.unmarshal(referencedBeanNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesReferencedBean.referencedBeanName = referencedBeanName;
} else if (("referenced-bean-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: referencedBeanClass
final String referencedBeanClassRaw = elementReader.getElementAsString();
final String referencedBeanClass;
try {
referencedBeanClass = Adapters.collapsedStringAdapterAdapter.unmarshal(referencedBeanClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesReferencedBean.referencedBeanClass = referencedBeanClass;
} 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", "referenced-bean-name"), new QName("http://java.sun.com/xml/ns/javaee", "referenced-bean-class"));
}
}
if (descriptions != null) {
try {
facesReferencedBean.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, FacesReferencedBean.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames != null) {
try {
facesReferencedBean.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
} catch (final Exception e) {
context.setterError(reader, FacesReferencedBean.class, "setDisplayNames", Text[].class, e);
}
}
if (icon != null) {
facesReferencedBean.icon = icon;
}
context.afterUnmarshal(facesReferencedBean, LifecycleCallback.NONE);
return facesReferencedBean;
}
use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.
the class FacesReferencedBean$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final FacesReferencedBean facesReferencedBean, RuntimeContext context) throws Exception {
if (facesReferencedBean == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (FacesReferencedBean.class != facesReferencedBean.getClass()) {
context.unexpectedSubclass(writer, facesReferencedBean, FacesReferencedBean.class);
return;
}
context.beforeMarshal(facesReferencedBean, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = facesReferencedBean.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesReferencedBean, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = facesReferencedBean.getDescriptions();
} catch (final Exception e) {
context.getterError(facesReferencedBean, "descriptions", FacesReferencedBean.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(facesReferencedBean, "descriptions");
}
}
}
// ELEMENT: displayNames
Text[] displayNames = null;
try {
displayNames = facesReferencedBean.getDisplayNames();
} catch (final Exception e) {
context.getterError(facesReferencedBean, "displayNames", FacesReferencedBean.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(facesReferencedBean, "displayNames");
}
}
}
// ELEMENT: icon
final LocalCollection<Icon> icon = facesReferencedBean.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(facesReferencedBean, "icon");
}
}
}
// ELEMENT: referencedBeanName
final String referencedBeanNameRaw = facesReferencedBean.referencedBeanName;
String referencedBeanName = null;
try {
referencedBeanName = Adapters.collapsedStringAdapterAdapter.marshal(referencedBeanNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesReferencedBean, "referencedBeanName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (referencedBeanName != null) {
writer.writeStartElement(prefix, "referenced-bean-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(referencedBeanName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesReferencedBean, "referencedBeanName");
}
// ELEMENT: referencedBeanClass
final String referencedBeanClassRaw = facesReferencedBean.referencedBeanClass;
String referencedBeanClass = null;
try {
referencedBeanClass = Adapters.collapsedStringAdapterAdapter.marshal(referencedBeanClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesReferencedBean, "referencedBeanClass", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (referencedBeanClass != null) {
writer.writeStartElement(prefix, "referenced-bean-class", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(referencedBeanClass);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesReferencedBean, "referencedBeanClass");
}
context.afterMarshal(facesReferencedBean, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.Icon$JAXB.writeIcon in project tomee by apache.
the class Application$JAXB method _read.
public static final Application _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final Application application = new Application();
context.beforeUnmarshal(application, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
ArrayList<Text> displayNames = null;
LocalCollection<Icon> icon = null;
List<Module> module = null;
List<SecurityRole> securityRole = null;
KeyedCollection<String, EnvEntry> envEntry = null;
KeyedCollection<String, EjbRef> ejbRef = null;
KeyedCollection<String, EjbLocalRef> ejbLocalRef = null;
KeyedCollection<String, ServiceRef> serviceRef = null;
KeyedCollection<String, ResourceRef> resourceRef = null;
KeyedCollection<String, ResourceEnvRef> resourceEnvRef = null;
KeyedCollection<String, MessageDestinationRef> messageDestinationRef = null;
KeyedCollection<String, PersistenceContextRef> persistenceContextRef = null;
KeyedCollection<String, PersistenceUnitRef> persistenceUnitRef = null;
KeyedCollection<String, MessageDestination> messageDestination = null;
KeyedCollection<String, DataSource> dataSource = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("applicationType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, Application.class);
}
}
// Read attributes
for (final Attribute attribute : reader.getAttributes()) {
if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
// ATTRIBUTE: version
application.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
} else if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
// ATTRIBUTE: id
final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
context.addXmlId(reader, id, application);
application.id = id;
} else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
context.unexpectedAttribute(attribute, new QName("", "version"), new QName("", "id"));
}
}
// Read elements
for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
if (("application-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: applicationName
final String applicationNameRaw = elementReader.getElementAsString();
final String applicationName;
try {
applicationName = Adapters.collapsedStringAdapterAdapter.unmarshal(applicationNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
application.applicationName = applicationName;
} else 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 = application.icon;
if (icon != null) {
icon.clear();
} else {
icon = new LocalCollection<Icon>();
}
}
icon.add(iconItem);
} else if (("initialize-in-order" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: initializeInOrder
final Boolean initializeInOrder = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
application.initializeInOrder = initializeInOrder;
} else if (("module" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: module
final Module moduleItem = readModule(elementReader, context);
if (module == null) {
module = application.module;
if (module != null) {
module.clear();
} else {
module = new ArrayList<Module>();
}
}
module.add(moduleItem);
} else if (("security-role" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: securityRole
final SecurityRole securityRoleItem = readSecurityRole(elementReader, context);
if (securityRole == null) {
securityRole = application.securityRole;
if (securityRole != null) {
securityRole.clear();
} else {
securityRole = new ArrayList<SecurityRole>();
}
}
securityRole.add(securityRoleItem);
} else if (("library-directory" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: libraryDirectory
final String libraryDirectoryRaw = elementReader.getElementAsString();
final String libraryDirectory;
try {
libraryDirectory = Adapters.collapsedStringAdapterAdapter.unmarshal(libraryDirectoryRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
application.libraryDirectory = libraryDirectory;
} else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: envEntry
final EnvEntry envEntryItem = readEnvEntry(elementReader, context);
if (envEntry == null) {
envEntry = application.envEntry;
if (envEntry != null) {
envEntry.clear();
} else {
envEntry = new KeyedCollection<String, EnvEntry>();
}
}
envEntry.add(envEntryItem);
} else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbRef
final EjbRef ejbRefItem = readEjbRef(elementReader, context);
if (ejbRef == null) {
ejbRef = application.ejbRef;
if (ejbRef != null) {
ejbRef.clear();
} else {
ejbRef = new KeyedCollection<String, EjbRef>();
}
}
ejbRef.add(ejbRefItem);
} else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbLocalRef
final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context);
if (ejbLocalRef == null) {
ejbLocalRef = application.ejbLocalRef;
if (ejbLocalRef != null) {
ejbLocalRef.clear();
} else {
ejbLocalRef = new KeyedCollection<String, EjbLocalRef>();
}
}
ejbLocalRef.add(ejbLocalRefItem);
} else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: serviceRef
final ServiceRef serviceRefItem = readServiceRef(elementReader, context);
if (serviceRef == null) {
serviceRef = application.serviceRef;
if (serviceRef != null) {
serviceRef.clear();
} else {
serviceRef = new KeyedCollection<String, ServiceRef>();
}
}
serviceRef.add(serviceRefItem);
} else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: resourceRef
final ResourceRef resourceRefItem = readResourceRef(elementReader, context);
if (resourceRef == null) {
resourceRef = application.resourceRef;
if (resourceRef != null) {
resourceRef.clear();
} else {
resourceRef = new KeyedCollection<String, ResourceRef>();
}
}
resourceRef.add(resourceRefItem);
} else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: resourceEnvRef
final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context);
if (resourceEnvRef == null) {
resourceEnvRef = application.resourceEnvRef;
if (resourceEnvRef != null) {
resourceEnvRef.clear();
} else {
resourceEnvRef = new KeyedCollection<String, ResourceEnvRef>();
}
}
resourceEnvRef.add(resourceEnvRefItem);
} else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: messageDestinationRef
final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context);
if (messageDestinationRef == null) {
messageDestinationRef = application.messageDestinationRef;
if (messageDestinationRef != null) {
messageDestinationRef.clear();
} else {
messageDestinationRef = new KeyedCollection<String, MessageDestinationRef>();
}
}
messageDestinationRef.add(messageDestinationRefItem);
} else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: persistenceContextRef
final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context);
if (persistenceContextRef == null) {
persistenceContextRef = application.persistenceContextRef;
if (persistenceContextRef != null) {
persistenceContextRef.clear();
} else {
persistenceContextRef = new KeyedCollection<String, PersistenceContextRef>();
}
}
persistenceContextRef.add(persistenceContextRefItem);
} else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: persistenceUnitRef
final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context);
if (persistenceUnitRef == null) {
persistenceUnitRef = application.persistenceUnitRef;
if (persistenceUnitRef != null) {
persistenceUnitRef.clear();
} else {
persistenceUnitRef = new KeyedCollection<String, PersistenceUnitRef>();
}
}
persistenceUnitRef.add(persistenceUnitRefItem);
} else if (("message-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: messageDestination
final MessageDestination messageDestinationItem = readMessageDestination(elementReader, context);
if (messageDestination == null) {
messageDestination = application.messageDestination;
if (messageDestination != null) {
messageDestination.clear();
} else {
messageDestination = new KeyedCollection<String, MessageDestination>();
}
}
messageDestination.add(messageDestinationItem);
} else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: dataSource
final DataSource dataSourceItem = readDataSource(elementReader, context);
if (dataSource == null) {
dataSource = application.dataSource;
if (dataSource != null) {
dataSource.clear();
} else {
dataSource = new KeyedCollection<String, DataSource>();
}
}
dataSource.add(dataSourceItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "application-name"), 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", "initialize-in-order"), new QName("http://java.sun.com/xml/ns/javaee", "module"), new QName("http://java.sun.com/xml/ns/javaee", "security-role"), new QName("http://java.sun.com/xml/ns/javaee", "library-directory"), new QName("http://java.sun.com/xml/ns/javaee", "env-entry"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-ref"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-local-ref"), new QName("http://java.sun.com/xml/ns/javaee", "service-ref"), new QName("http://java.sun.com/xml/ns/javaee", "resource-ref"), new QName("http://java.sun.com/xml/ns/javaee", "resource-env-ref"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-ref"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-context-ref"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-unit-ref"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"));
}
}
if (descriptions != null) {
try {
application.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, Application.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames != null) {
try {
application.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
} catch (final Exception e) {
context.setterError(reader, Application.class, "setDisplayNames", Text[].class, e);
}
}
if (icon != null) {
application.icon = icon;
}
if (module != null) {
application.module = module;
}
if (securityRole != null) {
application.securityRole = securityRole;
}
if (envEntry != null) {
application.envEntry = envEntry;
}
if (ejbRef != null) {
application.ejbRef = ejbRef;
}
if (ejbLocalRef != null) {
application.ejbLocalRef = ejbLocalRef;
}
if (serviceRef != null) {
application.serviceRef = serviceRef;
}
if (resourceRef != null) {
application.resourceRef = resourceRef;
}
if (resourceEnvRef != null) {
application.resourceEnvRef = resourceEnvRef;
}
if (messageDestinationRef != null) {
application.messageDestinationRef = messageDestinationRef;
}
if (persistenceContextRef != null) {
application.persistenceContextRef = persistenceContextRef;
}
if (persistenceUnitRef != null) {
application.persistenceUnitRef = persistenceUnitRef;
}
if (messageDestination != null) {
application.messageDestination = messageDestination;
}
if (dataSource != null) {
application.dataSource = dataSource;
}
context.afterUnmarshal(application, LifecycleCallback.NONE);
return application;
}
Aggregations