Search in sources :

Example 1 with ListType

use of net.geoprism.registry.ListType 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 ListType

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

the class CurationService method curate.

@Request(RequestType.SESSION)
public JsonObject curate(String sessionId, String listTypeVersionId) {
    final ListTypeVersion version = ListTypeVersion.get(listTypeVersionId);
    final ListType listType = version.getListType();
    final ServerGeoObjectType serverGOT = listType.getGeoObjectType();
    final String orgCode = listType.getOrganization().getCode();
    this.checkPermissions(orgCode, serverGOT);
    ListCurationJob job = new ListCurationJob();
    job.setRunAsUserId(Session.getCurrentSession().getUser().getOid());
    job.apply();
    ListCurationHistory history = job.start(version);
    return this.serializeHistory(history, GeoprismUser.get(job.getRunAsUser().getOid()), job);
}
Also used : ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ListType(net.geoprism.registry.ListType) ListTypeVersion(net.geoprism.registry.ListTypeVersion) Request(com.runwaysdk.session.Request)

Example 3 with ListType

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

the class MCSDFhirDataPopulator method configure.

@Override
public void configure(FhirConnection context, ListTypeVersion version, boolean resolveIds) {
    super.configure(context, version, resolveIds);
    ListType list = version.getListType();
    JsonArray hierarchies = list.getHierarchiesAsJson();
    for (int i = 0; i < hierarchies.size(); i++) {
        JsonObject hierarchy = hierarchies.get(i).getAsJsonObject();
        String hCode = hierarchy.get("code").getAsString();
        List<String> pCodes = list.getParentCodes(hierarchy);
        if (pCodes.size() > 0) {
            this.hierarchies.add(ServerHierarchyType.get(hCode));
        }
    }
}
Also used : JsonArray(com.google.gson.JsonArray) ListType(net.geoprism.registry.ListType) JsonObject(com.google.gson.JsonObject)

Example 4 with ListType

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

the class ListTypeService method record.

@Request(RequestType.SESSION)
public JsonObject record(String sessionId, String oid, String uid) {
    ListTypeVersion version = ListTypeVersion.get(oid);
    if (version.getWorking()) {
        ListType type = version.getListType();
        if (type.doesActorHaveExploratoryPermission()) {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            format.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
            ServerGeoObjectType geoObjectType = type.getGeoObjectType();
            ServerGeoObjectIF geoObject = new ServerGeoObjectService().getGeoObject(uid, geoObjectType.getCode());
            JsonObject object = new JsonObject();
            object.addProperty("recordType", "GEO_OBJECT");
            object.add("type", geoObject.getType().toJSON(new DefaultSerializer()));
            object.addProperty("code", geoObject.getCode());
            object.addProperty(ListTypeVersion.FORDATE, format.format(version.getForDate()));
            // Add geometry so we can zoom to it
            object.add("geoObject", geoObject.toGeoObject(version.getForDate()).toJSON());
            return object;
        }
    }
    return version.record(uid);
}
Also used : DefaultSerializer(org.commongeoregistry.adapter.metadata.DefaultSerializer) ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ListType(net.geoprism.registry.ListType) JsonObject(com.google.gson.JsonObject) ListTypeVersion(net.geoprism.registry.ListTypeVersion) SimpleDateFormat(java.text.SimpleDateFormat) Request(com.runwaysdk.session.Request)

Example 5 with ListType

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

the class ListTypeService method apply.

@Request(RequestType.SESSION)
public JsonObject apply(String sessionId, JsonObject list) {
    ListType mList = ListType.apply(list);
    ((Session) Session.getCurrentSession()).reloadPermissions();
    // Auto publish the working versions of the lists
    List<ListTypeVersion> versions = mList.getVersions();
    for (ListTypeVersion version : versions) {
        if (version.getWorking()) {
            this.publishVersion(sessionId, version.getOid());
        }
    }
    return mList.toJSON();
}
Also used : ListType(net.geoprism.registry.ListType) ListTypeVersion(net.geoprism.registry.ListTypeVersion) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request)

Aggregations

ListType (net.geoprism.registry.ListType)28 Request (com.runwaysdk.session.Request)21 JsonObject (com.google.gson.JsonObject)19 ListTypeVersion (net.geoprism.registry.ListTypeVersion)11 Test (org.junit.Test)10 IncrementalListType (net.geoprism.registry.IncrementalListType)9 IntervalListType (net.geoprism.registry.IntervalListType)9 SingleListType (net.geoprism.registry.SingleListType)9 DuplicateDataDatabaseException (com.runwaysdk.dataaccess.database.DuplicateDataDatabaseException)8 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)8 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)8 JsonArray (com.google.gson.JsonArray)5 ListTypeEntry (net.geoprism.registry.ListTypeEntry)5 QueryFactory (com.runwaysdk.query.QueryFactory)4 Session (com.runwaysdk.session.Session)4 MdBusinessDAOIF (com.runwaysdk.dataaccess.MdBusinessDAOIF)3 InvalidMasterListException (net.geoprism.registry.InvalidMasterListException)3 ListTypeVersionQuery (net.geoprism.registry.ListTypeVersionQuery)3 Geometry (com.vividsolutions.jts.geom.Geometry)2 Organization (net.geoprism.registry.Organization)2