public static Filter contains(final PropertyName propertyName, final String subsequence) { String pattern = "*" + fixSpecials(subsequence) + "*"; String wildcard = "*"; String singleChar = "?"; String escape = "\\"; boolean matchCase = false; return factory.like(propertyName, pattern, wildcard, singleChar, escape, matchCase); }
/** * Builds a like filter * * @matchCase * @return a PropertyIsLike * @throws CQLException */ public PropertyIsLike buildLikeFilter(boolean matchCase) throws CQLException { final String WC_MULTI = "%"; final String WC_SINGLE = "_"; final String ESCAPE = "\\"; try { org.opengis.filter.expression.Expression pattern = this.resultStack.popExpression(); org.opengis.filter.expression.Expression expr = this.resultStack.popExpression(); PropertyIsLike f = filterFactory.like( expr, pattern.toString(), WC_MULTI, WC_SINGLE, ESCAPE, matchCase); return f; } catch (IllegalFilterException ife) { throw new CQLException( "Exception building LikeFilter: " + ife.getMessage(), this.cqlSource); } }
public void testVisitLikeFilter() throws Exception { Filter filter = ff.like(ff.property(nameAtt), "j*", "*", "?", "\\"); FilterCapabilities likeCaps = new FilterCapabilities(PropertyIsLike.class); runTest(filter, likeCaps, nameAtt); }
return factory.like(name, literal.toString(), wildcard, single, escape, matchCase);
@Test public void testVisitLikeFilter() throws Exception { Filter filter = ff.like(ff.property(nameAtt), "j*", "*", "?", "\\"); runTest(filter, newCapabilities(PropertyIsLike.class), nameAtt); }
PropertyIsLike fn = factory.like(fnCall, "does-not-matter"); names = DataUtilities.attributeNames(fn); list = Arrays.asList(names);
/** * Builds a like filter * * @matchCase * * @return a PropertyIsLike * @throws CQLException */ public PropertyIsLike buildLikeFilter(boolean matchCase) throws CQLException { final String WC_MULTI = "%"; final String WC_SINGLE = "_"; final String ESCAPE = "\\"; try { org.opengis.filter.expression.Expression pattern = this.resultStack .popExpression(); org.opengis.filter.expression.Expression expr = this.resultStack .popExpression(); PropertyIsLike f = filterFactory.like(expr, pattern.toString(), WC_MULTI, WC_SINGLE, ESCAPE, matchCase); return f; } catch (IllegalFilterException ife) { throw new CQLException("Exception building LikeFilter: " + ife.getMessage(), this.cqlSource); } }
/** * Bulds a like filter * * @return a PropertyIsLike * @throws CQLException */ private PropertyIsLike buildLikeFilter() throws CQLException { final String WC_MULTI = "%"; final String WC_SINGLE = "_"; final String ESCAPE = "\\"; try { org.opengis.filter.expression.Expression pattern = resultStack .popExpression(); org.opengis.filter.expression.Expression expr = resultStack .popExpression(); PropertyIsLike f = filterFactory.like(expr, pattern.toString(), WC_MULTI, WC_SINGLE, ESCAPE); return f; } catch (IllegalFilterException ife) { throw new CQLException("Exception building LikeFilter", getToken(0), ife, this.cqlSource); } }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { PropertyName name = (PropertyName) node.getChildValue(PropertyName.class); Literal literal = (Literal) node.getChildValue(Literal.class); String wildcard = (String) node.getAttributeValue("wildCard"); String single = (String) node.getAttributeValue("singleChar"); String escape = (String) node.getAttributeValue("escape"); if (escape == null) { //1.1 uses "escapeChar", suppot that too escape = (String) node.getAttributeValue("escapeChar"); } return factory.like(name, literal.toString(), wildcard, single, escape); }
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { PropertyName name = (PropertyName) node.getChildValue(PropertyName.class); Literal literal = (Literal) node.getChildValue(Literal.class); String wildcard = (String) node.getAttributeValue("wildCard"); String single = (String) node.getAttributeValue("singleChar"); String escape = (String) node.getAttributeValue("escape"); boolean matchCase = true; if (node.getAttributeValue("matchCase") != null){ matchCase = Boolean.valueOf((String)node.getAttributeValue("matchCase")); } if (escape == null) { //1.1 uses "escapeChar", suppot that too escape = (String) node.getAttributeValue("escapeChar"); } return factory.like(name, literal.toString(), wildcard, single, escape, matchCase); }
Expression expr = expression(); try { PropertyIsLike f = factory.like(expr, pattern, "*", ".?", "//"); return f; } catch (IllegalFilterException ife) {
ff.not(ff.like(ff.property("ADDRESS"), "*Restricted Street*", "*", "?", "\\")); tam.putLimits( "cite_insertfilter",