Search in sources :

Example 1 with PropertyNotFoundException

use of org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException in project camunda-bpm-platform by camunda.

the class AstIdentifier method setValue.

public void setValue(Bindings bindings, ELContext context, Object value) {
    ValueExpression expression = bindings.getVariable(index);
    if (expression != null) {
        expression.setValue(context, value);
        return;
    }
    context.setPropertyResolved(false);
    context.getELResolver().setValue(context, null, name, value);
    if (!context.isPropertyResolved()) {
        throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
    }
}
Also used : PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) ValueExpression(org.camunda.bpm.engine.impl.javax.el.ValueExpression)

Example 2 with PropertyNotFoundException

use of org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException in project camunda-bpm-platform by camunda.

the class JuelExpression method getValue.

public Object getValue(VariableScope variableScope, BaseDelegateExecution contextExecution) {
    ELContext elContext = expressionManager.getElContext(variableScope);
    try {
        ExpressionGetInvocation invocation = new ExpressionGetInvocation(valueExpression, elContext, contextExecution);
        Context.getProcessEngineConfiguration().getDelegateInterceptor().handleInvocation(invocation);
        return invocation.getInvocationResult();
    } catch (PropertyNotFoundException pnfe) {
        throw new ProcessEngineException("Unknown property used in expression: " + expressionText + ". Cause: " + pnfe.getMessage(), pnfe);
    } catch (MethodNotFoundException mnfe) {
        throw new ProcessEngineException("Unknown method used in expression: " + expressionText + ". Cause: " + mnfe.getMessage(), mnfe);
    } catch (ELException ele) {
        throw new ProcessEngineException("Error while evaluating expression: " + expressionText + ". Cause: " + ele.getMessage(), ele);
    } catch (Exception e) {
        throw new ProcessEngineException("Error while evaluating expression: " + expressionText + ". Cause: " + e.getMessage(), e);
    }
}
Also used : ELContext(org.camunda.bpm.engine.impl.javax.el.ELContext) PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) ELException(org.camunda.bpm.engine.impl.javax.el.ELException) MethodNotFoundException(org.camunda.bpm.engine.impl.javax.el.MethodNotFoundException) ExpressionGetInvocation(org.camunda.bpm.engine.impl.delegate.ExpressionGetInvocation) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) MethodNotFoundException(org.camunda.bpm.engine.impl.javax.el.MethodNotFoundException) PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) ELException(org.camunda.bpm.engine.impl.javax.el.ELException)

Example 3 with PropertyNotFoundException

use of org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException in project camunda-bpm-platform by camunda.

the class ExpressionBeanAccessTest method testConfigurationBeanAccess.

@Deployment
public void testConfigurationBeanAccess() {
    // Exposed bean returns 'I'm exposed' when to-string is called in first service-task
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("expressionBeanAccess");
    assertEquals("I'm exposed", runtimeService.getVariable(pi.getId(), "exposedBeanResult"));
    // is not added to the beans-list
    try {
        runtimeService.signal(pi.getId());
        fail("Exception expected");
    } catch (ProcessEngineException ae) {
        assertNotNull(ae.getCause());
        assertTrue(ae.getCause() instanceof PropertyNotFoundException);
    }
}
Also used : PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) ProcessInstance(org.camunda.bpm.engine.runtime.ProcessInstance) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 4 with PropertyNotFoundException

use of org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException in project camunda-bpm-platform by camunda.

the class AstIdentifier method eval.

@Override
public Object eval(Bindings bindings, ELContext context) {
    ValueExpression expression = bindings.getVariable(index);
    if (expression != null) {
        return expression.getValue(context);
    }
    context.setPropertyResolved(false);
    Object result = context.getELResolver().getValue(context, null, name);
    if (!context.isPropertyResolved()) {
        throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
    }
    return result;
}
Also used : PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) ValueExpression(org.camunda.bpm.engine.impl.javax.el.ValueExpression)

Example 5 with PropertyNotFoundException

use of org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException in project camunda-bpm-platform by camunda.

the class AstIdentifier method isReadOnly.

public boolean isReadOnly(Bindings bindings, ELContext context) {
    ValueExpression expression = bindings.getVariable(index);
    if (expression != null) {
        return expression.isReadOnly(context);
    }
    context.setPropertyResolved(false);
    boolean result = context.getELResolver().isReadOnly(context, null, name);
    if (!context.isPropertyResolved()) {
        throw new PropertyNotFoundException(LocalMessages.get("error.identifier.property.notfound", name));
    }
    return result;
}
Also used : PropertyNotFoundException(org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException) ValueExpression(org.camunda.bpm.engine.impl.javax.el.ValueExpression)

Aggregations

PropertyNotFoundException (org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException)8 ValueExpression (org.camunda.bpm.engine.impl.javax.el.ValueExpression)4 Method (java.lang.reflect.Method)2 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 ELException (org.camunda.bpm.engine.impl.javax.el.ELException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ExpressionGetInvocation (org.camunda.bpm.engine.impl.delegate.ExpressionGetInvocation)1 ELContext (org.camunda.bpm.engine.impl.javax.el.ELContext)1 MethodInfo (org.camunda.bpm.engine.impl.javax.el.MethodInfo)1 MethodNotFoundException (org.camunda.bpm.engine.impl.javax.el.MethodNotFoundException)1 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)1 Deployment (org.camunda.bpm.engine.test.Deployment)1