Package org.camunda.bpm.engine.test.db

Source Code of org.camunda.bpm.engine.test.db.MigrateProcessInstanceDelegate

package org.camunda.bpm.engine.test.db;

import org.camunda.bpm.engine.RepositoryService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.impl.cmd.SetProcessDefinitionVersionCmd;
import org.camunda.bpm.engine.impl.context.Context;
import org.camunda.bpm.engine.repository.ProcessDefinition;

public class MigrateProcessInstanceDelegate implements JavaDelegate {

  public void execute(DelegateExecution execution) throws Exception {
    RepositoryService repoService = execution.getProcessEngineServices().getRepositoryService();
    ProcessDefinition targetDefinition = repoService.createProcessDefinitionQuery().latestVersion().singleResult();
   
    SetProcessDefinitionVersionCmd migrationCommand =
        new SetProcessDefinitionVersionCmd(execution.getProcessInstanceId(), targetDefinition.getVersion());
   
    Context.getProcessEngineConfiguration().getCommandExecutorTxRequired().execute(migrationCommand);

  }

}
TOP

Related Classes of org.camunda.bpm.engine.test.db.MigrateProcessInstanceDelegate

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.