use of org.n52.shetland.ogc.ows.extension.Extension 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.ows.extension.Extension in project arctic-sea by 52North.
the class AbstractCapabilitiesBaseTypeDecoder method parseOperationMetadata.
private OwsOperationsMetadata parseOperationMetadata(OperationsMetadata operationsMetadata) {
if (operationsMetadata == null) {
return null;
}
List<OwsOperation> operations = parseOperations(operationsMetadata.getOperationArray());
List<OwsDomain> parameters = parseDomains(operationsMetadata.getParameterArray());
List<OwsDomain> constraints = parseDomains(operationsMetadata.getConstraintArray());
OwsOperationMetadataExtension extension = parseOperationsMetadataExtension(operationsMetadata.getExtendedCapabilities());
return new OwsOperationsMetadata(operations, parameters, constraints, extension);
}
use of org.n52.shetland.ogc.ows.extension.Extension in project arctic-sea by 52North.
the class CapabilitiesTypeDecoder method parseOfferingExtension.
private Extensions parseOfferingExtension(ObservationOfferingType obsOff) throws DecodingException {
Extensions extensions = new Extensions();
for (XmlObject xmlObject : obsOff.getExtensionArray()) {
try {
Extension<?> extension = (Extension) decodeXmlElement(xmlObject);
extensions.addExtension(extension);
} catch (DecodingException ex) {
LOGGER.warn(ex.getLocalizedMessage());
}
}
return extensions;
}
use of org.n52.shetland.ogc.ows.extension.Extension in project arctic-sea by 52North.
the class AbstractOmV20XmlStreamWriter method writeMetadata.
/**
* Write extension information
*
* @param map
* Map with values
* @param element
* element name
* @throws XMLStreamException
* If an error occurs when writing to stream
* @throws EncodingException
* If an error occurs when creating elements to be written
*/
protected void writeMetadata(Map<String, NamedValue<?>> map, QName element) throws XMLStreamException, EncodingException {
for (Entry<String, NamedValue<?>> entry : map.entrySet()) {
Object o = getEncoder(OmConstants.NS_OM_2, entry.getValue()).encode(entry.getValue(), EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT));
if (o != null && o instanceof XmlObject) {
start(GetDataAvailabilityConstants.GDA_EXTENSION);
attr("name", entry.getKey());
rawText(((XmlObject) o).xmlText(getXmlOptions()));
end(GetDataAvailabilityConstants.GDA_EXTENSION);
}
}
}
use of org.n52.shetland.ogc.ows.extension.Extension in project arctic-sea by 52North.
the class AbstractGetCapabilitiesHandler method getOperations.
private OwsOperationsMetadata getOperations(String service, String version) throws OwsExceptionReport {
Collection<OwsDomain> parameters = getCommonParameters(service);
Collection<OwsDomain> constraints = null;
Collection<OwsOperation> operations = new LinkedList<>();
OwsOperationMetadataExtension extension = getOperationsMetadataExtension(service, version);
for (RequestOperatorKey operatorKey : requestOperatorRepository.getActiveRequestOperatorKeys(new OwsServiceKey(service, version))) {
Optional.ofNullable(requestOperatorRepository.getRequestOperator(operatorKey).getOperationMetadata(service, version)).ifPresent(operations::add);
}
return new OwsOperationsMetadata(operations, parameters, constraints, extension);
}
Aggregations