Package org.apache.commons.jexl2

Examples of org.apache.commons.jexl2.JexlException$Property


        StringBuffer url = request.getRequestURL().replace(index, request.getRequestURL().length(), newContext);
        applicationController.subscribeUserAndCreateStatistic(Long.valueOf(applicationVersionId), request);

        String itmsURL = "itms-services://?action=download-manifest&url=" + url.toString();

        Property property = new Property();
        property.setKey("URL");
        property.setValue(itmsURL);

        return property;
    }
View Full Code Here


    @RequestMapping(value = "/statistics", method = RequestMethod.GET, produces = contentType)
    public
    @ResponseBody
    Properties viewSystemManagementPage(HttpServletRequest request) {
        Property[] properties = new Property[3];
        properties[0] = new Property(SystemStatistics.ORGANIZATION_COUNT.name(), Long.toString(organizationService.countAll()), SystemStatistics.ORGANIZATION_COUNT.getDescription());
        properties[1] = new Property(SystemStatistics.USER_COUNT.name(), Long.toString(userService.countAll()), SystemStatistics.USER_COUNT.getDescription());
        properties[2] = new Property(SystemStatistics.APPLICATION_COUNT.name(), Long.toString(applicationService.countAll()), SystemStatistics.APPLICATION_COUNT.getDescription());

        Properties props = new Properties();
        props.setProperties(properties);

        return props;
View Full Code Here

    public String evaluate(final String expression, final JexlContext jexlContext) {
        String result = "";

        if (StringUtils.isNotBlank(expression) && jexlContext != null) {
            try {
                Expression jexlExpression = jexlEngine.createExpression(expression);
                Object evaluated = jexlExpression.evaluate(jexlContext);
                if (evaluated != null) {
                    result = evaluated.toString();
                }
            } catch (JexlException e) {
                LOG.error("Invalid jexl expression: " + expression, e);
View Full Code Here

     */
    @Override
    public FeatureState process(final ContextManager contextManager)
    {
        final JexlEngine jexlEngine = new JexlEngine();
        Expression jexlExpression;
        if (expression != null) {
            jexlExpression = jexlEngine.createExpression(expression);
        } else {
            jexlExpression = getOldExpression(jexlEngine);
        }
       
        final Map<String, Object> contextMap = contextManager.getContext(context);
        final JexlContext jexlContext = new MapContext(contextMap);

        return Boolean.TRUE.equals(jexlExpression.evaluate(jexlContext)) ? FeatureState.ENABLED : FeatureState.DISABLED;
    }
View Full Code Here

     * @param expected is the expected value of the expression
     * @throws Exception if the expression could not be evaluationed or an assertion
     * fails
     */
    public void assertExpression(String expression, Object expected) throws Exception {
        Expression exp = engine.createExpression(expression);
        Object value = exp.evaluate(context);

        assertEquals("expression: " + expression, expected, value);
    }
View Full Code Here

    public void failExpression(String expression, String matchException) throws Exception {
        boolean[] flags = { engine.isLenient(), engine.isSilent() };
        try {
            engine.setLenient(false);
            engine.setSilent(false);
            Expression exp = engine.createExpression(expression);
            exp.evaluate(context);
            fail("expression: " + expression);
        } catch(JexlException xjexl) {
            if (matchException != null && !xjexl.getMessage().matches(matchException)) {
                fail("expression: " + expression + ", expected: " + matchException + ", got " + xjexl.getMessage());
            }
View Full Code Here

   
    /**
     * {@inheritDoc }
     */
    public Object evaluate(Object context, String expression) {
        Expression jexlExpression = engine.createExpression(expression);
        JexlContext jexlContext = new ObjectContext(engine, context);
       
        return jexlExpression.evaluate(jexlContext);
    }
View Full Code Here

    public Map<String, Object> getVariables() {
        return variables;
    }

    protected Expression createExpression(final String expression) throws Exception {
        Expression expr = engine.createExpression(expression);
        return expr;
    }
View Full Code Here

        if (expression == null) {
            throw new IllegalArgumentException("expression");
        }

        log.trace("Evaluating expression: {}", expression);
        Expression expr = createExpression(expression);
        Object obj = expr.evaluate(context);
        log.trace("Result: {}", obj);

        return obj;
    }
View Full Code Here

    private Object doEvaluate(final String expression) throws Exception {
        assert expression != null;

        log.debug("Evaluating expression: {}", expression);
       
        Expression expr = engine.createExpression(expression);

        JexlContext ctx = new MapContext(vars);

        Object result = expr.evaluate(ctx);
        log.debug("Result: {}", result);

        return result;
    }   
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl2.JexlException$Property

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.