Search in sources :

Example 1 with Organization

use of net.geoprism.registry.Organization in project geoprism-registry by terraframe.

the class ListCurationJob method startInTrans.

@Transaction
private JobHistoryRecord startInTrans(ListTypeVersion version) {
    final ListType listType = version.getListType();
    final ServerGeoObjectType type = listType.getGeoObjectType();
    final Organization org = listType.getOrganization();
    RolePermissionService perms = ServiceFactory.getRolePermissionService();
    if (perms.isRA()) {
        perms.enforceRA(org.getCode());
    } else if (perms.isRM()) {
        perms.enforceRM(org.getCode(), type);
    } else {
        perms.enforceRM();
    }
    ListCurationHistory history = (ListCurationHistory) this.createNewHistory();
    history.appLock();
    history.setVersion(version);
    history.apply();
    JobHistoryRecord record = new JobHistoryRecord(this, history);
    record.apply();
    return record;
}
Also used : RolePermissionService(net.geoprism.registry.permission.RolePermissionService) Organization(net.geoprism.registry.Organization) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JobHistoryRecord(com.runwaysdk.system.scheduler.JobHistoryRecord) ListType(net.geoprism.registry.ListType) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 2 with Organization

use of net.geoprism.registry.Organization 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 3 with Organization

use of net.geoprism.registry.Organization in project geoprism-registry by terraframe.

the class LocalizedValueConverter method populateOrganizationDisplayLabel.

/**
 * Populates the {@link Organization} display label on the given
 * {@link RegistryRole} object.
 *
 * @param registryRole
 */
public static void populateOrganizationDisplayLabel(RegistryRole registryRole) {
    String organizationCode = registryRole.getOrganizationCode();
    if (organizationCode != null && !organizationCode.trim().equals("")) {
        Organization organization = Organization.getByCode(organizationCode);
        registryRole.setOrganizationLabel(LocalizedValueConverter.convert(organization.getDisplayLabel()));
    }
}
Also used : Organization(net.geoprism.registry.Organization)

Example 4 with Organization

use of net.geoprism.registry.Organization in project geoprism-registry by terraframe.

the class OrganizationConverter method fromDTO.

public Organization fromDTO(OrganizationDTO organizationDTO) {
    Organization organization = new Organization();
    organization.setCode(organizationDTO.getCode());
    populate(organization.getDisplayLabel(), organizationDTO.getLabel());
    populate(organization.getContactInfo(), organizationDTO.getContactInfo());
    return organization;
}
Also used : Organization(net.geoprism.registry.Organization)

Example 5 with Organization

use of net.geoprism.registry.Organization in project geoprism-registry by terraframe.

the class ServerGeoObjectTypeConverter method assignAll_RA_Permissions.

/**
 * Assigns all permissions to the Organization's RA
 *
 * @param mdGeoVertexDAO
 * @param mdBusiness
 * @param organizationCode
 */
private void assignAll_RA_Permissions(MdGeoVertexDAO mdGeoVertexDAO, MdBusiness mdBusiness, String organizationCode) {
    if (organizationCode != null && !organizationCode.trim().equals("")) {
        Organization organization = Organization.getByKey(organizationCode);
        Roles raRole = organization.getRegistryAdminiRole();
        this.assignAllPermissions(mdBusiness, raRole);
        this.assignAllPermissions(mdGeoVertexDAO, raRole);
    }
}
Also used : Organization(net.geoprism.registry.Organization) Roles(com.runwaysdk.system.Roles)

Aggregations

Organization (net.geoprism.registry.Organization)44 Request (com.runwaysdk.session.Request)13 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)10 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)8 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)7 QueryFactory (com.runwaysdk.query.QueryFactory)4 Roles (com.runwaysdk.system.Roles)4 RolePermissionService (net.geoprism.registry.permission.RolePermissionService)4 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)4 JsonArray (com.google.gson.JsonArray)3 JsonObject (com.google.gson.JsonObject)3 RoleDAOIF (com.runwaysdk.business.rbac.RoleDAOIF)3 SingleActorDAOIF (com.runwaysdk.business.rbac.SingleActorDAOIF)3 Universal (com.runwaysdk.system.gis.geo.Universal)3 LinkedList (java.util.LinkedList)3 SynchronizationConfig (net.geoprism.registry.SynchronizationConfig)3 GsonBuilder (com.google.gson.GsonBuilder)2 GraphQuery (com.runwaysdk.business.graph.GraphQuery)2 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)2 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)2