本文整理汇总了Java中org.activiti.engine.history.HistoricVariableInstance类的典型用法代码示例。如果您正苦于以下问题:Java HistoricVariableInstance类的具体用法?Java HistoricVariableInstance怎么用?Java HistoricVariableInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
HistoricVariableInstance类属于org.activiti.engine.history包,在下文中一共展示了HistoricVariableInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deleteAllocatedRoutes
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
protected void deleteAllocatedRoutes(HistoryService historyService, String processInstanceId) throws SLException {
HistoricVariableInstance allocatedPortsInstance = getHistoricVarInstanceValue(historyService, processInstanceId,
Constants.VAR_ALLOCATED_PORTS);
if (allocatedPortsInstance == null) {
return;
}
CloudFoundryOperations client = getCloudFoundryClient(historyService, processInstanceId);
String defaultDomain = client.getDefaultDomain() != null ? client.getDefaultDomain().getName() : null;
if (defaultDomain == null) {
LOGGER.warn(Messages.COULD_NOT_COMPUTE_DEFAULT_DOMAIN);
return;
}
Integer[] allocatedPorts = JsonUtil.getFromBinaryJson((byte[]) allocatedPortsInstance.getValue(), Integer[].class);
for (Integer port : allocatedPorts) {
try {
client.deleteRoute(port.toString(), defaultDomain);
} catch (CloudFoundryException e) {
LOGGER.warn(format(Messages.COULD_NOT_DELETE_ROUTE_FOR_PORT, port));
}
}
}
示例2: deleteDeploymentFiles
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
protected void deleteDeploymentFiles(HistoryService historyService, String processInstanceId) throws FileStorageException {
HistoricVariableInstance keepFiles = getHistoricVarInstanceValue(historyService, processInstanceId, Constants.PARAM_KEEP_FILES);
if (shouldKeepFiles(keepFiles)) {
return;
}
HistoricVariableInstance extensionDescriptorFileIds = getHistoricVarInstanceValue(historyService, processInstanceId,
Constants.PARAM_EXT_DESCRIPTOR_FILE_ID);
HistoricVariableInstance appArchiveFileIds = getHistoricVarInstanceValue(historyService, processInstanceId,
Constants.PARAM_APP_ARCHIVE_ID);
String spaceId = (String) getHistoricVarInstanceValue(historyService, processInstanceId,
com.sap.cloud.lm.sl.persistence.message.Constants.VARIABLE_NAME_SPACE_ID).getValue();
FileSweeper fileSweeper = new FileSweeper(spaceId, getBeanProvider().getFileService());
fileSweeper.sweep(extensionDescriptorFileIds);
fileSweeper.sweep(appArchiveFileIds);
}
示例3: prepareContext
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
private void prepareContext() {
context.setVariable(Constants.VAR_SPACE, input.currentSpace.getName());
context.setVariable(Constants.VAR_ORG, input.currentSpace.getOrganization().getName());
context.setVariable(Constants.VAR_MTA_MAJOR_SCHEMA_VERSION, majorSchemaVersion);
context.setVariable(Constants.PARAM_ALLOW_INVALID_ENV_NAMES, false);
context.setVariable(Constants.PARAM_USE_NAMESPACES, false);
context.setVariable(Constants.PARAM_USE_NAMESPACES_FOR_SERVICES, false);
context.setVariable(Constants.VAR_PORT_BASED_ROUTING, false);
StepsUtil.setPublishedEntries(context, getPublishedEntries());
StepsUtil.setDeletedEntries(context, getDeletedEntries());
context.setVariable(Constants.VAR_USER, USER);
step.orgAndSpaceCalculator = (client, spaceId) -> new Pair<>(spaceId, spaceId);
Mockito.when(activitiFacade.getHistoricSubProcessIds(Mockito.any())).thenReturn(Arrays.asList("test-subprocess-id"));
HistoricVariableInstance varInstanceMock = Mockito.mock(HistoricVariableInstance.class);
Mockito.when(activitiFacade.getHistoricVariableInstance("test-subprocess-id", Constants.VAR_PUBLISHED_ENTRIES))
.thenReturn(varInstanceMock);
Mockito.when(varInstanceMock.getValue()).thenReturn(getBytes(getPublishedEntries()));
}
示例4: prepareContext
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
private void prepareContext() {
context.setVariable(Constants.VAR_SPACE, stepInput.space);
context.setVariable(com.sap.cloud.lm.sl.persistence.message.Constants.VARIABLE_NAME_SPACE_ID, stepInput.spaceId);
context.setVariable(Constants.VAR_ORG, stepInput.org);
context.setVariable(Constants.PARAM_MTA_ID, stepInput.mtaId);
Mockito.when(context.getProcessInstanceId()).thenReturn("process-instance-id");
Mockito.when(activitiFacade.getHistoricSubProcessIds(Mockito.any())).thenReturn(Arrays.asList("test-subprocess-id"));
HistoricVariableInstance varInstanceMock = Mockito.mock(HistoricVariableInstance.class);
Mockito.when(activitiFacade.getHistoricVariableInstance("test-subprocess-id", Constants.VAR_PUBLISHED_ENTRIES))
.thenReturn(varInstanceMock);
Mockito.when(varInstanceMock.getValue()).thenReturn(getBytes(stepInput.publishedEntries));
HistoricVariableInstance varInstanceMockDeletedEntries = Mockito.mock(HistoricVariableInstance.class);
Mockito.when(activitiFacade.getHistoricVariableInstance("process-instance-id", Constants.VAR_DELETED_ENTRIES))
.thenReturn(varInstanceMockDeletedEntries);
Mockito.when(varInstanceMockDeletedEntries.getValue()).thenReturn(getBytes(getEntriesToDelete()));
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:17,代码来源:DeleteDiscontinuedConfigurationEntriesStepTest.java
示例5: getHistoricVarInstanceValue
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
@Override
protected HistoricVariableInstance getHistoricVarInstanceValue(HistoryService historyService, String processInstanceId,
String parameter) {
switch (parameter) {
case com.sap.cloud.lm.sl.persistence.message.Constants.VARIABLE_NAME_SPACE_ID:
return createInstanceMock(SPACE_ID);
case Constants.PARAM_EXT_DESCRIPTOR_FILE_ID:
return createInstanceMock(extensionDescriptorIds);
case Constants.PARAM_APP_ARCHIVE_ID:
return createInstanceMock(archiveIds);
case Constants.PARAM_KEEP_FILES:
return createInstanceMock(shouldKeepFiles);
default:
return null;
}
}
示例6: getStatus
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
public String getStatus(){
HistoryService historyService = processEngine.getHistoryService();
//Get all variables of process generated during execution (data objects and inputs/outputs)
List<HistoricVariableInstance> outVariables = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).list();
//For each variable of process
for (HistoricVariableInstance historicVariableInstance : outVariables)
if(historicVariableInstance.getVariableName().equals("status")){
if(historicVariableInstance.getValue() != null)
return (String) historicVariableInstance.getValue();
}
return "failure";
}
示例7: executeList
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
@Override
public List<HistoricVariableInstance> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
ensureVariablesInitialized();
List<HistoricVariableInstance> historicVariableInstances = commandContext
.getHistoricVariableInstanceEntityManager()
.findHistoricVariableInstancesByQueryCriteria(this, page);
if (!excludeVariableInitialization) {
for (HistoricVariableInstance historicVariableInstance : historicVariableInstances) {
if (historicVariableInstance instanceof HistoricVariableInstanceEntity) {
HistoricVariableInstanceEntity variableEntity = (HistoricVariableInstanceEntity) historicVariableInstance;
if (variableEntity.getVariableType() != null) {
variableEntity.getValue();
// make sure JPA entities are cached for later retrieval
if (JPAEntityVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName()) || JPAEntityListVariableType.TYPE_NAME.equals(variableEntity.getVariableType().getTypeName())) {
((CacheableVariable) variableEntity.getVariableType()).setForceCacheable(true);
}
}
}
}
}
return historicVariableInstances;
}
示例8: getApproveMap
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
/**
* 获取历史审批结果和审批意见
*
* @param activityInstance 历史任务节点
* @return
*/
public Map<String, String> getApproveMap(HistoricActivityInstance activityInstance) {
//审批结果和审批意见为Local变量
Map<String, String> map = new HashMap<>();
if (StrUtil.isEmpty(activityInstance.getTaskId()))
return map;
List<HistoricVariableInstance> variableInstances = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(activityInstance.getProcessInstanceId()).taskId(activityInstance.getTaskId()).list();
for (HistoricVariableInstance variableInstance : variableInstances) {
if (variableInstance.getVariableName().equals(Constants.APPROVE_RESULT)) {
map.put(Constants.APPROVE_RESULT, variableInstance.getValue().toString());
} else {
map.put(Constants.APPROVE_SUGGESTION, variableInstance.getValue().toString());
}
}
return map;
}
示例9: checkFinished
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
private void checkFinished(ProcessInstance processInstance) {
// 验证流程已结束
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
.processInstanceId(processInstance.getProcessInstanceId()).singleResult();
assertNotNull(historicProcessInstance.getEndTime());
// 查询历史任务
List<HistoricTaskInstance> list = historyService.createHistoricTaskInstanceQuery().list();
for (HistoricTaskInstance hti : list) {
System.out.println(hti.getName() + " " + hti.getDeleteReason());
}
// 流程结束后校验监听器设置的变量
HistoricVariableInstance variableInstance = historyService.createHistoricVariableInstanceQuery().variableName("settedOnEnd").singleResult();
assertEquals(true, variableInstance.getValue());
}
示例10: getBpDataExByBizKey
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
@Override
public BaseBpDataEx getBpDataExByBizKey(String bizKey) {
HistoricProcessInstance hpi = historyService.createHistoricProcessInstanceQuery()
.processInstanceBusinessKey(bizKey).singleResult();
if(hpi == null){
return null;
}
HistoricVariableInstance obj = historyService.createHistoricVariableInstanceQuery()
.processInstanceId(hpi.getId()).variableName(BpmConstant.BPM_BP_DATA_EX_KEY).singleResult();
if(obj != null){
BaseBpDataEx bpDataEx = (BaseBpDataEx)obj.getValue();
bpDataEx.setPiId(hpi.getId());
return bpDataEx;
}
return null;
}
示例11: executeList
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
public List<HistoricVariableInstance> executeList(CommandContext commandContext, Page page) {
checkQueryOk();
ensureVariablesInitialized();
List<HistoricVariableInstance> historicVariableInstances = commandContext
.getHistoricVariableInstanceEntityManager()
.findHistoricVariableInstancesByQueryCriteria(this, page);
for (HistoricVariableInstance historicVariableInstance: historicVariableInstances) {
// TODO what about JPAEntityVariableType? see HistoricDetailQueryImpl.executeList
if (historicVariableInstance instanceof HistoricVariableInstanceEntity) {
((HistoricVariableInstanceEntity)historicVariableInstance).getBytes();
}
}
return historicVariableInstances;
}
示例12: testScriptExecutionListener
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
@Deployment(resources = { "org/activiti/examples/bpmn/executionlistener/ScriptExecutionListenerTest.bpmn20.xml" })
public void testScriptExecutionListener() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("scriptExecutionListenerProcess");
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
List<HistoricVariableInstance> historicVariables = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).list();
Map<String, Object> varMap = new HashMap<String, Object>();
for (HistoricVariableInstance historicVariableInstance : historicVariables) {
varMap.put(historicVariableInstance.getVariableName(), historicVariableInstance.getValue());
}
assertTrue(varMap.containsKey("foo"));
assertEquals("FOO", varMap.get("foo"));
assertTrue(varMap.containsKey("var1"));
assertEquals("test", varMap.get("var1"));
assertFalse(varMap.containsKey("bar"));
assertTrue(varMap.containsKey("myVar"));
assertEquals("BAR", varMap.get("myVar"));
}
}
示例13: testSimple
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
@Deployment
public void testSimple() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
TaskQuery taskQuery = taskService.createTaskQuery();
Task userTask = taskQuery.singleResult();
assertEquals("userTask1", userTask.getName());
taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789"));
assertProcessEnded(processInstance.getId());
List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().list();
assertEquals(1, variables.size());
HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
assertEquals("test456", historicVariable.getTextValue());
assertEquals(5, historyService.createHistoricActivityInstanceQuery().count());
assertEquals(3, historyService.createHistoricDetailQuery().count());
}
示例14: testParallel
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
@Deployment
public void testParallel() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("myProc");
TaskQuery taskQuery = taskService.createTaskQuery();
Task userTask = taskQuery.singleResult();
assertEquals("userTask1", userTask.getName());
taskService.complete(userTask.getId(), CollectionUtil.singletonMap("myVar", "test789"));
assertProcessEnded(processInstance.getId());
List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list();
assertEquals(2, variables.size());
HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
assertEquals("myVar", historicVariable.getName());
assertEquals("test789", historicVariable.getTextValue());
HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1);
assertEquals("myVar1", historicVariable1.getName());
assertEquals("test456", historicVariable1.getTextValue());
assertEquals(8, historyService.createHistoricActivityInstanceQuery().count());
assertEquals(5, historyService.createHistoricDetailQuery().count());
}
示例15: testTwoSubProcessInParallelWithinSubProcess
import org.activiti.engine.history.HistoricVariableInstance; //导入依赖的package包/类
@Deployment
public void testTwoSubProcessInParallelWithinSubProcess() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("twoSubProcessInParallelWithinSubProcess");
assertProcessEnded(processInstance.getId());
List<HistoricVariableInstance> variables = historyService.createHistoricVariableInstanceQuery().orderByVariableName().asc().list();
assertEquals(2, variables.size());
HistoricVariableInstanceEntity historicVariable = (HistoricVariableInstanceEntity) variables.get(0);
assertEquals("myVar", historicVariable.getName());
assertEquals("test101112", historicVariable.getTextValue());
HistoricVariableInstanceEntity historicVariable1 = (HistoricVariableInstanceEntity) variables.get(1);
assertEquals("myVar1", historicVariable1.getName());
assertEquals("test789", historicVariable1.getTextValue());
assertEquals(15, historyService.createHistoricActivityInstanceQuery().count());
assertEquals(7, historyService.createHistoricDetailQuery().count());
}