use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class CmpField$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final CmpField cmpField, RuntimeContext context) throws Exception {
if (cmpField == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (CmpField.class != cmpField.getClass()) {
context.unexpectedSubclass(writer, cmpField, CmpField.class);
return;
}
context.beforeMarshal(cmpField, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = cmpField.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(cmpField, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = cmpField.getDescriptions();
} catch (final Exception e) {
context.getterError(cmpField, "descriptions", CmpField.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(cmpField, "descriptions");
}
}
}
// ELEMENT: fieldName
final String fieldNameRaw = cmpField.fieldName;
String fieldName = null;
try {
fieldName = Adapters.collapsedStringAdapterAdapter.marshal(fieldNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(cmpField, "fieldName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (fieldName != null) {
writer.writeStartElement(prefix, "field-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(fieldName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(cmpField, "fieldName");
}
context.afterMarshal(cmpField, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class CmrField$JAXB method _read.
public static final CmrField _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final CmrField cmrField = new CmrField();
context.beforeUnmarshal(cmrField, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("cmr-fieldType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, CmrField.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, cmrField);
cmrField.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 (("cmr-field-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: cmrFieldName
final String cmrFieldNameRaw = elementReader.getElementAsString();
final String cmrFieldName;
try {
cmrFieldName = Adapters.collapsedStringAdapterAdapter.unmarshal(cmrFieldNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
cmrField.cmrFieldName = cmrFieldName;
} else if (("cmr-field-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: cmrFieldType
final CmrFieldType cmrFieldType = parseCmrFieldType(elementReader, context, elementReader.getElementAsString());
if (cmrFieldType != null) {
cmrField.cmrFieldType = cmrFieldType;
}
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "cmr-field-name"), new QName("http://java.sun.com/xml/ns/javaee", "cmr-field-type"));
}
}
if (descriptions != null) {
try {
cmrField.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, CmrField.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(cmrField, LifecycleCallback.NONE);
return cmrField;
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class ConfigProperty$JAXB method _read.
public static final ConfigProperty _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ConfigProperty configProperty = new ConfigProperty();
context.beforeUnmarshal(configProperty, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("config-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ConfigProperty.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, configProperty);
configProperty.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 (("config-property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyName
final String configPropertyNameRaw = elementReader.getElementAsString();
final String configPropertyName;
try {
configPropertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
configProperty.configPropertyName = configPropertyName;
} else if (("config-property-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyType
final String configPropertyTypeRaw = elementReader.getElementAsString();
final String configPropertyType;
try {
configPropertyType = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
configProperty.configPropertyType = configPropertyType;
} else if (("config-property-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyValue
final String configPropertyValueRaw = elementReader.getElementAsString();
final String configPropertyValue;
try {
configPropertyValue = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyValueRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
configProperty.configPropertyValue = configPropertyValue;
} else if (("config-property-ignore" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyIgnore
final Boolean configPropertyIgnore = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
configProperty.configPropertyIgnore = configPropertyIgnore;
} else if (("config-property-supports-dynamic-updates" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertySupportsDynamicUpdates
final Boolean configPropertySupportsDynamicUpdates = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
configProperty.configPropertySupportsDynamicUpdates = configPropertySupportsDynamicUpdates;
} else if (("config-property-confidential" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyConfidential
final Boolean configPropertyConfidential = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
configProperty.configPropertyConfidential = configPropertyConfidential;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-name"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-type"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-value"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-ignore"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-supports-dynamic-updates"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-confidential"));
}
}
if (descriptions != null) {
try {
configProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, ConfigProperty.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(configProperty, LifecycleCallback.NONE);
return configProperty;
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class MessageDestination$JAXB method _read.
public static final MessageDestination _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final MessageDestination messageDestination = new MessageDestination();
context.beforeUnmarshal(messageDestination, 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 (("message-destinationType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, MessageDestination.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, messageDestination);
messageDestination.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 = messageDestination.icon;
if (icon != null) {
icon.clear();
} else {
icon = new LocalCollection<Icon>();
}
}
icon.add(iconItem);
} else if (("message-destination-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: messageDestinationName
final String messageDestinationNameRaw = elementReader.getElementAsString();
final String messageDestinationName;
try {
messageDestinationName = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
messageDestination.messageDestinationName = messageDestinationName;
} else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: mappedName
final String mappedNameRaw = elementReader.getElementAsString();
final String mappedName;
try {
mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
messageDestination.mappedName = mappedName;
} else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: lookupName
final String lookupNameRaw = elementReader.getElementAsString();
final String lookupName;
try {
lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
messageDestination.lookupName = lookupName;
} 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", "message-destination-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "lookup-name"));
}
}
if (descriptions != null) {
try {
messageDestination.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, MessageDestination.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames != null) {
try {
messageDestination.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
} catch (final Exception e) {
context.setterError(reader, MessageDestination.class, "setDisplayNames", Text[].class, e);
}
}
if (icon != null) {
messageDestination.icon = icon;
}
context.afterUnmarshal(messageDestination, LifecycleCallback.NONE);
return messageDestination;
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class MessageDestinationRef$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final MessageDestinationRef messageDestinationRef, RuntimeContext context) throws Exception {
if (messageDestinationRef == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (MessageDestinationRef.class != messageDestinationRef.getClass()) {
context.unexpectedSubclass(writer, messageDestinationRef, MessageDestinationRef.class);
return;
}
context.beforeMarshal(messageDestinationRef, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = messageDestinationRef.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(messageDestinationRef, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = messageDestinationRef.getDescriptions();
} catch (final Exception e) {
context.getterError(messageDestinationRef, "descriptions", MessageDestinationRef.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(messageDestinationRef, "descriptions");
}
}
}
// ELEMENT: messageDestinationRefName
final String messageDestinationRefNameRaw = messageDestinationRef.messageDestinationRefName;
String messageDestinationRefName = null;
try {
messageDestinationRefName = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationRefNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(messageDestinationRef, "messageDestinationRefName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (messageDestinationRefName != null) {
writer.writeStartElement(prefix, "message-destination-ref-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(messageDestinationRefName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(messageDestinationRef, "messageDestinationRefName");
}
// ELEMENT: messageDestinationType
final String messageDestinationTypeRaw = messageDestinationRef.messageDestinationType;
String messageDestinationType = null;
try {
messageDestinationType = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(messageDestinationRef, "messageDestinationType", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (messageDestinationType != null) {
writer.writeStartElement(prefix, "message-destination-type", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(messageDestinationType);
writer.writeEndElement();
}
// ELEMENT: messageDestinationUsage
final MessageDestinationUsage messageDestinationUsage = messageDestinationRef.messageDestinationUsage;
if (messageDestinationUsage != null) {
writer.writeStartElement(prefix, "message-destination-usage", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(toStringMessageDestinationUsage(messageDestinationRef, null, context, messageDestinationUsage));
writer.writeEndElement();
}
// ELEMENT: messageDestinationLink
final String messageDestinationLinkRaw = messageDestinationRef.messageDestinationLink;
String messageDestinationLink = null;
try {
messageDestinationLink = Adapters.collapsedStringAdapterAdapter.marshal(messageDestinationLinkRaw);
} catch (final Exception e) {
context.xmlAdapterError(messageDestinationRef, "messageDestinationLink", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (messageDestinationLink != null) {
writer.writeStartElement(prefix, "message-destination-link", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(messageDestinationLink);
writer.writeEndElement();
}
// ELEMENT: mappedName
final String mappedNameRaw = messageDestinationRef.mappedName;
String mappedName = null;
try {
mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(messageDestinationRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (mappedName != null) {
writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(mappedName);
writer.writeEndElement();
}
// ELEMENT: injectionTarget
final Set<InjectionTarget> injectionTarget = messageDestinationRef.injectionTarget;
if (injectionTarget != null) {
for (final InjectionTarget injectionTargetItem : injectionTarget) {
if (injectionTargetItem != null) {
writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee");
writeInjectionTarget(writer, injectionTargetItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(messageDestinationRef, "injectionTarget");
}
}
}
// ELEMENT: lookupName
final String lookupNameRaw = messageDestinationRef.lookupName;
String lookupName = null;
try {
lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(messageDestinationRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (lookupName != null) {
writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(lookupName);
writer.writeEndElement();
}
context.afterMarshal(messageDestinationRef, LifecycleCallback.NONE);
}
Aggregations