Search in sources :

Example 1 with ImportHistoryQuery

use of net.geoprism.registry.etl.ImportHistoryQuery in project geoprism-registry by terraframe.

the class PatchOrgIntoImportHistory method doIt.

@Transaction
private void doIt() {
    ImportHistoryQuery ihq = new ImportHistoryQuery(new QueryFactory());
    OIterator<? extends ImportHistory> it = ihq.getIterator();
    try {
        for (ImportHistory hist : it) {
            try {
                ImportConfiguration config = hist.getConfig();
                if (config instanceof GeoObjectImportConfiguration) {
                    GeoObjectImportConfiguration goConfig = (GeoObjectImportConfiguration) config;
                    Organization org = goConfig.getType().getOrganization();
                    hist.appLock();
                    hist.setOrganization(org);
                    hist.apply();
                }
            } catch (net.geoprism.registry.DataNotFoundException e) {
                logger.error("ImportHistory references object which does not exist", e);
            }
        }
    } finally {
        it.close();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) GeoObjectImportConfiguration(net.geoprism.registry.io.GeoObjectImportConfiguration) Organization(net.geoprism.registry.Organization) GeoObjectImportConfiguration(net.geoprism.registry.io.GeoObjectImportConfiguration) ImportConfiguration(net.geoprism.registry.etl.upload.ImportConfiguration) ImportHistoryQuery(net.geoprism.registry.etl.ImportHistoryQuery) ImportHistory(net.geoprism.registry.etl.ImportHistory) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 2 with ImportHistoryQuery

use of net.geoprism.registry.etl.ImportHistoryQuery in project geoprism-registry by terraframe.

the class PatchGotIntoImportHistory method doIt.

@Transaction
private void doIt() {
    ImportHistoryQuery ihq = new ImportHistoryQuery(new QueryFactory());
    OIterator<? extends ImportHistory> it = ihq.getIterator();
    try {
        for (ImportHistory hist : it) {
            try {
                ImportConfiguration config = hist.getConfig();
                if (config instanceof GeoObjectImportConfiguration) {
                    GeoObjectImportConfiguration goConfig = (GeoObjectImportConfiguration) config;
                    ServerGeoObjectType type = goConfig.getType();
                    hist.appLock();
                    hist.setOrganization(type.getOrganization());
                    hist.setGeoObjectTypeCode(type.getCode());
                    hist.apply();
                }
            } catch (net.geoprism.registry.DataNotFoundException e) {
                logger.error("ImportHistory references object which does not exist", e);
            }
        }
    } finally {
        it.close();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) GeoObjectImportConfiguration(net.geoprism.registry.io.GeoObjectImportConfiguration) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GeoObjectImportConfiguration(net.geoprism.registry.io.GeoObjectImportConfiguration) ImportConfiguration(net.geoprism.registry.etl.upload.ImportConfiguration) ImportHistoryQuery(net.geoprism.registry.etl.ImportHistoryQuery) ImportHistory(net.geoprism.registry.etl.ImportHistory) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Aggregations

Transaction (com.runwaysdk.dataaccess.transaction.Transaction)2 QueryFactory (com.runwaysdk.query.QueryFactory)2 ImportHistory (net.geoprism.registry.etl.ImportHistory)2 ImportHistoryQuery (net.geoprism.registry.etl.ImportHistoryQuery)2 ImportConfiguration (net.geoprism.registry.etl.upload.ImportConfiguration)2 GeoObjectImportConfiguration (net.geoprism.registry.io.GeoObjectImportConfiguration)2 Organization (net.geoprism.registry.Organization)1 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)1