本文整理汇总了Java中org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity类的典型用法代码示例。如果您正苦于以下问题:Java HistoricProcessInstanceEntity类的具体用法?Java HistoricProcessInstanceEntity怎么用?Java HistoricProcessInstanceEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HistoricProcessInstanceEntity类属于org.activiti.engine.impl.persistence.entity包,在下文中一共展示了HistoricProcessInstanceEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: recordProcessInstanceEnd
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Override
public void recordProcessInstanceEnd(String processInstanceId, String deleteReason, String activityId) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager()
.findHistoricProcessInstance(processInstanceId);
if (historicProcessInstance != null) {
historicProcessInstance.markEnded(deleteReason);
historicProcessInstance.setEndActivityId(activityId);
// Fire event
ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
if (config != null && config.getEventDispatcher().isEnabled()) {
config.getEventDispatcher().dispatchEvent(
ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.HISTORIC_PROCESS_INSTANCE_ENDED, historicProcessInstance));
}
}
}
}
示例3: getVariableFromRequest
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public RestVariable getVariableFromRequest(boolean includeBinary, String processInstanceId, String variableName) {
HistoryService historyService = BPMNOSGIService.getHistoryService();
HistoricProcessInstance processObject = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(processInstanceId).includeProcessVariables().singleResult();
if (processObject == null) {
throw new ActivitiObjectNotFoundException("Historic process instance '" + processInstanceId + "' couldn't be found.", HistoricProcessInstanceEntity.class);
}
Object value = processObject.getProcessVariables().get(variableName);
if (value == null) {
throw new ActivitiObjectNotFoundException("Historic process instance '" + processInstanceId + "' variable value for " + variableName + " couldn't be found.", VariableInstanceEntity.class);
} else {
return new RestResponseFactory().createRestVariable(variableName, value, null, processInstanceId,
RestResponseFactory.VARIABLE_HISTORY_PROCESS, includeBinary, uriInfo.getBaseUri().toString());
}
}
示例4: onCreate
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Override
public void onCreate(DelegateTask delegateTask) throws Exception {
String taskDefinitionKey = delegateTask.getTaskDefinitionKey();
String processDefinitionId = delegateTask.getProcessDefinitionId();
String processInstanceId = delegateTask.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext().getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
List<BpmConfRule> bpmConfRules = ApplicationContextHelper
.getBean(BpmConfRuleManager.class)
.find("from BpmConfRule where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
processDefinitionId, taskDefinitionKey);
logger.debug("delegateTask.getId : {}", delegateTask.getId());
logger.debug("taskDefinitionKey : {}", taskDefinitionKey);
logger.debug("processDefinitionId : {}", processDefinitionId);
logger.debug("processInstanceId : {}", processInstanceId);
logger.debug("bpmConfRules : {}", bpmConfRules);
for (BpmConfRule bpmConfRule : bpmConfRules) {
String value = bpmConfRule.getValue();
if ("职位".equals(value) || "高级职位自动跳过".equals(value)) {
this.processPosition(delegateTask, value);
} else if ("相邻相同人员自动跳过".equals(value)) {
this.processNeighbor(delegateTask, value);
} else {
this.processExpression(delegateTask, value);
}
}
}
示例5: 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());
}
}
示例6: onCreate
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public void onCreate(DelegateTask delegateTask) throws Exception {
String taskDefinitionKey = delegateTask.getTaskDefinitionKey();
String processDefinitionId = delegateTask.getProcessDefinitionId();
String processInstanceId = delegateTask.getProcessInstanceId();
HistoricProcessInstanceEntity historicProcessInstanceEntity = Context
.getCommandContext().getHistoricProcessInstanceEntityManager()
.findHistoricProcessInstance(processInstanceId);
List<BpmConfRule> bpmConfRules = ApplicationContextHelper
.getBean(BpmConfRuleManager.class)
.find("from BpmConfRule where bpmConfNode.bpmConfBase.processDefinitionId=? and bpmConfNode.code=?",
processDefinitionId, taskDefinitionKey);
logger.debug("delegateTask.getId : {}", delegateTask.getId());
logger.debug("taskDefinitionKey : {}", taskDefinitionKey);
logger.debug("processDefinitionId : {}", processDefinitionId);
logger.debug("processInstanceId : {}", processInstanceId);
logger.debug("bpmConfRules : {}", bpmConfRules);
for (BpmConfRule bpmConfRule : bpmConfRules) {
String value = bpmConfRule.getValue();
if ("职位".equals(value) || "高级职位自动跳过".equals(value)) {
this.processPosition(delegateTask, value);
} else if ("相邻相同人员自动跳过".equals(value)) {
this.processNeighbor(delegateTask, value);
} else {
this.processExpression(delegateTask, value);
}
}
}
示例7: 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);
}
}
示例8: 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);
}
}
示例9: 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;
}
示例10: recordProcessInstanceNameChange
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Override
public void recordProcessInstanceNameChange(String processInstanceId, String newName) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager()
.findHistoricProcessInstance(processInstanceId);
if (historicProcessInstance != null) {
historicProcessInstance.setName(newName);
}
}
}
示例11: recordProcessDefinitionChange
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Override
public void recordProcessDefinitionChange(String processInstanceId, String processDefinitionId) {
if (isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager().findHistoricProcessInstance(processInstanceId);
if (historicProcessInstance != null) {
historicProcessInstance.setProcessDefinitionId(processDefinitionId);
}
}
}
示例12: updateProcessBusinessKeyInHistory
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
@Override
public void updateProcessBusinessKeyInHistory(ExecutionEntity processInstance) {
if (isHistoryEnabled()) {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("updateProcessBusinessKeyInHistory : {}", processInstance.getId());
}
if (processInstance != null) {
HistoricProcessInstanceEntity historicProcessInstance = getDbSqlSession().selectById(HistoricProcessInstanceEntity.class, processInstance.getId());
if (historicProcessInstance != null) {
historicProcessInstance.setBusinessKey(processInstance.getProcessBusinessKey());
getDbSqlSession().update(historicProcessInstance);
}
}
}
}
示例13: notify
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
public void notify(DelegateExecution execution) {
HistoricProcessInstanceEntity historicProcessInstance = Context
.getCommandContext()
.getHistoricProcessInstanceManager()
.findHistoricProcessInstance(execution.getProcessInstanceId());
if (historicProcessInstance!=null) {
String deleteReason = ((ExecutionEntity) execution).getDeleteReason();
historicProcessInstance.markEnded(deleteReason);
historicProcessInstance.setEndActivityId(((ExecutionEntity) execution).getActivityId());
}
}
示例14: recordProcessInstanceEnd
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
/**
* Record a process-instance ended. Updates the historic process instance if activity history is enabled.
*/
public void recordProcessInstanceEnd(String processInstanceId, String deleteReason, String activityId) {
if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceManager()
.findHistoricProcessInstance(processInstanceId);
if (historicProcessInstance!=null) {
historicProcessInstance.markEnded(deleteReason);
historicProcessInstance.setEndActivityId(activityId);
}
}
}
示例15: recordProcessInstanceStart
import org.activiti.engine.impl.persistence.entity.HistoricProcessInstanceEntity; //导入依赖的package包/类
/**
* Record a process-instance started and record start-event if activity history is enabled.
*/
public void recordProcessInstanceStart(ExecutionEntity processInstance) {
if(isHistoryLevelAtLeast(HistoryLevel.ACTIVITY)) {
HistoricProcessInstanceEntity historicProcessInstance = new HistoricProcessInstanceEntity(processInstance);
// Insert historic process-instance
getDbSqlSession().insert(historicProcessInstance);
// Also record the start-event manually, as there is no "start" activity history listener for this
IdGenerator idGenerator = Context.getProcessEngineConfiguration().getIdGenerator();
String processDefinitionId = processInstance.getProcessDefinitionId();
String processInstanceId = processInstance.getProcessInstanceId();
String executionId = processInstance.getId();
HistoricActivityInstanceEntity historicActivityInstance = new HistoricActivityInstanceEntity();
historicActivityInstance.setId(idGenerator.getNextId());
historicActivityInstance.setProcessDefinitionId(processDefinitionId);
historicActivityInstance.setProcessInstanceId(processInstanceId);
historicActivityInstance.setExecutionId(executionId);
historicActivityInstance.setActivityId(processInstance.getActivityId());
historicActivityInstance.setActivityName((String) processInstance.getActivity().getProperty("name"));
historicActivityInstance.setActivityType((String) processInstance.getActivity().getProperty("type"));
Date now = ClockUtil.getCurrentTime();
historicActivityInstance.setStartTime(now);
getDbSqlSession()
.insert(historicActivityInstance);
}
}