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() + ")";
}
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;
}
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));
}
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;
}
}
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());
}
}
Aggregations