Search in sources :

Example 31 with GeoObjectType

use of org.commongeoregistry.adapter.metadata.GeoObjectType in project geoprism-registry by terraframe.

the class AttributeTypeServiceTest method testCreateGeoObjectTypeDate.

@Test
public void testCreateGeoObjectTypeDate() {
    String organizationCode = FastTestDataset.ORG_CGOV.getCode();
    GeoObjectType province = MetadataFactory.newGeoObjectType(TEST_GOT.getCode(), GeometryType.POLYGON, new LocalizedValue("Province"), new LocalizedValue(""), true, organizationCode, testData.adapter);
    String gtJSON = province.toJSON().toString();
    AttributeType testDate = AttributeType.factory("testDate", new LocalizedValue("testDateLocalName"), new LocalizedValue("testDateLocalDescrip"), AttributeDateType.TYPE, false, false, false);
    testData.adapter.createGeoObjectType(gtJSON);
    String geoObjectTypeCode = province.getCode();
    String attributeTypeJSON = testDate.toJSON().toString();
    testDate = testData.adapter.createAttributeType(geoObjectTypeCode, attributeTypeJSON);
    MdAttributeDAOIF mdAttributeConcreteDAOIF = checkAttribute(TEST_GOT.getCode(), testDate.getName());
    Assert.assertNotNull("A GeoObjectType did not define the attribute: " + testDate.getName(), mdAttributeConcreteDAOIF);
    Assert.assertTrue("A GeoObjectType did not define the attribute of the correct type: " + mdAttributeConcreteDAOIF.getType(), mdAttributeConcreteDAOIF instanceof MdAttributeMomentDAOIF);
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType) MdAttributeDAOIF(com.runwaysdk.dataaccess.MdAttributeDAOIF) AttributeType(org.commongeoregistry.adapter.metadata.AttributeType) MdAttributeMomentDAOIF(com.runwaysdk.dataaccess.MdAttributeMomentDAOIF) Test(org.junit.Test) ClassificationTypeTest(net.geoprism.registry.classification.ClassificationTypeTest)

Example 32 with GeoObjectType

use of org.commongeoregistry.adapter.metadata.GeoObjectType in project geoprism-registry by terraframe.

the class TestGeoObjectTypeInfo method applyInTrans.

@Transaction
private void applyInTrans() {
    if (this.getServerObject() != null) {
        return;
    }
    String organizationCode = this.getOrganization().getCode();
    GeoObjectType got = new GeoObjectType(this.getCode(), this.geomType, this.getDisplayLabel(), this.getDescription(), true, organizationCode, ServiceFactory.getAdapter());
    got.setIsAbstract(this.isAbstract);
    got.setIsPrivate(this.isPrivate);
    if (this.getSuperType() != null) {
        got.setSuperTypeCode(this.getSuperType().code);
    }
    this.serverObject = new ServerGeoObjectTypeConverter().create(got);
    universal = this.serverObject.getUniversal();
    this.setUid(universal.getOid());
}
Also used : ServerGeoObjectTypeConverter(net.geoprism.registry.conversion.ServerGeoObjectTypeConverter) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType) Transaction(com.runwaysdk.dataaccess.transaction.Transaction)

Example 33 with GeoObjectType

use of org.commongeoregistry.adapter.metadata.GeoObjectType in project geoprism-registry by terraframe.

the class InheritedHierarchyAnnotationTest method testGetTypeAncestorsInherited.

@Test
@Request
public void testGetTypeAncestorsInherited() {
    ServerGeoObjectType sGOT = FastTestDataset.PROVINCE.getServerObject();
    ServerHierarchyType forHierarchy = TEST_HT.getServerObject();
    ServerHierarchyType inheritedHierarchy = FastTestDataset.HIER_ADMIN.getServerObject();
    InheritedHierarchyAnnotation annotation = sGOT.setInheritedHierarchy(forHierarchy, inheritedHierarchy);
    try {
        ServerGeoObjectType childType = TEST_CHILD.getServerObject();
        List<GeoObjectType> results = childType.getTypeAncestors(TEST_HT.getServerObject(), true);
        Assert.assertEquals(2, results.size());
    } finally {
        annotation.delete();
    }
}
Also used : ServerHierarchyType(net.geoprism.registry.model.ServerHierarchyType) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) GeoObjectType(org.commongeoregistry.adapter.metadata.GeoObjectType) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) InheritedHierarchyAnnotation(net.geoprism.registry.InheritedHierarchyAnnotation) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

GeoObjectType (org.commongeoregistry.adapter.metadata.GeoObjectType)33 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)23 ServerHierarchyType (net.geoprism.registry.model.ServerHierarchyType)13 JsonArray (com.google.gson.JsonArray)10 JsonObject (com.google.gson.JsonObject)10 Request (com.runwaysdk.session.Request)10 LinkedList (java.util.LinkedList)7 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)6 Test (org.junit.Test)6 ServerGeoObjectTypeConverter (net.geoprism.registry.conversion.ServerGeoObjectTypeConverter)4 HierarchyNode (org.commongeoregistry.adapter.metadata.HierarchyNode)4 HierarchyType (org.commongeoregistry.adapter.metadata.HierarchyType)4 Endpoint (com.runwaysdk.mvc.Endpoint)3 RestBodyResponse (com.runwaysdk.mvc.RestBodyResponse)3 List (java.util.List)3 ServerGeoObjectIF (net.geoprism.registry.model.ServerGeoObjectIF)3 MdAttributeDAOIF (com.runwaysdk.dataaccess.MdAttributeDAOIF)2 Universal (com.runwaysdk.system.gis.geo.Universal)2 SimpleDateFormat (java.text.SimpleDateFormat)2 HashMap (java.util.HashMap)2