Package org.apache.commons.jexl2

Examples of org.apache.commons.jexl2.JexlContext


      script = ENGINE.createScript(filter);
    } catch (JexlException e) {
      throw new FeedEntryFilterException("Exception while parsing expression " + filter, e);
    }

    JexlContext context = new MapContext();
    context.set("title", Jsoup.parse(entry.getContent().getTitle()).text().toLowerCase());
    context.set("author", entry.getContent().getAuthor().toLowerCase());
    context.set("content", Jsoup.parse(entry.getContent().getContent()).text().toLowerCase());
    context.set("url", entry.getUrl().toLowerCase());

    Callable<Object> callable = script.callable(context);
    Future<Object> future = executor.submit(callable);
    Object result = null;
    try {
View Full Code Here


     * @param context <code>ExpressionContext</code>上下文
     * @return 表达式的计算结果
     */
    public Object evaluate(ExpressionContext context) {
        try {
            JexlContext jexlContext = new JexlContextAdapter(context);

            if (log.isDebugEnabled()) {
                log.debug("Evaluating EL: " + expression.getExpression());
            }

View Full Code Here

     * @param context <code>ExpressionContext</code>������
     * @return ���ʽ�ļ�����
     */
    public Object evaluate(ExpressionContext context) {
        try {
            JexlContext jexlContext = new JexlContextAdapter(context);

            if (log.isDebugEnabled()) {
                log.debug("Evaluating EL: " + expression.getExpression());
            }

View Full Code Here

      Set<String> dataObjectIds,
      DataObjectService dataObjectHandler,
      String uniqueProcessId,
      String instanceId) {
   
    JexlContext jc = fillContext(dataObjectIds, dataObjectHandler, uniqueProcessId, instanceId);
   
    // evaluate the expression
    Object result = expression.evaluate(jc);
       
    return result;
View Full Code Here

  public static JexlContext fillContext(Set<String> dataObjectIds,
      DataObjectService dataObjectHandler,
      String uniqueProcessId,
      String instanceId) {
    // create context
    JexlContext jc = new MapContext();
       
    // fill context
    for (String id : dataObjectIds) {
      jc.set(id, dataObjectHandler.loadObject(uniqueProcessId, instanceId, id));
    }
   
    return jc;
  }
View Full Code Here

      Set<String> dataObjectIds,
      DataObjectService dataObjectHandler,
      String uniqueProcessId,
      String instanceId) {
   
    JexlContext context = fillContext(dataObjectIds, dataObjectHandler, uniqueProcessId, instanceId);
    return evaluateToBoolean(expression, context);
  }
View Full Code Here

  }
 
  public ActorRef evaluateOutGoingSequence(String iid) {
    Iterator<ActorRef> it = this.conditionalExpressionStrings.keySet().iterator();
    // fill the context once and use it for every expression
    JexlContext context = ExpressionService.fillContext(this.usedDataObjectIds, this.dataObjectHandler, this.uniqueProcessId, iid);
   
    while (it.hasNext()) {
      ActorRef actorRef = it.next();
      Expression expression = this.conditionalExpressionStrings.get(actorRef);
      if(ExpressionService.evaluateToBoolean(expression, context)) {
View Full Code Here

        }

        // Evaluate AccountLink expression
        String evalAccountLink = null;
        if (StringUtils.isNotBlank(attrUtil.getAccountLink(resource))) {
            final JexlContext jexlContext = new MapContext();
            JexlUtil.addFieldsToContext(subject, jexlContext);
            JexlUtil.addAttrsToContext(subject.getAttrs(), jexlContext);
            JexlUtil.addDerAttrsToContext(subject.getDerAttrs(), subject.getAttrs(), jexlContext);
            evalAccountLink = JexlUtil.evaluate(attrUtil.getAccountLink(resource), jexlContext);
        }
View Full Code Here

     * @param attributes the set of attributes against which evaluate this derived attribute
     * @return the value of this derived attribute
     */
    public String getValue(final Collection<? extends AbstractAttr> attributes) {
        // Prepare context using user attributes
        final JexlContext jexlContext = new MapContext();
        JexlUtil.addAttrsToContext(attributes, jexlContext);
        JexlUtil.addFieldsToContext(getOwner(), jexlContext);

        // Evaluate expression using the context prepared before
        return JexlUtil.evaluate(getSchema().getExpression(), jexlContext);
View Full Code Here

                    if (role.getResourceNames().contains(task.getResource().getName())
                            && StringUtils.isNotBlank(task.getResource().getRmapping().getAccountLink())) {

                        LOG.debug("Evaluating accountLink for {}", role);

                        final JexlContext jexlContext = new MapContext();
                        JexlUtil.addFieldsToContext(role, jexlContext);
                        JexlUtil.addAttrsToContext(role.getAttrs(), jexlContext);
                        JexlUtil.addDerAttrsToContext(role.getDerAttrs(), role.getAttrs(), jexlContext);

                        final String roleAccountLink =
View Full Code Here

TOP

Related Classes of org.apache.commons.jexl2.JexlContext

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.