Search in sources :

Example 1 with AttributeReferenceIF

use of com.runwaysdk.dataaccess.AttributeReferenceIF 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();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) MdBusiness(com.runwaysdk.system.metadata.MdBusiness) MdBusinessDAOIF(com.runwaysdk.dataaccess.MdBusinessDAOIF) BusinessDAOIF(com.runwaysdk.dataaccess.BusinessDAOIF) BusinessDAOQuery(com.runwaysdk.query.BusinessDAOQuery) AttributeReferenceIF(com.runwaysdk.dataaccess.AttributeReferenceIF)

Aggregations

AttributeReferenceIF (com.runwaysdk.dataaccess.AttributeReferenceIF)1 BusinessDAOIF (com.runwaysdk.dataaccess.BusinessDAOIF)1 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)1 BusinessDAOQuery (com.runwaysdk.query.BusinessDAOQuery)1 QueryFactory (com.runwaysdk.query.QueryFactory)1 MdBusiness (com.runwaysdk.system.metadata.MdBusiness)1