use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ServerGeoObjectService method doesGeoObjectExistAtRange.
@Request(RequestType.SESSION)
public JsonObject doesGeoObjectExistAtRange(String sessionId, Date startDate, Date endDate, String typeCode, String code) {
VertexServerGeoObject vsgo = (VertexServerGeoObject) new ServerGeoObjectService().getGeoObjectByCode(code, typeCode);
JsonObject jo = new JsonObject();
jo.addProperty("exists", vsgo.existsAtRange(startDate, endDate));
jo.addProperty("invalid", vsgo.getInvalid());
return jo;
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class ServerGeoObjectService method getAll.
@Request(RequestType.SESSION)
public JsonObject getAll(String sessionId, String gotCode, String hierarchyCode, Date since, Boolean includeLevel, String format, String externalSystemId, Integer pageNumber, Integer pageSize) {
GeoObjectExportFormat goef = null;
if (format != null && format.length() > 0) {
goef = GeoObjectExportFormat.valueOf(format);
}
GeoObjectJsonExporter exporter = new GeoObjectJsonExporter(gotCode, hierarchyCode, since, includeLevel, goef, externalSystemId, pageSize, pageNumber);
try {
return exporter.export();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class HierarchyService method removeInheritedHierarchy.
/**
* Modifies a hierarchy to remove inheritance from another hierarchy for the
* given root
*
* @param sessionId
* @param hierarchyTypeCode
* code of the {@link HierarchyType} being modified.
* @param geoObjectTypeCode
* code of the root {@link GeoObjectType}.
*/
@Request(RequestType.SESSION)
public HierarchyType removeInheritedHierarchy(String sessionId, String hierarchyTypeCode, String geoObjectTypeCode) {
ServerHierarchyType forHierarchy = ServerHierarchyType.get(hierarchyTypeCode);
ServerGeoObjectType childType = ServerGeoObjectType.get(geoObjectTypeCode);
ServiceFactory.getGeoObjectTypeRelationshipPermissionService().enforceCanAddChild(forHierarchy, null, childType);
ServerGeoObjectType type = ServerGeoObjectType.get(geoObjectTypeCode);
type.removeInheritedHierarchy(forHierarchy);
forHierarchy.refresh();
return forHierarchy.toHierarchyType();
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class HierarchyService method getHierarchyGroupedTypes.
@Request(RequestType.SESSION)
public JsonArray getHierarchyGroupedTypes(String sessionId) {
final HierarchyTypePermissionServiceIF hierarchyPermissions = ServiceFactory.getHierarchyPermissionService();
final GeoObjectTypePermissionServiceIF typePermissions = ServiceFactory.getGeoObjectTypePermissionService();
final RolePermissionService rps = ServiceFactory.getRolePermissionService();
final boolean isSRA = rps.isSRA();
JsonArray allHiers = new JsonArray();
List<ServerHierarchyType> shts = ServiceFactory.getMetadataCache().getAllHierarchyTypes();
for (ServerHierarchyType sht : shts) {
final String htOrgCode = sht.getOrganizationCode();
if (hierarchyPermissions.canRead(htOrgCode) && (isSRA || rps.isRA(htOrgCode) || rps.isRM(htOrgCode))) {
JsonObject hierView = new JsonObject();
hierView.addProperty("code", sht.getCode());
hierView.addProperty("label", sht.getDisplayLabel().getValue());
hierView.addProperty("orgCode", sht.getOrganizationCode());
JsonArray allHierTypes = new JsonArray();
List<ServerGeoObjectType> types = sht.getAllTypes();
for (ServerGeoObjectType type : types) {
final String gotOrgCode = type.getOrganizationCode();
if (typePermissions.canRead(gotOrgCode, type, type.getIsPrivate()) && (isSRA || rps.isRA(gotOrgCode) || rps.isRM(gotOrgCode, type))) {
if (type.getIsAbstract()) {
JsonObject superView = new JsonObject();
superView.addProperty("code", type.getCode());
superView.addProperty("label", type.getLabel().getValue());
superView.addProperty("orgCode", type.getOrganizationCode());
superView.addProperty("isAbstract", true);
List<ServerGeoObjectType> subtypes = type.getSubtypes();
for (ServerGeoObjectType subtype : subtypes) {
JsonObject typeView = new JsonObject();
typeView.addProperty("code", subtype.getCode());
typeView.addProperty("label", subtype.getLabel().getValue());
typeView.addProperty("orgCode", subtype.getOrganization().getCode());
typeView.add("super", superView);
allHierTypes.add(typeView);
}
} else {
JsonObject typeView = new JsonObject();
typeView.addProperty("code", type.getCode());
typeView.addProperty("label", type.getLabel().getValue());
typeView.addProperty("orgCode", type.getOrganizationCode());
allHierTypes.add(typeView);
}
}
}
hierView.add("types", allHierTypes);
allHiers.add(hierView);
}
}
return allHiers;
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class HierarchyService method updateHierarchyType.
/**
* Updates the given {@link HierarchyType} represented as JSON.
*
* @param sessionId
* @param gtJSON
* JSON of the {@link HierarchyType} to be updated.
*/
@Request(RequestType.SESSION)
public HierarchyType updateHierarchyType(String sessionId, String htJSON) {
HierarchyType hierarchyType = HierarchyType.fromJSON(htJSON, ServiceFactory.getAdapter());
ServerHierarchyType type = ServerHierarchyType.get(hierarchyType);
ServiceFactory.getHierarchyPermissionService().enforceCanWrite(type.getOrganization().getCode());
type.update(hierarchyType);
return type.toHierarchyType();
}
Aggregations