use of org.n52.shetland.ogc.sos.SosProcedureDescription in project arctic-sea by 52North.
the class InsertSensorRequestEncoderTest method createProcedureDescription.
private SosProcedureDescription<PhysicalSystem> createProcedureDescription() {
PhysicalSystem description = new PhysicalSystem();
description.setIdentifier("test-identifier");
return new SosProcedureDescription<>(description);
}
use of org.n52.shetland.ogc.sos.SosProcedureDescription in project arctic-sea by 52North.
the class SensorMLDecoderV101Test method should_decode_child_procedure_from_sml.
@Test
public void should_decode_child_procedure_from_sml() throws DecodingException {
SensorMLDocument xbSmlDoc = getSensorMLDoc();
SystemType xbSystem = (SystemType) xbSmlDoc.getSensorML().addNewMember().addNewProcess().substitute(SensorMLConstants.SYSTEM_QNAME, SystemType.type);
IdentifierList xbIdentifierList = xbSystem.addNewIdentification().addNewIdentifierList();
addIdentifier(xbIdentifierList, "anyname", OGCConstants.URN_UNIQUE_IDENTIFIER, TEST_ID_1);
ComponentList xbComponentList = xbSystem.addNewComponents().addNewComponentList();
addChildProcedure(xbComponentList, TEST_ID_2);
AbstractProcess absProcess = decodeAbstractProcess(xbSmlDoc);
assertThat(absProcess.getIdentifier(), is(TEST_ID_1));
// assertThat(absProcess.getChildProcedures().size(), is(1));
// SosProcedureDescription childProcedure = absProcess.getChildProcedures().iterator().next();
// assertThat(childProcedure, instanceOf(System.class));
// assertThat(childProcedure.getIdentifier(), is(TEST_ID_2));
}
use of org.n52.shetland.ogc.sos.SosProcedureDescription in project arctic-sea by 52North.
the class SensorMLEncoderv101 method encode.
@Override
public XmlObject encode(final Object response, final EncodingContext additionalValues) throws EncodingException {
XmlObject encodedObject = null;
if (response instanceof AbstractSensorML) {
encodedObject = createSensorDescription((AbstractSensorML) response);
// }
// FIXME workaround? if of type UnknowProcedureType try to parse the
// description string, UNIT is missing "NOT_DEFINED"?!
// else if (response instanceof SosProcedureDescriptionUnknownType)
// {
// final String procDescXMLString = ((SosProcedureDescription)
// response).getXml();
// final AbstractSensorML sensorDesc = new AbstractSensorML();
// sensorDesc.setXml(procDescXMLString);
// encodedObject = createSensorDescriptionFromString(sensorDesc);
} else {
throw new UnsupportedEncoderInputException(this, response);
}
// check if all gml:id are unique
XmlHelper.makeGmlIdsUnique(encodedObject.getDomNode());
XmlHelper.validateDocument(encodedObject, EncodingException::new);
return encodedObject;
}
Aggregations