use of net.geoprism.registry.view.ServerParentTreeNodeOverTime 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.view.ServerParentTreeNodeOverTime in project geoprism-registry by terraframe.
the class HierarchyService method getHierarchiesForGeoObjectOverTimeInReq.
public JsonArray getHierarchiesForGeoObjectOverTimeInReq(String code, String typeCode) {
ServerGeoObjectIF geoObject = ServiceFactory.getGeoObjectService().getGeoObjectByCode(code, typeCode);
ServerParentTreeNodeOverTime pot = geoObject.getParentsOverTime(null, true);
filterHierarchiesFromPermissions(geoObject.getType(), pot);
return pot.toJSON();
}
use of net.geoprism.registry.view.ServerParentTreeNodeOverTime in project geoprism-registry by terraframe.
the class RegistryService method newGeoObjectInstanceOverTime.
@Request(RequestType.SESSION)
public String newGeoObjectInstanceOverTime(String sessionId, String typeCode) {
final ServerGeoObjectType type = ServerGeoObjectType.get(typeCode);
ServerGeoObjectIF go = service.newInstance(type);
go.setInvalid(false);
final GeoObjectOverTime goot = go.toGeoObjectOverTime();
ServerParentTreeNodeOverTime pot = go.getParentsOverTime(null, true);
HierarchyService.filterHierarchiesFromPermissions(type, pot);
/**
* Serialize the GeoObject and add it to the response
*/
JsonObject response = new JsonObject();
response.add("geoObject", goot.toJSON());
response.add("hierarchies", pot.toJSON());
return response.toString();
}
use of net.geoprism.registry.view.ServerParentTreeNodeOverTime in project geoprism-registry by terraframe.
the class ChangeRequestServiceTest method testCreateGeoObjectCR_Json.
@Request
private String[] testCreateGeoObjectCR_Json() throws Exception {
final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
sdf.setTimeZone(GeoRegistryUtil.SYSTEM_TIMEZONE);
final Date newStartDate = sdf.parse(NEW_START_DATE);
final Date newEndDate = sdf.parse(NEW_END_DATE);
String[] ret = new String[2];
ServerParentTreeNodeOverTime ptnot = new ServerParentTreeNodeOverTime(FastTestDataset.PROVINCE.getServerObject());
ServerParentTreeNode childNode = new ServerParentTreeNode(null, FastTestDataset.HIER_ADMIN.getServerObject(), newStartDate, newEndDate, null);
childNode.addParent(new ServerParentTreeNode(FastTestDataset.CAMBODIA.getServerObject(), FastTestDataset.HIER_ADMIN.getServerObject(), newStartDate, newEndDate, null));
ptnot.add(FastTestDataset.HIER_ADMIN.getServerObject(), childNode);
ret[0] = ptnot.toJSON().toString();
ret[1] = TEST_NEW_PROVINCE.newGeoObjectOverTime(ServiceFactory.getAdapter()).toJSON().toString();
return ret;
}
Aggregations