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();
}
}
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();
}
}
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();
}
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;
}
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();
}
}
Aggregations