use of net.geoprism.registry.geoobject.ServerGeoObjectService in project geoprism-registry by terraframe.
the class GeoObjectUtilTest method testGetAncestorMapForTreeType.
@Test
@Request
public void testGetAncestorMapForTreeType() {
ServerGeoObjectType type = USATestData.AREA.getServerObject();
ServerHierarchyType hierarchyType = ServerHierarchyType.get(USATestData.HIER_ADMIN.getCode());
ServerGeoObjectIF object = new ServerGeoObjectService().getGeoObjectByCode(USATestData.CO_A_ONE.getCode(), type);
List<GeoObjectType> dtoAncestors = type.getTypeAncestors(hierarchyType, true);
List<ServerGeoObjectType> ancestors = new LinkedList<ServerGeoObjectType>();
for (GeoObjectType ancestor : dtoAncestors) {
ancestors.add(ServerGeoObjectType.get(ancestor));
}
Map<String, LocationInfo> map = object.getAncestorMap(hierarchyType, ancestors);
Assert.assertEquals(3, map.size());
// Validate the county values
Assert.assertTrue(map.containsKey(USATestData.COUNTY.getCode()));
LocationInfo vObject = map.get(USATestData.COUNTY.getCode());
Assert.assertEquals(USATestData.CO_C_ONE.getCode(), vObject.getCode());
Assert.assertEquals(USATestData.CO_C_ONE.getDisplayLabel(), vObject.getLabel());
// Validate the state values
Assert.assertTrue(map.containsKey(USATestData.STATE.getCode()));
vObject = map.get(USATestData.STATE.getCode());
Assert.assertEquals(USATestData.COLORADO.getCode(), vObject.getCode());
Assert.assertEquals(USATestData.COLORADO.getDisplayLabel(), vObject.getLabel());
// Validate the country values
Assert.assertTrue(map.containsKey(USATestData.COUNTRY.getCode()));
vObject = map.get(USATestData.COUNTRY.getCode());
Assert.assertEquals(USATestData.USA.getCode(), vObject.getCode());
Assert.assertEquals(USATestData.USA.getDisplayLabel(), vObject.getLabel());
}
use of net.geoprism.registry.geoobject.ServerGeoObjectService in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testUpdateGeoObjectCR.
private void testUpdateGeoObjectCR(String json, ClientRequestIF request) throws Exception {
ServerGeoObjectService service = new ServerGeoObjectService();
JsonObject jo = service.updateGeoObject(request.getSessionId(), FastTestDataset.CAMBODIA.getCode(), FastTestDataset.COUNTRY.getCode(), json, null, "test-notes");
Assert.assertEquals(true, jo.get("isChangeRequest").getAsBoolean());
Assert.assertEquals(36, jo.get("changeRequestId").getAsString().length());
testUpdateGeoObjectCR_Verify();
}
use of net.geoprism.registry.geoobject.ServerGeoObjectService in project geoprism-registry by terraframe.
the class CreateGeoObjectAction method execute.
@Override
public void execute() {
String sJson = this.getGeoObjectJson();
GeoObjectOverTime geoObject = GeoObjectOverTime.fromJSON(ServiceFactory.getAdapter(), sJson);
ServerGeoObjectService service = new ServerGeoObjectService();
service.apply(geoObject, true, false);
ServerGeoObjectIF child = service.getGeoObjectByCode(geoObject.getCode(), geoObject.getType().getCode());
ServerParentTreeNodeOverTime ptnOt = ServerParentTreeNodeOverTime.fromJSON(child.getType(), this.getParentJson());
child.setParents(ptnOt);
}
use of net.geoprism.registry.geoobject.ServerGeoObjectService in project geoprism-registry by terraframe.
the class SetParentAction method execute.
@Override
public void execute() {
ServerGeoObjectService service = new ServerGeoObjectService();
ServerGeoObjectIF child = service.getGeoObjectByCode(this.getChildCode(), this.getChildTypeCode());
ServerParentTreeNodeOverTime ptnOt = ServerParentTreeNodeOverTime.fromJSON(child.getType(), this.getJson());
child.setParents(ptnOt);
}
use of net.geoprism.registry.geoobject.ServerGeoObjectService in project geoprism-registry by terraframe.
the class UpdateGeoObjectAction method execute.
@Override
public void execute() {
String sJson = this.getGeoObjectJson();
GeoObjectOverTime goTime = GeoObjectOverTime.fromJSON(ServiceFactory.getAdapter(), sJson);
ServerGeoObjectService builder = new ServerGeoObjectService();
builder.apply(goTime, false, false);
}
Aggregations