use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class ODataFesParserTest method testDisjunction.
@Test
@SuppressWarnings("unchecked")
public void testDisjunction() throws Exception {
Filter<?> filter = parser.decode("countValue lt 10 or textValue eq 'thetext'");
assertThat(filter, is(instanceOf(BinaryLogicFilter.class)));
BinaryLogicFilter blf = (BinaryLogicFilter) filter;
errors.checkThat(blf.getOperator(), is(BinaryLogicOperator.Or));
Set<Filter<?>> filterPredicates = blf.getFilterPredicates();
errors.checkThat(filterPredicates, Matchers.containsInAnyOrder(Matchers.instanceOf(ComparisonFilter.class), Matchers.instanceOf(ComparisonFilter.class)));
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class ObservationEncoder method getFieldForValue.
private SweField getFieldForValue(String phenomenon, Value<?> value) throws EncodingException {
final SweAbstractDataComponent def;
if (value instanceof BooleanValue) {
def = new SweBoolean();
} else if (value instanceof CategoryValue) {
SweCategory sweCategory = new SweCategory();
CategoryValue categoryValue = (CategoryValue) value;
sweCategory.setCodeSpace(categoryValue.getUnit());
def = sweCategory;
} else if (value instanceof CountValue) {
def = new SweCount();
} else if (value instanceof QuantityValue) {
SweQuantity sweQuantity = new SweQuantity();
QuantityValue quantityValue = (QuantityValue) value;
sweQuantity.setUom(quantityValue.getUnit());
def = sweQuantity;
} else if (value instanceof TextValue) {
def = new SweText();
} else if (value instanceof NilTemplateValue) {
def = new SweText();
} else if (value instanceof BooleanValue) {
def = new SweBoolean();
} else if (value instanceof GeometryValue) {
def = new SweText();
} else {
throw new UnsupportedEncoderInputException(this, value);
}
def.setDefinition(phenomenon);
return new SweField(phenomenon, def);
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class InsertSensorRequestDecoder method decodeRequest.
@Override
protected InsertSensorRequest decodeRequest(JsonNode node) throws DecodingException {
final InsertSensorRequest r = new InsertSensorRequest();
final SosInsertionMetadata meta = new SosInsertionMetadata();
meta.setFeatureOfInterestTypes(parseStringOrStringList(node.path(JSONConstants.FEATURE_OF_INTEREST_TYPE)));
meta.setObservationTypes(parseStringOrStringList(node.path(JSONConstants.OBSERVATION_TYPE)));
r.setMetadata(meta);
r.setObservableProperty(parseStringOrStringList(node.path(JSONConstants.OBSERVABLE_PROPERTY)));
r.setProcedureDescriptionFormat(node.path(JSONConstants.PROCEDURE_DESCRIPTION_FORMAT).textValue());
r.setRelatedFeature(parseFeatureRelationships(node.path(JSONConstants.RELATED_FEATURE)));
r.setProcedureDescription(parseProcedureDescription(node.path(JSONConstants.PROCEDURE_DESCRIPTION), r.getProcedureDescriptionFormat()));
return r;
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class GetCapabilitiesRequestDecoder method decodeRequest.
@Override
protected GetCapabilitiesRequest decodeRequest(JsonNode node) {
GetCapabilitiesRequest req = new GetCapabilitiesRequest(SosConstants.SOS);
req.setAcceptFormats(parseStringOrStringList(node.path(JSONConstants.ACCEPT_FORMATS)));
req.setAcceptVersions(parseStringOrStringList(node.path(JSONConstants.ACCEPT_VERSIONS)));
req.setSections(parseStringOrStringList(node.path(JSONConstants.SECTIONS)));
req.setUpdateSequence(node.path(JSONConstants.UPDATE_SEQUENCE).textValue());
return req;
}
use of org.n52.shetland.ogc.om.values.TextValue in project arctic-sea by 52North.
the class GetObservationRequestDecoder method decodeRequest.
@Override
public GetObservationRequest decodeRequest(JsonNode node) throws DecodingException {
GetObservationRequest r = new GetObservationRequest();
r.setFeatureIdentifiers(parseStringOrStringList(node.path(JSONConstants.FEATURE_OF_INTEREST)));
r.setObservedProperties(parseStringOrStringList(node.path(JSONConstants.OBSERVED_PROPERTY)));
r.setOfferings(parseStringOrStringList(node.path(JSONConstants.OFFERING)));
r.setProcedures(parseStringOrStringList(node.path(JSONConstants.PROCEDURE)));
r.setResponseFormat(node.path(JSONConstants.RESPONSE_FORMAT).textValue());
r.setResponseMode(node.path(JSONConstants.RESPONSE_MODE).textValue());
r.setResultModel(node.path(JSONConstants.RESULT_MODEL).textValue());
r.setResultFilter(parseComparisonFilter(node.path(JSONConstants.RESULT_FILTER)));
r.setSpatialFilter(parseSpatialFilter(node.path(JSONConstants.SPATIAL_FILTER)));
r.setTemporalFilters(parseTemporalFilters(node.path(JSONConstants.TEMPORAL_FILTER)));
// TODO whats that for?
r.setRequestString(Json.print(node));
return r;
}
Aggregations