use of net.opengis.sensorML.x101.ParametersDocument.Parameters in project arctic-sea by 52North.
the class SensorMLEncoderv101 method createParameters.
private Parameters createParameters(List<SmlParameter> smlParameters) throws EncodingException {
final Parameters parameters = Parameters.Factory.newInstance(getXmlOptions());
ParameterList parameterList = parameters.addNewParameterList();
for (SmlParameter smlParameter : smlParameters) {
DataComponentPropertyType param = parameterList.addNewParameter();
param.setName(smlParameter.getName());
if (smlParameter.isSetHref()) {
param.setHref(smlParameter.getHref());
if (smlParameter.isSetTitle()) {
param.setTitle(smlParameter.getTitle());
}
} else {
SweAbstractDataComponent parameter = smlParameter.getParameter();
XmlObject xmlObject = encodeObjectToXml(SweConstants.NS_SWE_101, parameter);
if (xmlObject != null) {
if (parameter instanceof SweBoolean) {
param.addNewBoolean().set(xmlObject);
} else if (parameter instanceof SweCategory) {
param.addNewCategory().set(xmlObject);
} else if (parameter instanceof SweCount) {
param.addNewCount().set(xmlObject);
} else if (parameter instanceof SweQuantity) {
param.addNewQuantity().set(xmlObject);
} else if (parameter instanceof SweText) {
param.addNewText().set(xmlObject);
} else if (parameter instanceof SweTimeRange) {
param.addNewTimeRange().set(xmlObject);
} else if (parameter instanceof SweTime) {
param.addNewTime().set(xmlObject);
} else if (parameter instanceof SweEnvelope) {
param.addNewAbstractDataRecord().set(xmlObject);
param.getAbstractDataRecord().substitute(SweConstants.QN_ENVELOPE_SWE_101, EnvelopeType.type);
} else if (parameter instanceof SweDataRecord) {
param.addNewAbstractDataRecord().set(xmlObject);
param.getAbstractDataRecord().substitute(SweConstants.QN_DATA_RECORD_SWE_101, DataRecordType.type);
} else if (parameter instanceof SweSimpleDataRecord) {
param.addNewAbstractDataRecord().set(xmlObject);
param.getAbstractDataRecord().substitute(SweConstants.QN_SIMPLEDATARECORD_SWE_101, SimpleDataRecordType.type);
} else if (parameter instanceof SweDataArray) {
param.addNewAbstractDataArray1().set(xmlObject);
param.getAbstractDataArray1().substitute(SweConstants.QN_DATA_RECORD_SWE_101, DataArrayType.type);
} else {
throw new UnsupportedEncoderInputException(this, parameter);
}
}
}
}
return parameters;
}
Aggregations