use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method deleteAttributeType.
/**
* Deletes an attribute from the given {@link GeoObjectType}.
*
* @pre given {@link GeoObjectType} must already exist.
* @pre given {@link GeoObjectType} must already exist.
*
* @param sessionId
* @param gtId
* string of the {@link GeoObjectType} to be updated.
* @param attributeName
* Name of the attribute to be removed from the GeoObjectType
* @return updated {@link GeoObjectType}
*/
@Request(RequestType.SESSION)
public void deleteAttributeType(String sessionId, String gtId, String attributeName) {
ServerGeoObjectType got = ServerGeoObjectType.get(gtId);
ServiceFactory.getGeoObjectTypePermissionService().enforceCanWrite(got.getOrganization().getCode(), got, got.getIsPrivate());
got.removeAttribute(attributeName);
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method oauthGetAll.
@Request(RequestType.SESSION)
public String oauthGetAll(String sessionId, String id) {
final JsonArray ja = new JsonArray();
if (id == null || id.length() == 0) {
OauthServer[] servers = OauthServer.getAll();
for (OauthServer server : servers) {
Gson gson2 = new GsonBuilder().registerTypeAdapter(OauthServer.class, new RunwayJsonAdapters.RunwayDeserializer()).create();
JsonObject json = (JsonObject) gson2.toJsonTree(server);
json.addProperty("url", buildOauthServerUrl(server));
ja.add(json);
}
} else {
OauthServer server = OauthServer.get(id);
Gson gson2 = new GsonBuilder().registerTypeAdapter(OauthServer.class, new RunwayJsonAdapters.RunwayDeserializer()).create();
JsonObject json = (JsonObject) gson2.toJsonTree(server);
json.addProperty("url", buildOauthServerUrl(server));
ja.add(json);
}
return ja.toString();
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method getAncestors.
@Request(RequestType.SESSION)
public List<GeoObjectType> getAncestors(String sessionId, String code, String hierarchyCode, Boolean includeInheritedTypes, Boolean includeChild) {
ServerGeoObjectType child = ServerGeoObjectType.get(code);
ServerHierarchyType hierarchyType = ServerHierarchyType.get(hierarchyCode);
List<GeoObjectType> ancestors = child.getTypeAncestors(hierarchyType, includeInheritedTypes);
if (includeChild) {
ancestors.add(child.getType());
}
return ancestors;
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method oauthGetPublic.
@Request(RequestType.SESSION)
public String oauthGetPublic(String sessionId, String id) {
final JsonArray ja = new JsonArray();
if (id == null || id.length() == 0) {
OauthServer[] servers = OauthServer.getAll();
for (OauthServer server : servers) {
if (!FhirExternalSystem.isFhirOauth(server)) {
JsonObject json = new JsonObject();
json.add("label", LocalizedValueConverter.convert(server.getDisplayLabel()).toJSON());
json.addProperty("url", buildOauthServerUrl(server));
ja.add(json);
}
}
} else {
OauthServer server = OauthServer.get(id);
JsonObject json = new JsonObject();
json.add("label", LocalizedValueConverter.convert(server.getDisplayLabel()).toJSON());
json.addProperty("url", buildOauthServerUrl(server));
ja.add(json);
}
return ja.toString();
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class RegistryService method getGeoObjectByCode.
@Request(RequestType.SESSION)
public GeoObject getGeoObjectByCode(String sessionId, String code, String typeCode, Date date) {
ServerGeoObjectIF object = service.getGeoObjectByCode(code, typeCode, true);
ServiceFactory.getGeoObjectPermissionService().enforceCanRead(object.getType().getOrganization().getCode(), object.getType());
return object.toGeoObject(date);
}
Aggregations