Search in sources :

Example 6 with UndirectedGraphType

use of net.geoprism.registry.UndirectedGraphType in project geoprism-registry by terraframe.

the class UndirectedGraphTypeTest method testGetByMdEdge.

@Test
@Request
public void testGetByMdEdge() {
    UndirectedGraphType type = UndirectedGraphType.create("TEST", new LocalizedValue("Test Label"), new LocalizedValue("Test Description"));
    try {
        UndirectedGraphType result = UndirectedGraphType.getByMdEdge(type.getMdEdge());
        Assert.assertNotNull(result);
        Assert.assertEquals(type.getCode(), result.getCode());
    } finally {
        type.delete();
    }
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) UndirectedGraphType(net.geoprism.registry.UndirectedGraphType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 7 with UndirectedGraphType

use of net.geoprism.registry.UndirectedGraphType in project geoprism-registry by terraframe.

the class UndirectedGraphTypeTest method testUpdate.

@Test
@Request
public void testUpdate() {
    UndirectedGraphType type = UndirectedGraphType.create("TEST", new LocalizedValue("Test Label"), new LocalizedValue("Test Description"));
    try {
        JsonObject object = new JsonObject();
        object.add(UndirectedGraphType.JSON_LABEL, new LocalizedValue("Updated Label").toJSON());
        object.add(UndirectedGraphType.DESCRIPTION, new LocalizedValue("Updated Description").toJSON());
        type.update(object);
        Assert.assertEquals("Updated Label", type.getDisplayLabel().getValue());
        Assert.assertEquals("Updated Description", type.getDescription().getValue());
    } finally {
        type.delete();
    }
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) JsonObject(com.google.gson.JsonObject) UndirectedGraphType(net.geoprism.registry.UndirectedGraphType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 8 with UndirectedGraphType

use of net.geoprism.registry.UndirectedGraphType in project geoprism-registry by terraframe.

the class UndirectedGraphTypeService method update.

@Request(RequestType.SESSION)
public JsonObject update(String sessionId, String json) {
    JsonObject object = JsonParser.parseString(json).getAsJsonObject();
    String code = object.get(UndirectedGraphType.CODE).getAsString();
    UndirectedGraphType type = UndirectedGraphType.getByCode(code);
    type.update(object);
    return type.toJSON();
}
Also used : JsonObject(com.google.gson.JsonObject) UndirectedGraphType(net.geoprism.registry.UndirectedGraphType) Request(com.runwaysdk.session.Request)

Example 9 with UndirectedGraphType

use of net.geoprism.registry.UndirectedGraphType in project geoprism-registry by terraframe.

the class XMLImporter method createUndirectedGraphType.

private UndirectedGraphType createUndirectedGraphType(Element elem) {
    String code = elem.getAttribute("code");
    LocalizedValue label = this.getLabel(elem);
    LocalizedValue description = this.getDescription(elem);
    UndirectedGraphType type = UndirectedGraphType.create(code, label, description);
    return type;
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) UndirectedGraphType(net.geoprism.registry.UndirectedGraphType)

Example 10 with UndirectedGraphType

use of net.geoprism.registry.UndirectedGraphType in project geoprism-registry by terraframe.

the class UndirectedGraphTypeTest method testCreate.

@Test
@Request
public void testCreate() {
    String code = "TEST";
    LocalizedValue label = new LocalizedValue("Test Label");
    LocalizedValue description = new LocalizedValue("Test Description");
    UndirectedGraphType type = UndirectedGraphType.create(code, label, description);
    try {
        Assert.assertNotNull(type);
        Assert.assertEquals(code, type.getCode());
        Assert.assertEquals(label.getValue(), type.getDisplayLabel().getValue());
        Assert.assertEquals(description.getValue(), type.getDescription().getValue());
        MdEdge mdEdge = type.getMdEdge();
        Assert.assertNotNull(mdEdge);
        MdEdgeDAO mdEdgeDao = (MdEdgeDAO) BusinessFacade.getEntityDAO(mdEdge);
        Assert.assertNotNull(mdEdgeDao.definesAttribute("startDate"));
        Assert.assertNotNull(mdEdgeDao.definesAttribute("endDate"));
    } finally {
        type.delete();
    }
}
Also used : MdEdge(com.runwaysdk.system.metadata.MdEdge) LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) MdEdgeDAO(com.runwaysdk.dataaccess.metadata.graph.MdEdgeDAO) UndirectedGraphType(net.geoprism.registry.UndirectedGraphType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

UndirectedGraphType (net.geoprism.registry.UndirectedGraphType)10 Request (com.runwaysdk.session.Request)9 LocalizedValue (org.commongeoregistry.adapter.dataaccess.LocalizedValue)6 Test (org.junit.Test)5 JsonObject (com.google.gson.JsonObject)4 JsonArray (com.google.gson.JsonArray)1 MdEdgeDAO (com.runwaysdk.dataaccess.metadata.graph.MdEdgeDAO)1 Session (com.runwaysdk.session.Session)1 MdEdge (com.runwaysdk.system.metadata.MdEdge)1 HashSet (java.util.HashSet)1 DirectedAcyclicGraphType (net.geoprism.registry.DirectedAcyclicGraphType)1 GraphType (net.geoprism.registry.model.GraphType)1 ServerGeoObjectType (net.geoprism.registry.model.ServerGeoObjectType)1 VertexServerGeoObject (net.geoprism.registry.model.graph.VertexServerGeoObject)1 GeoObjectTypePermissionServiceIF (net.geoprism.registry.permission.GeoObjectTypePermissionServiceIF)1