Search in sources :

Example 6 with DirectedAcyclicGraphType

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

the class DirectedAcyclicGraphTypeTest method testGetByCode.

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

Example 7 with DirectedAcyclicGraphType

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

the class DirectedAcyclicGraphTypeService method create.

@Request(RequestType.SESSION)
public JsonObject create(String sessionId, String json) {
    JsonObject object = JsonParser.parseString(json).getAsJsonObject();
    DirectedAcyclicGraphType type = DirectedAcyclicGraphType.create(object);
    ((Session) Session.getCurrentSession()).reloadPermissions();
    return type.toJSON();
}
Also used : DirectedAcyclicGraphType(net.geoprism.registry.DirectedAcyclicGraphType) JsonObject(com.google.gson.JsonObject) Session(com.runwaysdk.session.Session) Request(com.runwaysdk.session.Request)

Example 8 with DirectedAcyclicGraphType

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

the class DirectedAcyclicGraphTypeTest method testCreate.

@Test
@Request
public void testCreate() {
    String code = "TEST";
    LocalizedValue label = new LocalizedValue("Test Label");
    LocalizedValue description = new LocalizedValue("Test Description");
    DirectedAcyclicGraphType type = DirectedAcyclicGraphType.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) DirectedAcyclicGraphType(net.geoprism.registry.DirectedAcyclicGraphType) MdEdgeDAO(com.runwaysdk.dataaccess.metadata.graph.MdEdgeDAO) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Example 9 with DirectedAcyclicGraphType

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

the class DirectedAcyclicGraphTypeTest method testGetByMdEdge.

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

Example 10 with DirectedAcyclicGraphType

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

the class DirectedAcyclicGraphTypeTest method testGetByAll.

@Test
@Request
public void testGetByAll() {
    DirectedAcyclicGraphType type = DirectedAcyclicGraphType.create("TEST", new LocalizedValue("Test Label"), new LocalizedValue("Test Description"));
    try {
        List<DirectedAcyclicGraphType> results = DirectedAcyclicGraphType.getAll();
        Assert.assertEquals(1, results.size());
        DirectedAcyclicGraphType result = results.get(0);
        Assert.assertEquals(type.getCode(), result.getCode());
    } finally {
        type.delete();
    }
}
Also used : LocalizedValue(org.commongeoregistry.adapter.dataaccess.LocalizedValue) DirectedAcyclicGraphType(net.geoprism.registry.DirectedAcyclicGraphType) Test(org.junit.Test) Request(com.runwaysdk.session.Request)

Aggregations

DirectedAcyclicGraphType (net.geoprism.registry.DirectedAcyclicGraphType)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 UndirectedGraphType (net.geoprism.registry.UndirectedGraphType)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