use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project ddf by codice.
the class WfsFilterDelegate method createPropertyIsFilter.
private JAXBElement<? extends ComparisonOpsType> createPropertyIsFilter(String property, Object literal, PROPERTY_IS_OPS operation) {
switch(operation) {
case PropertyIsEqualTo:
JAXBElement<BinaryComparisonOpType> propIsEqualTo = filterObjectFactory.createPropertyIsEqualTo(new BinaryComparisonOpType());
propIsEqualTo.getValue().getExpression().add(createPropertyNameType(property));
propIsEqualTo.getValue().getExpression().add(createLiteralType(literal));
return propIsEqualTo;
case PropertyIsNotEqualTo:
JAXBElement<BinaryComparisonOpType> propIsNotEqualTo = filterObjectFactory.createPropertyIsNotEqualTo(new BinaryComparisonOpType());
propIsNotEqualTo.getValue().getExpression().add(createPropertyNameType(property));
propIsNotEqualTo.getValue().getExpression().add(createLiteralType(literal));
return propIsNotEqualTo;
case PropertyIsGreaterThan:
JAXBElement<BinaryComparisonOpType> propIsGreaterThan = filterObjectFactory.createPropertyIsGreaterThan(new BinaryComparisonOpType());
propIsGreaterThan.getValue().getExpression().add(createPropertyNameType(property));
propIsGreaterThan.getValue().getExpression().add(createLiteralType(literal));
return propIsGreaterThan;
case PropertyIsGreaterThanOrEqualTo:
JAXBElement<BinaryComparisonOpType> propIsGreaterThanOrEqualTo = filterObjectFactory.createPropertyIsGreaterThanOrEqualTo(new BinaryComparisonOpType());
propIsGreaterThanOrEqualTo.getValue().getExpression().add(createPropertyNameType(property));
propIsGreaterThanOrEqualTo.getValue().getExpression().add(createLiteralType(literal));
return propIsGreaterThanOrEqualTo;
case PropertyIsLessThan:
JAXBElement<BinaryComparisonOpType> propIsLessThan = filterObjectFactory.createPropertyIsLessThan(new BinaryComparisonOpType());
propIsLessThan.getValue().getExpression().add(createPropertyNameType(property));
propIsLessThan.getValue().getExpression().add(createLiteralType(literal));
return propIsLessThan;
case PropertyIsLessThanOrEqualTo:
JAXBElement<BinaryComparisonOpType> propIsLessThanOrEqualTo = filterObjectFactory.createPropertyIsLessThanOrEqualTo(new BinaryComparisonOpType());
propIsLessThanOrEqualTo.getValue().getExpression().add(createPropertyNameType(property));
propIsLessThanOrEqualTo.getValue().getExpression().add(createLiteralType(literal));
return propIsLessThanOrEqualTo;
case PropertyIsLike:
JAXBElement<PropertyIsLikeType> propIsLike = filterObjectFactory.createPropertyIsLike(new PropertyIsLikeType());
propIsLike.getValue().setPropertyName(createPropertyNameType(property).getValue());
propIsLike.getValue().setEscape(WfsConstants.ESCAPE);
propIsLike.getValue().setSingleChar(SINGLE_CHAR);
propIsLike.getValue().setWildCard(WfsConstants.WILD_CARD);
propIsLike.getValue().setLiteral(createLiteralType(literal).getValue());
return propIsLike;
default:
throw new UnsupportedOperationException("Unsupported Property Comparison Type");
}
}
use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project arctic-sea by 52North.
the class FesDecoderV20Test method should_parse_PropertyIsEqualTo_Filter.
/**
* Test PropertyIsEqualTo filter decoding
*
* @throws OwsExceptionReport
*/
@Test
public void should_parse_PropertyIsEqualTo_Filter() throws DecodingException {
PropertyIsEqualToDocument propertyIsEqualToDoc = PropertyIsEqualToDocument.Factory.newInstance();
BinaryComparisonOpType propertyIsEqualToType = propertyIsEqualToDoc.addNewPropertyIsEqualTo();
// valueReference
XmlString valueReference = (XmlString) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_VALUE_REFERENCE, XmlString.type);
valueReference.setStringValue(TEST_VALUE_REFERENCE);
// literal
LiteralType literalType = (LiteralType) propertyIsEqualToType.addNewExpression().substitute(FilterConstants.QN_LITERAL, LiteralType.type);
XmlString newInstance = XmlString.Factory.newInstance();
newInstance.setStringValue(TEST_LITERAL);
literalType.set(newInstance);
// create document
FilterDocument filterDoc = FilterDocument.Factory.newInstance();
FilterType filterType = filterDoc.addNewFilter();
filterType.setComparisonOps(propertyIsEqualToType);
filterType.getComparisonOps().substitute(FilterConstants.QN_PROPERTY_IS_EQUAL_TO, BinaryComparisonOpType.type);
ComparisonFilter comparisonFilter = (ComparisonFilter) decoder.decode(filterDoc);
// test
assertThat(comparisonFilter.getOperator(), is(FilterConstants.ComparisonOperator.PropertyIsEqualTo));
assertThat(comparisonFilter.getValueReference(), is(TEST_VALUE_REFERENCE));
assertThat(comparisonFilter.getValue(), is(TEST_LITERAL));
}
use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project geo-platform by geosdi.
the class TimeSearchRequestFilter method createFilterTimePredicate.
/**
* @param startDate
* @param endDate
* @return {@link List<JAXBElement<?>}
*/
private List<JAXBElement<?>> createFilterTimePredicate(Date startDate, Date endDate) {
BinaryComparisonOpType begin = this.createBinaryComparisonOpType(TEMP_BEGIN, formatter.format(startDate));
BinaryComparisonOpType end = this.createBinaryComparisonOpType(TEMP_END, formatter.format(endDate));
List<JAXBElement<?>> timePredicate = new ArrayList(2);
timePredicate.add(filterFactory.createPropertyIsGreaterThanOrEqualTo(begin));
timePredicate.add(filterFactory.createPropertyIsLessThanOrEqualTo(end));
return timePredicate;
}
use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project geo-platform by geosdi.
the class BaseBinaryStrategy method createBinaryComparisonTypeForDate.
/**
* @param queryRestrictionDTO
* @return {@link BinaryComparisonOpType}
*/
protected BinaryComparisonOpType createBinaryComparisonTypeForDate(QueryRestrictionDTO queryRestrictionDTO) {
return new BinaryComparisonOpType() {
{
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(asList(queryRestrictionDTO.getAttribute().getName()));
FunctionType functionType = new FunctionType();
functionType.setName("dateParse");
LiteralType literalType = new LiteralType();
literalType.setContent(asList(queryRestrictionDTO.getRestriction()));
LiteralType literalTypeFormat = new LiteralType();
literalTypeFormat.setContent(dateFormatStrategyFinder.findDateFormat(queryRestrictionDTO.getAttribute()));
List<JAXBElement<?>> functionElements = new ArrayList<>(2);
functionElements.add(filterFactory.createLiteral(literalTypeFormat));
functionElements.add(filterFactory.createLiteral(literalType));
functionType.setExpression(functionElements);
List<JAXBElement<?>> elements = new ArrayList<>(2);
elements.add(filterFactory.createPropertyName(propertyNameType));
elements.add(filterFactory.createFunction(functionType));
super.setExpression(elements);
}
};
}
use of org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType in project geo-platform by geosdi.
the class BaseBinaryStrategy method createBinaryComparisonType.
/**
* @param queryRestrictionDTO
* @return {@link BinaryComparisonOpType}
*/
protected BinaryComparisonOpType createBinaryComparisonType(QueryRestrictionDTO queryRestrictionDTO) {
return new BinaryComparisonOpType() {
{
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(asList(queryRestrictionDTO.getAttribute().getName()));
LiteralType literalType = new LiteralType();
literalType.setContent(asList(queryRestrictionDTO.getRestriction()));
List<JAXBElement<?>> elements = new ArrayList<>(2);
elements.add(filterFactory.createPropertyName(propertyNameType));
elements.add(filterFactory.createLiteral(literalType));
super.setExpression(elements);
}
};
}
Aggregations