Search in sources :

Example 81 with ServerGeoObjectType

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

the class TestGeoObjectTypeInfo method getServerObject.

public ServerGeoObjectType getServerObject(boolean forceFetch) {
    if (this.serverObject != null && !forceFetch) {
        return this.serverObject;
    } else {
        Optional<ServerGeoObjectType> got = ServiceFactory.getMetadataCache().getGeoObjectType(code);
        if (got.isPresent()) {
            this.serverObject = got.get();
            return this.serverObject;
        } else {
            Universal uni = TestDataSet.getUniversalIfExist(getCode());
            if (uni == null) {
                return null;
            }
            this.serverObject = new ServerGeoObjectTypeConverter().build(uni);
            return this.serverObject;
        }
    }
}
Also used : Universal(com.runwaysdk.system.gis.geo.Universal) ServerGeoObjectTypeConverter(net.geoprism.registry.conversion.ServerGeoObjectTypeConverter) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType)

Example 82 with ServerGeoObjectType

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

the class GeoObjectQueryTest method testQueryTreeNodes.

@Test
@Request
public void testQueryTreeNodes() {
    ServerGeoObjectType type = USATestData.STATE.getServerObject();
    VertexGeoObjectQuery query = new VertexGeoObjectQuery(type, null);
    List<ServerGeoObjectIF> results = query.getResults();
    Assert.assertEquals(2, results.size());
    ServerGeoObjectIF result = results.get(0);
    Assert.assertEquals(USATestData.COLORADO.getCode(), result.getCode());
    Assert.assertNotNull(result.getGeometry());
    Assert.assertEquals(USATestData.COLORADO.getDisplayLabel(), result.getDisplayLabel().getValue());
    Assert.assertEquals(true, result.getExists());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexGeoObjectQuery(net.geoprism.registry.query.graph.VertexGeoObjectQuery) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 83 with ServerGeoObjectType

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

the class GeoObjectQueryTest method testLeafCodeRestriction.

@Test
@Request
public void testLeafCodeRestriction() {
    ServerGeoObjectType type = USATestData.DISTRICT.getServerObject();
    VertexGeoObjectQuery query = new VertexGeoObjectQuery(type, null);
    query.setRestriction(new ServerCodeRestriction(USATestData.CO_D_ONE.getCode()));
    ServerGeoObjectIF result = query.getSingleResult();
    Assert.assertEquals(USATestData.CO_D_ONE.getCode(), result.getCode());
    Assert.assertNotNull(result.getGeometry());
    Assert.assertEquals(USATestData.CO_D_ONE.getDisplayLabel(), result.getDisplayLabel().getValue());
    Assert.assertEquals(true, result.getExists());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexGeoObjectQuery(net.geoprism.registry.query.graph.VertexGeoObjectQuery) ServerCodeRestriction(net.geoprism.registry.query.ServerCodeRestriction) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 84 with ServerGeoObjectType

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

the class GeoObjectQueryTest method testTreeSynonymRestrictionByCode.

@Test
@Request
public void testTreeSynonymRestrictionByCode() {
    ServerGeoObjectType type = USATestData.STATE.getServerObject();
    VertexGeoObjectQuery query = new VertexGeoObjectQuery(type, null);
    query.setRestriction(new ServerSynonymRestriction(USATestData.COLORADO.getCode(), USATestData.COLORADO.getDate()));
    ServerGeoObjectIF result = query.getSingleResult();
    Assert.assertEquals(USATestData.COLORADO.getCode(), result.getCode());
    Assert.assertNotNull(result.getGeometry());
    Assert.assertEquals(USATestData.COLORADO.getDisplayLabel(), result.getDisplayLabel().getValue());
    Assert.assertEquals(true, result.getExists());
}
Also used : ServerGeoObjectIF(net.geoprism.registry.model.ServerGeoObjectIF) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) VertexGeoObjectQuery(net.geoprism.registry.query.graph.VertexGeoObjectQuery) ServerSynonymRestriction(net.geoprism.registry.query.ServerSynonymRestriction) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 85 with ServerGeoObjectType

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

the class ShapefileServiceTest method testGetAttributeInformationPostalCode.

@Test
@Request
public void testGetAttributeInformationPostalCode() {
    InputStream istream = this.getClass().getResourceAsStream("/cb_2017_us_state_500k.zip.test");
    ServerGeoObjectType type = USATestData.STATE.getServerObject();
    PostalCodeFactory.addPostalCode(type, new LocationBuilder() {

        @Override
        public Location build(ShapefileFunction function) {
            return null;
        }
    });
    Assert.assertNotNull(istream);
    ShapefileService service = new ShapefileService();
    JSONObject result = service.getShapefileConfiguration(testData.clientRequest.getSessionId(), USATestData.STATE.getCode(), null, null, "cb_2017_us_state_500k.zip", istream, ImportStrategy.NEW_AND_UPDATE, false);
    Assert.assertTrue(result.getBoolean(GeoObjectImportConfiguration.HAS_POSTAL_CODE));
}
Also used : JSONObject(org.json.JSONObject) LocationBuilder(net.geoprism.registry.io.LocationBuilder) InputStream(java.io.InputStream) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) ShapefileFunction(net.geoprism.data.importer.ShapefileFunction) ConstantShapefileFunction(net.geoprism.registry.io.ConstantShapefileFunction) ShapefileService(net.geoprism.registry.service.ShapefileService) Location(net.geoprism.registry.io.Location) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)201 Request (com.runwaysdk.session.Request)69 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)57 JsonObject (com.google.gson.JsonObject)48 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)32 JsonArray (com.google.gson.JsonArray)30 Transaction (com.runwaysdk.dataaccess.transaction.Transaction)30 MdVertexDAOIF (com.runwaysdk.dataaccess.MdVertexDAOIF)27 LinkedList (java.util.LinkedList)27 Test (org.junit.Test)27 VertexObject (com.runwaysdk.business.graph.VertexObject)26 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)26 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)23 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)23 Date (java.util.Date)21 GraphQuery (com.runwaysdk.business.graph.GraphQuery)19 List (java.util.List)18 EdgeObject (com.runwaysdk.business.graph.EdgeObject)17 SimpleDateFormat (java.text.SimpleDateFormat)17 Locale (java.util.Locale)17