Search in sources :

Example 6 with SmlClassifier

use of org.n52.shetland.ogc.sensorML.elements.SmlClassifier in project arctic-sea by 52North.

the class SensorMLEncoderv101 method createClassification.

/**
 * Creates the classification section of the SensorML description.
 *
 * @param classifications
 *            SOS classifications
 *
 * @return XML Classification array
 */
private Classification[] createClassification(List<SmlClassifier> classifications) {
    Classification xbClassification = Classification.Factory.newInstance(getXmlOptions());
    ClassifierList xbClassifierList = xbClassification.addNewClassifierList();
    classifications.forEach(sosSMLClassifier -> {
        Classifier xbClassifier = xbClassifierList.addNewClassifier();
        if (sosSMLClassifier.getName() != null) {
            xbClassifier.setName(sosSMLClassifier.getName());
        }
        Term xbTerm = xbClassifier.addNewTerm();
        xbTerm.setValue(sosSMLClassifier.getValue());
        if (sosSMLClassifier.isSetDefinition()) {
            xbTerm.setDefinition(sosSMLClassifier.getDefinition());
        }
        if (sosSMLClassifier.isSetCodeSpace()) {
            xbTerm.addNewCodeSpace().setHref(sosSMLClassifier.getCodeSpace());
        }
    });
    return new Classification[] { xbClassification };
}
Also used : Classification(net.opengis.sensorML.x101.ClassificationDocument.Classification) ClassifierList(net.opengis.sensorML.x101.ClassificationDocument.Classification.ClassifierList) SmlClassifier(org.n52.shetland.ogc.sensorML.elements.SmlClassifier) Classifier(net.opengis.sensorML.x101.ClassificationDocument.Classification.ClassifierList.Classifier) Term(net.opengis.sensorML.x101.TermDocument.Term)

Aggregations

SmlClassifier (org.n52.shetland.ogc.sensorML.elements.SmlClassifier)6 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)1 Classification (net.opengis.sensorML.x101.ClassificationDocument.Classification)1 ClassifierList (net.opengis.sensorML.x101.ClassificationDocument.Classification.ClassifierList)1 Classifier (net.opengis.sensorML.x101.ClassificationDocument.Classification.ClassifierList.Classifier)1 Term (net.opengis.sensorML.x101.TermDocument.Term)1 ClassifierListPropertyType (net.opengis.sensorml.x20.ClassifierListPropertyType)1 ClassifierListType (net.opengis.sensorml.x20.ClassifierListType)1 Classifier (net.opengis.sensorml.x20.ClassifierListType.Classifier)1