06-08-2017 02:38 PM
The task is completed and I have to update the value of bytearray in act_ge_bytearray table. Please suggest me
06-09-2017 09:37 PM
I'm sorry that the answer was delayed.
I made the sample code to modify binary variable after process completing.
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment().addInputStream("myProcess.bpmn20.xml", new FileInputStream(filename))
.deploy();// Process executed
Map<String, Object> var1 = new HashMap<String, Object>();
var1.put("aaa", "bbb");
Map<String, Object> var = new HashMap<String, Object>();
var.put("var1", var1);
ProcessInstance pi = processEngine.getRuntimeService().startProcessInstanceByKey("myProcess", var);
Task task = processEngine.getTaskService().createTaskQuery().processInstanceId(pi.getId()).singleResult();
processEngine.getTaskService().complete(task.getId());// Alteration of history
((ProcessEngineConfigurationImpl) processEngineConfiguration).getCommandExecutor().execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
HistoricVariableInstance historicVar = processEngine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(pi.getId()).singleResult();
HistoricVariableInstanceEntity entity = (HistoricVariableInstanceEntity) historicVar;
var1.put("ccc", "ddd");
final VariableTypes variableTypes = Context.getCommandContext().getProcessEngineConfiguration().getVariableTypes();
final VariableType variableType = variableTypes.findVariableType(entity.getValue());
entity.setVariableType(variableType);
variableType.setValue(var1, entity);
return null;
}
});
06-09-2017 09:37 PM
I'm sorry that the answer was delayed.
I made the sample code to modify binary variable after process completing.
ProcessEngineConfiguration processEngineConfiguration = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
ProcessEngine processEngine = processEngineConfiguration.buildProcessEngine();RepositoryService repositoryService = processEngine.getRepositoryService();
repositoryService.createDeployment().addInputStream("myProcess.bpmn20.xml", new FileInputStream(filename))
.deploy();// Process executed
Map<String, Object> var1 = new HashMap<String, Object>();
var1.put("aaa", "bbb");
Map<String, Object> var = new HashMap<String, Object>();
var.put("var1", var1);
ProcessInstance pi = processEngine.getRuntimeService().startProcessInstanceByKey("myProcess", var);
Task task = processEngine.getTaskService().createTaskQuery().processInstanceId(pi.getId()).singleResult();
processEngine.getTaskService().complete(task.getId());// Alteration of history
((ProcessEngineConfigurationImpl) processEngineConfiguration).getCommandExecutor().execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
HistoricVariableInstance historicVar = processEngine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(pi.getId()).singleResult();
HistoricVariableInstanceEntity entity = (HistoricVariableInstanceEntity) historicVar;
var1.put("ccc", "ddd");
final VariableTypes variableTypes = Context.getCommandContext().getProcessEngineConfiguration().getVariableTypes();
final VariableType variableType = variableTypes.findVariableType(entity.getValue());
entity.setVariableType(variableType);
variableType.setValue(var1, entity);
return null;
}
});
Explore our Alfresco products with the links below. Use labels to filter content by product module.