Search in sources :

Example 1 with SweAbstractDataComponent

use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.

the class SmlCapabilities method getCapabilities.

/**
 * @return the capabilities
 */
public List<SmlCapability> getCapabilities() {
    if (!hasCapabilities() && isSetAbstractDataComponents()) {
        List<SmlCapability> caps = Lists.newArrayList();
        for (SweAbstractDataComponent component : getAbstractDataComponents()) {
            SmlCapability smlCapability = new SmlCapability();
            if (component.isSetName()) {
                smlCapability.setName(component.getName().getValue());
            } else if (component.isSetDefinition()) {
                smlCapability.setName(component.getDefinition());
            }
            smlCapability.setAbstractDataComponent(component);
            caps.add(smlCapability);
        }
        return caps;
    }
    return this.capabilities;
}
Also used : SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent)

Example 2 with SweAbstractDataComponent

use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.

the class SwesExtension method setValue.

@Override
public SwesExtension<T> setValue(T value) {
    this.value = value;
    if (value != null && value instanceof SweAbstractDataComponent) {
        SweAbstractDataComponent c = (SweAbstractDataComponent) value;
        setIdentifier(getIdentifier() == null && c.isSetIdentifier() ? c.getIdentifier() : getIdentifier());
        setDefinition(getDefinition() == null && c.isSetDefinition() ? c.getDefinition() : getDefinition());
    }
    return this;
}
Also used : SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent)

Example 3 with SweAbstractDataComponent

use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.

the class SweHelper method getFieldForValue.

private SweField getFieldForValue(Value<?> iValue, String name) throws EncodingException {
    SweAbstractDataComponent value = getValue(iValue);
    value.setDefinition(name);
    return new SweField(name, value);
}
Also used : SweField(org.n52.shetland.ogc.swe.SweField) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent)

Example 4 with SweAbstractDataComponent

use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.

the class SweHelper method createElementType.

private SweAbstractDataComponent createElementType(TimeValuePair tvp, String name) throws EncodingException {
    SweDataRecord dataRecord = new SweDataRecord();
    dataRecord.addField(getPhenomenonTimeField(tvp.getTime()));
    dataRecord.addField(getFieldForValue(tvp.getValue(), name));
    return dataRecord;
}
Also used : SweDataRecord(org.n52.shetland.ogc.swe.SweDataRecord)

Example 5 with SweAbstractDataComponent

use of org.n52.shetland.ogc.swe.SweAbstractDataComponent in project arctic-sea by 52North.

the class FieldDecoder method decodeJSON.

public SweField decodeJSON(JsonNode node) throws DecodingException {
    final String type = node.path(JSONConstants.TYPE).textValue();
    final SweAbstractDataComponent element;
    if (type.equals(JSONConstants.BOOLEAN_TYPE)) {
        element = decodeBoolean(node);
    } else if (type.equals(JSONConstants.COUNT_TYPE)) {
        element = decodeCount(node);
    } else if (type.equals(JSONConstants.COUNT_RANGE_TYPE)) {
        element = decodeCountRange(node);
    } else if (type.equals(JSONConstants.OBSERVABLE_PROPERTY_TYPE)) {
        element = decodeObservableProperty(node);
    } else if (type.equals(JSONConstants.QUALITY_TYPE)) {
        element = decodeQuality(node);
    } else if (type.equals(JSONConstants.TEXT_TYPE)) {
        element = decodeText(node);
    } else if (type.equals(JSONConstants.QUANTITY_TYPE)) {
        element = decodeQuantity(node);
    } else if (type.equals(JSONConstants.QUANTITY_RANGE_TYPE)) {
        element = decodeQuantityRange(node);
    } else if (type.equals(JSONConstants.TIME_TYPE)) {
        element = decodeTime(node);
    } else if (type.equals(JSONConstants.TIME_RANGE_TYPE)) {
        element = decodeTimeRange(node);
    } else if (type.equals(JSONConstants.CATEGORY_TYPE)) {
        element = decodeCategory(node);
    } else {
        throw new UnsupportedDecoderInputException(this, node);
    }
    final String name = node.path(JSONConstants.NAME).textValue();
    element.setDescription(node.path(JSONConstants.DESCRIPTION).textValue());
    element.setIdentifier(node.path(JSONConstants.IDENTIFIER).textValue());
    element.setDefinition(node.path(JSONConstants.DEFINITION).textValue());
    element.setLabel(node.path(JSONConstants.LABEL).textValue());
    return new SweField(name, element);
}
Also used : SweField(org.n52.shetland.ogc.swe.SweField) SweAbstractDataComponent(org.n52.shetland.ogc.swe.SweAbstractDataComponent) UnsupportedDecoderInputException(org.n52.svalbard.decode.exception.UnsupportedDecoderInputException)

Aggregations

SweAbstractDataComponent (org.n52.shetland.ogc.swe.SweAbstractDataComponent)24 XmlObject (org.apache.xmlbeans.XmlObject)11 SweDataRecord (org.n52.shetland.ogc.swe.SweDataRecord)8 SweField (org.n52.shetland.ogc.swe.SweField)7 ArrayList (java.util.ArrayList)4 DecodingException (org.n52.svalbard.decode.exception.DecodingException)4 EncodingException (org.n52.svalbard.encode.exception.EncodingException)4 SweBoolean (org.n52.shetland.ogc.swe.simpleType.SweBoolean)3 SweTime (org.n52.shetland.ogc.swe.simpleType.SweTime)3 SweTimeRange (org.n52.shetland.ogc.swe.simpleType.SweTimeRange)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 CapabilityListType (net.opengis.sensorml.x20.CapabilityListType)2 Capability (net.opengis.sensorml.x20.CapabilityListType.Capability)2 CharacteristicListType (net.opengis.sensorml.x20.CharacteristicListType)2 Characteristic (net.opengis.sensorml.x20.CharacteristicListType.Characteristic)2 Capabilities (net.opengis.sensorml.x20.DescribedObjectType.Capabilities)2 DataRecordType (net.opengis.swe.x20.DataRecordType)2 DescribedObject (org.n52.shetland.ogc.sensorML.v20.DescribedObject)2 SweDataArray (org.n52.shetland.ogc.swe.SweDataArray)2 SweEnvelope (org.n52.shetland.ogc.swe.SweEnvelope)2