Search in sources :

Example 1 with FieldDeclaration

use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.

the class AbstractBehaviorFactory method createFieldDeclarations.

public List<FieldDeclaration> createFieldDeclarations(List<FieldExtension> fieldList) {
    List<FieldDeclaration> fieldDeclarations = new ArrayList<FieldDeclaration>();
    for (FieldExtension fieldExtension : fieldList) {
        FieldDeclaration fieldDeclaration = null;
        if (StringUtils.isNotEmpty(fieldExtension.getExpression())) {
            fieldDeclaration = new FieldDeclaration(fieldExtension.getFieldName(), Expression.class.getName(), expressionManager.createExpression(fieldExtension.getExpression()));
        } else {
            fieldDeclaration = new FieldDeclaration(fieldExtension.getFieldName(), Expression.class.getName(), new FixedValue(fieldExtension.getStringValue()));
        }
        fieldDeclarations.add(fieldDeclaration);
    }
    return fieldDeclarations;
}
Also used : FieldExtension(org.activiti.bpmn.model.FieldExtension) ArrayList(java.util.ArrayList) FixedValue(org.activiti.engine.impl.el.FixedValue) FieldDeclaration(org.activiti.engine.impl.bpmn.parser.FieldDeclaration)

Example 2 with FieldDeclaration

use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.

the class DefaultActivityBehaviorFactory method addExceptionMapAsFieldDeclaraion.

private void addExceptionMapAsFieldDeclaraion(List<FieldDeclaration> fieldDeclarations, List<MapExceptionEntry> mapExceptions) {
    FieldDeclaration exceptionMapsFieldDeclaration = new FieldDeclaration(EXCEPTION_MAP_FIELD, mapExceptions.getClass().toString(), mapExceptions);
    fieldDeclarations.add(exceptionMapsFieldDeclaration);
}
Also used : FieldDeclaration(org.activiti.engine.impl.bpmn.parser.FieldDeclaration)

Example 3 with FieldDeclaration

use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.

the class DefaultActivityBehaviorFactory method createCamelActivityBehavior.

protected ActivityBehavior createCamelActivityBehavior(TaskWithFieldExtensions task, List<FieldExtension> fieldExtensions, BpmnModel bpmnModel) {
    try {
        Class<?> theClass = null;
        FieldExtension behaviorExtension = null;
        for (FieldExtension fieldExtension : fieldExtensions) {
            if ("camelBehaviorClass".equals(fieldExtension.getFieldName()) && StringUtils.isNotEmpty(fieldExtension.getStringValue())) {
                theClass = Class.forName(fieldExtension.getStringValue());
                behaviorExtension = fieldExtension;
                break;
            }
        }
        if (behaviorExtension != null) {
            fieldExtensions.remove(behaviorExtension);
        }
        if (theClass == null) {
            // Default Camel behavior class
            theClass = Class.forName("org.activiti.camel.impl.CamelBehaviorDefaultImpl");
        }
        List<FieldDeclaration> fieldDeclarations = createFieldDeclarations(fieldExtensions);
        addExceptionMapAsFieldDeclaraion(fieldDeclarations, task.getMapExceptions());
        return (ActivityBehavior) ClassDelegate.defaultInstantiateDelegate(theClass, fieldDeclarations);
    } catch (ClassNotFoundException e) {
        throw new ActivitiException("Could not find org.activiti.camel.CamelBehavior: ", e);
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) FieldExtension(org.activiti.bpmn.model.FieldExtension) BoundaryEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.BoundaryEventActivityBehavior) UserTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior) ScriptTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior) ErrorEndEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ErrorEndEventActivityBehavior) InclusiveGatewayActivityBehavior(org.activiti.engine.impl.bpmn.behavior.InclusiveGatewayActivityBehavior) ServiceTaskDelegateExpressionActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior) ServiceTaskExpressionActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior) ReceiveTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior) ActivityBehavior(org.activiti.engine.impl.pvm.delegate.ActivityBehavior) CallActivityBehavior(org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior) ExclusiveGatewayActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior) MailActivityBehavior(org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior) TransactionActivityBehavior(org.activiti.engine.impl.bpmn.behavior.TransactionActivityBehavior) NoneStartEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.NoneStartEventActivityBehavior) ShellActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ShellActivityBehavior) IntermediateThrowNoneEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.IntermediateThrowNoneEventActivityBehavior) TerminateEndEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.TerminateEndEventActivityBehavior) IntermediateThrowCompensationEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.IntermediateThrowCompensationEventActivityBehavior) ManualTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ManualTaskActivityBehavior) IntermediateCatchEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBehavior) EventBasedGatewayActivityBehavior(org.activiti.engine.impl.bpmn.behavior.EventBasedGatewayActivityBehavior) IntermediateThrowSignalEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.IntermediateThrowSignalEventActivityBehavior) WebServiceActivityBehavior(org.activiti.engine.impl.bpmn.behavior.WebServiceActivityBehavior) NoneEndEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.NoneEndEventActivityBehavior) CancelEndEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.CancelEndEventActivityBehavior) CancelBoundaryEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.CancelBoundaryEventActivityBehavior) EventSubProcessStartEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.EventSubProcessStartEventActivityBehavior) AbstractBpmnActivityBehavior(org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior) BusinessRuleTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.BusinessRuleTaskActivityBehavior) SubProcessActivityBehavior(org.activiti.engine.impl.bpmn.behavior.SubProcessActivityBehavior) TaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.TaskActivityBehavior) ParallelGatewayActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ParallelGatewayActivityBehavior) FieldDeclaration(org.activiti.engine.impl.bpmn.parser.FieldDeclaration)

