use of net.geoprism.registry.conversion.VertexGeoObjectStrategy in project geoprism-registry by terraframe.
the class GeoVertexSynonym method createSynonym.
@Transaction
public static JSONObject createSynonym(String typeCode, String code, String label) {
ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
VertexGeoObjectStrategy strategy = new VertexGeoObjectStrategy(type);
VertexServerGeoObject object = strategy.getGeoObjectByCode(code);
final String oid = object.addSynonym(label);
JSONObject jObject = new JSONObject();
jObject.put("synonymId", oid);
jObject.put("label", object.getDisplayLabel().getValue());
// jObject.put("ancestors", object.getA new
// JSONArray(GeoEntityUtil.getAncestorsAsJSON(code)));
JSONObject response = new JSONObject(jObject);
response.put("vOid", oid);
return response;
}
use of net.geoprism.registry.conversion.VertexGeoObjectStrategy in project geoprism-registry by terraframe.
the class Transition method apply.
public static Transition apply(TransitionEvent event, int order, JsonObject object) {
Transition transition = (object.has("isNew") && object.get("isNew").getAsBoolean()) ? new Transition() : Transition.get(object.get(OID).getAsString());
transition.setTransitionType(object.get(Transition.TRANSITIONTYPE).getAsString());
transition.setImpact(object.get(Transition.IMPACT).getAsString());
if (transition.isNew()) {
transition.setValue(Transition.EVENT, event);
}
String sourceCode = object.get("sourceCode").getAsString();
String sourceType = object.get("sourceType").getAsString();
String targetCode = object.get("targetCode").getAsString();
String targetType = object.get("targetType").getAsString();
VertexServerGeoObject source = new VertexGeoObjectStrategy(ServerGeoObjectType.get(sourceType)).getGeoObjectByCode(sourceCode);
VertexServerGeoObject target = new VertexGeoObjectStrategy(ServerGeoObjectType.get(targetType)).getGeoObjectByCode(targetCode);
transition.apply(event, order, source, target);
return transition;
}
use of net.geoprism.registry.conversion.VertexGeoObjectStrategy in project geoprism-registry by terraframe.
the class UpdateParentValueOverTimeView method getNewValueAsGO.
public VertexServerGeoObject getNewValueAsGO() {
if (this.newValue != null && !this.newValue.isJsonNull()) {
String[] newValueSplit = (this.getNewValue().getAsString()).split(VALUE_SPLIT_TOKEN);
String parentTypeCode = newValueSplit[0];
String parentCode = newValueSplit[1];
ServerGeoObjectType parentType = ServerGeoObjectType.get(parentTypeCode);
final VertexServerGeoObject parent = new VertexGeoObjectStrategy(parentType).getGeoObjectByCode(parentCode);
return parent;
}
return null;
}
use of net.geoprism.registry.conversion.VertexGeoObjectStrategy in project geoprism-registry by terraframe.
the class UpdateAttributeAction method execute.
@Override
public void execute() {
ChangeRequest cr = this.getAllRequest().next();
ServerGeoObjectType type = ServerGeoObjectType.get(cr.getGeoObjectTypeCode());
VertexServerGeoObject go = new VertexGeoObjectStrategy(type).getGeoObjectByCode(cr.getGeoObjectCode());
AbstractUpdateAttributeView view = UpdateAttributeViewJsonAdapters.deserialize(this.getJson(), this.getAttributeName(), type);
view.execute(go);
if (!this.getAttributeName().equals(UpdateAttributeViewJsonAdapters.PARENT_ATTR_NAME)) {
String attributeName = this.getAttributeName();
if (attributeName.equals("geometry")) {
attributeName = go.getGeometryAttributeName();
}
ValueOverTimeCollection votc = go.getValuesOverTime(attributeName);
votc.reorder();
go.apply(false);
}
}
use of net.geoprism.registry.conversion.VertexGeoObjectStrategy in project geoprism-registry by terraframe.
the class HierarchyChangeTest method testRemoveFromHierarchyWithData.
@Test
@Request
public void testRemoveFromHierarchyWithData() {
String sessionId = testData.clientSession.getSessionId();
String hierarchyCode = USATestData.HIER_ADMIN.getCode();
String countryTypeCode = USATestData.COUNTRY.getCode();
String stateTypeCode = USATestData.STATE.getCode();
String cd1TypeCode = USATestData.CO_D_ONE.getCode();
ServerGeoObjectIF geoobject = new VertexGeoObjectStrategy(USATestData.DISTRICT.getServerObject()).getGeoObjectByCode(cd1TypeCode);
ServerParentTreeNode parents = geoobject.getParentGeoObjects(null, false, TestDataSet.DEFAULT_OVER_TIME_DATE);
Assert.assertEquals(1, parents.getParents().size());
ServiceFactory.getHierarchyService().removeFromHierarchy(sessionId, hierarchyCode, countryTypeCode, stateTypeCode, true);
ServerGeoObjectIF test = new VertexGeoObjectStrategy(USATestData.DISTRICT.getServerObject()).getGeoObjectByCode(cd1TypeCode);
ServerParentTreeNode tParents = test.getParentGeoObjects(null, false, TestDataSet.DEFAULT_OVER_TIME_DATE);
Assert.assertEquals(0, tParents.getParents().size());
}
Aggregations