Search in sources :

Example 1 with I18N

use of org.n52.io.I18N in project series-rest-api by 52North.

the class ResourcesController method createResources.

protected List<ResourceCollection> createResources(IoParameters params) {
    IoParameters parameters = IoParameters.ensureBackwardsCompatibility(params);
    I18N i18n = I18N.getMessageLocalizer(parameters.getLocale());
    ResourceCollection services = add("services", "Service Provider", i18n.get("msg.web.resources.services"));
    ResourceCollection stations = add("stations", "Station", i18n.get("msg.web.resources.stations"));
    ResourceCollection timeseries = add("timeseries", "Timeseries", i18n.get("msg.web.resources.timeseries"));
    ResourceCollection categories = add("categories", "Category", i18n.get("msg.web.resources.categories"));
    ResourceCollection offerings = add("offerings", "Offering", i18n.get("msg.web.resources.offerings"));
    ResourceCollection features = add("features", "Feature", i18n.get("msg.web.resources.features"));
    ResourceCollection procedures = add("procedures", "Procedure", i18n.get("msg.web.resources.procedures"));
    ResourceCollection phenomena = add("phenomena", "Phenomenon", i18n.get("msg.web.resources.phenomena"));
    if (parameters.isExpanded()) {
        services.setSize(getMetadataService().getServiceCount(parameters));
        if (new FilterResolver(parameters).shallBehaveBackwardsCompatible()) {
            // ensure backwards compatibility
            stations.setSize(getMetadataService().getStationCount());
            timeseries.setSize(getMetadataService().getTimeseriesCount());
        }
        categories.setSize(getMetadataService().getCategoryCount(parameters));
        offerings.setSize(getMetadataService().getOfferingCount(parameters));
        features.setSize(getMetadataService().getFeatureCount(parameters));
        procedures.setSize(getMetadataService().getProcedureCount(parameters));
        phenomena.setSize(getMetadataService().getPhenomenaCount(parameters));
    }
    List<ResourceCollection> resources = new ArrayList<>();
    resources.add(services);
    resources.add(stations);
    resources.add(timeseries);
    resources.add(categories);
    resources.add(offerings);
    resources.add(features);
    resources.add(procedures);
    resources.add(phenomena);
    // since 2.0.0
    ResourceCollection platforms = add("platforms", "Platforms", i18n.get("msg.web.resources.platforms"));
    ResourceCollection datasets = add("datasets", "Datasets", i18n.get("msg.web.resources.datasets"));
    ResourceCollection geometries = add("geometries", "Geometries", i18n.get("msg.web.resources.geometries"));
    resources.add(platforms);
    resources.add(datasets);
    resources.add(geometries);
    if (parameters.isExpanded()) {
        platforms.setSize(getMetadataService().getPlatformCount(parameters));
        datasets.setSize(getMetadataService().getDatasetCount(parameters));
    }
    return resources;
}
Also used : FilterResolver(org.n52.io.request.FilterResolver) ArrayList(java.util.ArrayList) IoParameters(org.n52.io.request.IoParameters) I18N(org.n52.io.I18N)

Aggregations

ArrayList (java.util.ArrayList)1 I18N (org.n52.io.I18N)1 FilterResolver (org.n52.io.request.FilterResolver)1 IoParameters (org.n52.io.request.IoParameters)1