Search in sources :

Example 1 with ExternalSystemService

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);
}
Also used : JsonArray(com.google.gson.JsonArray) JsonObject(com.google.gson.JsonObject) ExternalSystemService(net.geoprism.registry.service.ExternalSystemService) CustomSerializer(org.commongeoregistry.adapter.metadata.CustomSerializer) RestBodyResponse(com.runwaysdk.mvc.RestBodyResponse) OrganizationDTO(org.commongeoregistry.adapter.metadata.OrganizationDTO) Endpoint(com.runwaysdk.mvc.Endpoint)

Aggregations

JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 Endpoint (com.runwaysdk.mvc.Endpoint)1 RestBodyResponse (com.runwaysdk.mvc.RestBodyResponse)1 ExternalSystemService (net.geoprism.registry.service.ExternalSystemService)1 CustomSerializer (org.commongeoregistry.adapter.metadata.CustomSerializer)1 OrganizationDTO (org.commongeoregistry.adapter.metadata.OrganizationDTO)1