Example 4 with FieldDeclaration

use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.

the class DefaultActivityBehaviorFactory method createMuleActivityBehavior.

protected ActivityBehavior createMuleActivityBehavior(TaskWithFieldExtensions task, List<FieldExtension> fieldExtensions, BpmnModel bpmnModel) {
    try {
        Class<?> theClass = Class.forName("org.activiti.mule.MuleSendActivitiBehavior");
        List<FieldDeclaration> fieldDeclarations = createFieldDeclarations(fieldExtensions);
        return (ActivityBehavior) ClassDelegate.defaultInstantiateDelegate(theClass, fieldDeclarations);
    } catch (ClassNotFoundException e) {
        throw new ActivitiException("Could not find org.activiti.mule.MuleSendActivitiBehavior: ", e);
    }
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) BoundaryEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.BoundaryEventActivityBehavior) UserTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.UserTaskActivityBehavior) ScriptTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ScriptTaskActivityBehavior) ErrorEndEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ErrorEndEventActivityBehavior) InclusiveGatewayActivityBehavior(org.activiti.engine.impl.bpmn.behavior.InclusiveGatewayActivityBehavior) ServiceTaskDelegateExpressionActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior) ServiceTaskExpressionActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ServiceTaskExpressionActivityBehavior) ReceiveTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior) ActivityBehavior(org.activiti.engine.impl.pvm.delegate.ActivityBehavior) CallActivityBehavior(org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior) ExclusiveGatewayActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior) MailActivityBehavior(org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior) TransactionActivityBehavior(org.activiti.engine.impl.bpmn.behavior.TransactionActivityBehavior) NoneStartEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.NoneStartEventActivityBehavior) ShellActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ShellActivityBehavior) IntermediateThrowNoneEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.IntermediateThrowNoneEventActivityBehavior) TerminateEndEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.TerminateEndEventActivityBehavior) IntermediateThrowCompensationEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.IntermediateThrowCompensationEventActivityBehavior) ManualTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ManualTaskActivityBehavior) IntermediateCatchEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBehavior) EventBasedGatewayActivityBehavior(org.activiti.engine.impl.bpmn.behavior.EventBasedGatewayActivityBehavior) IntermediateThrowSignalEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.IntermediateThrowSignalEventActivityBehavior) WebServiceActivityBehavior(org.activiti.engine.impl.bpmn.behavior.WebServiceActivityBehavior) NoneEndEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.NoneEndEventActivityBehavior) CancelEndEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.CancelEndEventActivityBehavior) CancelBoundaryEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.CancelBoundaryEventActivityBehavior) EventSubProcessStartEventActivityBehavior(org.activiti.engine.impl.bpmn.behavior.EventSubProcessStartEventActivityBehavior) AbstractBpmnActivityBehavior(org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior) BusinessRuleTaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.BusinessRuleTaskActivityBehavior) SubProcessActivityBehavior(org.activiti.engine.impl.bpmn.behavior.SubProcessActivityBehavior) TaskActivityBehavior(org.activiti.engine.impl.bpmn.behavior.TaskActivityBehavior) ParallelGatewayActivityBehavior(org.activiti.engine.impl.bpmn.behavior.ParallelGatewayActivityBehavior) FieldDeclaration(org.activiti.engine.impl.bpmn.parser.FieldDeclaration)

