use of com.runwaysdk.dataaccess.io.dataDefinition.ExportMetadata in project geoprism-registry by terraframe.
the class HierarchyExporter method exportHierarchyInstances.
/**
* Exports all instances of Universals, including Leaf Types. If a
* file of the specified filename already exists then the file is overwritten.
*
* @param fileName
* The name of the xml file to create.
* @param schemaLocation
* The location of the schema
* @param _exportOnlyModifiedAttributes
* True if only modified attributes should be exported, false otherwise.
*/
@Request
public static void exportHierarchyInstances(String fileName, String schemaLocation, boolean _exportOnlyModifiedAttributes) {
ExportMetadata exportMetadata = new ExportMetadata();
QueryFactory qf = new QueryFactory();
List<Universal> universalList = new LinkedList<Universal>();
UniversalQuery uQ = new UniversalQuery(qf);
// All of the leaf node types will be last in the query
uQ.ORDER_BY(uQ.getIsLeafType(), OrderBy.SortOrder.ASC);
OIterator<? extends Universal> i = uQ.getIterator();
try {
while (i.hasNext()) {
universalList.add(i.next());
}
} finally {
i.close();
}
for (Universal universal : universalList) {
exportUniversalInstances(exportMetadata, universal);
}
List<MdTermRelationshipDAOIF> geoEntityRelList = getGeoEntityRelationships();
for (MdTermRelationshipDAOIF mdTermRelationshipDAOIF : geoEntityRelList) {
exportMdTermRelInstances(exportMetadata, mdTermRelationshipDAOIF);
}
VersionExporter.export(fileName, schemaLocation, exportMetadata);
}
use of com.runwaysdk.dataaccess.io.dataDefinition.ExportMetadata in project geoprism-registry by terraframe.
the class HierarchyExporter method exportHierarchyDefinition.
/**
* Exports the metadata for the hierarchies. If a
* file of the specified filename already exists then the file is overwritten.
*
* @param fileName
* The name of the xml file to create.
* @param schemaLocation
* The location of the schema
* @param _exportOnlyModifiedAttributes
* True if only modified attributes should be exported, false otherwise.
*/
@Request
public static void exportHierarchyDefinition(String fileName, String schemaLocation, boolean _exportOnlyModifiedAttributes) {
ExportMetadata exportMetadata = new ExportMetadata();
QueryFactory qf = new QueryFactory();
// Export the MdBusinesses that define the hierarchy attributes
BusinessDAOQuery uQ = qf.businessDAOQuery(Universal.CLASS);
BusinessDAOQuery mdbQ = qf.businessDAOQuery(MdBusiness.CLASS);
mdbQ.WHERE(mdbQ.aUUID(MdBusiness.OID).EQ(uQ.aReference(Universal.MDBUSINESS).aUUID(Universal.OID)));
OIterator<? extends BusinessDAOIF> mdbI = mdbQ.getIterator();
try {
while (mdbI.hasNext()) {
MdBusinessDAOIF mdBusiness = (MdBusinessDAOIF) mdbI.next();
System.out.println(mdBusiness.getType() + " " + mdBusiness.getTypeName());
exportMetadata.addCreateOrUpdate(mdBusiness);
}
} finally {
mdbI.close();
}
// Export the Universals
uQ = qf.businessDAOQuery(Universal.CLASS);
OIterator<? extends BusinessDAOIF> uQI = uQ.getIterator();
try {
while (uQI.hasNext()) {
BusinessDAOIF businessDAOIF = (BusinessDAOIF) uQI.next();
System.out.println(businessDAOIF.getType() + " " + businessDAOIF.getKey());
exportMetadata.addCreateOrUpdate(businessDAOIF);
}
} finally {
mdbI.close();
}
// Export the MdTermRelationships that involve universals
List<MdTermRelationshipDAOIF> universalRelList = getUniversalRelationships();
for (MdTermRelationshipDAOIF mdTermRelationshipDAOIF : universalRelList) {
System.out.println(mdTermRelationshipDAOIF.getType() + " " + mdTermRelationshipDAOIF.getKey());
exportMetadata.addCreateOrUpdate(mdTermRelationshipDAOIF);
}
// Export the instances of the relationships between the universals.
for (MdTermRelationshipDAOIF mdTermRelationshipDAOIF : universalRelList) {
RelationshipDAOQuery relQ = qf.relationshipDAOQuery(mdTermRelationshipDAOIF.definesType());
OIterator<RelationshipDAOIF> relI = relQ.getIterator();
try {
while (relI.hasNext()) {
RelationshipDAOIF relationshipDAOIF = relI.next();
exportMetadata.addCreateOrUpdate(relationshipDAOIF);
}
} finally {
relI.close();
}
}
List<MdTermRelationshipDAOIF> geoEntityRelList = getGeoEntityRelationships();
for (MdTermRelationshipDAOIF mdTermRelationshipDAOIF : geoEntityRelList) {
System.out.println(mdTermRelationshipDAOIF.getType() + " " + mdTermRelationshipDAOIF.getKey());
exportMetadata.addCreateOrUpdate(mdTermRelationshipDAOIF);
}
VersionExporter.export(fileName, schemaLocation, exportMetadata);
// FileInstanceExporter.export(fileName, schemaLocation, queries, _exportOnlyModifiedAttributes);
}
Aggregations