Search in sources :

Example 16 with ClassificationType

use of net.geoprism.registry.model.ClassificationType 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 17 with ClassificationType

use of net.geoprism.registry.model.ClassificationType 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 18 with ClassificationType

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

the class ClassificationTypeTest method testPage.

@Test
@Request
public void testPage() {
    ClassificationType classificationType = ClassificationType.apply(createMock());
    try {
        Page<ClassificationType> page = ClassificationType.page(new JsonObject());
        Assert.assertEquals(new Long(1), page.getCount());
        ClassificationType result = page.getResults().get(0);
        Assert.assertEquals(classificationType.getOid(), result.getOid());
    } finally {
        classificationType.delete();
    }
}
Also used : JsonObject(com.google.gson.JsonObject) ClassificationType(net.geoprism.registry.model.ClassificationType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 19 with ClassificationType

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

the class ClassificationTypeTest method testUpdate.

@Test
@Request
public void testUpdate() {
    ClassificationType type = ClassificationType.apply(createMock());
    try {
        String label = "Updated";
        JsonObject json = type.toJSON();
        json.add(MdClassificationInfo.DISPLAY_LABEL, new LocalizedValue(label).toJSON());
        type = ClassificationType.apply(json);
        Assert.assertEquals(label, type.getDisplayLabel().getValue());
    } finally {
        type.delete();
    }
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) JsonObject(com.google.gson.JsonObject) ClassificationType(net.geoprism.registry.model.ClassificationType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

ClassificationType (net.geoprism.registry.model.ClassificationType)19 Classification (net.geoprism.registry.model.Classification)14 Request (com.runwaysdk.session.Request)13 JsonObject (com.google.gson.JsonObject)6 AttributeClassificationType (org.commongeoregistry.adapter.metadata.AttributeClassificationType)5 AttributeTermType (org.commongeoregistry.adapter.metadata.AttributeTermType)5 Classifier (net.geoprism.ontology.Classifier)4 AttributeType (org.commongeoregistry.adapter.metadata.AttributeType)4 Test (org.junit.Test)4 MdClassificationDAOIF (com.runwaysdk.dataaccess.MdClassificationDAOIF)3 List (java.util.List)3 Term (org.commongeoregistry.adapter.Term)3 DefaultAttribute (org.commongeoregistry.adapter.constants.DefaultAttribute)3 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)3 JsonArray (com.google.gson.JsonArray)2 EdgeObject (com.runwaysdk.business.graph.EdgeObject)2 GraphObject (com.runwaysdk.business.graph.GraphObject)2 VertexObject (com.runwaysdk.business.graph.VertexObject)2 AbstractClassification (com.runwaysdk.system.AbstractClassification)2 LineString (com.vividsolutions.jts.geom.LineString)2