use of org.n52.shetland.ogc.sos.SosInsertionMetadata in project arctic-sea by 52North.
the class InsertSensorRequestDecoder method decodeRequest.
@Override
protected InsertSensorRequest decodeRequest(JsonNode node) throws DecodingException {
final InsertSensorRequest r = new InsertSensorRequest();
final SosInsertionMetadata meta = new SosInsertionMetadata();
meta.setFeatureOfInterestTypes(parseStringOrStringList(node.path(JSONConstants.FEATURE_OF_INTEREST_TYPE)));
meta.setObservationTypes(parseStringOrStringList(node.path(JSONConstants.OBSERVATION_TYPE)));
r.setMetadata(meta);
r.setObservableProperty(parseStringOrStringList(node.path(JSONConstants.OBSERVABLE_PROPERTY)));
r.setProcedureDescriptionFormat(node.path(JSONConstants.PROCEDURE_DESCRIPTION_FORMAT).textValue());
r.setRelatedFeature(parseFeatureRelationships(node.path(JSONConstants.RELATED_FEATURE)));
r.setProcedureDescription(parseProcedureDescription(node.path(JSONConstants.PROCEDURE_DESCRIPTION), r.getProcedureDescriptionFormat()));
return r;
}
use of org.n52.shetland.ogc.sos.SosInsertionMetadata in project arctic-sea by 52North.
the class InsertSensorRequestEncoderTest method prepare.
@Before
public void prepare() {
request = new InsertSensorRequest("service", "version");
request.setProcedureDescriptionFormat(SensorML20Constants.SENSORML_20_OUTPUT_FORMAT_URL);
request.setProcedureDescription(createProcedureDescription());
SosInsertionMetadata metadata = new SosInsertionMetadata();
metadata.setFeatureOfInterestTypes(CollectionHelper.list("test-foi-type-1", "test-foi-type-2"));
metadata.setObservationTypes(CollectionHelper.list("test-observation-type-1", "test-observation-type-2"));
request.setMetadata(metadata);
request.setObservableProperty(CollectionHelper.list("test-property-1", "test-property-2"));
encoder = new InsertSensorRequestEncoder();
encoder.setXmlOptions(() -> new XmlOptions());
SensorMLEncoderv20 sensorMLEncoderv20 = new SensorMLEncoderv20();
sensorMLEncoderv20.setXmlOptions(() -> new XmlOptions());
GmlEncoderv321 gmlEncoder = new GmlEncoderv321();
gmlEncoder.setXmlOptions(() -> new XmlOptions());
SosInsertionMetadataTypeEncoder metadataEncoder = new SosInsertionMetadataTypeEncoder();
metadataEncoder.setXmlOptions(() -> new XmlOptions());
EncoderRepository encoderRepository = new EncoderRepository();
encoderRepository.setEncoders(Arrays.asList(encoder, sensorMLEncoderv20, gmlEncoder, metadataEncoder));
encoderRepository.init();
encoder.setEncoderRepository(encoderRepository);
sensorMLEncoderv20.setEncoderRepository(encoderRepository);
gmlEncoder.setEncoderRepository(encoderRepository);
metadataEncoder.setEncoderRepository(encoderRepository);
}
use of org.n52.shetland.ogc.sos.SosInsertionMetadata in project arctic-sea by 52North.
the class SosInsertionMetadataTypeEncoderTest method prepare.
@Before
public void prepare() {
insertionMetadata = new SosInsertionMetadata();
insertionMetadata.setObservationTypes(CollectionHelper.list("type-1", "type-2"));
insertionMetadata.setFeatureOfInterestTypes(CollectionHelper.list("f-type-1", "f-type-2"));
encoder = new SosInsertionMetadataTypeEncoder();
encoder.setXmlOptions(() -> new XmlOptions());
}
use of org.n52.shetland.ogc.sos.SosInsertionMetadata in project arctic-sea by 52North.
the class SwesDecoderv20 method parseMetadata.
private SosInsertionMetadata parseMetadata(final Metadata[] metadataArray) throws DecodingException {
final SosInsertionMetadata sosMetadata = new SosInsertionMetadata();
try {
for (final Metadata metadata : metadataArray) {
SosInsertionMetadataType xbSosInsertionMetadata = null;
if (metadata.getInsertionMetadata() != null && metadata.getInsertionMetadata().schemaType() == SosInsertionMetadataType.type) {
xbSosInsertionMetadata = (SosInsertionMetadataType) metadata.getInsertionMetadata();
} else {
if (metadata.getDomNode().hasChildNodes()) {
final Node node = getNodeFromNodeList(metadata.getDomNode().getChildNodes());
final SosInsertionMetadataPropertyType xbMetadata = SosInsertionMetadataPropertyType.Factory.parse(node);
xbSosInsertionMetadata = xbMetadata.getSosInsertionMetadata();
}
}
if (xbSosInsertionMetadata != null) {
// featureOfInterest types
if (xbSosInsertionMetadata.getFeatureOfInterestTypeArray() != null) {
sosMetadata.setFeatureOfInterestTypes(Arrays.asList(xbSosInsertionMetadata.getFeatureOfInterestTypeArray()));
}
// observation types
if (xbSosInsertionMetadata.getObservationTypeArray() != null) {
sosMetadata.setObservationTypes(Arrays.asList(xbSosInsertionMetadata.getObservationTypeArray()));
}
}
}
} catch (final XmlException xmle) {
throw new DecodingException("An error occurred while parsing the metadata in the http post request", xmle);
}
return sosMetadata;
}
Aggregations