Search in sources :

Example 51 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class PatchTerms method getByClassifierId.

private Classifier getByClassifierId(String classifierId) {
    ClassifierQuery gQuery = new ClassifierQuery(new QueryFactory());
    gQuery.WHERE(gQuery.getClassifierId().EQ(classifierId));
    try (OIterator<? extends Classifier> it = gQuery.getIterator()) {
        return it.next();
    }
}
Also used : ClassifierQuery(net.geoprism.ontology.ClassifierQuery) QueryFactory(com.runwaysdk.query.QueryFactory)

Example 52 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class UserInfoPatch method doIt.

@Transaction
private void doIt() {
    UserInfoQuery query = new UserInfoQuery(new QueryFactory());
    try (OIterator<? extends UserInfo> it = query.getIterator()) {
        while (it.hasNext()) {
            UserInfo info = it.next();
            info.appLock();
            info.apply();
        }
    }
    // Ensure all geoprism users have a user info
    GeoprismUserQuery gQuery = new GeoprismUserQuery(new QueryFactory());
    try (OIterator<? extends GeoprismUser> it = gQuery.getIterator()) {
        while (it.hasNext()) {
            GeoprismUser user = it.next();
            UserInfo info = UserInfo.getByUser(user);
            if (info == null) {
                info = new UserInfo();
                info.setGeoprismUser(user);
                info.apply();
            }
        }
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) GeoprismUserQuery(net.geoprism.GeoprismUserQuery) UserInfo(net.geoprism.registry.UserInfo) GeoprismUser(net.geoprism.GeoprismUser) UserInfoQuery(net.geoprism.registry.UserInfoQuery) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 53 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class ChangeRequestTestDataGenerator method deleteAllChangeRequests.

@Request
public static void deleteAllChangeRequests() {
    ChangeRequestQuery crq = new ChangeRequestQuery(new QueryFactory());
    OIterator<? extends ChangeRequest> it = crq.getIterator();
    while (it.hasNext()) {
        it.next().delete();
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) ChangeRequestQuery(net.geoprism.registry.action.ChangeRequestQuery) Request(com.runwaysdk.session.Request) ChangeRequest(net.geoprism.registry.action.ChangeRequest)

Example 54 with QueryFactory

use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.

the class DHIS2SynchronizationManager method handleExportErrors.

private void handleExportErrors() {
    ExportErrorQuery query = new ExportErrorQuery(new QueryFactory());
    query.WHERE(query.getHistory().EQ(history));
    Boolean hasErrors = query.getCount() > 0;
    if (hasErrors) {
        ExportJobHasErrors ex = new ExportJobHasErrors();
        throw ex;
    }
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) ExportErrorQuery(net.geoprism.registry.etl.export.ExportErrorQuery) ExportJobHasErrors(net.geoprism.registry.etl.ExportJobHasErrors)

Example 55 with QueryFactory

use of com.runwaysdk.query.QueryFactory 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);
}
Also used : MdTermRelationshipDAOIF(com.runwaysdk.dataaccess.MdTermRelationshipDAOIF) ExportMetadata(com.runwaysdk.dataaccess.io.dataDefinition.ExportMetadata) QueryFactory(com.runwaysdk.query.QueryFactory) Universal(com.runwaysdk.system.gis.geo.Universal) UniversalQuery(com.runwaysdk.system.gis.geo.UniversalQuery) LinkedList(java.util.LinkedList) Request(com.runwaysdk.session.Request)

Aggregations

QueryFactory (com.runwaysdk.query.QueryFactory)158 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)37 LinkedList (java.util.LinkedList)35 Request (com.runwaysdk.session.Request)31 JsonArray (com.google.gson.JsonArray)19 JsonObject (com.google.gson.JsonObject)19 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)19 SimpleDateFormat (java.text.SimpleDateFormat)15 List (java.util.List)14 Date (java.util.Date)13 ChangeRequest (net.geoprism.registry.action.ChangeRequest)13 OIterator (com.runwaysdk.query.OIterator)12 Universal (com.runwaysdk.system.gis.geo.Universal)12 ChangeRequestQuery (net.geoprism.registry.action.ChangeRequestQuery)12 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)11 BusinessQuery (com.runwaysdk.business.BusinessQuery)10 Session (com.runwaysdk.session.Session)10 GeoprismUser (net.geoprism.GeoprismUser)10 ProgrammingErrorException (com.runwaysdk.dataaccess.ProgrammingErrorException)9 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)8