use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class MasterListVersion method updateRecord.
@Transaction
public void updateRecord(ServerGeoObjectIF object) {
object.setDate(this.getForDate());
// Delete tile cache
TileCache.deleteTiles(this);
MasterList masterlist = this.getMasterlist();
MdBusinessDAO mdBusiness = MdBusinessDAO.get(this.getMdBusinessOid()).getBusinessDAO();
Collection<Locale> locales = LocalizationFacade.getInstalledLocales();
// Add the type ancestor fields
ServerGeoObjectType type = ServerGeoObjectType.get(masterlist.getUniversal());
Set<ServerHierarchyType> hierarchiesOfSubTypes = type.getHierarchiesOfSubTypes();
Map<ServerHierarchyType, List<ServerGeoObjectType>> ancestorMap = masterlist.getAncestorMap(type);
Collection<AttributeType> attributes = type.getAttributeMap().values();
BusinessQuery query = new QueryFactory().businessQuery(mdBusiness.definesType());
query.WHERE(query.aCharacter(DefaultAttribute.CODE.getName()).EQ(object.getCode()));
List<Business> records = query.getIterator().getAll();
for (Business record : records) {
try {
record.appLock();
this.publish(object, record, attributes, ancestorMap, hierarchiesOfSubTypes, locales);
} finally {
record.unlock();
}
}
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class Organization method getUserOrganizations.
public static List<Organization> getUserOrganizations() {
OrganizationQuery query = new OrganizationQuery(new QueryFactory());
query.ORDER_BY_ASC(query.getDisplayLabel().localize());
try (final OIterator<? extends Organization> iterator = query.getIterator()) {
final List<? extends Organization> orgs = iterator.getAll();
List<Organization> result = orgs.stream().filter(o -> {
return Organization.isMember(o);
}).collect(Collectors.toList());
return result;
}
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class Organization method getUserAdminOrganizations.
public static List<Organization> getUserAdminOrganizations() {
OrganizationQuery query = new OrganizationQuery(new QueryFactory());
query.ORDER_BY_ASC(query.getDisplayLabel().localize());
try (final OIterator<? extends Organization> iterator = query.getIterator()) {
final List<? extends Organization> orgs = iterator.getAll();
List<Organization> result = orgs.stream().filter(o -> {
return Organization.isRegistryAdmin(o);
}).collect(Collectors.toList());
return result;
}
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class OrganizationUser method exists.
public static boolean exists(Organization org, SingleActor user) {
OrganizationUserQuery query = new OrganizationUserQuery(new QueryFactory());
query.WHERE(query.parentOid().EQ(org.getOid()));
query.AND(query.childOid().EQ(user.getOid()));
return (query.getCount() > 0);
}
use of com.runwaysdk.query.QueryFactory in project geoprism-registry by terraframe.
the class SynchronizationConfig method getSynchronizationConfigsForOrg.
public static List<SynchronizationConfig> getSynchronizationConfigsForOrg(Integer pageNumber, Integer pageSize) {
List<Organization> organizations = Organization.getUserAdminOrganizations();
if (organizations.size() > 0) {
SynchronizationConfigQuery query = new SynchronizationConfigQuery(new QueryFactory());
for (int i = 0; i < organizations.size(); i++) {
Organization organization = organizations.get(i);
query.OR(query.getOrganization().EQ(organization));
}
query.ORDER_BY_DESC(query.getLabel().localize());
query.restrictRows(pageSize, pageNumber);
try (OIterator<? extends SynchronizationConfig> it = query.getIterator()) {
return new LinkedList<SynchronizationConfig>(it.getAll());
}
}
return new LinkedList<SynchronizationConfig>();
}
Aggregations