Search in sources :

Example 71 with ServerGeoObjectIF

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

the class LocationService method search.

@Request(RequestType.SESSION)
public List<GeoObject> search(String sessionId, String text, Date date) {
    final GeoObjectPermissionService pService = new GeoObjectPermissionService();
    List<ServerGeoObjectIF> results = new SearchService().search(text, date, 20L);
    return results.stream().collect(() -> new LinkedList<GeoObject>(), (list, element) -> {
        ServerGeoObjectType type = element.getType();
        GeoObject geoObject = element.toGeoObject(date);
        geoObject.setWritable(pService.canCreateCR(type.getOrganization().getCode(), type));
        list.add(geoObject);
    }, (listA, listB) -> {
    });
}
Also used : GeoObjectPermissionService(net.geoprism.registry.permission.GeoObjectPermissionService) ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexServerGeoObject(net.geoprism.registry.model.graph.VertexServerGeoObject) GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) Request(com.runwaysdk.session.Request)

Example 72 with ServerGeoObjectIF

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

the class RegistryService method search.

@Request(RequestType.SESSION)
public List<GeoObject> search(String sessionId, String typeCode, String text, Date date) {
    List<GeoObject> objects = new LinkedList<GeoObject>();
    if (date == null) {
        date = ValueOverTime.INFINITY_END_DATE;
    }
    ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
    ServerGeoObjectQuery query = this.service.createQuery(type, date);
    query.setRestriction(new ServerSynonymRestriction(text, date));
    query.setLimit(20);
    List<ServerGeoObjectIF> results = query.getResults();
    for (ServerGeoObjectIF result : results) {
        objects.add(result.toGeoObject(date));
    }
    return objects;
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ServerSynonymRestriction(net.geoprism.registry.query.ServerSynonymRestriction) GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) LinkedList(java.util.LinkedList) ServerGeoObjectQuery(net.geoprism.registry.query.ServerGeoObjectQuery) Request(com.runwaysdk.session.Request) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest)

Example 73 with ServerGeoObjectIF

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

the class RegistryService method createGeoObject.

@Request(RequestType.SESSION)
public GeoObject createGeoObject(String sessionId, String jGeoObj, Date startDate, Date endDate) {
    GeoObject geoObject = GeoObject.fromJSON(adapter, jGeoObj);
    ServerGeoObjectIF object = service.apply(geoObject, startDate, endDate, true, false);
    return object.toGeoObject(startDate);
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) GeoObject(org.commongeoregistry.adapter.dataaccess.GeoObject) Request(com.runwaysdk.session.Request) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest)

Example 74 with ServerGeoObjectIF

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

the class RegistryService method newGeoObjectInstanceOverTime.

@Request(RequestType.SESSION)
public String newGeoObjectInstanceOverTime(String sessionId, String typeCode) {
    final ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
    ServerGeoObjectIF go = service.newInstance(type);
    go.setInvalid(false);
    final GeoObjectOverTime goot = go.toGeoObjectOverTime();
    ServerParentTreeNodeOverTime pot = go.getParentsOverTime(null, true);
    HierarchyService.filterHierarchiesFromPermissions(type, pot);
    /**
     * Serialize the GeoObject and add it to the response
     */
    JsonObject response = new JsonObject();
    response.add("geoObject", goot.toJSON());
    response.add("hierarchies", pot.toJSON());
    return response.toString();
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) JsonObject(com.google.gson.JsonObject) GeoObjectOverTime(org.commongeoregistry.adapter.dataaccess.GeoObjectOverTime) ServerParentTreeNodeOverTime(net.geoprism.registry.view.ServerParentTreeNodeOverTime) Request(com.runwaysdk.session.Request) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest)

Example 75 with ServerGeoObjectIF

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

the class RegistryService method getChildGeoObjects.

@Request(RequestType.SESSION)
public ChildTreeNode getChildGeoObjects(String sessionId, String parentCode, String parentGeoObjectTypeCode, String[] childrenTypes, Boolean recursive, Date date) {
    ServerGeoObjectIF object = this.service.getGeoObjectByCode(parentCode, parentGeoObjectTypeCode, true);
    if (date != null) {
        object.setDate(date);
    }
    ServerChildTreeNode node = object.getChildGeoObjects(childrenTypes, recursive, date);
    return node.toNode(true);
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerChildTreeNode(net.geoprism.registry.model.ServerChildTreeNode) Request(com.runwaysdk.session.Request) OAuthClientRequest(org.apache.oltu.oauth2.client.request.OAuthClientRequest)

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