private static String getDateWithoutOp(String ddf) { return Filter.getDateWithoutOp(ddf); }
public void init(String filter) { if (filter != null) { Matcher expressionMatcher = __comparatorPattern.matcher(filter); while (expressionMatcher.find()) { String filterKey = expressionMatcher.group(1); String op = expressionMatcher.group(2); String value = expressionMatcher.group(3); FKEY keyval; try { keyval = parseKey(filterKey.toUpperCase().replaceAll("-", "_")); } catch (Exception ex) { String errmsg = __msgs.msgUnrecognizedFilterKey(filterKey, getFilterKeysStr()); throw new IllegalArgumentException(errmsg, ex); } Restriction<String> restriction = new Restriction<String>(filterKey,op,value); _criteria.put(keyval, restriction); process(keyval, restriction); } } }
private Collection<String> getFilterKeysStr() { return CollectionsX.transform(new ArrayList<String>(), CollectionUtils.makeCollection(ArrayList.class , getFilterKeys()), new UnaryFunction<FKEY,String>() { public String apply(FKEY x) { return x.name(); } }); } }
private static String dateFilter(String filter) { String date = Filter.getDateWithoutOp(filter); String op = filter.substring(0,filter.indexOf(date)); Date dt = null; try { dt = ISO8601DateParser.parse(date); } catch (ParseException e) { e.printStackTrace(); } Timestamp ts = new Timestamp(dt.getTime()); return op + " '" + ts.toString() + "'"; }
public boolean dateMatch(List<String> dateFilters, Date instanceDate, InstanceFilter filter) { boolean match = true; for (String ddf : dateFilters) { String isoDate = ISO8601DateParser.format(instanceDate); String critDate = Filter.getDateWithoutOp(ddf); if (ddf.startsWith("=")) { if (!isoDate.startsWith(critDate)) match = false; } else if (ddf.startsWith("<=")) { if (!isoDate.startsWith(critDate) && isoDate.compareTo(critDate) > 0) match = false; } else if (ddf.startsWith(">=")) { if (!isoDate.startsWith(critDate) && isoDate.compareTo(critDate) < 0) match = false; } else if (ddf.startsWith("<")) { if (isoDate.compareTo(critDate) > 0) match = false; } else if (ddf.startsWith(">")) { if (isoDate.compareTo(critDate) < 0) match = false; } } return match; }
final Date dd; try { dd = ISO8601DateParser.parse(Filter.getDateWithoutOp(ddf)); } catch (ParseException e) {
final Date dd; try { dd = ISO8601DateParser.parse(Filter.getDateWithoutOp(ddf)); } catch (ParseException e) {