use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class SynchronizationConfigService method remove.
@Request(RequestType.SESSION)
public void remove(String sessionId, String oid) {
SynchronizationConfig config = SynchronizationConfig.get(oid);
Organization organization = config.getOrganization();
ServiceFactory.getRolePermissionService().enforceRA(organization.getCode());
config.delete();
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class SynchronizationConfigService method run.
@Request(RequestType.SESSION)
public JsonObject run(String sessionId, String oid) {
SynchronizationConfig config = SynchronizationConfig.get(oid);
ServiceFactory.getRolePermissionService().enforceRA(config.getOrganization().getCode());
List<? extends DataExportJob> jobs = config.getJobs();
DataExportJob job = jobs.get(0);
job.appLock();
job.setRunAsUserId(Session.getCurrentSession().getUser().getOid());
job.apply();
ExportHistory hist = job.start(config);
GeoprismUser user = GeoprismUser.get(job.getRunAsUser().getOid());
return serializeHistory(hist, user, job);
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class SynchronizationConfigService method edit.
@Request(RequestType.SESSION)
public JsonObject edit(String sessionId, String oid) {
JsonObject response = new JsonObject();
if (oid != null && oid.length() > 0) {
SynchronizationConfig config = SynchronizationConfig.lock(oid);
response.add("config", config.toJSON());
}
JsonArray orgs = new JsonArray();
List<Organization> organizations = Organization.getUserAdminOrganizations();
for (Organization organization : organizations) {
JsonArray hierarchies = new JsonArray();
List<ServerHierarchyType> sHierachies = ServerHierarchyType.getForOrganization(organization);
for (ServerHierarchyType hierarchy : sHierachies) {
JsonObject object = new JsonObject();
object.addProperty("label", hierarchy.getDisplayLabel().getValue());
object.addProperty("code", hierarchy.getCode());
hierarchies.add(object);
}
JsonArray systems = new JsonArray();
List<ExternalSystem> esystems = ExternalSystem.getForOrganization(organization);
for (ExternalSystem system : esystems) {
if (system.isExportSupported()) {
LocalizedValue label = LocalizedValueConverter.convert(system.getEmbeddedComponent(ExternalSystem.LABEL));
JsonObject object = new JsonObject();
object.addProperty("label", label.getValue());
object.addProperty("oid", system.getOid());
object.addProperty("type", system.getMdClass().getTypeName());
systems.add(object);
}
}
JsonObject object = new JsonObject();
object.addProperty("label", organization.getDisplayLabel().getValue());
object.addProperty("code", organization.getCode());
object.add("hierarchies", hierarchies);
object.add("systems", systems);
orgs.add(object);
}
response.add("orgs", orgs);
return response;
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class UndirectedGraphTypeService method create.
@Request(RequestType.SESSION)
public JsonObject create(String sessionId, String json) {
JsonObject object = JsonParser.parseString(json).getAsJsonObject();
UndirectedGraphType type = UndirectedGraphType.create(object);
((Session) Session.getCurrentSession()).reloadPermissions();
return type.toJSON();
}
use of com.runwaysdk.session.Request in project geoprism-registry by terraframe.
the class UndirectedGraphTypeService method remove.
@Request(RequestType.SESSION)
public void remove(String sessionId, String code) {
UndirectedGraphType type = UndirectedGraphType.getByCode(code);
type.delete();
}
Aggregations