Search in sources :

Example 21 with Classification

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

the class ClassificationService method removeChild.

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

Example 22 with Classification

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

the class ClassificationService method remove.

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

Example 23 with Classification

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

the class ExcelServiceTest method classSetUp.

@BeforeClass
@Request
public static void classSetUp() {
    type = ClassificationType.apply(ClassificationTypeTest.createMock());
    Classification root = Classification.newInstance(type);
    root.setCode(CODE);
    root.setDisplayLabel(new LocalizedValue("Test Classification"));
    root.apply(null);
    TestDataSet.deleteAllSchedulerData();
    testData = USATestData.newTestData();
    testData.setUpMetadata();
    testTerm = (AttributeTermType) TestDataSet.createTermAttribute("testTerm", "testTermLocalName", USATestData.DISTRICT, null).fetchDTO();
    testBoolean = (AttributeBooleanType) TestDataSet.createAttribute("testBoolean", "testBooleanLocalName", USATestData.DISTRICT, AttributeBooleanType.TYPE).fetchDTO();
    testDate = (AttributeDateType) TestDataSet.createAttribute("testDate", "testDateLocalName", USATestData.DISTRICT, AttributeDateType.TYPE).fetchDTO();
    testInteger = (AttributeIntegerType) TestDataSet.createAttribute("testInteger", "testIntegerLocalName", USATestData.DISTRICT, AttributeIntegerType.TYPE).fetchDTO();
    if (!SchedulerManager.initialized()) {
        SchedulerManager.start();
    }
    testClassification = (AttributeClassificationType) AttributeType.factory("testClassification", new LocalizedValue("testClassificationLocalName"), new LocalizedValue("testClassificationLocalDescrip"), AttributeClassificationType.TYPE, false, false, false);
    testClassification.setClassificationType(type.getCode());
    testClassification.setRootTerm(root.toTerm());
    ServerGeoObjectType got = ServerGeoObjectType.get(USATestData.DISTRICT.getCode());
    testClassification = (AttributeClassificationType) got.createAttributeType(testClassification.toJSON().toString());
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) ServerGeoObjectType(net.geoprism.registry.model.ServerGeoObjectType) AbstractClassification(com.runwaysdk.system.AbstractClassification) Classification(net.geoprism.registry.model.Classification) BeforeClass(org.junit.BeforeClass) Request(com.runwaysdk.session.Request)

Example 24 with Classification

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

the class AttributeTypeServiceTest method createMdClassification.

@Request
private void createMdClassification() {
    type = ClassificationType.apply(ClassificationTypeTest.createMock());
    Classification root = Classification.newInstance(type);
    root.setCode(CODE);
    root.setDisplayLabel(new LocalizedValue("Test Classification"));
    root.apply(null);
    TYPE_CODE = type.getCode();
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) Classification(net.geoprism.registry.model.Classification) Request(com.runwaysdk.session.Request)

Example 25 with Classification

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

the class ClassificationTest method testRemoveChild.

@Test
@Request
public void testRemoveChild() {
    Classification parent = Classification.newInstance(type);
    parent.setCode(PARENT_CODE);
    parent.apply(null);
    try {
        Classification child = Classification.newInstance(type);
        child.setCode(CHILD_CODE);
        child.apply(null);
        try {
            parent.addChild(child);
            Assert.assertEquals(Long.valueOf(1), parent.getChildren().getCount());
            parent.removeChild(child);
            Assert.assertEquals(Long.valueOf(0), parent.getChildren().getCount());
        } finally {
            child.delete();
        }
    } finally {
        parent.delete();
    }
}
Also used : Classification(net.geoprism.registry.model.Classification) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

Classification (net.geoprism.registry.model.Classification)27 Request (com.runwaysdk.session.Request)19 ClassificationType (net.geoprism.registry.model.ClassificationType)14 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)9 AttributeClassificationType (org.commongeoregistry.adapter.metadata.AttributeClassificationType)8 AttributeTermType (org.commongeoregistry.adapter.metadata.AttributeTermType)8 Classifier (net.geoprism.ontology.Classifier)7 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)7 Term (org.commongeoregistry.adapter.Term)6 AbstractClassification (com.runwaysdk.system.AbstractClassification)5 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)5 JsonObject (com.google.gson.JsonObject)4 EdgeObject (com.runwaysdk.business.graph.EdgeObject)4 GraphObject (com.runwaysdk.business.graph.GraphObject)4 VertexObject (com.runwaysdk.business.graph.VertexObject)4 LineString (com.vividsolutions.jts.geom.LineString)4 MultiLineString (com.vividsolutions.jts.geom.MultiLineString)4 Test (org.junit.Test)4 JsonArray (com.google.gson.JsonArray)3 MdClassificationDAOIF (com.runwaysdk.dataaccess.MdClassificationDAOIF)3