use of net.geoprism.registry.DirectedAcyclicGraphType in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphTypeService method update.
@Request(RequestType.SESSION)
public JsonObject update(String sessionId, String json) {
JsonObject object = JsonParser.parseString(json).getAsJsonObject();
String code = object.get(DirectedAcyclicGraphType.CODE).getAsString();
DirectedAcyclicGraphType type = DirectedAcyclicGraphType.getByCode(code);
type.update(object);
return type.toJSON();
}
use of net.geoprism.registry.DirectedAcyclicGraphType in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphTypeService method remove.
@Request(RequestType.SESSION)
public void remove(String sessionId, String code) {
DirectedAcyclicGraphType type = DirectedAcyclicGraphType.getByCode(code);
type.delete();
}
use of net.geoprism.registry.DirectedAcyclicGraphType in project geoprism-registry by terraframe.
the class RelationshipVisualizationService method tree.
@Request(RequestType.SESSION)
public JsonElement tree(String sessionId, Date date, String relationshipType, String graphTypeCode, String geoObjectCode, String geoObjectTypeCode) {
final GeoObjectTypePermissionServiceIF typePermissions = ServiceFactory.getGeoObjectTypePermissionService();
final ServerGeoObjectType type = ServiceFactory.getMetadataCache().getGeoObjectType(geoObjectTypeCode).get();
JsonObject view = new JsonObject();
JsonArray jaEdges = new JsonArray();
view.add("edges", jaEdges);
JsonArray jaVerticies = new JsonArray();
view.add("verticies", jaVerticies);
if (typePermissions.canRead(type.getOrganization().getCode(), type, type.getIsPrivate())) {
VertexServerGeoObject rootGo = (VertexServerGeoObject) ServiceFactory.getGeoObjectService().getGeoObjectByCode(geoObjectCode, type);
final GraphType graphType = GraphType.getByCode(relationshipType, graphTypeCode);
jaVerticies.add(serializeVertex(rootGo, (graphType instanceof UndirectedGraphType) ? "PARENT" : "SELECTED"));
Set<String> setEdges = new HashSet<String>();
Set<String> setVerticies = new HashSet<String>();
if (graphType instanceof UndirectedGraphType) {
// get parent and get children return the same thing for an undirected
// graph
fetchChildrenData(false, rootGo, graphType, date, jaEdges, jaVerticies, setEdges, setVerticies);
} else if (graphType instanceof DirectedAcyclicGraphType) {
// Out is children
fetchParentsData(false, rootGo, graphType, date, jaEdges, jaVerticies, setEdges, setVerticies);
// In is parents
fetchChildrenData(false, rootGo, graphType, date, jaEdges, jaVerticies, setEdges, setVerticies);
} else {
// Out is children
fetchParentsData(true, rootGo, graphType, date, jaEdges, jaVerticies, setEdges, setVerticies);
// In is parents
fetchChildrenData(false, rootGo, graphType, date, jaEdges, jaVerticies, setEdges, setVerticies);
}
}
return view;
}
use of net.geoprism.registry.DirectedAcyclicGraphType in project geoprism-registry by terraframe.
the class XMLImporter method createDirectedAcyclicGraphType.
private DirectedAcyclicGraphType createDirectedAcyclicGraphType(Element elem) {
String code = elem.getAttribute("code");
LocalizedValue label = this.getLabel(elem);
LocalizedValue description = this.getDescription(elem);
DirectedAcyclicGraphType type = DirectedAcyclicGraphType.create(code, label, description);
return type;
}
use of net.geoprism.registry.DirectedAcyclicGraphType in project geoprism-registry by terraframe.
the class DirectedAcyclicGraphTypeTest method testUpdate.
@Test
@Request
public void testUpdate() {
DirectedAcyclicGraphType type = DirectedAcyclicGraphType.create("TEST", new LocalizedValue("Test Label"), new LocalizedValue("Test Description"));
try {
JsonObject object = new JsonObject();
object.add(DirectedAcyclicGraphType.DISPLAYLABEL, new LocalizedValue("Updated Label").toJSON());
object.add(DirectedAcyclicGraphType.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();
}
}
Aggregations