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;
}
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;
}
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);
}
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;
}
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);
}
Aggregations