use of org.metatype.sxc.util.Attribute in project tomee by apache.
the class Property$JAXB method _read.
public static final Property _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final Property property = new Property();
context.beforeUnmarshal(property, LifecycleCallback.NONE);
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, Property.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, property);
property.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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: name
final String nameRaw = elementReader.getElementAsString();
final String name;
try {
name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
property.name = name;
} else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: value
final String valueRaw = elementReader.getElementAsString();
final String value;
try {
value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
property.value = value;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "value"));
}
}
context.afterUnmarshal(property, LifecycleCallback.NONE);
return property;
}
use of org.metatype.sxc.util.Attribute in project tomee by apache.
the class Query$JAXB method _read.
public static final Query _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final Query query = new Query();
context.beforeUnmarshal(query, LifecycleCallback.NONE);
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("queryType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, Query.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, query);
query.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: description
final Text description = readText(elementReader, context);
query.description = description;
} else if (("query-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: queryMethod
final QueryMethod queryMethod = readQueryMethod(elementReader, context);
query.queryMethod = queryMethod;
} else if (("result-type-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: resultTypeMapping
final ResultTypeMapping resultTypeMapping = parseResultTypeMapping(elementReader, context, elementReader.getElementAsString());
if (resultTypeMapping != null) {
query.resultTypeMapping = resultTypeMapping;
}
} else if (("ejb-ql" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbQl
final String ejbQlRaw = elementReader.getElementAsString();
final String ejbQl;
try {
ejbQl = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbQlRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
query.ejbQl = ejbQl;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "query-method"), new QName("http://java.sun.com/xml/ns/javaee", "result-type-mapping"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-ql"));
}
}
context.afterUnmarshal(query, LifecycleCallback.NONE);
return query;
}
use of org.metatype.sxc.util.Attribute in project tomee by apache.
the class RelationshipRoleSource$JAXB method _read.
public static final RelationshipRoleSource _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final RelationshipRoleSource relationshipRoleSource = new RelationshipRoleSource();
context.beforeUnmarshal(relationshipRoleSource, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("relationship-role-sourceType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, RelationshipRoleSource.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, relationshipRoleSource);
relationshipRoleSource.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 (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbName
final String ejbNameRaw = elementReader.getElementAsString();
final String ejbName;
try {
ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
relationshipRoleSource.ejbName = ejbName;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-name"));
}
}
if (descriptions != null) {
try {
relationshipRoleSource.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, RelationshipRoleSource.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(relationshipRoleSource, LifecycleCallback.NONE);
return relationshipRoleSource;
}
use of org.metatype.sxc.util.Attribute in project tomee by apache.
the class Relationships$JAXB method _read.
public static final Relationships _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final Relationships relationships = new Relationships();
context.beforeUnmarshal(relationships, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
List<EjbRelation> ejbRelation = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("relationshipsType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, Relationships.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, relationships);
relationships.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 (("ejb-relation" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbRelation
final EjbRelation ejbRelationItem = readEjbRelation(elementReader, context);
if (ejbRelation == null) {
ejbRelation = relationships.ejbRelation;
if (ejbRelation != null) {
ejbRelation.clear();
} else {
ejbRelation = new ArrayList<EjbRelation>();
}
}
ejbRelation.add(ejbRelationItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-relation"));
}
}
if (descriptions != null) {
try {
relationships.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, Relationships.class, "setDescriptions", Text[].class, e);
}
}
if (ejbRelation != null) {
relationships.ejbRelation = ejbRelation;
}
context.afterUnmarshal(relationships, LifecycleCallback.NONE);
return relationships;
}
use of org.metatype.sxc.util.Attribute in project tomee by apache.
the class RemoveMethod$JAXB method _read.
public static final RemoveMethod _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final RemoveMethod removeMethod = new RemoveMethod();
context.beforeUnmarshal(removeMethod, LifecycleCallback.NONE);
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("remove-methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, RemoveMethod.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, removeMethod);
removeMethod.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 (("bean-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: beanMethod
final NamedMethod beanMethod = readNamedMethod(elementReader, context);
removeMethod.beanMethod = beanMethod;
} else if (("retain-if-exception" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: retainIfException
final Boolean retainIfException = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
removeMethod.retainIfException = retainIfException;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "bean-method"), new QName("http://java.sun.com/xml/ns/javaee", "retain-if-exception"));
}
}
context.afterUnmarshal(removeMethod, LifecycleCallback.NONE);
return removeMethod;
}
Aggregations