当前位置: 首页>>代码示例>>Java>>正文


Java DelegateTask.setVariableLocal方法代码示例

本文整理汇总了Java中org.activiti.engine.delegate.DelegateTask.setVariableLocal方法的典型用法代码示例。如果您正苦于以下问题:Java DelegateTask.setVariableLocal方法的具体用法?Java DelegateTask.setVariableLocal怎么用?Java DelegateTask.setVariableLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.delegate.DelegateTask的用法示例。


在下文中一共展示了DelegateTask.setVariableLocal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: notify

import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
@Override
public void notify(DelegateTask task)
{
    // Set all default properties, based on the type-definition
    propertyConverter.setDefaultTaskProperties(task);

    String taskFormKey = getFormKey(task);
    
    // Fetch definition and extract name again. Possible that the default is used if the provided is missing
    TypeDefinition typeDefinition = propertyConverter.getWorkflowObjectFactory().getTaskTypeDefinition(taskFormKey, false);
    taskFormKey = typeDefinition.getName().toPrefixString();
    
    // The taskDefinition key is set as a variable in order to be available
    // in the history
    task.setVariableLocal(ActivitiConstants.PROP_TASK_FORM_KEY, taskFormKey);
    
    // Add process initiator as involved person
    ActivitiScriptNode initiatorNode = (ActivitiScriptNode) task.getExecution().getVariable(WorkflowConstants.PROP_INITIATOR);
    if(initiatorNode != null) {
        task.addUserIdentityLink((String) initiatorNode.getProperties().get(ContentModel.PROP_USERNAME.toPrefixString()), IdentityLinkType.STARTER);
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:TaskCreateListener.java

示例2: notify

import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
@Override
	public void notify(DelegateTask delegateTask) {

		DelegateExecution execution = delegateTask.getExecution();
		PrismContext prismContext = getPrismContext();
		OperationResult opResult = new OperationResult(TaskCompleteListener.class.getName() + ".notify");
		Task wfTask = ActivitiUtil.getTask(execution, opResult);
		ApprovalStageDefinitionType stageDef = ActivitiUtil.getAndVerifyCurrentStage(execution, wfTask, true, prismContext);

		delegateTask.setVariableLocal(CommonProcessVariableNames.VARIABLE_WORK_ITEM_WAS_COMPLETED, Boolean.TRUE);

		//		System.out.println("%%% Task " + delegateTask + " has been completed.");
//		LOGGER.info("%%% Task {} has been completed", delegateTask);

		MidPointPrincipal user;
		try {
			user = SecurityUtil.getPrincipal();
		} catch (SecurityViolationException e) {
			throw new SystemException("Couldn't record a decision: " + e.getMessage(), e);
		}

		if (user != null && user.getOid() != null) {
			delegateTask.setVariableLocal(CommonProcessVariableNames.VARIABLE_WORK_ITEM_COMPLETED_BY, user.getOid());
		}

		LOGGER.trace("======================================== Recording individual decision of {}", user);

		@NotNull WorkItemResultType result1 = getItemApprovalProcessInterface().extractWorkItemResult(delegateTask.getVariables());
		boolean isApproved = ApprovalUtils.isApproved(result1);

        LevelEvaluationStrategyType levelEvaluationStrategyType = stageDef.getEvaluationStrategy();
        Boolean setLoopApprovesInStageStop = null;
        if (levelEvaluationStrategyType == LevelEvaluationStrategyType.FIRST_DECIDES) {
			LOGGER.trace("Setting " + LOOP_APPROVERS_IN_STAGE_STOP + " to true, because the stage evaluation strategy is 'firstDecides'.");
            setLoopApprovesInStageStop = true;
        } else if ((levelEvaluationStrategyType == null || levelEvaluationStrategyType == LevelEvaluationStrategyType.ALL_MUST_AGREE) && !isApproved) {
			LOGGER.trace("Setting " + LOOP_APPROVERS_IN_STAGE_STOP + " to true, because the stage eval strategy is 'allMustApprove' and the decision was 'reject'.");
            setLoopApprovesInStageStop = true;
        }

        if (setLoopApprovesInStageStop != null) {
			//noinspection ConstantConditions
			execution.setVariable(LOOP_APPROVERS_IN_STAGE_STOP, setLoopApprovesInStageStop);
        }

        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Approval process instance {} (id {}), stage {}: recording decision {}; stage stops now: {}",
					execution.getVariable(CommonProcessVariableNames.VARIABLE_PROCESS_INSTANCE_NAME),
                    execution.getProcessInstanceId(),
					WfContextUtil.getStageDiagName(stageDef), result1.getOutcome(), setLoopApprovesInStageStop);
        }

		getActivitiInterface().notifyMidpointAboutTaskEvent(delegateTask);
		getActivitiInterface().notifyMidpointAboutProcessEvent(execution);
    }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:56,代码来源:TaskCompleteListener.java

示例3: notify

import org.activiti.engine.delegate.DelegateTask; //导入方法依赖的package包/类
public void notify(DelegateTask delegateTask) {
  delegateTask.getExecution().setVariable("greeting", "Hello from " + greeter.getValue(delegateTask.getExecution()));
  delegateTask.getExecution().setVariable("shortName", shortName.getValue(delegateTask.getExecution()));
  
  delegateTask.setVariableLocal("myTaskVariable", "test");
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:7,代码来源:TaskCompleteListener.java


注:本文中的org.activiti.engine.delegate.DelegateTask.setVariableLocal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。