I want to update the value of bytes_ in act_ge_bytearray table. Please suggest as I am stuck and it is very urgent for me.

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

I want to update the value of bytes_ in act_ge_bytearray table. Please suggest as I am stuck and it is very urgent for me.

Jump to solution

The task is completed and I have to update the value of bytearray in act_ge_bytearray table. Please suggest me

1 Solution

Accepted Solutions
Highlighted
Senior Member

Re: I want to update the value of bytes_ in act_ge_bytearray table. Please suggest as I am stuck and it is very urgent for me.

Jump to solution

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;
  }
});

View solution in original post

1 Reply
Highlighted
Senior Member

Re: I want to update the value of bytes_ in act_ge_bytearray table. Please suggest as I am stuck and it is very urgent for me.

Jump to solution

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;
  }
});

View solution in original post