use of net.geoprism.registry.service.ExternalSystemService in project geoprism-registry by terraframe.
the class RegistryController method initSettings.
@Endpoint(url = "init-settings", method = ServletMethod.GET, error = ErrorSerialization.JSON)
public ResponseIF initSettings(ClientRequestIF request) throws ParseException {
OrganizationDTO[] orgs = this.registryService.getOrganizations(request.getSessionId(), null);
JsonArray jaLocales = this.registryService.getLocales(request.getSessionId());
JsonObject esPage = new ExternalSystemService().page(request.getSessionId(), 1, 10);
JsonObject sraPage = JsonParser.parseString(AccountService.getInstance().getSRAs(request.getSessionId(), 1, 10)).getAsJsonObject();
CustomSerializer serializer = this.registryService.serializer(request.getSessionId());
JsonObject settingsView = new JsonObject();
JsonArray orgsJson = new JsonArray();
for (OrganizationDTO org : orgs) {
orgsJson.add(org.toJSON(serializer));
}
settingsView.add("organizations", orgsJson);
settingsView.add("locales", jaLocales);
settingsView.add("externalSystems", esPage);
settingsView.add("sras", sraPage);
return new RestBodyResponse(settingsView);
}
Aggregations