Search in sources :

Example 21 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.

the class GraphService method getChildren.

@Request(RequestType.SESSION)
public JsonObject getChildren(String sessionId, String parentCode, String parentGeoObjectTypeCode, String graphTypeCode, Boolean recursive, Date date) {
    ServerGeoObjectService service = ServiceFactory.getGeoObjectService();
    ServerGeoObjectIF parent = service.getGeoObjectByCode(parentCode, parentGeoObjectTypeCode, true);
    GraphType graphType = this.getGraphType(graphTypeCode);
    // ServiceFactory.getGeoObjectRelationshipPermissionService().enforceCanAddChild(ht.getOrganization().getCode(),
    // parent.getType(), child.getType());
    ServerGraphNode node = parent.getGraphChildren(graphType, recursive, date);
    return node.toJSON();
}
Also used : ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) GraphType(net.geoprism.registry.model.GraphType) ServerGraphNode(net.geoprism.registry.model.ServerGraphNode) Request(com.runwaysdk.session.Request)

Example 22 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.

the class GraphService method removeChild.

@Request(RequestType.SESSION)
public void removeChild(String sessionId, String parentCode, String parentGeoObjectTypeCode, String childCode, String childGeoObjectTypeCode, String graphTypeCode, Date startDate, Date endDate) {
    ServerGeoObjectService service = ServiceFactory.getGeoObjectService();
    ServerGeoObjectIF parent = service.getGeoObjectByCode(parentCode, parentGeoObjectTypeCode, true);
    ServerGeoObjectIF child = service.getGeoObjectByCode(childCode, childGeoObjectTypeCode, true);
    GraphType graphType = this.getGraphType(graphTypeCode);
    // ServiceFactory.getGeoObjectRelationshipPermissionService().enforceCanAddChild(ht.getOrganization().getCode(),
    // parent.getType(), child.getType());
    parent.removeGraphChild(child, graphType, startDate, endDate);
}
Also used : ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) GraphType(net.geoprism.registry.model.GraphType) Request(com.runwaysdk.session.Request)

Example 23 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.

the class GraphService method addChild.

@Request(RequestType.SESSION)
public JsonObject addChild(String sessionId, String parentCode, String parentGeoObjectTypeCode, String childCode, String childGeoObjectTypeCode, String graphTypeCode, Date startDate, Date endDate) {
    ServerGeoObjectService service = ServiceFactory.getGeoObjectService();
    ServerGeoObjectIF parent = service.getGeoObjectByCode(parentCode, parentGeoObjectTypeCode, true);
    ServerGeoObjectIF child = service.getGeoObjectByCode(childCode, childGeoObjectTypeCode, true);
    GraphType graphType = this.getGraphType(graphTypeCode);
    // ServiceFactory.getGeoObjectRelationshipPermissionService().enforceCanAddChild(ht.getOrganization().getCode(),
    // parent.getType(), child.getType());
    ServerGraphNode node = parent.addGraphChild(child, graphType, startDate, endDate);
    return node.toJSON();
}
Also used : ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) GraphType(net.geoprism.registry.model.GraphType) ServerGraphNode(net.geoprism.registry.model.ServerGraphNode) Request(com.runwaysdk.session.Request)

Example 24 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF in project geoprism-registry by terraframe.

the class GraphService method getParents.

@Request(RequestType.SESSION)
public JsonObject getParents(String sessionId, String childCode, String childGeoObjectTypeCode, String graphTypeCode, Boolean recursive, Date date) {
    ServerGeoObjectService service = ServiceFactory.getGeoObjectService();
    ServerGeoObjectIF child = service.getGeoObjectByCode(childCode, childGeoObjectTypeCode, true);
    GraphType graphType = this.getGraphType(graphTypeCode);
    // ServiceFactory.getGeoObjectRelationshipPermissionService().enforceCanAddChild(ht.getOrganization().getCode(),
    // parent.getType(), child.getType());
    ServerGraphNode node = child.getGraphParents(graphType, recursive, date);
    return node.toJSON();
}
Also used : ServerGeoObjectService(net.geoprism.registry.geoobject.ServerGeoObjectService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) GraphType(net.geoprism.registry.model.GraphType) ServerGraphNode(net.geoprism.registry.model.ServerGraphNode) Request(com.runwaysdk.session.Request)

Example 25 with ServerGeoObjectIF

use of net.geoprism.registry.model.ServerGeoObjectIF 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)

Aggregations

ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)106 Request (com.runwaysdk.session.Request)68 Test (org.junit.Test)43 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)28 ServerGeoObjectService (net.geoprism.registry.geoobject.ServerGeoObjectService)23 ValueOverTime (com.runwaysdk.dataaccess.graph.attributes.ValueOverTime)18 ValueOverTimeCollection (com.runwaysdk.dataaccess.graph.attributes.ValueOverTimeCollection)18 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)16 Date (java.util.Date)15 GeoObject (org.commongeoregistry.adapter.dataaccess.GeoObject)15 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)13 LinkedList (java.util.LinkedList)11 OAuthClientRequest (org.apache.oltu.oauth2.client.request.OAuthClientRequest)10 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)10 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)10 JsonObject (com.google.gson.JsonObject)9 VertexObject (com.runwaysdk.business.graph.VertexObject)9 ChangeRequest (net.geoprism.registry.action.ChangeRequest)9 ServerParentTreeNode (net.geoprism.registry.model.ServerParentTreeNode)9 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)9