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();
}
}
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();
}
}
}
}
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();
}
}
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;
}
}
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);
}
Aggregations