Search in sources :

Example 6 with Metadata

use of org.n52.shetland.ogc.om.series.wml.Metadata in project series-rest-api by 52North.

the class PDFReportGenerator method createValueTableHeader.

private String createValueTableHeader(TimeseriesMetadataOutput metadata) {
    SeriesParameters parameters = metadata.getSeriesParameters();
    String phenomenon = parameters.getPhenomenon().getLabel();
    return phenomenon + " (" + metadata.getUom() + ")";
}
Also used : SeriesParameters(org.n52.io.response.dataset.SeriesParameters)

Example 7 with Metadata

use of org.n52.shetland.ogc.om.series.wml.Metadata in project series-rest-api by 52North.

the class ParameterController method getExtras.

@Override
public Map<String, Object> getExtras(String resourceId, String locale, MultiValueMap<String, String> query) {
    RequestUtils.overrideQueryLocaleWhenSet(locale, query);
    IoParameters map = QueryParameters.createFromQuery(query);
    LOGGER.debug("getExtras() with id '{}' and query '{}'", resourceId, map);
    Map<String, Object> extras = new HashMap<>();
    for (MetadataExtension<T> extension : metadataExtensions) {
        T from = parameterService.getParameter(resourceId, map);
        final Map<String, Object> furtherExtras = extension.getExtras(from, map);
        Collection<String> overridableKeys = checkForOverridingData(extras, furtherExtras);
        if (!overridableKeys.isEmpty()) {
            String[] keys = overridableKeys.toArray(new String[0]);
            LOGGER.warn("Metadata extension overrides existing extra data: {}", Arrays.toString(keys));
        }
        extras.putAll(furtherExtras);
    }
    return extras;
}
Also used : HashMap(java.util.HashMap) IoParameters(org.n52.io.request.IoParameters)

Example 8 with Metadata

use of org.n52.shetland.ogc.om.series.wml.Metadata in project series-rest-api by 52North.

the class IoStyleContext method createContextForSingleSeries.

public static IoStyleContext createContextForSingleSeries(DatasetOutput metadata, IoParameters ioConfig) {
    RequestStyledParameterSet parameters = ioConfig.toStyledParameterSet();
    parameters.addSeriesWithStyleOptions(metadata.getId(), ioConfig.getStyle());
    return createContextWith(parameters, Collections.singletonList(metadata));
}
Also used : RequestStyledParameterSet(org.n52.io.request.RequestStyledParameterSet)

Example 9 with Metadata

use of org.n52.shetland.ogc.om.series.wml.Metadata in project series-rest-api by 52North.

the class ChartIoHandler method formatTitle.

protected String formatTitle(DatasetOutput metadata, String title) {
    SeriesParameters parameters = metadata.getSeriesParameters();
    Object[] varargs = { // index important to reference in config!
    parameters.getPlatform().getLabel(), parameters.getPhenomenon().getLabel(), parameters.getProcedure().getLabel(), parameters.getCategory().getLabel(), parameters.getOffering().getLabel(), parameters.getFeature().getLabel(), parameters.getService().getLabel(), metadata.getUom() };
    try {
        return String.format(title, varargs);
    } catch (Exception e) {
        String datasetId = metadata.getId();
        LOGGER.info("Couldn't format title while prerendering dataset '{}'", datasetId, e);
        // return template as fallback
        return title;
    }
}
Also used : SeriesParameters(org.n52.io.response.dataset.SeriesParameters) IoParseException(org.n52.io.IoParseException) IOException(java.io.IOException)

Example 10 with Metadata

use of org.n52.shetland.ogc.om.series.wml.Metadata in project arctic-sea by 52North.

the class ElasticsearchAdminHandler method createSchema.

@Override
public synchronized void createSchema() {
    IndicesAdminClient indices = client.admin().indices();
    if (indices.prepareExists(settings.getIndexId()).get().isExists()) {
        logger.info("Index {} already exists", settings.getIndexId());
        // update mapping
        Integer version = getCurrentVersion();
        logger.info("Elasticsearch schema version is {}", version);
        if (version == null) {
            throw new ConfigurationError("Database inconsistency. Metadata version not found in type %s", MetadataDataMapping.METADATA_TYPE_NAME);
        }
        if (version != schemas.getSchemaVersion()) {
            throw new ConfigurationError("Database schema version inconsistency. Version numbers don't match. " + "Database version number %d <-> Application version number %d", version, schemas.getSchemaVersion());
        }
        addUuidToMetadataIfNeeded(settings.getUuid());
    } else {
        logger.info("Index {} not exists creating a new one now.", settings.getIndexId());
        // create metadata table and index table table
        CreateIndexResponse response = indices.prepareCreate(settings.getIndexId()).addMapping(MetadataDataMapping.METADATA_TYPE_NAME, schemas.getMetadataSchema()).addMapping(settings.getTypeId(), schemas.getSchema()).get();
        logger.debug("Created indices: {}", response);
        // insert metadata values
        createMetadataType(schemas.getSchemaVersion());
    }
}
Also used : ConfigurationError(org.n52.faroe.ConfigurationError) IndicesAdminClient(org.elasticsearch.client.IndicesAdminClient) CreateIndexResponse(org.elasticsearch.action.admin.indices.create.CreateIndexResponse)

Aggregations

XmlObject (org.apache.xmlbeans.XmlObject)5 QuantityData (org.n52.io.response.dataset.quantity.QuantityData)5 IoParameters (org.n52.io.request.IoParameters)4 DatasetOutput (org.n52.io.response.dataset.DatasetOutput)4 SeriesParameters (org.n52.io.response.dataset.SeriesParameters)4 DecodingException (org.n52.svalbard.decode.exception.DecodingException)4 Test (org.junit.Test)3 QuantityDatasetMetadata (org.n52.io.response.dataset.quantity.QuantityDatasetMetadata)3 InsertSensorRequest (org.n52.shetland.ogc.sos.request.InsertSensorRequest)3 Strings (com.google.common.base.Strings)2 FileOutputStream (java.io.FileOutputStream)2 IOException (java.io.IOException)2 URI (java.net.URI)2 HashMap (java.util.HashMap)2 XmlException (org.apache.xmlbeans.XmlException)2 DateTime (org.joda.time.DateTime)2 RequestStyledParameterSet (org.n52.io.request.RequestStyledParameterSet)2 ParameterOutput (org.n52.io.response.ParameterOutput)2 QuantityValue (org.n52.io.response.dataset.quantity.QuantityValue)2 LocalizedString (org.n52.janmayen.i18n.LocalizedString)2