Search in sources :

Example 31 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ChangeRequestService method update.

@Request(RequestType.SESSION)
public JsonObject update(String sessionId, String cr) {
    JsonObject obj = JsonParser.parseString(cr).getAsJsonObject();
    String oid = obj.get("oid").getAsString();
    JsonArray actions = obj.get("actions").getAsJsonArray();
    String notes = obj.get("contributorNotes").getAsString();
    ChangeRequest current = ChangeRequest.get(oid);
    ServerGeoObjectService service = new ServerGeoObjectService();
    service.updateChangeRequest(current, notes, actions);
    return current.getDetails();
}
Also used : JsonArray(com.google.gson.JsonArray) ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) JsonObject(com.google.gson.JsonObject) ChangeRequest(net.geoprism.registry.action.ChangeRequest) Request(com.runwaysdk.session.Request) ChangeRequest(net.geoprism.registry.action.ChangeRequest)

Example 32 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ChangeRequestService method implementDecisions.

@Request(RequestType.SESSION)
public JsonObject implementDecisions(String sessionId, String request) {
    ChangeRequest input = ChangeRequest.fromJSON(request);
    ChangeRequest current = ChangeRequest.get(JsonParser.parseString(request).getAsJsonObject().get("oid").getAsString());
    if (!this.permService.getPermissions(current).containsAll(Arrays.asList(ChangeRequestPermissionAction.EXECUTE, ChangeRequestPermissionAction.WRITE_APPROVAL_STATUS, ChangeRequestPermissionAction.WRITE))) {
        throw new CGRPermissionException();
    }
    current.execute(input.getMaintainerNotes(), input.getAdditionalNotes());
    return current.getDetails();
}
Also used : CGRPermissionException(net.geoprism.registry.CGRPermissionException) ChangeRequest(net.geoprism.registry.action.ChangeRequest) Request(com.runwaysdk.session.Request) ChangeRequest(net.geoprism.registry.action.ChangeRequest)

Example 33 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ChangeRequestService method reject.

@Request(RequestType.SESSION)
public void reject(String sessionId, String request) {
    ChangeRequest input = ChangeRequest.fromJSON(request);
    ChangeRequest current = ChangeRequest.get(JsonParser.parseString(request).getAsJsonObject().get("oid").getAsString());
    if (!this.permService.getPermissions(current).containsAll(Arrays.asList(ChangeRequestPermissionAction.WRITE, ChangeRequestPermissionAction.WRITE_APPROVAL_STATUS, ChangeRequestPermissionAction.READ, ChangeRequestPermissionAction.READ_DETAILS))) {
        throw new CGRPermissionException();
    }
    current.reject(input.getMaintainerNotes(), input.getAdditionalNotes());
}
Also used : CGRPermissionException(net.geoprism.registry.CGRPermissionException) ChangeRequest(net.geoprism.registry.action.ChangeRequest) Request(com.runwaysdk.session.Request) ChangeRequest(net.geoprism.registry.action.ChangeRequest)

Example 34 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ClassificationService method apply.

@Request(RequestType.SESSION)
public JsonObject apply(String sessionId, String classificationCode, String parentCode, JsonObject object, boolean isNew) {
    ClassificationType type = ClassificationType.getByCode(classificationCode);
    Classification parent = parentCode != null ? Classification.get(type, parentCode) : null;
    Classification classification = Classification.construct(type, object, isNew);
    classification.populate(object);
    classification.apply(parent);
    // Return the refreshed copy of the geoObject
    return classification.toJSON();
}
Also used : Classification(net.geoprism.registry.model.Classification) ClassificationType(net.geoprism.registry.model.ClassificationType) Request(com.runwaysdk.session.Request)

Example 35 with Request

use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.

the class ClassificationService method move.

@Request(RequestType.SESSION)
public void move(String sessionId, String classificationCode, String code, String parentCode) {
    ClassificationType type = ClassificationType.getByCode(classificationCode);
    Classification classification = Classification.get(type, code);
    Classification newParent = Classification.get(type, parentCode);
    classification.move(newParent);
}
Also used : Classification(net.geoprism.registry.model.Classification) ClassificationType(net.geoprism.registry.model.ClassificationType) Request(com.runwaysdk.session.Request)

Aggregations

Request (com.runwaysdk.session.Request)340 Test (org.junit.Test)145 JsonObject (com.google.gson.JsonObject)85 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)73 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)73 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)53 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)40 JsonArray (com.google.gson.JsonArray)36 Date (java.util.Date)33 ChangeRequest (net.geoprism.registry.action.ChangeRequest)32 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)31 QueryFactory (com.runwaysdk.query.QueryFactory)30 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)26 ValueOverTimeCollection (com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)22 ListType (net.geoprism.registry.ListType)21 SimpleDateFormat (java.text.SimpleDateFormat)19 Classification (net.geoprism.registry.model.Classification)19 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)19 ClassificationTypeTest (net.geoprism.registry.classification.ClassificationTypeTest)17 TransitionEvent (net.geoprism.registry.graph.transition.TransitionEvent)17