@Test public void testDate() { final Calendar now = Calendar.getInstance(); final int year = now.get(Calendar.YEAR); final Map<String, String> attributes = new HashMap<>(); attributes.put("entryDate", String.valueOf(now.getTimeInMillis())); verifyEquals("${entryDate:toNumber():toDate():format('yyyy')}", attributes, String.valueOf(year)); assertEquals("", Query.evaluateExpressions("${notExistingAtt:toDate()}", attributes, null)); attributes.clear(); attributes.put("month", "3"); attributes.put("day", "4"); attributes.put("year", "2013"); assertEquals("63", Query.evaluateExpressions("${year:append('/'):append(${month}):append('/'):append(${day}):toDate('yyyy/MM/dd'):format('D')}", attributes, null)); assertEquals("63", Query.evaluateExpressions("${year:append('/'):append('${month}'):append('/'):append('${day}'):toDate('yyyy/MM/dd'):format('D')}", attributes, null)); verifyEquals("${year:append('/'):append(${month}):append('/'):append(${day}):toDate('yyyy/MM/dd'):format('D')}", attributes, "63"); }
static String evaluateExpressions(final String rawValue, Map<String, String> expressionMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { return Query.prepare(rawValue).evaluateExpressions(expressionMap, decorator, stateVariables); }
Query { static String evaluateExpressions(final String rawValue, Map<String, String> expressionMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { return Query.prepare(rawValue).evaluateExpressions(expressionMap, decorator, stateVariables); } }
Query { static String evaluateExpressions(final String rawValue, Map<String, String> expressionMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { return Query.prepare(rawValue).evaluateExpressions(expressionMap, decorator, stateVariables); } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); }
Query { static String evaluateExpressions(final String rawValue, Map<String, String> expressionMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { return Query.prepare(rawValue).evaluateExpressions(expressionMap, decorator, stateVariables); } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); static boolean isValidExpression(final String value); static ResultType getResultType(final String value); static List<ResultType> extractResultTypes(final String value); static List<String> extractExpressions(final String value); static List<Range> extractExpressionRanges(final String value); static void validateExpression(final String value, final boolean allowSurroundingCharacters); static String unescape(final String value); static Query fromTree(final Tree tree, final String text); static Tree compileTree(final String query); static PreparedQuery prepare(final String query); static Query compile(final String query); ResultType getResultType(); @Override String toString(); }
Query { static String evaluateExpressions(final String rawValue, Map<String, String> expressionMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { return Query.prepare(rawValue).evaluateExpressions(expressionMap, decorator, stateVariables); } private  Query(final String query, final Tree tree, final Evaluator<?> evaluator); static boolean isValidExpression(final String value); static ResultType getResultType(final String value); static List<ResultType> extractResultTypes(final String value); static List<String> extractExpressions(final String value); static List<Range> extractExpressionRanges(final String value); static void validateExpression(final String value, final boolean allowSurroundingCharacters); static String unescape(final String value); static Query fromTree(final Tree tree, final String text); static Tree compileTree(final String query); static PreparedQuery prepare(final String query); static Query compile(final String query); ResultType getResultType(); @Override String toString();  }