Example 5 with FieldDeclaration

use of org.activiti.engine.impl.bpmn.parser.FieldDeclaration in project Activiti by Activiti.

the class TestActivityBehaviorFactory method createNoOpServiceTask.

private ClassDelegate createNoOpServiceTask(ServiceTask serviceTask) {
    List<FieldDeclaration> fieldDeclarations = new ArrayList<FieldDeclaration>();
    fieldDeclarations.add(new FieldDeclaration("name", Expression.class.getName(), new FixedValue(serviceTask.getImplementation())));
    return new ClassDelegate(NoOpServiceTask.class, fieldDeclarations);
}
Also used : ArrayList(java.util.ArrayList) FixedValue(org.activiti.engine.impl.el.FixedValue) ClassDelegate(org.activiti.engine.impl.bpmn.helper.ClassDelegate) FieldDeclaration(org.activiti.engine.impl.bpmn.parser.FieldDeclaration)

Aggregations

FieldDeclaration (org.activiti.engine.impl.bpmn.parser.FieldDeclaration)5 ArrayList (java.util.ArrayList)2 FieldExtension (org.activiti.bpmn.model.FieldExtension)2 ActivitiException (org.activiti.engine.ActivitiException)2 AbstractBpmnActivityBehavior (org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior)2 BoundaryEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.BoundaryEventActivityBehavior)2 BusinessRuleTaskActivityBehavior (org.activiti.engine.impl.bpmn.behavior.BusinessRuleTaskActivityBehavior)2 CallActivityBehavior (org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior)2 CancelBoundaryEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.CancelBoundaryEventActivityBehavior)2 CancelEndEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.CancelEndEventActivityBehavior)2 ErrorEndEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.ErrorEndEventActivityBehavior)2 EventBasedGatewayActivityBehavior (org.activiti.engine.impl.bpmn.behavior.EventBasedGatewayActivityBehavior)2 EventSubProcessStartEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.EventSubProcessStartEventActivityBehavior)2 ExclusiveGatewayActivityBehavior (org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior)2 InclusiveGatewayActivityBehavior (org.activiti.engine.impl.bpmn.behavior.InclusiveGatewayActivityBehavior)2 IntermediateCatchEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.IntermediateCatchEventActivityBehavior)2 IntermediateThrowCompensationEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.IntermediateThrowCompensationEventActivityBehavior)2 IntermediateThrowNoneEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.IntermediateThrowNoneEventActivityBehavior)2 IntermediateThrowSignalEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.IntermediateThrowSignalEventActivityBehavior)2 MailActivityBehavior (org.activiti.engine.impl.bpmn.behavior.MailActivityBehavior)2