use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class EjbRelation$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final EjbRelation ejbRelation, RuntimeContext context) throws Exception {
if (ejbRelation == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (EjbRelation.class != ejbRelation.getClass()) {
context.unexpectedSubclass(writer, ejbRelation, EjbRelation.class);
return;
}
context.beforeMarshal(ejbRelation, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = ejbRelation.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(ejbRelation, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = ejbRelation.getDescriptions();
} catch (final Exception e) {
context.getterError(ejbRelation, "descriptions", EjbRelation.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(ejbRelation, "descriptions");
}
}
}
// ELEMENT: ejbRelationName
final String ejbRelationNameRaw = ejbRelation.ejbRelationName;
String ejbRelationName = null;
try {
ejbRelationName = Adapters.collapsedStringAdapterAdapter.marshal(ejbRelationNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(ejbRelation, "ejbRelationName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (ejbRelationName != null) {
writer.writeStartElement(prefix, "ejb-relation-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(ejbRelationName);
writer.writeEndElement();
}
// ELEMENT: ejbRelationshipRole
final List<EjbRelationshipRole> ejbRelationshipRole = ejbRelation.ejbRelationshipRole;
if (ejbRelationshipRole != null) {
for (final EjbRelationshipRole ejbRelationshipRoleItem : ejbRelationshipRole) {
if (ejbRelationshipRoleItem != null) {
writer.writeStartElement(prefix, "ejb-relationship-role", "http://java.sun.com/xml/ns/javaee");
writeEjbRelationshipRole(writer, ejbRelationshipRoleItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(ejbRelation, "ejbRelationshipRole");
}
}
}
context.afterMarshal(ejbRelation, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class EjbRelationshipRole$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final EjbRelationshipRole ejbRelationshipRole, RuntimeContext context) throws Exception {
if (ejbRelationshipRole == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (EjbRelationshipRole.class != ejbRelationshipRole.getClass()) {
context.unexpectedSubclass(writer, ejbRelationshipRole, EjbRelationshipRole.class);
return;
}
context.beforeMarshal(ejbRelationshipRole, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = ejbRelationshipRole.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(ejbRelationshipRole, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = ejbRelationshipRole.getDescriptions();
} catch (final Exception e) {
context.getterError(ejbRelationshipRole, "descriptions", EjbRelationshipRole.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(ejbRelationshipRole, "descriptions");
}
}
}
// ELEMENT: ejbRelationshipRoleName
final String ejbRelationshipRoleNameRaw = ejbRelationshipRole.ejbRelationshipRoleName;
String ejbRelationshipRoleName = null;
try {
ejbRelationshipRoleName = Adapters.collapsedStringAdapterAdapter.marshal(ejbRelationshipRoleNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(ejbRelationshipRole, "ejbRelationshipRoleName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (ejbRelationshipRoleName != null) {
writer.writeStartElement(prefix, "ejb-relationship-role-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(ejbRelationshipRoleName);
writer.writeEndElement();
}
// ELEMENT: multiplicity
final Multiplicity multiplicity = ejbRelationshipRole.multiplicity;
if (multiplicity != null) {
writer.writeStartElement(prefix, "multiplicity", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(toStringMultiplicity(ejbRelationshipRole, null, context, multiplicity));
writer.writeEndElement();
} else {
context.unexpectedNullValue(ejbRelationshipRole, "multiplicity");
}
// ELEMENT: cascadeDelete
final Empty cascadeDelete = ejbRelationshipRole.cascadeDelete;
if (cascadeDelete != null) {
writer.writeStartElement(prefix, "cascade-delete", "http://java.sun.com/xml/ns/javaee");
writeEmpty(writer, cascadeDelete, context);
writer.writeEndElement();
}
// ELEMENT: relationshipRoleSource
final RelationshipRoleSource relationshipRoleSource = ejbRelationshipRole.relationshipRoleSource;
if (relationshipRoleSource != null) {
writer.writeStartElement(prefix, "relationship-role-source", "http://java.sun.com/xml/ns/javaee");
writeRelationshipRoleSource(writer, relationshipRoleSource, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(ejbRelationshipRole, "relationshipRoleSource");
}
// ELEMENT: cmrField
final CmrField cmrField = ejbRelationshipRole.cmrField;
if (cmrField != null) {
writer.writeStartElement(prefix, "cmr-field", "http://java.sun.com/xml/ns/javaee");
writeCmrField(writer, cmrField, context);
writer.writeEndElement();
}
context.afterMarshal(ejbRelationshipRole, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class EnvEntry$JAXB method _read.
public static final EnvEntry _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final EnvEntry envEntry = new EnvEntry();
context.beforeUnmarshal(envEntry, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
Set<InjectionTarget> injectionTarget = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("env-entryType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, EnvEntry.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, envEntry);
envEntry.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 (("env-entry-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: envEntryName
final String envEntryNameRaw = elementReader.getElementAsString();
final String envEntryName;
try {
envEntryName = Adapters.collapsedStringAdapterAdapter.unmarshal(envEntryNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
envEntry.envEntryName = envEntryName;
} else if (("env-entry-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: envEntryType
final String envEntryTypeRaw = elementReader.getElementAsString();
final String envEntryType;
try {
envEntryType = Adapters.collapsedStringAdapterAdapter.unmarshal(envEntryTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
envEntry.envEntryType = envEntryType;
} else if (("env-entry-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: envEntryValue
// don't trim
final String envEntryValueRaw = elementReader.getElementText();
final String envEntryValue;
try {
envEntryValue = Adapters.stringAdapterAdapter.unmarshal(envEntryValueRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, StringAdapter.class, String.class, String.class, e);
continue;
}
envEntry.envEntryValue = envEntryValue;
} 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;
}
envEntry.mappedName = mappedName;
} else if (("injection-target" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: injectionTarget
final InjectionTarget injectionTargetItem = readInjectionTarget(elementReader, context);
if (injectionTarget == null) {
injectionTarget = envEntry.injectionTarget;
if (injectionTarget != null) {
injectionTarget.clear();
} else {
injectionTarget = new LinkedHashSet<InjectionTarget>();
}
}
injectionTarget.add(injectionTargetItem);
} 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;
}
envEntry.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", "env-entry-name"), new QName("http://java.sun.com/xml/ns/javaee", "env-entry-type"), new QName("http://java.sun.com/xml/ns/javaee", "env-entry-value"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "injection-target"), new QName("http://java.sun.com/xml/ns/javaee", "lookup-name"));
}
}
if (descriptions != null) {
try {
envEntry.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, EnvEntry.class, "setDescriptions", Text[].class, e);
}
}
if (injectionTarget != null) {
envEntry.injectionTarget = injectionTarget;
}
context.afterUnmarshal(envEntry, LifecycleCallback.NONE);
return envEntry;
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class ExcludeList$JAXB method _read.
public static final ExcludeList _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ExcludeList excludeList = new ExcludeList();
context.beforeUnmarshal(excludeList, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
List<Method> method = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("exclude-listType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ExcludeList.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, excludeList);
excludeList.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 (("method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: method
final Method methodItem = readMethod(elementReader, context);
if (method == null) {
method = excludeList.method;
if (method != null) {
method.clear();
} else {
method = new ArrayList<Method>();
}
}
method.add(methodItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "method"));
}
}
if (descriptions != null) {
try {
excludeList.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, ExcludeList.class, "setDescriptions", Text[].class, e);
}
}
if (method != null) {
excludeList.method = method;
}
context.afterUnmarshal(excludeList, LifecycleCallback.NONE);
return excludeList;
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class ExcludeList$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final ExcludeList excludeList, RuntimeContext context) throws Exception {
if (excludeList == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (ExcludeList.class != excludeList.getClass()) {
context.unexpectedSubclass(writer, excludeList, ExcludeList.class);
return;
}
context.beforeMarshal(excludeList, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = excludeList.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(excludeList, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = excludeList.getDescriptions();
} catch (final Exception e) {
context.getterError(excludeList, "descriptions", ExcludeList.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(excludeList, "descriptions");
}
}
}
// ELEMENT: method
final List<Method> method = excludeList.method;
if (method != null) {
for (final Method methodItem : method) {
if (methodItem != null) {
writer.writeStartElement(prefix, "method", "http://java.sun.com/xml/ns/javaee");
writeMethod(writer, methodItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(excludeList, "method");
}
}
}
context.afterMarshal(excludeList, LifecycleCallback.NONE);
}
Aggregations