Search in sources :

Example 1 with Parameters

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;
}
Also used : SweQuantity(org.n52.shetland.ogc.swe.simpleType.SweQuantity) SweText(org.n52.shetland.ogc.swe.simpleType.SweText) SweTime(org.n52.shetland.ogc.swe.simpleType.SweTime) Parameters(net.opengis.sensorML.x101.ParametersDocument.Parameters) SweSimpleDataRecord(org.n52.shetland.ogc.swe.SweSimpleDataRecord) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) SweCount(org.n52.shetland.ogc.swe.simpleType.SweCount) SweTimeRange(org.n52.shetland.ogc.swe.simpleType.SweTimeRange) SweDataArray(org.n52.shetland.ogc.swe.SweDataArray) SweBoolean(org.n52.shetland.ogc.swe.simpleType.SweBoolean) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException) SmlParameter(org.n52.shetland.ogc.sensorML.elements.SmlParameter) SweEnvelope(org.n52.shetland.ogc.swe.SweEnvelope) SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord) ParameterList(net.opengis.sensorML.x101.ParametersDocument.Parameters.ParameterList) SweCategory(org.n52.shetland.ogc.swe.simpleType.SweCategory) DataComponentPropertyType(net.opengis.swe.x101.DataComponentPropertyType) XmlObject(org.apache.xmlbeans.XmlObject)

Aggregations

Parameters (net.opengis.sensorML.x101.ParametersDocument.Parameters)1 ParameterList (net.opengis.sensorML.x101.ParametersDocument.Parameters.ParameterList)1 DataComponentPropertyType (net.opengis.swe.x101.DataComponentPropertyType)1 XmlObject (org.apache.xmlbeans.XmlObject)1 SmlParameter (org.n52.shetland.ogc.sensorML.elements.SmlParameter)1 SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)1 SweDataArray (org.n52.shetland.ogc.swe.SweDataArray)1 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)1 SweEnvelope (org.n52.shetland.ogc.swe.SweEnvelope)1 SweSimpleDataRecord (org.n52.shetland.ogc.swe.SweSimpleDataRecord)1 SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)1 SweCategory (org.n52.shetland.ogc.swe.simpleType.SweCategory)1 SweCount (org.n52.shetland.ogc.swe.simpleType.SweCount)1 SweQuantity (org.n52.shetland.ogc.swe.simpleType.SweQuantity)1 SweText (org.n52.shetland.ogc.swe.simpleType.SweText)1 SweTime (org.n52.shetland.ogc.swe.simpleType.SweTime)1 SweTimeRange (org.n52.shetland.ogc.swe.simpleType.SweTimeRange)1 UnsupportedEncoderInputException (org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)1