本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity.getStartUserId方法的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstanceEntity.getStartUserId方法的具体用法?Java HistoricProcessInstanceEntity.getStartUserId怎么用?Java HistoricProcessInstanceEntity.getStartUserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity
的用法示例。
在下文中一共展示了HistoricProcessInstanceEntity.getStartUserId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processPosition
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入方法依赖的package包/类
public void processPosition(DelegateTask delegateTask, String value) {
String processInstanceId = delegateTask.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext().getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
String initiator = historicProcessInstanceEntity.getStartUserId();
OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
.getBean(OrgConnector.class);
// 获得发起人的职位
int initiatorLevel = orgConnector.getJobLevelByUserId(initiator);
// 获得审批人的职位
int assigneeLevel = orgConnector.getJobLevelByUserId(delegateTask
.getAssignee());
// 比较
if (initiatorLevel >= assigneeLevel) {
logger.info("skip task : {}", delegateTask.getId());
logger.info("initiatorLevel : {}, assigneeLevel : {}",
initiatorLevel, assigneeLevel);
new CompleteTaskWithCommentCmd(delegateTask.getId(),
Collections.<String, Object> emptyMap(), "高级职位自动跳过")
.execute(Context.getCommandContext());
}
}
示例2: processExpression
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入方法依赖的package包/类
public void processExpression(DelegateTask delegateTask, String value) {
UserConnector userConnector = ApplicationContextHelper
.getBean(UserConnector.class);
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration().getExpressionManager();
String processInstanceId = delegateTask.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext().getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
String initiator = historicProcessInstanceEntity.getStartUserId();
MapVariableScope mapVariableScope = new MapVariableScope();
mapVariableScope.setVariable("initiator",
userConnector.findById(initiator));
Object objectResult = expressionManager.createExpression(value)
.getValue(mapVariableScope);
if ((objectResult == null) || (!(objectResult instanceof Boolean))) {
logger.error("{} is not Boolean, just return", objectResult);
return;
}
Boolean result = (Boolean) objectResult;
logger.info("value : {}, result : {}", value, result);
if (result) {
logger.info("skip task : {}", delegateTask.getId());
new CompleteTaskWithCommentCmd(delegateTask.getId(),
Collections.<String, Object> emptyMap(), "跳过")
.execute(Context.getCommandContext());
}
}
示例3: processPosition
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入方法依赖的package包/类
public void processPosition(DelegateTask delegateTask, String value) {
String processInstanceId = delegateTask.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext().getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
String initiator = historicProcessInstanceEntity.getStartUserId();
OrgConnector orgConnector = (OrgConnector) ApplicationContextHelper
.getBean(OrgConnector.class);
// 获得发起人的职位
int initiatorLevel = orgConnector.getJobLevelByUserId(initiator);
// 获得审批人的职位
int assigneeLevel = orgConnector.getJobLevelByUserId(delegateTask
.getAssignee());
// 比较
if (initiatorLevel >= assigneeLevel) {
logger.info("skip task : {}", delegateTask.getId());
logger.info("initiatorLevel : {}, assigneeLevel : {}",
initiatorLevel, assigneeLevel);
// new CompleteTaskWithCommentCmd(delegateTask.getId(),
// Collections.<String, Object> emptyMap(), "高级职位自动跳过")
// .execute(Context.getCommandContext());
this.doSkip(delegateTask);
}
}
示例4: processExpression
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入方法依赖的package包/类
public void processExpression(DelegateTask delegateTask, String value) {
UserConnector userConnector = ApplicationContextHelper
.getBean(UserConnector.class);
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration().getExpressionManager();
String processInstanceId = delegateTask.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext().getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
String initiator = historicProcessInstanceEntity.getStartUserId();
MapVariableScope mapVariableScope = new MapVariableScope();
mapVariableScope.setVariable("initiator",
userConnector.findById(initiator));
Object objectResult = expressionManager.createExpression(value)
.getValue(mapVariableScope);
if ((objectResult == null) || (!(objectResult instanceof Boolean))) {
logger.error("{} is not Boolean, just return", objectResult);
return;
}
Boolean result = (Boolean) objectResult;
logger.info("value : {}, result : {}", value, result);
if (result) {
logger.info("skip task : {}", delegateTask.getId());
// new CompleteTaskWithCommentCmd(delegateTask.getId(),
// Collections.<String, Object> emptyMap(), "跳过")
// .execute(Context.getCommandContext());
this.doSkip(delegateTask);
}
}
示例5: execute
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入方法依赖的package包/类
public Void execute(CommandContext commandContext) {
HistoricProcessInstanceEntity historicProcessInstanceEntity = commandContext
.getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(historicProcessInstanceId);
if (historicProcessInstanceEntity.getEndTime() == null) {
logger.info("historicProcessInstanceId is running");
return null;
}
historicProcessInstanceEntity.setEndActivityId(null);
historicProcessInstanceEntity.setEndTime(null);
String processDefinitionId = historicProcessInstanceEntity
.getProcessDefinitionId();
String initiator = historicProcessInstanceEntity.getStartUserId();
String businessKey = historicProcessInstanceEntity.getBusinessKey();
ProcessDefinitionEntity processDefinition = new GetDeploymentProcessDefinitionCmd(
processDefinitionId).execute(commandContext);
// ExecutionEntity processInstance = processDefinition
// .createProcessInstance(businessKey);
ExecutionEntity processInstance = this.createProcessInstance(
historicProcessInstanceEntity.getId(), businessKey, initiator,
processDefinition);
try {
Authentication.setAuthenticatedUserId(initiator);
// start
processInstance.start();
} finally {
Authentication.setAuthenticatedUserId(null);
}
return null;
}