use of org.activiti.engine.delegate.Expression in project Activiti by Activiti.
the class TimerEntity method restoreExtraData.
protected void restoreExtraData(CommandContext commandContext, String jobHandlerConfiguration) {
String embededActivityId = jobHandlerConfiguration;
if (jobHandlerType.equalsIgnoreCase(TimerExecuteNestedActivityJobHandler.TYPE) || jobHandlerType.equalsIgnoreCase(TimerCatchIntermediateEventJobHandler.TYPE) || jobHandlerType.equalsIgnoreCase(TimerStartEventJobHandler.TYPE)) {
embededActivityId = TimerEventHandler.getActivityIdFromConfiguration(jobHandlerConfiguration);
String endDateExpressionString = TimerEventHandler.getEndDateFromConfiguration(jobHandlerConfiguration);
if (endDateExpressionString != null) {
Expression endDateExpression = Context.getProcessEngineConfiguration().getExpressionManager().createExpression(endDateExpressionString);
String endDateString = null;
BusinessCalendar businessCalendar = Context.getProcessEngineConfiguration().getBusinessCalendarManager().getBusinessCalendar(getBusinessCalendarName(TimerEventHandler.geCalendarNameFromConfiguration(jobHandlerConfiguration)));
VariableScope executionEntity = null;
if (executionId != null) {
executionEntity = commandContext.getExecutionEntityManager().findExecutionById(executionId);
}
if (executionEntity == null) {
executionEntity = NoExecutionVariableScope.getSharedInstance();
}
if (endDateExpression != null) {
Object endDateValue = endDateExpression.getValue(executionEntity);
if (endDateValue instanceof String) {
endDateString = (String) endDateValue;
} else if (endDateValue instanceof Date) {
endDate = (Date) endDateValue;
} else {
throw new ActivitiException("Timer '" + ((ExecutionEntity) executionEntity).getActivityId() + "' was not configured with a valid duration/time, either hand in a java.util.Date or a String in format 'yyyy-MM-dd'T'hh:mm:ss'");
}
if (endDate == null) {
endDate = businessCalendar.resolveEndDate(endDateString);
}
}
}
}
if (processDefinitionId != null) {
ProcessDefinition definition = commandContext.getProcessEngineConfiguration().getDeploymentManager().findDeployedProcessDefinitionById(processDefinitionId);
maxIterations = checkStartEventDefinitions(definition, embededActivityId);
if (maxIterations <= 1) {
maxIterations = checkBoundaryEventsDefinitions(definition, embededActivityId);
}
} else {
maxIterations = 1;
}
}
use of org.activiti.engine.delegate.Expression in project Activiti by Activiti.
the class DefaultActivityBehaviorFactory method createServiceTaskExpressionActivityBehavior.
public ServiceTaskExpressionActivityBehavior createServiceTaskExpressionActivityBehavior(ServiceTask serviceTask) {
Expression expression = expressionManager.createExpression(serviceTask.getImplementation());
Expression skipExpression;
if (StringUtils.isNotEmpty(serviceTask.getSkipExpression())) {
skipExpression = expressionManager.createExpression(serviceTask.getSkipExpression());
} else {
skipExpression = null;
}
return new ServiceTaskExpressionActivityBehavior(serviceTask.getId(), expression, skipExpression, serviceTask.getResultVariableName());
}
use of org.activiti.engine.delegate.Expression in project Activiti by Activiti.
the class DefaultActivityBehaviorFactory method createServiceTaskDelegateExpressionActivityBehavior.
public ServiceTaskDelegateExpressionActivityBehavior createServiceTaskDelegateExpressionActivityBehavior(ServiceTask serviceTask) {
Expression delegateExpression = expressionManager.createExpression(serviceTask.getImplementation());
Expression skipExpression;
if (StringUtils.isNotEmpty(serviceTask.getSkipExpression())) {
skipExpression = expressionManager.createExpression(serviceTask.getSkipExpression());
} else {
skipExpression = null;
}
return new ServiceTaskDelegateExpressionActivityBehavior(serviceTask.getId(), delegateExpression, skipExpression, createFieldDeclarations(serviceTask.getFieldExtensions()));
}
use of org.activiti.engine.delegate.Expression in project Activiti by Activiti.
the class AbstractExternalInvocationBpmnParseHandler method createDataOutputAssociation.
public AbstractDataAssociation createDataOutputAssociation(BpmnParse bpmnParse, DataAssociation dataAssociationElement) {
if (StringUtils.isNotEmpty(dataAssociationElement.getSourceRef())) {
return new MessageImplicitDataOutputAssociation(dataAssociationElement.getTargetRef(), dataAssociationElement.getSourceRef());
} else {
Expression transformation = bpmnParse.getExpressionManager().createExpression(dataAssociationElement.getTransformation());
AbstractDataAssociation dataOutputAssociation = new TransformationDataOutputAssociation(null, dataAssociationElement.getTargetRef(), transformation);
return dataOutputAssociation;
}
}
use of org.activiti.engine.delegate.Expression in project Activiti by Activiti.
the class AbstractExternalInvocationBpmnParseHandler method createDataInputAssociation.
public AbstractDataAssociation createDataInputAssociation(BpmnParse bpmnParse, DataAssociation dataAssociationElement) {
if (dataAssociationElement.getAssignments().isEmpty()) {
return new MessageImplicitDataInputAssociation(dataAssociationElement.getSourceRef(), dataAssociationElement.getTargetRef());
} else {
SimpleDataInputAssociation dataAssociation = new SimpleDataInputAssociation(dataAssociationElement.getSourceRef(), dataAssociationElement.getTargetRef());
for (org.activiti.bpmn.model.Assignment assigmentElement : dataAssociationElement.getAssignments()) {
if (StringUtils.isNotEmpty(assigmentElement.getFrom()) && StringUtils.isNotEmpty(assigmentElement.getTo())) {
Expression from = bpmnParse.getExpressionManager().createExpression(assigmentElement.getFrom());
Expression to = bpmnParse.getExpressionManager().createExpression(assigmentElement.getTo());
Assignment assignment = new Assignment(from, to);
dataAssociation.addAssignment(assignment);
}
}
return dataAssociation;
}
}
Aggregations