use of com.runwaysdk.system.metadata.MdBusiness in project geoprism-registry by terraframe.
the class HierarchyExporter method exportUniversalInstances.
/**
* Export all instances of the given {@link Universal} type.
*
* @param universal
*/
private static void exportUniversalInstances(ExportMetadata exportMetadata, Universal universal) {
boolean isLeafType = universal.getIsLeafType();
MdBusiness mdBusiness = universal.getMdBusiness();
QueryFactory qf = new QueryFactory();
BusinessDAOQuery q = qf.businessDAOQuery(mdBusiness.definesType());
System.out.println("\nExporting Universal [" + universal.getUniversalId() + "] instances:");
System.out.println("-----------------------------------------------------------------------");
int counter = 0;
OIterator<BusinessDAOIF> i = q.getIterator();
try {
for (BusinessDAOIF businessDAOIF : i) {
if (!isLeafType) {
BusinessDAOIF geoEntity = ((AttributeReferenceIF) businessDAOIF.getAttributeIF(RegistryConstants.GEO_ENTITY_ATTRIBUTE_NAME)).dereference();
exportMetadata.addCreate(geoEntity);
}
exportMetadata.addCreate(businessDAOIF);
System.out.print(".");
if (counter % 100 == 0) {
System.out.println();
}
counter++;
}
} finally {
i.close();
}
}
use of com.runwaysdk.system.metadata.MdBusiness in project geoprism-registry by terraframe.
the class HierarchyExporter method getUniversalRelationships.
/**
* Returns a list of {@link MdTermRelationshipDAOIF} that defines relationships between universals.
*
* @return list of {@link MdTermRelationshipDAOIF} that defines relationships between universals.
*/
private static List<MdTermRelationshipDAOIF> getUniversalRelationships() {
List<MdTermRelationshipDAOIF> list = new LinkedList<MdTermRelationshipDAOIF>();
QueryFactory qf = new QueryFactory();
// Export the MdTermRelationships that involve universals
MdBusiness univMdBusiness = MdBusiness.getMdBusiness(Universal.CLASS);
BusinessDAOQuery trQ = qf.businessDAOQuery(MdTermRelationship.CLASS);
trQ.WHERE(trQ.get(MdTermRelationship.PARENTMDBUSINESS).EQ(univMdBusiness.getOid()).AND(trQ.get(MdTermRelationship.CHILDMDBUSINESS).EQ(univMdBusiness.getOid())));
OIterator<? extends BusinessDAOIF> mdtrI = trQ.getIterator();
try {
while (mdtrI.hasNext()) {
MdTermRelationshipDAOIF businessDAOIF = (MdTermRelationshipDAOIF) mdtrI.next();
list.add(businessDAOIF);
}
} finally {
mdtrI.close();
}
return list;
}
use of com.runwaysdk.system.metadata.MdBusiness in project geoprism-registry by terraframe.
the class ServerGeoObjectType method updateGeoObjectType.
@Transaction
private Universal updateGeoObjectType(GeoObjectType geoObjectType) {
this.universal.lock();
this.universal.setIsGeometryEditable(geoObjectType.isGeometryEditable());
LocalizedValueConverter.populate(universal.getDisplayLabel(), geoObjectType.getLabel());
LocalizedValueConverter.populate(universal.getDescription(), geoObjectType.getDescription());
this.universal.apply();
MdBusiness mdBusiness = universal.getMdBusiness();
mdBusiness.lock();
mdBusiness.getDisplayLabel().setValue(universal.getDisplayLabel().getValue());
mdBusiness.getDescription().setValue(universal.getDescription().getValue());
mdBusiness.apply();
GeoObjectTypeMetadata metadata = this.getMetadata();
if (!metadata.getIsPrivate().equals(geoObjectType.getIsPrivate())) {
metadata.appLock();
metadata.setIsPrivate(geoObjectType.getIsPrivate());
metadata.apply();
}
mdBusiness.unlock();
universal.unlock();
return universal;
}
Aggregations