Search in sources :

Example 96 with QueryFactory

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();
        }
    }
}
Also used : Locale(java.util.Locale) BusinessQuery(com.runwaysdk.business.BusinessQuery) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) QueryFactory(com.runwaysdk.query.QueryFactory) MdBusinessDAO(com.runwaysdk.dataaccess.metadata.MdBusinessDAO) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) List(java.util.List) LinkedList(java.util.LinkedList) MdBusiness(com.runwaysdk.system.metadata.MdBusiness) Business(com.runwaysdk.business.Business) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 97 with QueryFactory

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;
    }
}
Also used : RegistryRole(org.commongeoregistry.adapter.metadata.RegistryRole) Universal(com.runwaysdk.system.gis.geo.Universal) Actor(com.runwaysdk.system.Actor) HashMap(java.util.HashMap) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ServiceFactory(net.geoprism.registry.service.ServiceFactory) LocalizedValueConverter(net.geoprism.registry.conversion.LocalizedValueConverter) Map(java.util.Map) QueryFactory(com.runwaysdk.query.QueryFactory) RoleDAO(com.runwaysdk.business.rbac.RoleDAO) LinkedList(java.util.LinkedList) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) ObjectCache(com.runwaysdk.dataaccess.cache.ObjectCache) RoleDAOIF(com.runwaysdk.business.rbac.RoleDAOIF) Set(java.util.Set) Roles(com.runwaysdk.system.Roles) Collectors(java.util.stream.Collectors) BusinessFacade(com.runwaysdk.business.BusinessFacade) OIterator(com.runwaysdk.query.OIterator) List(java.util.List) GeoprismUser(net.geoprism.GeoprismUser) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType) Entry(java.util.Map.Entry) SingleActor(com.runwaysdk.system.SingleActor) Session(com.runwaysdk.session.Session) SessionIF(com.runwaysdk.session.SessionIF) EntityDAOIF(com.runwaysdk.dataaccess.EntityDAOIF) OrganizationDTO(org.commongeoregistry.adapter.metadata.OrganizationDTO) RolePermissionService(net.geoprism.registry.permission.RolePermissionService) QueryFactory(com.runwaysdk.query.QueryFactory)

Example 98 with QueryFactory

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;
    }
}
Also used : RegistryRole(org.commongeoregistry.adapter.metadata.RegistryRole) Universal(com.runwaysdk.system.gis.geo.Universal) Actor(com.runwaysdk.system.Actor) HashMap(java.util.HashMap) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ServiceFactory(net.geoprism.registry.service.ServiceFactory) LocalizedValueConverter(net.geoprism.registry.conversion.LocalizedValueConverter) Map(java.util.Map) QueryFactory(com.runwaysdk.query.QueryFactory) RoleDAO(com.runwaysdk.business.rbac.RoleDAO) LinkedList(java.util.LinkedList) ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) ObjectCache(com.runwaysdk.dataaccess.cache.ObjectCache) RoleDAOIF(com.runwaysdk.business.rbac.RoleDAOIF) Set(java.util.Set) Roles(com.runwaysdk.system.Roles) Collectors(java.util.stream.Collectors) BusinessFacade(com.runwaysdk.business.BusinessFacade) OIterator(com.runwaysdk.query.OIterator) List(java.util.List) GeoprismUser(net.geoprism.GeoprismUser) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType) Entry(java.util.Map.Entry) SingleActor(com.runwaysdk.system.SingleActor) Session(com.runwaysdk.session.Session) SessionIF(com.runwaysdk.session.SessionIF) EntityDAOIF(com.runwaysdk.dataaccess.EntityDAOIF) OrganizationDTO(org.commongeoregistry.adapter.metadata.OrganizationDTO) RolePermissionService(net.geoprism.registry.permission.RolePermissionService) QueryFactory(com.runwaysdk.query.QueryFactory)

Example 99 with QueryFactory

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);
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory)

Example 100 with QueryFactory

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>();
}
Also used : QueryFactory(com.runwaysdk.query.QueryFactory) LinkedList(java.util.LinkedList)

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