use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class HierarchyController method setInheritedHierarchy.
/**
* Modifies a hierarchy to inherit from another hierarchy at the given
* GeoObjectType
*
* @param request
* Session Request
* @param hierarchyTypeCode
* code of the {@link HierarchyType} being modified.
* @param inheritedHierarchyTypeCode
* code of the {@link HierarchyType} being inherited.
* @param geoObjectTypeCode
* code of the root {@link GeoObjectType}.
*/
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON, url = "setInherited")
public ResponseIF setInheritedHierarchy(ClientRequestIF request, @RequestParamter(name = "hierarchyTypeCode", required = true) String hierarchyTypeCode, @RequestParamter(name = "inheritedHierarchyTypeCode", required = true) String inheritedHierarchyTypeCode, @RequestParamter(name = "geoObjectTypeCode", required = true) String geoObjectTypeCode) {
HierarchyType ht = ServiceFactory.getHierarchyService().setInheritedHierarchy(request.getSessionId(), hierarchyTypeCode, inheritedHierarchyTypeCode, geoObjectTypeCode);
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
return new RestBodyResponse(ht.toJSON(serializer));
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class ListTypeController method tile.
@Endpoint(error = ErrorSerialization.JSON)
public ResponseIF tile(ClientRequestIF request, @RequestParamter(name = "x", required = true) Integer x, @RequestParamter(name = "y", required = true) Integer y, @RequestParamter(name = "z", required = true) Integer z, @RequestParamter(name = "config", required = true) String config) throws JSONException {
JSONObject object = new JSONObject(config);
object.put("x", x);
object.put("y", y);
object.put("z", z);
return new InputStreamResponse(this.service.getTile(request.getSessionId(), object), "application/x-protobuf", null);
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class RegistryAccountController method apply.
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF apply(ClientRequestIF request, @RequestParamter(name = "account", required = true) String account, @RequestParamter(name = "roleNames") String roleNames) throws JSONException {
String[] roleNameArray = null;
if (roleNames != null) {
JSONArray arr = new JSONArray(roleNames);
roleNameArray = new String[arr.length()];
for (int i = 0; i < arr.length(); i++) {
roleNameArray[i] = arr.getString(i);
}
}
JSONObject user = this.accountService.apply(request.getSessionId(), account, roleNameArray);
RegistryRole[] registryRoles = this.accountService.getRolesForUser(request.getSessionId(), user.getString(GeoprismUserDTO.OID));
JsonArray rolesJSONArray = this.createRoleMap(registryRoles);
RestResponse response = new RestResponse();
response.set("user", user);
response.set("roles", new JSONArray(rolesJSONArray.toString()));
return response;
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class RegistryAccountController method newInvite.
/**
* @param request
* @param organizationCodes
* comma delimited list of registry codes. Returns all registry roles
* if empty.
* @return
* @throws JSONException
*/
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF newInvite(ClientRequestIF request, @RequestParamter(name = "organizationCodes") String organizationCodes) throws JSONException {
String[] orgCodeArray = null;
if (organizationCodes != null) {
JSONArray arr = new JSONArray(organizationCodes);
orgCodeArray = new String[arr.length()];
for (int i = 0; i < arr.length(); i++) {
orgCodeArray[i] = arr.getString(i);
}
} else {
orgCodeArray = new String[0];
}
JSONObject user = new JSONObject();
user.put("newInstance", true);
RegistryRole[] registryRoles = this.accountService.getRolesForOrganization(request.getSessionId(), orgCodeArray);
JsonArray rolesJSONArray = this.createRoleMap(registryRoles);
RestResponse response = new RestResponse();
response.set("user", user);
response.set("roles", new JSONArray(rolesJSONArray.toString()));
return response;
}
use of com.runwaysdk.mvc.Endpoint in project geoprism-registry by terraframe.
the class RegistryAccountController method edit.
@Endpoint(method = ServletMethod.POST, error = ErrorSerialization.JSON)
public ResponseIF edit(ClientRequestIF request, @RequestParamter(name = "oid", required = true) String oid) throws JSONException {
JSONObject user = this.accountService.lock(request.getSessionId(), oid);
RegistryRole[] registryRoles = this.accountService.getRolesForUser(request.getSessionId(), oid);
JsonArray rolesJSONArray = this.createRoleMap(registryRoles);
RestResponse response = new RestResponse();
response.set("user", user);
response.set("roles", new JSONArray(rolesJSONArray.toString()));
return response;
}
Aggregations