org.activiti.engine.impl.el.FixedValue Java Examples

The following examples show how to use org.activiti.engine.impl.el.FixedValue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RuntimeActivityCreatorSupport.java    From openwebflow with BSD 2-Clause "Simplified" License 6 votes vote down vote up
protected ActivityImpl createActivity(ProcessEngine processEngine, ProcessDefinitionEntity processDefinition,
		ActivityImpl prototypeActivity, String cloneActivityId, String assignee)
{
	ActivityImpl clone = cloneActivity(processDefinition, prototypeActivity, cloneActivityId, "executionListeners",
		"properties");

	//设置assignee
	UserTaskActivityBehavior activityBehavior = (UserTaskActivityBehavior) (prototypeActivity.getActivityBehavior());

	TaskDefinition taskDefinition = cloneTaskDefinition(activityBehavior.getTaskDefinition());
	taskDefinition.setKey(cloneActivityId);
	if (assignee != null)
	{
		taskDefinition.setAssigneeExpression(new FixedValue(assignee));
	}

	UserTaskActivityBehavior cloneActivityBehavior = new UserTaskActivityBehavior(prototypeActivity.getId(), taskDefinition);
	clone.setActivityBehavior(cloneActivityBehavior);

	return clone;
}
 
Example #2
Source File: AbstractBehaviorFactory.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
public List<FieldDeclaration> createFieldDeclarations(List<FieldExtension> fieldList) {
    List<FieldDeclaration> fieldDeclarations = new ArrayList<>();

    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;
}
 
Example #3
Source File: ProcessDefinitionUtils.java    From openwebflow with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public static void grantPermission(ActivityImpl activity, String assigneeExpression,
		String candidateGroupIdExpressions, String candidateUserIdExpressions) throws Exception
{
	TaskDefinition taskDefinition = ((UserTaskActivityBehavior) activity.getActivityBehavior()).getTaskDefinition();
	taskDefinition.setAssigneeExpression(assigneeExpression == null ? null : new FixedValue(assigneeExpression));
	FieldUtils.writeField(taskDefinition, "candidateUserIdExpressions",
		ExpressionUtils.stringToExpressionSet(candidateUserIdExpressions), true);
	FieldUtils.writeField(taskDefinition, "candidateGroupIdExpressions",
		ExpressionUtils.stringToExpressionSet(candidateGroupIdExpressions), true);

	Logger.getLogger(ProcessDefinitionUtils.class).info(
		String.format("granting previledges for [%s, %s, %s] on [%s, %s]", assigneeExpression,
			candidateGroupIdExpressions, candidateUserIdExpressions, activity.getProcessDefinition().getKey(),
			activity.getProperty("name")));
}
 
Example #4
Source File: MultiInstanceActivityCreator.java    From openwebflow with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private ActivityImpl createMultiInstanceActivity(ProcessEngine processEngine,
		ProcessDefinitionEntity processDefinition, String processInstanceId, String prototypeActivityId,
		String cloneActivityId, boolean isSequential, List<String> assignees)
{
	ActivityImpl prototypeActivity = ProcessDefinitionUtils.getActivity(processEngine, processDefinition.getId(),
		prototypeActivityId);

	//拷贝listener,executionListeners会激活历史记录的保存
	ActivityImpl clone = cloneActivity(processDefinition, prototypeActivity, cloneActivityId, "executionListeners",
		"properties");
	//拷贝所有后向链接
	for (PvmTransition trans : prototypeActivity.getOutgoingTransitions())
	{
		clone.createOutgoingTransition(trans.getId()).setDestination((ActivityImpl) trans.getDestination());
	}

	MultiInstanceActivityBehavior multiInstanceBehavior = isSequential ? new SequentialMultiInstanceBehavior(clone,
			(TaskActivityBehavior) prototypeActivity.getActivityBehavior()) : new ParallelMultiInstanceBehavior(
			clone, (TaskActivityBehavior) prototypeActivity.getActivityBehavior());

	clone.setActivityBehavior(multiInstanceBehavior);

	clone.setScope(true);
	clone.setProperty("multiInstance", isSequential ? "sequential" : "parallel");

	//设置多实例节点属性
	multiInstanceBehavior.setLoopCardinalityExpression(new FixedValue(assignees.size()));
	multiInstanceBehavior.setCollectionExpression(new FixedValue(assignees));
	return clone;
}
 
Example #5
Source File: DelegateHelper.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
/**
 * Creates an {@link Expression} for the {@link FieldExtension}.
 */
public static Expression createExpressionForField(FieldExtension fieldExtension) {
  if (StringUtils.isNotEmpty(fieldExtension.getExpression())) {
    ExpressionManager expressionManager = Context.getProcessEngineConfiguration().getExpressionManager();
    return expressionManager.createExpression(fieldExtension.getExpression());
  } else {
    return new FixedValue(fieldExtension.getStringValue());
  }
}
 
Example #6
Source File: AbstractBehaviorFactory.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #7
Source File: MyTaskListenerBean.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
public FixedValue getSomeField() {
    return someField;
}
 
Example #8
Source File: ExpressionUtils.java    From openwebflow with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public static Expression stringToExpression(String expr)
{
	return new FixedValue(expr);
}
 
Example #9
Source File: DelegateExpressionBean.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
public void setSomeField(FixedValue someField) {
    this.someField = someField;
}
 
Example #10
Source File: DelegateExpressionBean.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
public FixedValue getSomeField() {
    return someField;
}
 
Example #11
Source File: MyExecutionListenerBean.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
public void setSomeField(FixedValue someField) {
    this.someField = someField;
}
 
Example #12
Source File: MyExecutionListenerBean.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
public FixedValue getSomeField() {
    return someField;
}
 
Example #13
Source File: MyTaskListenerBean.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
public void setSomeField(FixedValue someField) {
    this.someField = someField;
}
 
Example #14
Source File: MyTaskListenerBean.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public FixedValue getSomeField() {
  return someField;
}
 
Example #15
Source File: TestActivityBehaviorFactory.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example #16
Source File: TestActivityBehaviorFactory.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
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);
}
 
Example #17
Source File: DelegateExpressionBean.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void setSomeField(FixedValue someField) {
  this.someField = someField;
}
 
Example #18
Source File: DelegateExpressionBean.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public FixedValue getSomeField() {
  return someField;
}
 
Example #19
Source File: MyExecutionListenerBean.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void setSomeField(FixedValue someField) {
  this.someField = someField;
}
 
Example #20
Source File: MyExecutionListenerBean.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public FixedValue getSomeField() {
  return someField;
}
 
Example #21
Source File: MyTaskListenerBean.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
public void setSomeField(FixedValue someField) {
  this.someField = someField;
}