diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 27a8c0c..44f26a0 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -11,16 +11,16 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/client/src/main/java/com/ossez/usreio/client/RetsTransport.java b/client/src/main/java/com/ossez/usreio/client/RetsTransport.java
index 93d2b79..57f352d 100644
--- a/client/src/main/java/com/ossez/usreio/client/RetsTransport.java
+++ b/client/src/main/java/com/ossez/usreio/client/RetsTransport.java
@@ -302,8 +302,7 @@ public class RetsTransport {
}
metadataBuilder.setStrict(this.strict);
-
-
+
return metadataBuilder.doBuild(xmlDocument);
} finally {
this.monitor.eventFinish(monitorobj);
diff --git a/client/src/main/java/com/ossez/usreio/tests/common/metadata/JDomCompactBuilder.java b/client/src/main/java/com/ossez/usreio/tests/common/metadata/JDomCompactBuilder.java
index d231522..030841c 100644
--- a/client/src/main/java/com/ossez/usreio/tests/common/metadata/JDomCompactBuilder.java
+++ b/client/src/main/java/com/ossez/usreio/tests/common/metadata/JDomCompactBuilder.java
@@ -11,6 +11,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.StringTokenizer;
+import com.ossez.usreio.client.CapabilityUrls;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dom4j.*;
@@ -32,671 +33,678 @@ import com.ossez.usreio.tests.common.metadata.types.MValidationExternalType;
import com.ossez.usreio.tests.common.metadata.types.MValidationLookup;
import com.ossez.usreio.tests.common.metadata.types.MValidationLookupType;
import org.dom4j.io.SAXReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.xml.sax.InputSource;
public class JDomCompactBuilder extends MetadataBuilder {
- public static final String CONTAINER_PREFIX = "METADATA-";
- public static final String CONTAINER_ROOT = "RETS";
- public static final String CONTAINER_METADATA = "METADATA";
- public static final String CONTAINER_SYSTEM = "METADATA-SYSTEM";
- public static final String CONTAINER_RESOURCE = "METADATA-RESOURCE";
- public static final String CONTAINER_FOREIGNKEY = "METADATA-FOREIGN_KEY";
- public static final String CONTAINER_CLASS = "METADATA-CLASS";
- public static final String CONTAINER_TABLE = "METADATA-TABLE";
- public static final String CONTAINER_UPDATE = "METADATA-UPDATE";
- public static final String CONTAINER_UPDATETYPE = "METADATA-UPDATE_TYPE";
- public static final String CONTAINER_OBJECT = "METADATA-OBJECT";
- public static final String CONTAINER_SEARCHHELP = "METADATA-SEARCH_HELP";
- public static final String CONTAINER_EDITMASK = "METADATA-EDITMASK";
- public static final String CONTAINER_UPDATEHELP = "METADATA-UPDATE_HELP";
- public static final String CONTAINER_LOOKUP = "METADATA-LOOKUP";
- public static final String CONTAINER_LOOKUPTYPE = "METADATA-LOOKUP_TYPE";
- public static final String CONTAINER_VALIDATIONLOOKUP = "METADATA-VALIDATION_LOOKUP";
- public static final String CONTAINER_VALIDATIONLOOKUPTYPE = "METADATA-VALIDATION_LOOKUP_TYPE";
- public static final String CONTAINER_VALIDATIONEXPRESSION = "METADATA-VALIDATION_EXPRESSION";
- public static final String CONTAINER_VALIDATIONEXTERNAL = "METADATA-VALIDATION_EXTERNAL";
- public static final String CONTAINER_VALIDATIONEXTERNALTYPE = "METADATA-VALIDATION_EXTERNAL_TYPE";
- public static final String ELEMENT_SYSTEM = "SYSTEM";
- public static final String COLUMNS = "COLUMNS";
- public static final String DATA = "DATA";
- public static final String ATTRIBUTE_RESOURCE = "Resource";
- public static final String ATTRIBUTE_CLASS = "Class";
- public static final String ATTRIBUTE_UPDATE = "Update";
- public static final String ATTRIBUTE_LOOKUP = "Lookup";
- public static final String ATTRIBUTE_VALIDATIONEXTERNAL = "ValidationExternal";
- public static final String ATTRIBUTE_VALIDATIONLOOKUP = "ValidationLookup";
- private static final Log LOG = LogFactory.getLog(JDomCompactBuilder.class);
+ private final static Logger log = LoggerFactory.getLogger(JDomCompactBuilder.class);
- @Override
- public Metadata doBuild(Object src) throws MetadataException {
- return build((Document) src);
- }
+ public static final String CONTAINER_PREFIX = "METADATA-";
+ public static final String CONTAINER_ROOT = "RETS";
+ public static final String CONTAINER_METADATA = "METADATA";
+ public static final String CONTAINER_SYSTEM = "METADATA-SYSTEM";
+ public static final String CONTAINER_RESOURCE = "METADATA-RESOURCE";
+ public static final String CONTAINER_FOREIGNKEY = "METADATA-FOREIGN_KEY";
+ public static final String CONTAINER_CLASS = "METADATA-CLASS";
+ public static final String CONTAINER_TABLE = "METADATA-TABLE";
+ public static final String CONTAINER_UPDATE = "METADATA-UPDATE";
+ public static final String CONTAINER_UPDATETYPE = "METADATA-UPDATE_TYPE";
+ public static final String CONTAINER_OBJECT = "METADATA-OBJECT";
+ public static final String CONTAINER_SEARCHHELP = "METADATA-SEARCH_HELP";
+ public static final String CONTAINER_EDITMASK = "METADATA-EDITMASK";
+ public static final String CONTAINER_UPDATEHELP = "METADATA-UPDATE_HELP";
+ public static final String CONTAINER_LOOKUP = "METADATA-LOOKUP";
+ public static final String CONTAINER_LOOKUPTYPE = "METADATA-LOOKUP_TYPE";
+ public static final String CONTAINER_VALIDATIONLOOKUP = "METADATA-VALIDATION_LOOKUP";
+ public static final String CONTAINER_VALIDATIONLOOKUPTYPE = "METADATA-VALIDATION_LOOKUP_TYPE";
+ public static final String CONTAINER_VALIDATIONEXPRESSION = "METADATA-VALIDATION_EXPRESSION";
+ public static final String CONTAINER_VALIDATIONEXTERNAL = "METADATA-VALIDATION_EXTERNAL";
+ public static final String CONTAINER_VALIDATIONEXTERNALTYPE = "METADATA-VALIDATION_EXTERNAL_TYPE";
+ public static final String ELEMENT_SYSTEM = "SYSTEM";
+ public static final String COLUMNS = "COLUMNS";
+ public static final String DATA = "DATA";
+ public static final String ATTRIBUTE_RESOURCE = "Resource";
+ public static final String ATTRIBUTE_CLASS = "Class";
+ public static final String ATTRIBUTE_UPDATE = "Update";
+ public static final String ATTRIBUTE_LOOKUP = "Lookup";
+ public static final String ATTRIBUTE_VALIDATIONEXTERNAL = "ValidationExternal";
+ public static final String ATTRIBUTE_VALIDATIONLOOKUP = "ValidationLookup";
+ private static final Log LOG = LogFactory.getLog(JDomCompactBuilder.class);
- public Metadata build(InputSource source) throws MetadataException {
- SAXReader builder = new SAXReader();
- Document document;
- try {
- document = builder.read(source);
- } catch (DocumentException e) {
- throw new MetadataException("Couldn't build document", e);
- }
- return build(document);
- }
+ @Override
+ public Metadata doBuild(Object src) throws MetadataException {
+ log.info("Rets Meta Data JDomCompactBuilder");
+ return build((Document) src);
+ }
- @Override
- public MetaObject[] parse(Object src) throws MetadataException {
- return parse((Document) src);
- }
+ public Metadata build(InputSource source) throws MetadataException {
+ SAXReader builder = new SAXReader();
+ Document document;
+ try {
+ document = builder.read(source);
+ } catch (DocumentException e) {
+ throw new MetadataException("Couldn't build document", e);
+ }
+ return build(document);
+ }
- public MetaObject[] parse(Document src) throws MetadataException {
- Element root = src.getRootElement();
- if (!root.getName().equals(CONTAINER_ROOT)) {
- throw new MetadataException("Invalid root element");
- }
- Element container = root.element(CONTAINER_SYSTEM);
- if (container != null) {
- MSystem sys = processSystem(container);
- if (root.element(CONTAINER_RESOURCE) != null) {
- Metadata m = new Metadata(sys);
- recurseAll(m, root);
- }
- return new MetaObject[] { sys };
- }
- container = root.element(CONTAINER_RESOURCE);
- if (container != null) {
- return processResource(container);
- }
- container = root.element(CONTAINER_CLASS);
- if (container != null) {
- return processClass(container);
- }
- container = root.element(CONTAINER_TABLE);
- if (container != null) {
- return processTable(container);
- }
- container = root.element(CONTAINER_UPDATE);
- if (container != null) {
- return processUpdate(container);
- }
- container = root.element(CONTAINER_UPDATETYPE);
- if (container != null) {
- return processUpdateType(container);
- }
- container = root.element(CONTAINER_OBJECT);
- if (container != null) {
- return processObject(container);
- }
- container = root.element(CONTAINER_SEARCHHELP);
- if (container != null) {
- return processSearchHelp(container);
- }
- container = root.element(CONTAINER_EDITMASK);
- if (container != null) {
- return processEditMask(container);
- }
- container = root.element(CONTAINER_LOOKUP);
- if (container != null) {
- return processLookup(container);
- }
- container = root.element(CONTAINER_LOOKUPTYPE);
- if (container != null) {
- return processLookupType(container);
- }
- container = root.element(CONTAINER_VALIDATIONLOOKUP);
- if (container != null) {
- return processValidationLookup(container);
- }
- container = root.element(CONTAINER_VALIDATIONLOOKUPTYPE);
- if (container != null) {
- return processValidationLookupType(container);
- }
- container = root.element(CONTAINER_VALIDATIONEXTERNAL);
- if (container != null) {
- return processValidationExternal(container);
- }
- container = root.element(CONTAINER_VALIDATIONEXTERNALTYPE);
- if (container != null) {
- return processValidationExternalType(container);
- }
- container = root.element(CONTAINER_VALIDATIONEXPRESSION);
- if (container != null) {
- return processValidationExpression(container);
- }
- return null;
- }
+ @Override
+ public MetaObject[] parse(Object src) throws MetadataException {
+ return parse((Document) src);
+ }
- public Metadata build(Document src) throws MetadataException {
- Element root = src.getRootElement();
- if (!root.getName().equals(CONTAINER_ROOT)) {
- throw new MetadataException("Invalid root element");
- }
- Element element = root.element(CONTAINER_SYSTEM);
- if (element == null) {
- throw new MetadataException("Missing element " + CONTAINER_SYSTEM);
- }
- MSystem sys = processSystem(element);
- Metadata metadata;
- metadata = new Metadata(sys);
- recurseAll(metadata, root);
- return metadata;
- }
+ public MetaObject[] parse(Document src) throws MetadataException {
+ Element root = src.getRootElement();
+ if (!root.getName().equals(CONTAINER_ROOT)) {
+ throw new MetadataException("Invalid root element");
+ }
+ Element container = root.element(CONTAINER_SYSTEM);
+ if (container != null) {
+ MSystem sys = processSystem(container);
+ if (root.element(CONTAINER_RESOURCE) != null) {
+ Metadata m = new Metadata(sys);
+ recurseAll(m, root);
+ }
+ return new MetaObject[]{sys};
+ }
+ container = root.element(CONTAINER_RESOURCE);
+ if (container != null) {
+ return processResource(container);
+ }
+ container = root.element(CONTAINER_CLASS);
+ if (container != null) {
+ return processClass(container);
+ }
+ container = root.element(CONTAINER_TABLE);
+ if (container != null) {
+ return processTable(container);
+ }
+ container = root.element(CONTAINER_UPDATE);
+ if (container != null) {
+ return processUpdate(container);
+ }
+ container = root.element(CONTAINER_UPDATETYPE);
+ if (container != null) {
+ return processUpdateType(container);
+ }
+ container = root.element(CONTAINER_OBJECT);
+ if (container != null) {
+ return processObject(container);
+ }
+ container = root.element(CONTAINER_SEARCHHELP);
+ if (container != null) {
+ return processSearchHelp(container);
+ }
+ container = root.element(CONTAINER_EDITMASK);
+ if (container != null) {
+ return processEditMask(container);
+ }
+ container = root.element(CONTAINER_LOOKUP);
+ if (container != null) {
+ return processLookup(container);
+ }
+ container = root.element(CONTAINER_LOOKUPTYPE);
+ if (container != null) {
+ return processLookupType(container);
+ }
+ container = root.element(CONTAINER_VALIDATIONLOOKUP);
+ if (container != null) {
+ return processValidationLookup(container);
+ }
+ container = root.element(CONTAINER_VALIDATIONLOOKUPTYPE);
+ if (container != null) {
+ return processValidationLookupType(container);
+ }
+ container = root.element(CONTAINER_VALIDATIONEXTERNAL);
+ if (container != null) {
+ return processValidationExternal(container);
+ }
+ container = root.element(CONTAINER_VALIDATIONEXTERNALTYPE);
+ if (container != null) {
+ return processValidationExternalType(container);
+ }
+ container = root.element(CONTAINER_VALIDATIONEXPRESSION);
+ if (container != null) {
+ return processValidationExpression(container);
+ }
+ return null;
+ }
- private void recurseAll(Metadata metadata, Element root) throws MetaParseException {
- attachResource(metadata, root);
- attachClass(metadata, root);
- attachTable(metadata, root);
- attachUpdate(metadata, root);
- attachUpdateType(metadata, root);
- attachObject(metadata, root);
- attachSearchHelp(metadata, root);
- attachEditMask(metadata, root);
- attachLookup(metadata, root);
- attachLookupType(metadata, root);
- attachValidationLookup(metadata, root);
- attachValidationLookupType(metadata, root);
- attachValidationExternal(metadata, root);
- attachValidationExternalType(metadata, root);
- attachValidationExpression(metadata, root);
- }
+ public Metadata build(Document src) throws MetadataException {
+ Element root = src.getRootElement();
+ if (!root.getName().equals(CONTAINER_ROOT)) {
+ throw new MetadataException("Invalid root element");
+ }
+ Element element = root.element(CONTAINER_SYSTEM);
+ if (element == null) {
+ throw new MetadataException("Missing element " + CONTAINER_SYSTEM);
+ }
+ MSystem sys = processSystem(element);
+ Metadata metadata = new Metadata(sys);
+ recurseAll(metadata, root);
+ metadata.setRawMetaData(src.asXML());
+ return metadata;
+ }
- private void setAttributes(MetaObject obj, String[] columns, String[] data) {
- int count = columns.length;
- if (count > data.length) {
- count = data.length;
- }
- for (int i = 0; i < count; i++) {
- String column = columns[i];
- String datum = data[i];
- if (!datum.equals("")) {
- setAttribute(obj, column, datum);
- }
- }
- }
+ private void recurseAll(Metadata metadata, Element root) throws MetaParseException {
+ attachResource(metadata, root);
+ attachClass(metadata, root);
+ attachTable(metadata, root);
+ attachUpdate(metadata, root);
+ attachUpdateType(metadata, root);
+ attachObject(metadata, root);
+ attachSearchHelp(metadata, root);
+ attachEditMask(metadata, root);
+ attachLookup(metadata, root);
+ attachLookupType(metadata, root);
+ attachValidationLookup(metadata, root);
+ attachValidationLookupType(metadata, root);
+ attachValidationExternal(metadata, root);
+ attachValidationExternalType(metadata, root);
+ attachValidationExpression(metadata, root);
+ }
- private String[] getColumns(Element el) {
- Element cols = el.element(COLUMNS);
- return split(cols);
- }
+ private void setAttributes(MetaObject obj, String[] columns, String[] data) {
+ int count = columns.length;
+ if (count > data.length) {
+ count = data.length;
+ }
+ for (int i = 0; i < count; i++) {
+ String column = columns[i];
+ String datum = data[i];
+ if (!datum.equals("")) {
+ setAttribute(obj, column, datum);
+ }
+ }
+ }
- /** do NOT use string.split() unless your prepared to deal with loss due to token boundary conditions */
- private String[] split(Element el) {
- if( el == null ) return null;
- final String delimiter = "\t";
- StringTokenizer tkn = new StringTokenizer(el.getText(), delimiter, true);
- List list = new LinkedList();
- tkn.nextToken(); // junk the first element
- String last = null;
- while (tkn.hasMoreTokens()) {
- String next = tkn.nextToken();
- if (next.equals(delimiter)) {
- if (last == null) {
- list.add("");
- } else {
- last = null;
- }
- } else {
- list.add(next);
- last = next;
- }
- }
- return (String[]) list.toArray(new String[0]);
- }
+ private String[] getColumns(Element el) {
+ Element cols = el.element(COLUMNS);
+ return split(cols);
+ }
- /**
- * Gets an attribute that is not expected to be null (i.e. an attribute that
- * MUST exist).
- *
- * @param element Element
- * @param name Attribute name
- * @return value of attribute
- * @throws MetaParseException if the value is null.
- */
- private String getNonNullAttribute(Element element, String name) throws MetaParseException {
- String value = element.attributeValue(name);
- if (value == null) {
- throw new MetaParseException("Attribute '" + name + "' not found on tag " + toString(element));
- }
- return value;
- }
+ /**
+ * do NOT use string.split() unless your prepared to deal with loss due to token boundary conditions
+ */
+ private String[] split(Element el) {
+ if (el == null) return null;
+ final String delimiter = "\t";
+ StringTokenizer tkn = new StringTokenizer(el.getText(), delimiter, true);
+ List list = new LinkedList();
+ tkn.nextToken(); // junk the first element
+ String last = null;
+ while (tkn.hasMoreTokens()) {
+ String next = tkn.nextToken();
+ if (next.equals(delimiter)) {
+ if (last == null) {
+ list.add("");
+ } else {
+ last = null;
+ }
+ } else {
+ list.add(next);
+ last = next;
+ }
+ }
+ return (String[]) list.toArray(new String[0]);
+ }
- private String toString(Element element) {
- StringBuffer buffer = new StringBuffer();
- List attributes = element.attributes();
- buffer.append("'").append(element.getName()).append("'");
- buffer.append(", attributes: ").append(attributes);
- return buffer.toString();
- }
+ /**
+ * Gets an attribute that is not expected to be null (i.e. an attribute that
+ * MUST exist).
+ *
+ * @param element Element
+ * @param name Attribute name
+ * @return value of attribute
+ * @throws MetaParseException if the value is null.
+ */
+ private String getNonNullAttribute(Element element, String name) throws MetaParseException {
+ String value = element.attributeValue(name);
+ if (value == null) {
+ throw new MetaParseException("Attribute '" + name + "' not found on tag " + toString(element));
+ }
+ return value;
+ }
- private MSystem processSystem(Element container) {
- Element element = container.element(ELEMENT_SYSTEM);
- MSystem system = buildSystem();
- // system metadata is such a hack. the first one here is by far my favorite
- String comment = container.elementText(MSystem.COMMENTS);
- String systemId = element.attributeValue(MSystem.SYSTEMID);
- String systemDescription = element.attributeValue(MSystem.SYSTEMDESCRIPTION);
- String version = container.attributeValue(MSystem.VERSION);
- String date = container.attributeValue(MSystem.DATE);
- setAttribute(system, MSystem.COMMENTS, comment);
- setAttribute(system, MSystem.SYSTEMID, systemId);
- setAttribute(system, MSystem.SYSTEMDESCRIPTION, systemDescription);
- setAttribute(system, MSystem.VERSION, version);
- setAttribute(system, MSystem.DATE, date);
- return system;
- }
+ private String toString(Element element) {
+ StringBuffer buffer = new StringBuffer();
+ List attributes = element.attributes();
+ buffer.append("'").append(element.getName()).append("'");
+ buffer.append(", attributes: ").append(attributes);
+ return buffer.toString();
+ }
- private void attachResource(Metadata metadata, Element root) {
- MSystem system = metadata.getSystem();
- List containers = root.elements(CONTAINER_RESOURCE);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MResource[] resources = this.processResource(container);
- for (int j = 0; j < resources.length; j++) {
- system.addChild(MetadataType.RESOURCE, resources[j]);
- }
- }
- }
+ private MSystem processSystem(Element container) {
+ Element element = container.element(ELEMENT_SYSTEM);
+ MSystem system = buildSystem();
+ // system metadata is such a hack. the first one here is by far my favorite
+ String comment = container.elementText(MSystem.COMMENTS);
+ String systemId = element.attributeValue(MSystem.SYSTEMID);
+ String systemDescription = element.attributeValue(MSystem.SYSTEMDESCRIPTION);
+ String version = container.attributeValue(MSystem.VERSION);
+ String date = container.attributeValue(MSystem.DATE);
+ setAttribute(system, MSystem.COMMENTS, comment);
+ setAttribute(system, MSystem.SYSTEMID, systemId);
+ setAttribute(system, MSystem.SYSTEMDESCRIPTION, systemDescription);
+ setAttribute(system, MSystem.VERSION, version);
+ setAttribute(system, MSystem.DATE, date);
+ return system;
+ }
- private MResource[] processResource(Element resourceContainer) {
- String[] columns = getColumns(resourceContainer);
- List rows = resourceContainer.elements(DATA);
- MResource[] resources = new MResource[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MResource resource = buildResource();
- setAttributes(resource, columns, data);
- resources[i] = resource;
- }
- return resources;
- }
+ private void attachResource(Metadata metadata, Element root) {
+ MSystem system = metadata.getSystem();
+ List containers = root.elements(CONTAINER_RESOURCE);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MResource[] resources = this.processResource(container);
+ for (int j = 0; j < resources.length; j++) {
+ system.addChild(MetadataType.RESOURCE, resources[j]);
+ }
+ }
+ }
- private void attachClass(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_CLASS);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- String resourceId = getNonNullAttribute(container, ATTRIBUTE_RESOURCE);
- MResource resource = metadata.getResource(resourceId);
- MClass[] classes = processClass(container);
- for (int j = 0; j < classes.length; j++) {
- resource.addChild(MetadataType.CLASS, classes[j]);
- }
- }
- }
+ private MResource[] processResource(Element resourceContainer) {
+ String[] columns = getColumns(resourceContainer);
+ List rows = resourceContainer.elements(DATA);
+ MResource[] resources = new MResource[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MResource resource = buildResource();
+ setAttributes(resource, columns, data);
+ resources[i] = resource;
+ }
+ return resources;
+ }
- private MClass[] processClass(Element classContainer) throws MetaParseException {
- String name = classContainer.getName();
- String resourceId = getNonNullAttribute(classContainer, ATTRIBUTE_RESOURCE);
- LOG.debug("resource name: " + resourceId + " for container " + name);
- String[] columns = getColumns(classContainer);
- List rows = classContainer.elements(DATA);
- MClass[] classes = new MClass[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MClass clazz = buildClass();
- setAttributes(clazz, columns, data);
- classes[i] = clazz;
- }
- return classes;
- }
+ private void attachClass(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_CLASS);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ String resourceId = getNonNullAttribute(container, ATTRIBUTE_RESOURCE);
+ MResource resource = metadata.getResource(resourceId);
+ MClass[] classes = processClass(container);
+ for (int j = 0; j < classes.length; j++) {
+ resource.addChild(MetadataType.CLASS, classes[j]);
+ }
+ }
+ }
- private void attachTable(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_TABLE);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- String resourceId = getNonNullAttribute(container, ATTRIBUTE_RESOURCE);
- String className = getNonNullAttribute(container, ATTRIBUTE_CLASS);
- MClass clazz = metadata.getMClass(resourceId, className);
+ private MClass[] processClass(Element classContainer) throws MetaParseException {
+ String name = classContainer.getName();
+ String resourceId = getNonNullAttribute(classContainer, ATTRIBUTE_RESOURCE);
+ LOG.debug("resource name: " + resourceId + " for container " + name);
+ String[] columns = getColumns(classContainer);
+ List rows = classContainer.elements(DATA);
+ MClass[] classes = new MClass[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MClass clazz = buildClass();
+ setAttributes(clazz, columns, data);
+ classes[i] = clazz;
+ }
+ return classes;
+ }
- if (clazz == null) {
- //MarketLinx Strikes!!!
- LOG.warn("Found table metadata for resource class: " + resourceId + ":" + className
- + " but there is no class metadata for " + resourceId + ":" + className);
- continue;
- }
+ private void attachTable(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_TABLE);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ String resourceId = getNonNullAttribute(container, ATTRIBUTE_RESOURCE);
+ String className = getNonNullAttribute(container, ATTRIBUTE_CLASS);
+ MClass clazz = metadata.getMClass(resourceId, className);
- MTable[] fieldMetadata = processTable(container);
- for (int j = 0; j < fieldMetadata.length; j++) {
- clazz.addChild(MetadataType.TABLE, fieldMetadata[j]);
- }
- }
- }
+ if (clazz == null) {
+ //MarketLinx Strikes!!!
+ LOG.warn("Found table metadata for resource class: " + resourceId + ":" + className
+ + " but there is no class metadata for " + resourceId + ":" + className);
+ continue;
+ }
- private MTable[] processTable(Element tableContainer) {
- String[] columns = getColumns(tableContainer);
- List rows = tableContainer.elements(DATA);
- MTable[] fieldMetadata = new MTable[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MTable mTable = buildTable();
- setAttributes(mTable, columns, data);
- fieldMetadata[i] = mTable;
- }
- return fieldMetadata;
- }
+ MTable[] fieldMetadata = processTable(container);
+ for (int j = 0; j < fieldMetadata.length; j++) {
+ clazz.addChild(MetadataType.TABLE, fieldMetadata[j]);
+ }
+ }
+ }
- private void attachUpdate(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_UPDATE);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MClass parent = metadata.getMClass(getNonNullAttribute(container, ATTRIBUTE_RESOURCE), getNonNullAttribute(
- container, ATTRIBUTE_CLASS));
- MUpdate[] updates = processUpdate(container);
- for (int j = 0; j < updates.length; j++) {
- parent.addChild(MetadataType.UPDATE, updates[j]);
- }
- }
- }
+ private MTable[] processTable(Element tableContainer) {
+ String[] columns = getColumns(tableContainer);
+ List rows = tableContainer.elements(DATA);
+ MTable[] fieldMetadata = new MTable[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MTable mTable = buildTable();
+ setAttributes(mTable, columns, data);
+ fieldMetadata[i] = mTable;
+ }
+ return fieldMetadata;
+ }
- private MUpdate[] processUpdate(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MUpdate[] updates = new MUpdate[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MUpdate update = buildUpdate();
- setAttributes(update, columns, data);
- updates[i] = update;
- }
- return updates;
- }
+ private void attachUpdate(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_UPDATE);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MClass parent = metadata.getMClass(getNonNullAttribute(container, ATTRIBUTE_RESOURCE), getNonNullAttribute(
+ container, ATTRIBUTE_CLASS));
+ MUpdate[] updates = processUpdate(container);
+ for (int j = 0; j < updates.length; j++) {
+ parent.addChild(MetadataType.UPDATE, updates[j]);
+ }
+ }
+ }
- private void attachUpdateType(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_UPDATETYPE);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MUpdate parent = metadata.getUpdate(getNonNullAttribute(container, ATTRIBUTE_RESOURCE),
- getNonNullAttribute(container, ATTRIBUTE_CLASS), getNonNullAttribute(container, ATTRIBUTE_UPDATE));
- MUpdateType[] updateTypes = processUpdateType(container);
- for (int j = 0; j < updateTypes.length; j++) {
- parent.addChild(MetadataType.UPDATE_TYPE, updateTypes[j]);
- }
- }
- }
+ private MUpdate[] processUpdate(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MUpdate[] updates = new MUpdate[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MUpdate update = buildUpdate();
+ setAttributes(update, columns, data);
+ updates[i] = update;
+ }
+ return updates;
+ }
- private MUpdateType[] processUpdateType(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MUpdateType[] updateTypes = new MUpdateType[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MUpdateType updateType = buildUpdateType();
- setAttributes(updateType, columns, data);
- updateTypes[i] = updateType;
- }
- return updateTypes;
- }
+ private void attachUpdateType(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_UPDATETYPE);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MUpdate parent = metadata.getUpdate(getNonNullAttribute(container, ATTRIBUTE_RESOURCE),
+ getNonNullAttribute(container, ATTRIBUTE_CLASS), getNonNullAttribute(container, ATTRIBUTE_UPDATE));
+ MUpdateType[] updateTypes = processUpdateType(container);
+ for (int j = 0; j < updateTypes.length; j++) {
+ parent.addChild(MetadataType.UPDATE_TYPE, updateTypes[j]);
+ }
+ }
+ }
- private void attachObject(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_OBJECT);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
- MObject[] objects = processObject(container);
- for (int j = 0; j < objects.length; j++) {
- parent.addChild(MetadataType.OBJECT, objects[j]);
- }
- }
- }
+ private MUpdateType[] processUpdateType(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MUpdateType[] updateTypes = new MUpdateType[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MUpdateType updateType = buildUpdateType();
+ setAttributes(updateType, columns, data);
+ updateTypes[i] = updateType;
+ }
+ return updateTypes;
+ }
- private MObject[] processObject(Element objectContainer) {
- String[] columns = getColumns(objectContainer);
- List rows = objectContainer.elements(DATA);
- MObject[] objects = new MObject[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MObject object = buildObject();
- setAttributes(object, columns, data);
- objects[i] = object;
- }
- return objects;
- }
+ private void attachObject(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_OBJECT);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
+ MObject[] objects = processObject(container);
+ for (int j = 0; j < objects.length; j++) {
+ parent.addChild(MetadataType.OBJECT, objects[j]);
+ }
+ }
+ }
- private void attachSearchHelp(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_SEARCHHELP);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
- MSearchHelp[] searchHelps = processSearchHelp(container);
- for (int j = 0; j < searchHelps.length; j++) {
- parent.addChild(MetadataType.SEARCH_HELP, searchHelps[j]);
- }
- }
- }
+ private MObject[] processObject(Element objectContainer) {
+ String[] columns = getColumns(objectContainer);
+ List rows = objectContainer.elements(DATA);
+ MObject[] objects = new MObject[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MObject object = buildObject();
+ setAttributes(object, columns, data);
+ objects[i] = object;
+ }
+ return objects;
+ }
- private MSearchHelp[] processSearchHelp(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MSearchHelp[] searchHelps = new MSearchHelp[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MSearchHelp searchHelp = buildSearchHelp();
- setAttributes(searchHelp, columns, data);
- searchHelps[i] = searchHelp;
- }
- return searchHelps;
- }
+ private void attachSearchHelp(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_SEARCHHELP);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
+ MSearchHelp[] searchHelps = processSearchHelp(container);
+ for (int j = 0; j < searchHelps.length; j++) {
+ parent.addChild(MetadataType.SEARCH_HELP, searchHelps[j]);
+ }
+ }
+ }
- private void attachEditMask(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_EDITMASK);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
- MEditMask[] editMasks = processEditMask(container);
- for (int j = 0; j < editMasks.length; j++) {
- parent.addChild(MetadataType.EDITMASK, editMasks[j]);
- }
- }
- }
+ private MSearchHelp[] processSearchHelp(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MSearchHelp[] searchHelps = new MSearchHelp[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MSearchHelp searchHelp = buildSearchHelp();
+ setAttributes(searchHelp, columns, data);
+ searchHelps[i] = searchHelp;
+ }
+ return searchHelps;
+ }
- private MEditMask[] processEditMask(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MEditMask[] editMasks = new MEditMask[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MEditMask editMask = buildEditMask();
- setAttributes(editMask, columns, data);
- editMasks[i] = editMask;
- }
- return editMasks;
- }
+ private void attachEditMask(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_EDITMASK);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
+ MEditMask[] editMasks = processEditMask(container);
+ for (int j = 0; j < editMasks.length; j++) {
+ parent.addChild(MetadataType.EDITMASK, editMasks[j]);
+ }
+ }
+ }
- private void attachLookup(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_LOOKUP);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
- MLookup[] lookups = processLookup(container);
- for (int j = 0; j < lookups.length; j++) {
- parent.addChild(MetadataType.LOOKUP, lookups[j]);
- }
- }
- }
+ private MEditMask[] processEditMask(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MEditMask[] editMasks = new MEditMask[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MEditMask editMask = buildEditMask();
+ setAttributes(editMask, columns, data);
+ editMasks[i] = editMask;
+ }
+ return editMasks;
+ }
- private MLookup[] processLookup(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MLookup[] lookups = new MLookup[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MLookup lookup = buildLookup();
- setAttributes(lookup, columns, data);
- lookups[i] = lookup;
- }
- return lookups;
- }
+ private void attachLookup(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_LOOKUP);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
+ MLookup[] lookups = processLookup(container);
+ for (int j = 0; j < lookups.length; j++) {
+ parent.addChild(MetadataType.LOOKUP, lookups[j]);
+ }
+ }
+ }
- private void attachLookupType(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_LOOKUPTYPE);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MLookup parent = metadata.getLookup(getNonNullAttribute(container, ATTRIBUTE_RESOURCE),
- getNonNullAttribute(container, ATTRIBUTE_LOOKUP));
+ private MLookup[] processLookup(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MLookup[] lookups = new MLookup[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MLookup lookup = buildLookup();
+ setAttributes(lookup, columns, data);
+ lookups[i] = lookup;
+ }
+ return lookups;
+ }
- if (parent == null) {
- LOG.warn("Skipping lookup type: could not find lookup for tag " + toString(container));
- continue;
- }
+ private void attachLookupType(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_LOOKUPTYPE);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MLookup parent = metadata.getLookup(getNonNullAttribute(container, ATTRIBUTE_RESOURCE),
+ getNonNullAttribute(container, ATTRIBUTE_LOOKUP));
- MLookupType[] lookupTypes = processLookupType(container);
- for (int j = 0; j < lookupTypes.length; j++) {
- parent.addChild(MetadataType.LOOKUP_TYPE, lookupTypes[j]);
- }
- }
- }
+ if (parent == null) {
+ LOG.warn("Skipping lookup type: could not find lookup for tag " + toString(container));
+ continue;
+ }
- private MLookupType[] processLookupType(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MLookupType[] lookupTypes = new MLookupType[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MLookupType lookupType = buildLookupType();
- setAttributes(lookupType, columns, data);
- lookupTypes[i] = lookupType;
- }
- return lookupTypes;
- }
+ MLookupType[] lookupTypes = processLookupType(container);
+ for (int j = 0; j < lookupTypes.length; j++) {
+ parent.addChild(MetadataType.LOOKUP_TYPE, lookupTypes[j]);
+ }
+ }
+ }
- private void attachValidationLookup(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_VALIDATIONLOOKUP);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
- MValidationLookup[] validationLookups = processValidationLookup(container);
- for (int j = 0; j < validationLookups.length; j++) {
- parent.addChild(MetadataType.VALIDATION_LOOKUP, validationLookups[j]);
- }
- }
- }
+ private MLookupType[] processLookupType(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MLookupType[] lookupTypes = new MLookupType[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MLookupType lookupType = buildLookupType();
+ setAttributes(lookupType, columns, data);
+ lookupTypes[i] = lookupType;
+ }
+ return lookupTypes;
+ }
- private MValidationLookup[] processValidationLookup(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MValidationLookup[] validationLookups = new MValidationLookup[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MValidationLookup validationLookup = buildValidationLookup();
- setAttributes(validationLookup, columns, data);
- validationLookups[i] = validationLookup;
- }
- return validationLookups;
- }
+ private void attachValidationLookup(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_VALIDATIONLOOKUP);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
+ MValidationLookup[] validationLookups = processValidationLookup(container);
+ for (int j = 0; j < validationLookups.length; j++) {
+ parent.addChild(MetadataType.VALIDATION_LOOKUP, validationLookups[j]);
+ }
+ }
+ }
- private void attachValidationLookupType(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_VALIDATIONLOOKUPTYPE);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MValidationLookup parent = metadata.getValidationLookup(getNonNullAttribute(container, ATTRIBUTE_RESOURCE),
- getNonNullAttribute(container, ATTRIBUTE_VALIDATIONLOOKUP));
- MValidationLookupType[] validationLookupTypes = processValidationLookupType(container);
- for (int j = 0; j < validationLookupTypes.length; j++) {
- parent.addChild(MetadataType.VALIDATION_LOOKUP_TYPE, validationLookupTypes[j]);
- }
- }
- }
+ private MValidationLookup[] processValidationLookup(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MValidationLookup[] validationLookups = new MValidationLookup[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MValidationLookup validationLookup = buildValidationLookup();
+ setAttributes(validationLookup, columns, data);
+ validationLookups[i] = validationLookup;
+ }
+ return validationLookups;
+ }
- private MValidationLookupType[] processValidationLookupType(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MValidationLookupType[] validationLookupTypes = new MValidationLookupType[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MValidationLookupType validationLookupType = buildValidationLookupType();
- setAttributes(validationLookupType, columns, data);
- validationLookupTypes[i] = validationLookupType;
- }
- return validationLookupTypes;
- }
+ private void attachValidationLookupType(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_VALIDATIONLOOKUPTYPE);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MValidationLookup parent = metadata.getValidationLookup(getNonNullAttribute(container, ATTRIBUTE_RESOURCE),
+ getNonNullAttribute(container, ATTRIBUTE_VALIDATIONLOOKUP));
+ MValidationLookupType[] validationLookupTypes = processValidationLookupType(container);
+ for (int j = 0; j < validationLookupTypes.length; j++) {
+ parent.addChild(MetadataType.VALIDATION_LOOKUP_TYPE, validationLookupTypes[j]);
+ }
+ }
+ }
- private void attachValidationExternal(Metadata metadata, Element root) {
- List containers = root.elements(CONTAINER_VALIDATIONEXTERNAL);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MResource parent = metadata.getResource(container.attributeValue(ATTRIBUTE_RESOURCE));
- MValidationExternal[] validationExternals = processValidationExternal(container);
- for (int j = 0; j < validationExternals.length; j++) {
- parent.addChild(MetadataType.VALIDATION_EXTERNAL, validationExternals[j]);
- }
- }
- }
+ private MValidationLookupType[] processValidationLookupType(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MValidationLookupType[] validationLookupTypes = new MValidationLookupType[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MValidationLookupType validationLookupType = buildValidationLookupType();
+ setAttributes(validationLookupType, columns, data);
+ validationLookupTypes[i] = validationLookupType;
+ }
+ return validationLookupTypes;
+ }
- private MValidationExternal[] processValidationExternal(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MValidationExternal[] validationExternals = new MValidationExternal[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MValidationExternal validationExternal = buildValidationExternal();
- setAttributes(validationExternal, columns, data);
- validationExternals[i] = validationExternal;
- }
- return validationExternals;
- }
+ private void attachValidationExternal(Metadata metadata, Element root) {
+ List containers = root.elements(CONTAINER_VALIDATIONEXTERNAL);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MResource parent = metadata.getResource(container.attributeValue(ATTRIBUTE_RESOURCE));
+ MValidationExternal[] validationExternals = processValidationExternal(container);
+ for (int j = 0; j < validationExternals.length; j++) {
+ parent.addChild(MetadataType.VALIDATION_EXTERNAL, validationExternals[j]);
+ }
+ }
+ }
- private void attachValidationExternalType(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_VALIDATIONEXTERNALTYPE);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MValidationExternal parent = metadata.getValidationExternal(getNonNullAttribute(container,
- ATTRIBUTE_RESOURCE), getNonNullAttribute(container, ATTRIBUTE_VALIDATIONEXTERNAL));
- MValidationExternalType[] validationExternalTypes = processValidationExternalType(container);
- for (int j = 0; j < validationExternalTypes.length; j++) {
- parent.addChild(MetadataType.VALIDATION_EXTERNAL_TYPE, validationExternalTypes[j]);
- }
- }
- }
+ private MValidationExternal[] processValidationExternal(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MValidationExternal[] validationExternals = new MValidationExternal[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MValidationExternal validationExternal = buildValidationExternal();
+ setAttributes(validationExternal, columns, data);
+ validationExternals[i] = validationExternal;
+ }
+ return validationExternals;
+ }
- private MValidationExternalType[] processValidationExternalType(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MValidationExternalType[] validationExternalTypes = new MValidationExternalType[rows.size()];
- for (int i = 0; i < rows.size(); i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MValidationExternalType validationExternalType = buildValidationExternalType();
- setAttributes(validationExternalType, columns, data);
- validationExternalTypes[i] = validationExternalType;
- }
- return validationExternalTypes;
- }
+ private void attachValidationExternalType(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_VALIDATIONEXTERNALTYPE);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MValidationExternal parent = metadata.getValidationExternal(getNonNullAttribute(container,
+ ATTRIBUTE_RESOURCE), getNonNullAttribute(container, ATTRIBUTE_VALIDATIONEXTERNAL));
+ MValidationExternalType[] validationExternalTypes = processValidationExternalType(container);
+ for (int j = 0; j < validationExternalTypes.length; j++) {
+ parent.addChild(MetadataType.VALIDATION_EXTERNAL_TYPE, validationExternalTypes[j]);
+ }
+ }
+ }
- private void attachValidationExpression(Metadata metadata, Element root) throws MetaParseException {
- List containers = root.elements(CONTAINER_VALIDATIONEXPRESSION);
- for (int i = 0; i < containers.size(); i++) {
- Element container = (Element) containers.get(i);
- MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
- MValidationExpression[] expressions = processValidationExpression(container);
- for (int j = 0; j < expressions.length; j++) {
- parent.addChild(MetadataType.VALIDATION_EXPRESSION, expressions[j]);
- }
- }
- }
+ private MValidationExternalType[] processValidationExternalType(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MValidationExternalType[] validationExternalTypes = new MValidationExternalType[rows.size()];
+ for (int i = 0; i < rows.size(); i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MValidationExternalType validationExternalType = buildValidationExternalType();
+ setAttributes(validationExternalType, columns, data);
+ validationExternalTypes[i] = validationExternalType;
+ }
+ return validationExternalTypes;
+ }
- private MValidationExpression[] processValidationExpression(Element container) {
- String[] columns = getColumns(container);
- List rows = container.elements(DATA);
- MValidationExpression[] expressions = new MValidationExpression[rows.size()];
- for (int i = 0; i < expressions.length; i++) {
- Element element = (Element) rows.get(i);
- String[] data = split(element);
- MValidationExpression expression = buildValidationExpression();
- setAttributes(expression, columns, data);
- expressions[i] = expression;
- }
- return expressions;
- }
+ private void attachValidationExpression(Metadata metadata, Element root) throws MetaParseException {
+ List containers = root.elements(CONTAINER_VALIDATIONEXPRESSION);
+ for (int i = 0; i < containers.size(); i++) {
+ Element container = (Element) containers.get(i);
+ MResource parent = metadata.getResource(getNonNullAttribute(container, ATTRIBUTE_RESOURCE));
+ MValidationExpression[] expressions = processValidationExpression(container);
+ for (int j = 0; j < expressions.length; j++) {
+ parent.addChild(MetadataType.VALIDATION_EXPRESSION, expressions[j]);
+ }
+ }
+ }
+
+ private MValidationExpression[] processValidationExpression(Element container) {
+ String[] columns = getColumns(container);
+ List rows = container.elements(DATA);
+ MValidationExpression[] expressions = new MValidationExpression[rows.size()];
+ for (int i = 0; i < expressions.length; i++) {
+ Element element = (Element) rows.get(i);
+ String[] data = split(element);
+ MValidationExpression expression = buildValidationExpression();
+ setAttributes(expression, columns, data);
+ expressions[i] = expression;
+ }
+ return expressions;
+ }
}
diff --git a/client/src/main/java/com/ossez/usreio/tests/common/metadata/JDomStandardBuilder.java b/client/src/main/java/com/ossez/usreio/tests/common/metadata/JDomStandardBuilder.java
index 7fd0d3c..2bc11ce 100644
--- a/client/src/main/java/com/ossez/usreio/tests/common/metadata/JDomStandardBuilder.java
+++ b/client/src/main/java/com/ossez/usreio/tests/common/metadata/JDomStandardBuilder.java
@@ -34,595 +34,607 @@ import com.ossez.usreio.tests.common.metadata.types.MValidationLookupType;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.Element;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-/** Parses apart a complete Standard-XML response, returns a Metadata object */
+/**
+ * Parses apart a complete Standard-XML response, returns a Metadata object
+ */
public class JDomStandardBuilder extends MetadataBuilder {
- public static final String ELEMENT_SYSTEM = "System";
- public static final String ELEMENT_RESOURCE = "Resource";
- public static final String ELEMENT_FOREIGNKEY = "ForeignKey";
- public static final String ELEMENT_CLASS = "Class";
- public static final String ELEMENT_TABLE = "Field";
- public static final String ELEMENT_UPDATE = "UpdateType";
- public static final String ELEMENT_UPDATETYPE = "UpdateField";
- public static final String ELEMENT_OBJECT = "Object";
- public static final String ELEMENT_SEARCHHELP = "SearchHelp";
- public static final String ELEMENT_EDITMASK = "EditMask";
- public static final String ELEMENT_UPDATEHELP = "UpdateHelp";
- public static final String ELEMENT_LOOKUP = "Lookup";
- public static final String ELEMENT_LOOKUPTYPE = "LookupType";
- public static final String ELEMENT_VALIDATIONLOOKUP = "ValidationLookup";
- public static final String ELEMENT_VALIDATIONLOOKUPTYPE = "ValidationLookupType";
- public static final String ELEMENT_VALIDATIONEXPRESSION = "ValidationExpression";
- public static final String ELEMENT_VALIDATIONEXTERNAL = "ValidationExternalType";
- public static final String ELEMENT_VALIDATIONEXTERNALTYPE = "ValidationExternal";
- public static final String ATTRIBUTE_RESOURCEID = ELEMENT_RESOURCE;
- public static final String ATTRIBUTE_CLASSNAME = ELEMENT_CLASS;
- public static final String ATTRIBUTE_UPDATE = ELEMENT_UPDATE;
- public static final String ATTRIBUTE_LOOKUP = ELEMENT_LOOKUP;
- public static final String ATTRIBUTE_VALIDATIONLOOKUP = ELEMENT_VALIDATIONLOOKUP;
- public static final String ATTRIBUTE_VALIDATIONEXTERNAL = ELEMENT_VALIDATIONEXTERNAL;
- public static final Map sType2Element = new HashMap();
- static {
- sType2Element.put(MetadataType.SYSTEM, ELEMENT_SYSTEM);
- sType2Element.put(MetadataType.RESOURCE, ELEMENT_RESOURCE);
- sType2Element.put(MetadataType.FOREIGNKEYS, ELEMENT_FOREIGNKEY);
- sType2Element.put(MetadataType.CLASS, ELEMENT_CLASS);
- sType2Element.put(MetadataType.TABLE, ELEMENT_TABLE);
- sType2Element.put(MetadataType.UPDATE, ELEMENT_UPDATE);
- sType2Element.put(MetadataType.UPDATE_TYPE, ELEMENT_UPDATETYPE);
- sType2Element.put(MetadataType.SEARCH_HELP, ELEMENT_SEARCHHELP);
- sType2Element.put(MetadataType.EDITMASK, ELEMENT_EDITMASK);
- sType2Element.put(MetadataType.UPDATE_HELP, ELEMENT_UPDATEHELP);
- sType2Element.put(MetadataType.LOOKUP, ELEMENT_LOOKUP);
- sType2Element.put(MetadataType.LOOKUP_TYPE, ELEMENT_LOOKUPTYPE);
- sType2Element.put(MetadataType.VALIDATION_LOOKUP, ELEMENT_VALIDATIONLOOKUP);
- sType2Element.put(MetadataType.VALIDATION_LOOKUP_TYPE, ELEMENT_VALIDATIONLOOKUPTYPE);
- sType2Element.put(MetadataType.VALIDATION_EXTERNAL, ELEMENT_VALIDATIONEXTERNAL);
- sType2Element.put(MetadataType.VALIDATION_EXTERNAL_TYPE, ELEMENT_VALIDATIONEXTERNALTYPE);
- sType2Element.put(MetadataType.VALIDATION_EXPRESSION, ELEMENT_VALIDATIONEXPRESSION);
- }
+ private final static Logger log = LoggerFactory.getLogger(JDomStandardBuilder.class);
- @Override
- public Metadata doBuild(Object src) throws MetadataException {
- return build((Document) src);
- }
+ public static final String ELEMENT_SYSTEM = "System";
+ public static final String ELEMENT_RESOURCE = "Resource";
+ public static final String ELEMENT_FOREIGNKEY = "ForeignKey";
+ public static final String ELEMENT_CLASS = "Class";
+ public static final String ELEMENT_TABLE = "Field";
+ public static final String ELEMENT_UPDATE = "UpdateType";
+ public static final String ELEMENT_UPDATETYPE = "UpdateField";
+ public static final String ELEMENT_OBJECT = "Object";
+ public static final String ELEMENT_SEARCHHELP = "SearchHelp";
+ public static final String ELEMENT_EDITMASK = "EditMask";
+ public static final String ELEMENT_UPDATEHELP = "UpdateHelp";
+ public static final String ELEMENT_LOOKUP = "Lookup";
+ public static final String ELEMENT_LOOKUPTYPE = "LookupType";
+ public static final String ELEMENT_VALIDATIONLOOKUP = "ValidationLookup";
+ public static final String ELEMENT_VALIDATIONLOOKUPTYPE = "ValidationLookupType";
+ public static final String ELEMENT_VALIDATIONEXPRESSION = "ValidationExpression";
+ public static final String ELEMENT_VALIDATIONEXTERNAL = "ValidationExternalType";
+ public static final String ELEMENT_VALIDATIONEXTERNALTYPE = "ValidationExternal";
+ public static final String ATTRIBUTE_RESOURCEID = ELEMENT_RESOURCE;
+ public static final String ATTRIBUTE_CLASSNAME = ELEMENT_CLASS;
+ public static final String ATTRIBUTE_UPDATE = ELEMENT_UPDATE;
+ public static final String ATTRIBUTE_LOOKUP = ELEMENT_LOOKUP;
+ public static final String ATTRIBUTE_VALIDATIONLOOKUP = ELEMENT_VALIDATIONLOOKUP;
+ public static final String ATTRIBUTE_VALIDATIONEXTERNAL = ELEMENT_VALIDATIONEXTERNAL;
+ public static final Map sType2Element = new HashMap();
- public Metadata build(Document src) throws MetadataException {
- Element element = src.getRootElement();
- expectElement(element, CONTAINER_ROOT);
- element = getElement(element, CONTAINER_METADATA);
- return build(element);
- }
+ static {
+ sType2Element.put(MetadataType.SYSTEM, ELEMENT_SYSTEM);
+ sType2Element.put(MetadataType.RESOURCE, ELEMENT_RESOURCE);
+ sType2Element.put(MetadataType.FOREIGNKEYS, ELEMENT_FOREIGNKEY);
+ sType2Element.put(MetadataType.CLASS, ELEMENT_CLASS);
+ sType2Element.put(MetadataType.TABLE, ELEMENT_TABLE);
+ sType2Element.put(MetadataType.UPDATE, ELEMENT_UPDATE);
+ sType2Element.put(MetadataType.UPDATE_TYPE, ELEMENT_UPDATETYPE);
+ sType2Element.put(MetadataType.SEARCH_HELP, ELEMENT_SEARCHHELP);
+ sType2Element.put(MetadataType.EDITMASK, ELEMENT_EDITMASK);
+ sType2Element.put(MetadataType.UPDATE_HELP, ELEMENT_UPDATEHELP);
+ sType2Element.put(MetadataType.LOOKUP, ELEMENT_LOOKUP);
+ sType2Element.put(MetadataType.LOOKUP_TYPE, ELEMENT_LOOKUPTYPE);
+ sType2Element.put(MetadataType.VALIDATION_LOOKUP, ELEMENT_VALIDATIONLOOKUP);
+ sType2Element.put(MetadataType.VALIDATION_LOOKUP_TYPE, ELEMENT_VALIDATIONLOOKUPTYPE);
+ sType2Element.put(MetadataType.VALIDATION_EXTERNAL, ELEMENT_VALIDATIONEXTERNAL);
+ sType2Element.put(MetadataType.VALIDATION_EXTERNAL_TYPE, ELEMENT_VALIDATIONEXTERNALTYPE);
+ sType2Element.put(MetadataType.VALIDATION_EXPRESSION, ELEMENT_VALIDATIONEXPRESSION);
+ }
- @Override
- public MetaObject[] parse(Object src) throws MetadataException {
- return parse((Document) src);
- }
+ @Override
+ public Metadata doBuild(Object src) throws MetadataException {
+ log.info("Rets Meta Data JDomStandardBuilder");
+ return build((Document) src);
+ }
- public MetaObject[] parse(Document src) throws MetadataException {
- Element element = src.getRootElement();
- expectElement(element, CONTAINER_ROOT);
- Element container = getElement(element, CONTAINER_METADATA);
- boolean recurse = checkForRecursion(container);
- List list = container.elements();
- if (list.size() == 0) {
- return null;
- }
- return processContainer(null, (Element) list.get(0), recurse);
- }
+ public Metadata build(Document src) throws MetadataException {
+ Element element = src.getRootElement();
+ expectElement(element, CONTAINER_ROOT);
+ element = getElement(element, CONTAINER_METADATA);
- /**
- * Function to determine if a request contains recursive data or not.
- * This is done here instead of inside processContainer because, well,
- * it's easier and more reliable (processContainer might not figure out
- * that a request is recursive until the third or 4th child if there are
- * no children for the first couple of elements.
- *
- * @param top The outside METADATA container.
- * @return true if the request is recursive
- *
- */
- private boolean checkForRecursion(Element top) {
- /*
- * this seems like a really nasty loop. However, if there are a
- * lot of recursive elements, we'll find out pretty quickly, and if
- * we fall all the way to the end then there probably wasn't that
- * much to look through.
- */
- Iterator children = top.elements().iterator();
- while (children.hasNext()) {
- /* each of these is a container (METADATA-*) type */
- Element element = (Element) children.next();
- Iterator iterator = element.elements().iterator();
- while (iterator.hasNext()) {
- /* each of these is an item element */
- Element child = (Element) iterator.next();
- Iterator subtypes = child.elements().iterator();
- while (subtypes.hasNext()) {
- Element subtype = (Element) subtypes.next();
- if (subtype.getName().startsWith(CONTAINER_PREFIX)) {
- return true;
- }
- }
- }
- }
- return false;
- }
+ // Set return MetaData
+ Metadata metadata = build(element);
+ metadata.setRawMetaData(src.asXML());
+ return metadata;
+ }
- private MetaObject[] processContainer(MetaObject parent, Element container, boolean recursion) {
- MetadataType type = (MetadataType) sContainer2Type.get(container.getName());
- if (type == null) {
- throw new RuntimeException("no matching type for container " + container.getName());
- }
- List elements = container.elements((String) sType2Element.get(type));
- String path = getPath(container);
- List output = null;
- if (parent == null) {
- output = new LinkedList();
- }
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MetaObject obj = newType(type);
- setAttributes(obj, element);
- if (output != null) {
- output.add(obj);
- }
- if (parent != null) {
- parent.addChild(type, obj);
- } else {
- /**
- * Weirdness abounds. There IS an ID attribute of System,
- * and the SystemID is included in the Metadata container
- * attributes, but the system id is not part of the metadata
- * request path for a getMetadata request, so we ignore it.
- */
- if (!type.equals(MetadataType.SYSTEM)) {
- obj.setPath(path);
- }
- }
- if (recursion) {
- MetadataType[] childTypes = obj.getChildTypes();
- for (int j = 0; j < childTypes.length; j++) {
- MetadataType childType = childTypes[j];
- Element childContainer = element.element(CONTAINER_PREFIX + childType.name());
- if (childContainer == null) {
- obj.addChild(childType, null);
- } else {
- processContainer(obj, childContainer, true);
- }
- }
- }
- }
- if (output == null) {
- return null;
- }
- return (MetaObject[]) output.toArray(new MetaObject[0]);
- }
+ @Override
+ public MetaObject[] parse(Object src) throws MetadataException {
+ return parse((Document) src);
+ }
- String getPath(Element container) {
- String resource = container.attributeValue(ATTRIBUTE_RESOURCEID);
- if (resource == null) {
- return null;
- }
- String classname = container.attributeValue(ATTRIBUTE_CLASSNAME);
- if (classname != null) {
- String update = container.attributeValue(ATTRIBUTE_UPDATE);
- if (update != null) {
- return resource + ":" + classname + ":" + update;
- }
- return resource + ":" + classname;
- }
- String lookup = container.attributeValue(ATTRIBUTE_LOOKUP);
- if (lookup != null) {
- return resource + ":" + lookup;
- }
- String vallkp = container.attributeValue(ATTRIBUTE_VALIDATIONLOOKUP);
- if (vallkp != null) {
- return resource + ":" + vallkp;
- }
- String vale = container.attributeValue(ATTRIBUTE_VALIDATIONEXTERNAL);
- if (vale != null) {
- return resource + ":" + vale;
- }
- return resource;
- }
+ public MetaObject[] parse(Document src) throws MetadataException {
+ Element element = src.getRootElement();
+ expectElement(element, CONTAINER_ROOT);
+ Element container = getElement(element, CONTAINER_METADATA);
+ boolean recurse = checkForRecursion(container);
+ List list = container.elements();
+ if (list.size() == 0) {
+ return null;
+ }
+ return processContainer(null, (Element) list.get(0), recurse);
+ }
- public Metadata build(Element element) throws MetadataException {
- expectElement(element, CONTAINER_METADATA);
- element = getElement(element, CONTAINER_SYSTEM);
- //maybe i get the attribute here
- MSystem sys = processSystem(element);
- return new Metadata(sys);
- }
+ /**
+ * Function to determine if a request contains recursive data or not.
+ * This is done here instead of inside processContainer because, well,
+ * it's easier and more reliable (processContainer might not figure out
+ * that a request is recursive until the third or 4th child if there are
+ * no children for the first couple of elements.
+ *
+ * @param top The outside METADATA container.
+ * @return true if the request is recursive
+ */
+ private boolean checkForRecursion(Element top) {
+ /*
+ * this seems like a really nasty loop. However, if there are a
+ * lot of recursive elements, we'll find out pretty quickly, and if
+ * we fall all the way to the end then there probably wasn't that
+ * much to look through.
+ */
+ Iterator children = top.elements().iterator();
+ while (children.hasNext()) {
+ /* each of these is a container (METADATA-*) type */
+ Element element = (Element) children.next();
+ Iterator iterator = element.elements().iterator();
+ while (iterator.hasNext()) {
+ /* each of these is an item element */
+ Element child = (Element) iterator.next();
+ Iterator subtypes = child.elements().iterator();
+ while (subtypes.hasNext()) {
+ Element subtype = (Element) subtypes.next();
+ if (subtype.getName().startsWith(CONTAINER_PREFIX)) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
- private Element getElement(Element parent, String type) throws MetadataException {
- Element element = parent.element(type);
- if (element == null) {
- throw new MetadataException("Missing element " + type);
- }
- return element;
- }
+ private MetaObject[] processContainer(MetaObject parent, Element container, boolean recursion) {
+ MetadataType type = (MetadataType) sContainer2Type.get(container.getName());
+ if (type == null) {
+ throw new RuntimeException("no matching type for container " + container.getName());
+ }
+ List elements = container.elements((String) sType2Element.get(type));
+ String path = getPath(container);
+ List output = null;
+ if (parent == null) {
+ output = new LinkedList();
+ }
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MetaObject obj = newType(type);
+ setAttributes(obj, element);
+ if (output != null) {
+ output.add(obj);
+ }
+ if (parent != null) {
+ parent.addChild(type, obj);
+ } else {
+ /**
+ * Weirdness abounds. There IS an ID attribute of System,
+ * and the SystemID is included in the Metadata container
+ * attributes, but the system id is not part of the metadata
+ * request path for a getMetadata request, so we ignore it.
+ */
+ if (!type.equals(MetadataType.SYSTEM)) {
+ obj.setPath(path);
+ }
+ }
+ if (recursion) {
+ MetadataType[] childTypes = obj.getChildTypes();
+ for (int j = 0; j < childTypes.length; j++) {
+ MetadataType childType = childTypes[j];
+ Element childContainer = element.element(CONTAINER_PREFIX + childType.name());
+ if (childContainer == null) {
+ obj.addChild(childType, null);
+ } else {
+ processContainer(obj, childContainer, true);
+ }
+ }
+ }
+ }
+ if (output == null) {
+ return null;
+ }
+ return (MetaObject[]) output.toArray(new MetaObject[0]);
+ }
-
- private void expectElement(Element element, String type) throws MetadataException {
- if (!element.getName().equalsIgnoreCase(type)) {// changed to ignore case
- throw new MetadataException("Expecting element " + type + ", got " + element.getName());
- }
- }
+ String getPath(Element container) {
+ String resource = container.attributeValue(ATTRIBUTE_RESOURCEID);
+ if (resource == null) {
+ return null;
+ }
+ String classname = container.attributeValue(ATTRIBUTE_CLASSNAME);
+ if (classname != null) {
+ String update = container.attributeValue(ATTRIBUTE_UPDATE);
+ if (update != null) {
+ return resource + ":" + classname + ":" + update;
+ }
+ return resource + ":" + classname;
+ }
+ String lookup = container.attributeValue(ATTRIBUTE_LOOKUP);
+ if (lookup != null) {
+ return resource + ":" + lookup;
+ }
+ String vallkp = container.attributeValue(ATTRIBUTE_VALIDATIONLOOKUP);
+ if (vallkp != null) {
+ return resource + ":" + vallkp;
+ }
+ String vale = container.attributeValue(ATTRIBUTE_VALIDATIONEXTERNAL);
+ if (vale != null) {
+ return resource + ":" + vale;
+ }
+ return resource;
+ }
- private void setAttributes(MetaObject obj, Element el) {
+ public Metadata build(Element element) throws MetadataException {
+ expectElement(element, CONTAINER_METADATA);
+ element = getElement(element, CONTAINER_SYSTEM);
+ //maybe i get the attribute here
+ MSystem sys = processSystem(element);
+ return new Metadata(sys);
+ }
- List children = el.elements();
- for (int i = 0; i < children.size(); i++) {
- Element child = (Element) children.get(i);
- String name = child.getName();
- if (!name.startsWith(CONTAINER_PREFIX)) {
- String value = child.getTextTrim();
- setAttribute(obj, name, value);
- } else {
- // LOG.info("skipping container element " + name);
- }
- }
- }
-
- //when atrributes from the xml element are needed
- public void setAttributesFromXMLAttr(MetaObject obj, Element el) {
-
- Iterator attrIter = el.getParent().attributes().iterator();
-
- while(attrIter.hasNext()){
- Attribute attr = (Attribute) attrIter.next();
- String name = attr.getName();
- String value= attr.getValue().trim();
- setAttribute(obj, name, value);
- }
- }
-
+ private Element getElement(Element parent, String type) throws MetadataException {
+ Element element = parent.element(type);
+ if (element == null) {
+ throw new MetadataException("Missing element " + type);
+ }
+ return element;
+ }
- /**
- * If we're a recursive request, initialize all possible child types so
- * we don't have to try to pull them later, dynamically
- */
- private void init(MetaObject item) {
- MetadataType[] childTypes = item.getChildTypes();
- for (int i = 0; i < childTypes.length; i++) {
- MetadataType type = childTypes[i];
- item.addChild(type, null);
- }
- }
- private MSystem processSystem(Element container) {
- Element element = container.element(ELEMENT_SYSTEM);
- if (element == null){
- element = container.element(ELEMENT_SYSTEM.toUpperCase());
- }
- MSystem system = buildSystem();
- init(system);
- setAttributesFromXMLAttr(system, element);
- setAttributes(system, element);
- Element child;
- child = element.element(CONTAINER_RESOURCE);
- if (child != null) {
- processResource(system, child);
- }
- child = element.element(CONTAINER_FOREIGNKEY);
- if (child != null) {
- processForeignKey(system, child);
- }
- return system;
- }
+ private void expectElement(Element element, String type) throws MetadataException {
+ if (!element.getName().equalsIgnoreCase(type)) {// changed to ignore case
+ throw new MetadataException("Expecting element " + type + ", got " + element.getName());
+ }
+ }
- private void processResource(MSystem system, Element container) {
- List resources = container.elements(ELEMENT_RESOURCE);
- for (int i = 0; i < resources.size(); i++) {
- Element element = (Element) resources.get(i);
- MResource resource = buildResource();
- init(resource);
- setAttributes(resource, element);
- system.addChild(MetadataType.RESOURCE, resource);
- Element child;
- child = element.element(CONTAINER_CLASS);
- if (child != null) {
- processClass(resource, child);
- }
- child = element.element(CONTAINER_OBJECT);
- if (child != null) {
- processObject(resource, child);
- }
- child = element.element(CONTAINER_SEARCH_HELP);
- if (child != null) {
- processSearchHelp(resource, child);
- }
- child = element.element(CONTAINER_EDITMASK);
- if (child != null) {
- processEditMask(resource, child);
- }
- child = element.element(CONTAINER_LOOKUP);
- if (child != null) {
- processLookup(resource, child);
- }
- child = element.element(CONTAINER_UPDATEHELP);
- if (child != null) {
- processUpdateHelp(resource, child);
- }
- child = element.element(CONTAINER_VALIDATIONLOOKUP);
- if (child != null) {
- processValidationLookup(resource, child);
- }
- child = element.element(CONTAINER_VALIDATIONEXPRESSION);
- if (child != null) {
- processValidationExpression(resource, child);
- }
- child = element.element(CONTAINER_VALIDATIONEXTERNAL);
- if (child != null) {
- processValidationExternal(resource, child);
- }
- }
- }
+ private void setAttributes(MetaObject obj, Element el) {
- private void processEditMask(MResource parent, Element container) {
- List elements = container.elements(ELEMENT_EDITMASK);
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MEditMask mask = buildEditMask();
- setAttributes(mask, element);
- parent.addChild(MetadataType.EDITMASK, mask);
- }
- }
+ List children = el.elements();
+ for (int i = 0; i < children.size(); i++) {
+ Element child = (Element) children.get(i);
+ String name = child.getName();
+ if (!name.startsWith(CONTAINER_PREFIX)) {
+ String value = child.getTextTrim();
+ setAttribute(obj, name, value);
+ } else {
+ // LOG.info("skipping container element " + name);
+ }
+ }
+ }
- private void processLookup(MResource parent, Element container) {
- List elements15 = container.elements(ELEMENT_LOOKUP);
- List elements17 = container.elements(ELEMENT_LOOKUPTYPE);
- List elements;
- //some Rets Servers have lookuptype and lookup elements interchanged
- if (elements15.isEmpty()){
- elements = elements17;
- } else {
- elements = elements15;
- }
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MLookup lookup = buildLookup();
- init(lookup);
- setAttributes(lookup, element);
- parent.addChild(MetadataType.LOOKUP, lookup);
- Element child = element.element(CONTAINER_LOOKUPTYPE);
- if (child != null) {
- processLookupType(lookup, child);
- }
- }
- }
-
- private void processLookupType(MLookup parent, Element container) {
-
- List elements15 = container.elements(ELEMENT_LOOKUPTYPE);// check spec
- List elements17 = container.elements(ELEMENT_LOOKUP);
- List elements;
- //some Rets Servers have lookuptype and lookup elements interchanged
- if (elements15.isEmpty()){
- elements = elements17;
- } else {
- elements = elements15;
- }
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MLookupType type = buildLookupType();
- setAttributes(type, element);
- parent.addChild(MetadataType.LOOKUP_TYPE, type);
- }
- }
+ //when atrributes from the xml element are needed
+ public void setAttributesFromXMLAttr(MetaObject obj, Element el) {
- private void processUpdateHelp(MResource parent, Element container) {
- List elements = container.elements(ELEMENT_UPDATEHELP);
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MUpdateHelp help = buildUpdateHelp();
- setAttributes(help, element);
- parent.addChild(MetadataType.UPDATE_HELP, help);
- }
- }
+ Iterator attrIter = el.getParent().attributes().iterator();
- private void processValidationLookup(MResource parent, Element container) {
- List elements = container.elements(ELEMENT_VALIDATIONLOOKUP);
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MValidationLookup lookup = buildValidationLookup();
- init(lookup);
- setAttributes(lookup, element);
- parent.addChild(MetadataType.VALIDATION_LOOKUP, lookup);
- Element child = element.element(CONTAINER_VALIDATIONLOOKUPTYPE);
- if (child != null) {
- processValidationLookupType(lookup, child);
- }
- }
- }
+ while (attrIter.hasNext()) {
+ Attribute attr = (Attribute) attrIter.next();
+ String name = attr.getName();
+ String value = attr.getValue().trim();
+ setAttribute(obj, name, value);
+ }
+ }
- private void processValidationLookupType(MValidationLookup parent, Element container) {
- List elements = container.elements(ELEMENT_VALIDATIONLOOKUPTYPE);
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MValidationLookupType lookupType = buildValidationLookupType();
- setAttributes(lookupType, element);
- parent.addChild(MetadataType.VALIDATION_LOOKUP_TYPE, lookupType);
- }
- }
- private void processValidationExpression(MResource parent, Element container) {
- List elements = container.elements(ELEMENT_VALIDATIONEXPRESSION);
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MValidationExpression expression = buildValidationExpression();
- setAttributes(expression, element);
- parent.addChild(MetadataType.VALIDATION_EXPRESSION, expression);
- }
- }
+ /**
+ * If we're a recursive request, initialize all possible child types so
+ * we don't have to try to pull them later, dynamically
+ */
+ private void init(MetaObject item) {
+ MetadataType[] childTypes = item.getChildTypes();
+ for (int i = 0; i < childTypes.length; i++) {
+ MetadataType type = childTypes[i];
+ item.addChild(type, null);
+ }
+ }
- private void processValidationExternal(MResource parent, Element container) {
- List elements = container.elements(ELEMENT_VALIDATIONEXTERNAL);
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MValidationExternal external = buildValidationExternal();
- init(external);
- setAttributes(external, element);
- parent.addChild(MetadataType.VALIDATION_EXTERNAL, external);
- Element child = element.element(CONTAINER_VALIDATIONEXTERNALTYPE);
- if (child != null) {
- processValidationExternalType(external, child);
- }
- }
- }
+ private MSystem processSystem(Element container) {
+ Element element = container.element(ELEMENT_SYSTEM);
+ if (element == null) {
+ element = container.element(ELEMENT_SYSTEM.toUpperCase());
+ }
+ MSystem system = buildSystem();
+ init(system);
+ setAttributesFromXMLAttr(system, element);
+ setAttributes(system, element);
+ Element child;
+ child = element.element(CONTAINER_RESOURCE);
+ if (child != null) {
+ processResource(system, child);
+ }
+ child = element.element(CONTAINER_FOREIGNKEY);
+ if (child != null) {
+ processForeignKey(system, child);
+ }
+ return system;
+ }
- private void processValidationExternalType(MValidationExternal parent, Element container) {
- List elements = container.elements(ELEMENT_VALIDATIONEXTERNALTYPE);
- for (int i = 0; i < elements.size(); i++) {
- Element element = (Element) elements.get(i);
- MValidationExternalType type = buildValidationExternalType();
- setAttributes(type, element);
- parent.addChild(MetadataType.VALIDATION_EXTERNAL_TYPE, type);
- }
- }
+ private void processResource(MSystem system, Element container) {
+ List resources = container.elements(ELEMENT_RESOURCE);
+ for (int i = 0; i < resources.size(); i++) {
+ Element element = (Element) resources.get(i);
+ MResource resource = buildResource();
+ init(resource);
+ setAttributes(resource, element);
+ system.addChild(MetadataType.RESOURCE, resource);
+ Element child;
+ child = element.element(CONTAINER_CLASS);
+ if (child != null) {
+ processClass(resource, child);
+ }
+ child = element.element(CONTAINER_OBJECT);
+ if (child != null) {
+ processObject(resource, child);
+ }
+ child = element.element(CONTAINER_SEARCH_HELP);
+ if (child != null) {
+ processSearchHelp(resource, child);
+ }
+ child = element.element(CONTAINER_EDITMASK);
+ if (child != null) {
+ processEditMask(resource, child);
+ }
+ child = element.element(CONTAINER_LOOKUP);
+ if (child != null) {
+ processLookup(resource, child);
+ }
+ child = element.element(CONTAINER_UPDATEHELP);
+ if (child != null) {
+ processUpdateHelp(resource, child);
+ }
+ child = element.element(CONTAINER_VALIDATIONLOOKUP);
+ if (child != null) {
+ processValidationLookup(resource, child);
+ }
+ child = element.element(CONTAINER_VALIDATIONEXPRESSION);
+ if (child != null) {
+ processValidationExpression(resource, child);
+ }
+ child = element.element(CONTAINER_VALIDATIONEXTERNAL);
+ if (child != null) {
+ processValidationExternal(resource, child);
+ }
+ }
+ }
- private void processSearchHelp(MResource parent, Element container) {
- List searchhelps = container.elements(ELEMENT_SEARCHHELP);
- for (int i = 0; i < searchhelps.size(); i++) {
- Element element = (Element) searchhelps.get(i);
- MSearchHelp searchhelp = buildSearchHelp();
- setAttributes(searchhelp, element);
- parent.addChild(MetadataType.SEARCH_HELP, searchhelp);
- }
- }
+ private void processEditMask(MResource parent, Element container) {
+ List elements = container.elements(ELEMENT_EDITMASK);
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MEditMask mask = buildEditMask();
+ setAttributes(mask, element);
+ parent.addChild(MetadataType.EDITMASK, mask);
+ }
+ }
- private void processObject(MResource parent, Element container) {
- List objects = container.elements(ELEMENT_OBJECT);
- for (int i = 0; i < objects.size(); i++) {
- Element element = (Element) objects.get(i);
- MObject obj = buildObject();
- setAttributes(obj, element);
- parent.addChild(MetadataType.OBJECT, obj);
- }
- }
+ private void processLookup(MResource parent, Element container) {
+ List elements15 = container.elements(ELEMENT_LOOKUP);
+ List elements17 = container.elements(ELEMENT_LOOKUPTYPE);
+ List elements;
+ //some Rets Servers have lookuptype and lookup elements interchanged
+ if (elements15.isEmpty()) {
+ elements = elements17;
+ } else {
+ elements = elements15;
+ }
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MLookup lookup = buildLookup();
+ init(lookup);
+ setAttributes(lookup, element);
+ parent.addChild(MetadataType.LOOKUP, lookup);
+ Element child = element.element(CONTAINER_LOOKUPTYPE);
+ if (child != null) {
+ processLookupType(lookup, child);
+ }
+ }
+ }
- private void processClass(MResource parent, Element container) {
- List classes = container.elements(ELEMENT_CLASS);
- for (int i = 0; i < classes.size(); i++) {
- Element element = (Element) classes.get(i);
- MClass clazz = buildClass();
- init(clazz);
- setAttributes(clazz, element);
- parent.addChild(MetadataType.CLASS, clazz);
- Element child;
- child = element.element(CONTAINER_TABLE);
- if (child != null) {
- processTable(clazz, child);
- }
- child = element.element(CONTAINER_UPDATE);
- if (child != null) {
- processUpdate(clazz, child);
- }
- }
- }
+ private void processLookupType(MLookup parent, Element container) {
- private void processTable(MClass parent, Element container) {
- List tables = container.elements(ELEMENT_TABLE);
- for (int i = 0; i < tables.size(); i++) {
- Element element = (Element) tables.get(i);
- MTable table = buildTable();
- setAttributes(table, element);
- parent.addChild(MetadataType.TABLE, table);
- }
- }
+ List elements15 = container.elements(ELEMENT_LOOKUPTYPE);// check spec
+ List elements17 = container.elements(ELEMENT_LOOKUP);
+ List elements;
+ //some Rets Servers have lookuptype and lookup elements interchanged
+ if (elements15.isEmpty()) {
+ elements = elements17;
+ } else {
+ elements = elements15;
+ }
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MLookupType type = buildLookupType();
+ setAttributes(type, element);
+ parent.addChild(MetadataType.LOOKUP_TYPE, type);
+ }
+ }
- private void processUpdate(MClass parent, Element container) {
- List updates = container.elements(ELEMENT_UPDATE);
- for (int i = 0; i < updates.size(); i++) {
- Element element = (Element) updates.get(i);
- MUpdate update = buildUpdate();
- init(update);
- setAttributes(update, element);
- parent.addChild(MetadataType.UPDATE, update);
- Element child = element.element(CONTAINER_UPDATE_TYPE);
- if (child != null) {
- processUpdateType(update, child);
- }
- }
- }
+ private void processUpdateHelp(MResource parent, Element container) {
+ List elements = container.elements(ELEMENT_UPDATEHELP);
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MUpdateHelp help = buildUpdateHelp();
+ setAttributes(help, element);
+ parent.addChild(MetadataType.UPDATE_HELP, help);
+ }
+ }
- private void processUpdateType(MUpdate parent, Element container) {
- List updateFields = container.elements(ELEMENT_UPDATETYPE);
- for (int i = 0; i < updateFields.size(); i++) {
- Element element = (Element) updateFields.get(i);
- MUpdateType updateType = buildUpdateType();
- parent.addChild(MetadataType.UPDATE_TYPE, updateType);
- setAttributes(updateType, element);
- }
- }
+ private void processValidationLookup(MResource parent, Element container) {
+ List elements = container.elements(ELEMENT_VALIDATIONLOOKUP);
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MValidationLookup lookup = buildValidationLookup();
+ init(lookup);
+ setAttributes(lookup, element);
+ parent.addChild(MetadataType.VALIDATION_LOOKUP, lookup);
+ Element child = element.element(CONTAINER_VALIDATIONLOOKUPTYPE);
+ if (child != null) {
+ processValidationLookupType(lookup, child);
+ }
+ }
+ }
- private void processForeignKey(MSystem system, Element container) {
- List fkeys = container.elements("ForeignKey");
- for (int i = 0; i < fkeys.size(); i++) {
- Element element = (Element) fkeys.get(i);
- MForeignKey foreignKey = buildForeignKey();
- setAttributes(foreignKey, element);
- system.addChild(MetadataType.FOREIGNKEYS, foreignKey);
- }
- }
+ private void processValidationLookupType(MValidationLookup parent, Element container) {
+ List elements = container.elements(ELEMENT_VALIDATIONLOOKUPTYPE);
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MValidationLookupType lookupType = buildValidationLookupType();
+ setAttributes(lookupType, element);
+ parent.addChild(MetadataType.VALIDATION_LOOKUP_TYPE, lookupType);
+ }
+ }
- public static final String CONTAINER_PREFIX = "METADATA-";
+ private void processValidationExpression(MResource parent, Element container) {
+ List elements = container.elements(ELEMENT_VALIDATIONEXPRESSION);
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MValidationExpression expression = buildValidationExpression();
+ setAttributes(expression, element);
+ parent.addChild(MetadataType.VALIDATION_EXPRESSION, expression);
+ }
+ }
- public static final String CONTAINER_ROOT = "RETS";
+ private void processValidationExternal(MResource parent, Element container) {
+ List elements = container.elements(ELEMENT_VALIDATIONEXTERNAL);
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MValidationExternal external = buildValidationExternal();
+ init(external);
+ setAttributes(external, element);
+ parent.addChild(MetadataType.VALIDATION_EXTERNAL, external);
+ Element child = element.element(CONTAINER_VALIDATIONEXTERNALTYPE);
+ if (child != null) {
+ processValidationExternalType(external, child);
+ }
+ }
+ }
- public static final String CONTAINER_METADATA = "METADATA";
+ private void processValidationExternalType(MValidationExternal parent, Element container) {
+ List elements = container.elements(ELEMENT_VALIDATIONEXTERNALTYPE);
+ for (int i = 0; i < elements.size(); i++) {
+ Element element = (Element) elements.get(i);
+ MValidationExternalType type = buildValidationExternalType();
+ setAttributes(type, element);
+ parent.addChild(MetadataType.VALIDATION_EXTERNAL_TYPE, type);
+ }
+ }
- public static final String CONTAINER_SYSTEM = "METADATA-SYSTEM";
+ private void processSearchHelp(MResource parent, Element container) {
+ List searchhelps = container.elements(ELEMENT_SEARCHHELP);
+ for (int i = 0; i < searchhelps.size(); i++) {
+ Element element = (Element) searchhelps.get(i);
+ MSearchHelp searchhelp = buildSearchHelp();
+ setAttributes(searchhelp, element);
+ parent.addChild(MetadataType.SEARCH_HELP, searchhelp);
+ }
+ }
- public static final String CONTAINER_RESOURCE = "METADATA-RESOURCE";
+ private void processObject(MResource parent, Element container) {
+ List objects = container.elements(ELEMENT_OBJECT);
+ for (int i = 0; i < objects.size(); i++) {
+ Element element = (Element) objects.get(i);
+ MObject obj = buildObject();
+ setAttributes(obj, element);
+ parent.addChild(MetadataType.OBJECT, obj);
+ }
+ }
- public static final String CONTAINER_FOREIGNKEY = "METADATA-FOREIGN_KEYS";
+ private void processClass(MResource parent, Element container) {
+ List classes = container.elements(ELEMENT_CLASS);
+ for (int i = 0; i < classes.size(); i++) {
+ Element element = (Element) classes.get(i);
+ MClass clazz = buildClass();
+ init(clazz);
+ setAttributes(clazz, element);
+ parent.addChild(MetadataType.CLASS, clazz);
+ Element child;
+ child = element.element(CONTAINER_TABLE);
+ if (child != null) {
+ processTable(clazz, child);
+ }
+ child = element.element(CONTAINER_UPDATE);
+ if (child != null) {
+ processUpdate(clazz, child);
+ }
+ }
+ }
- public static final String CONTAINER_CLASS = "METADATA-CLASS";
+ private void processTable(MClass parent, Element container) {
+ List tables = container.elements(ELEMENT_TABLE);
+ for (int i = 0; i < tables.size(); i++) {
+ Element element = (Element) tables.get(i);
+ MTable table = buildTable();
+ setAttributes(table, element);
+ parent.addChild(MetadataType.TABLE, table);
+ }
+ }
- public static final String CONTAINER_TABLE = "METADATA-TABLE";
+ private void processUpdate(MClass parent, Element container) {
+ List updates = container.elements(ELEMENT_UPDATE);
+ for (int i = 0; i < updates.size(); i++) {
+ Element element = (Element) updates.get(i);
+ MUpdate update = buildUpdate();
+ init(update);
+ setAttributes(update, element);
+ parent.addChild(MetadataType.UPDATE, update);
+ Element child = element.element(CONTAINER_UPDATE_TYPE);
+ if (child != null) {
+ processUpdateType(update, child);
+ }
+ }
+ }
- public static final String CONTAINER_UPDATE = "METADATA-UPDATE";
+ private void processUpdateType(MUpdate parent, Element container) {
+ List updateFields = container.elements(ELEMENT_UPDATETYPE);
+ for (int i = 0; i < updateFields.size(); i++) {
+ Element element = (Element) updateFields.get(i);
+ MUpdateType updateType = buildUpdateType();
+ parent.addChild(MetadataType.UPDATE_TYPE, updateType);
+ setAttributes(updateType, element);
+ }
+ }
- public static final String CONTAINER_UPDATE_TYPE = "METADATA-UPDATE_TYPE";
+ private void processForeignKey(MSystem system, Element container) {
+ List fkeys = container.elements("ForeignKey");
+ for (int i = 0; i < fkeys.size(); i++) {
+ Element element = (Element) fkeys.get(i);
+ MForeignKey foreignKey = buildForeignKey();
+ setAttributes(foreignKey, element);
+ system.addChild(MetadataType.FOREIGNKEYS, foreignKey);
+ }
+ }
- public static final String CONTAINER_OBJECT = "METADATA-OBJECT";
+ public static final String CONTAINER_PREFIX = "METADATA-";
- public static final String CONTAINER_SEARCH_HELP = "METADATA-SEARCH_HELP";
+ public static final String CONTAINER_ROOT = "RETS";
- public static final String CONTAINER_EDITMASK = "METADATA-EDITMASK";
+ public static final String CONTAINER_METADATA = "METADATA";
- public static final String CONTAINER_UPDATEHELP = "METADATA-UPDATE_HELP";
+ public static final String CONTAINER_SYSTEM = "METADATA-SYSTEM";
- public static final String CONTAINER_LOOKUP = "METADATA-LOOKUP";
+ public static final String CONTAINER_RESOURCE = "METADATA-RESOURCE";
- public static final String CONTAINER_LOOKUPTYPE = "METADATA-LOOKUP_TYPE";
+ public static final String CONTAINER_FOREIGNKEY = "METADATA-FOREIGN_KEYS";
- public static final String CONTAINER_VALIDATIONLOOKUP = "METADATA-VALIDATION_LOOKUP";
+ public static final String CONTAINER_CLASS = "METADATA-CLASS";
- public static final String CONTAINER_VALIDATIONLOOKUPTYPE = "METADATA-VALIDATION_LOOKUP_TYPE";
+ public static final String CONTAINER_TABLE = "METADATA-TABLE";
- public static final String CONTAINER_VALIDATIONEXPRESSION = "METADATA-VALIDATION_EXPRESSION";
+ public static final String CONTAINER_UPDATE = "METADATA-UPDATE";
- public static final String CONTAINER_VALIDATIONEXTERNAL = "METADATA-VALIDATION_EXTERNAL";
+ public static final String CONTAINER_UPDATE_TYPE = "METADATA-UPDATE_TYPE";
- public static final String CONTAINER_VALIDATIONEXTERNALTYPE = "METADATA-VALIDATION_EXTERNAL_TYPE";
+ public static final String CONTAINER_OBJECT = "METADATA-OBJECT";
- public static final Map sContainer2Type = new HashMap();
- static {
- for (int i = 0; i < MetadataType.values().length; i++) {
- MetadataType type = MetadataType.values()[i];
- sContainer2Type.put(CONTAINER_PREFIX + type.name(), type);
- }
+ public static final String CONTAINER_SEARCH_HELP = "METADATA-SEARCH_HELP";
+
+ public static final String CONTAINER_EDITMASK = "METADATA-EDITMASK";
+
+ public static final String CONTAINER_UPDATEHELP = "METADATA-UPDATE_HELP";
+
+ public static final String CONTAINER_LOOKUP = "METADATA-LOOKUP";
+
+ public static final String CONTAINER_LOOKUPTYPE = "METADATA-LOOKUP_TYPE";
+
+ public static final String CONTAINER_VALIDATIONLOOKUP = "METADATA-VALIDATION_LOOKUP";
+
+ public static final String CONTAINER_VALIDATIONLOOKUPTYPE = "METADATA-VALIDATION_LOOKUP_TYPE";
+
+ public static final String CONTAINER_VALIDATIONEXPRESSION = "METADATA-VALIDATION_EXPRESSION";
+
+ public static final String CONTAINER_VALIDATIONEXTERNAL = "METADATA-VALIDATION_EXTERNAL";
+
+ public static final String CONTAINER_VALIDATIONEXTERNALTYPE = "METADATA-VALIDATION_EXTERNAL_TYPE";
+
+ public static final Map sContainer2Type = new HashMap();
+
+ static {
+ for (int i = 0; i < MetadataType.values().length; i++) {
+ MetadataType type = MetadataType.values()[i];
+ sContainer2Type.put(CONTAINER_PREFIX + type.name(), type);
+ }
/* you have got to be kidding me. The spec (compact) says
METADATA-FOREIGNKEYS and that's the request type but the DTD says
METADATA-FOREIGN_KEY.
I think I'm going to be sick.
*/
- sContainer2Type.remove(CONTAINER_PREFIX + MetadataType.FOREIGNKEYS.name());
- sContainer2Type.put(CONTAINER_FOREIGNKEY, MetadataType.FOREIGNKEYS);
- }
+ sContainer2Type.remove(CONTAINER_PREFIX + MetadataType.FOREIGNKEYS.name());
+ sContainer2Type.put(CONTAINER_FOREIGNKEY, MetadataType.FOREIGNKEYS);
+ }
}
diff --git a/client/src/main/java/com/ossez/usreio/tests/common/metadata/Metadata.java b/client/src/main/java/com/ossez/usreio/tests/common/metadata/Metadata.java
index 2775002..13f4806 100644
--- a/client/src/main/java/com/ossez/usreio/tests/common/metadata/Metadata.java
+++ b/client/src/main/java/com/ossez/usreio/tests/common/metadata/Metadata.java
@@ -18,6 +18,7 @@ import com.ossez.usreio.tests.common.metadata.types.MSearchHelp;
public class Metadata implements Serializable {
protected MSystem system;
+ protected String rawMetaData;
public Metadata(MetaCollector collector) throws MetadataException {
MetaObject[] sys = collector.getMetadata(MetadataType.SYSTEM, null);
@@ -151,4 +152,12 @@ public class Metadata implements Serializable {
public MResource getResource(MClass clazz) {
return getResource(getResourceId(clazz));
}
+
+ public String getRawMetaData() {
+ return rawMetaData;
+ }
+
+ public void setRawMetaData(String rawMetaData) {
+ this.rawMetaData = rawMetaData;
+ }
}