本文整理汇总了Java中org.camunda.bpm.engine.impl.interceptor.CommandExecutor.execute方法的典型用法代码示例。如果您正苦于以下问题:Java CommandExecutor.execute方法的具体用法?Java CommandExecutor.execute怎么用?Java CommandExecutor.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.camunda.bpm.engine.impl.interceptor.CommandExecutor
的用法示例。
在下文中一共展示了CommandExecutor.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSetProcessDefinitionVersionPIIsSubExecution
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
@Deployment(resources = {TEST_PROCESS_WITH_PARALLEL_GATEWAY})
public void testSetProcessDefinitionVersionPIIsSubExecution() {
// start process instance
ProcessInstance pi = runtimeService.startProcessInstanceByKey("forkJoin");
Execution execution = runtimeService.createExecutionQuery()
.activityId("receivePayment")
.singleResult();
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
SetProcessDefinitionVersionCmd command = new SetProcessDefinitionVersionCmd(execution.getId(), 1);
try {
commandExecutor.execute(command);
fail("ProcessEngineException expected");
} catch (ProcessEngineException ae) {
assertTextPresent("A process instance id is required, but the provided id '"+execution.getId()+"' points to a child execution of process instance '"+pi.getId()+"'. Please invoke the "+command.getClass().getSimpleName()+" with a root execution id.", ae.getMessage());
}
}
示例2: testSetProcessDefinitionVersionAttachedTimer
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
@Deployment(resources = TEST_PROCESS_ATTACHED_TIMER)
public void testSetProcessDefinitionVersionAttachedTimer() {
// given a process instance
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("attachedTimer");
// and a second deployment of the process
org.camunda.bpm.engine.repository.Deployment deployment = repositoryService
.createDeployment()
.addClasspathResource(TEST_PROCESS_ATTACHED_TIMER)
.deploy();
ProcessDefinition newDefinition =
repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
assertNotNull(newDefinition);
// when the process instance is migrated
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new SetProcessDefinitionVersionCmd(instance.getId(), 2));
Job job = managementService.createJobQuery().singleResult();
assertNotNull(job);
assertEquals(newDefinition.getId(), job.getProcessDefinitionId());
repositoryService.deleteDeployment(deployment.getId(), true);
}
示例3: testDiagramCreationDisabled
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
public void testDiagramCreationDisabled() {
repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/bpmn/parse/BpmnParseTest.testParseDiagramInterchangeElements.bpmn20.xml").deploy();
// Graphical information is not yet exposed publicly, so we need to do some plumbing
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
ProcessDefinitionEntity processDefinitionEntity = commandExecutor.execute(new Command<ProcessDefinitionEntity>() {
@Override
public ProcessDefinitionEntity execute(CommandContext commandContext) {
return Context.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedLatestProcessDefinitionByKey("myProcess");
}
});
assertNotNull(processDefinitionEntity);
assertEquals(7, processDefinitionEntity.getActivities().size());
// Check that no diagram has been created
List<String> resourceNames = repositoryService.getDeploymentResourceNames(processDefinitionEntity.getDeploymentId());
assertEquals(1, resourceNames.size());
repositoryService.deleteDeployment(repositoryService.createDeploymentQuery().singleResult().getId(), true);
}
示例4: createJobWithoutExceptionMsg
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
private void createJobWithoutExceptionMsg() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
JobManager jobManager = commandContext.getJobManager();
timerEntity = new TimerEntity();
timerEntity.setLockOwner(UUID.randomUUID().toString());
timerEntity.setDuedate(new Date());
timerEntity.setRetries(0);
StringWriter stringWriter = new StringWriter();
NullPointerException exception = new NullPointerException();
exception.printStackTrace(new PrintWriter(stringWriter));
timerEntity.setExceptionStacktrace(stringWriter.toString());
jobManager.insert(timerEntity);
assertNotNull(timerEntity.getId());
return null;
}
});
}
示例5: createJobWithoutExceptionStacktrace
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
private void createJobWithoutExceptionStacktrace() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
JobManager jobManager = commandContext.getJobManager();
timerEntity = new TimerEntity();
timerEntity.setLockOwner(UUID.randomUUID().toString());
timerEntity.setDuedate(new Date());
timerEntity.setRetries(0);
timerEntity.setExceptionMessage("I'm supposed to fail");
jobManager.insert(timerEntity);
assertNotNull(timerEntity.getId());
return null;
}
});
}
示例6: deleteJobInDatabase
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
private void deleteJobInDatabase() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Void>() {
public Void execute(CommandContext commandContext) {
timerEntity.delete();
commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(timerEntity.getId());
List<HistoricIncident> historicIncidents = Context
.getProcessEngineConfiguration()
.getHistoryService()
.createHistoricIncidentQuery()
.list();
for (HistoricIncident historicIncident : historicIncidents) {
commandContext
.getDbEntityManager()
.delete((DbEntity) historicIncident);
}
return null;
}
});
}
示例7: deleteJobAndIncidents
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
protected void deleteJobAndIncidents(final Job job) {
final List<HistoricIncident> incidents =
historyService.createHistoricIncidentQuery()
.incidentType(Incident.FAILED_JOB_HANDLER_TYPE).list();
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Void>() {
@Override
public Void execute(CommandContext commandContext) {
((JobEntity) job).delete();
HistoricIncidentManager historicIncidentManager = commandContext.getHistoricIncidentManager();
for (HistoricIncident incident : incidents) {
HistoricIncidentEntity incidentEntity = (HistoricIncidentEntity) incident;
historicIncidentManager.delete(incidentEntity);
}
commandContext.getHistoricJobLogManager().deleteHistoricJobLogByJobId(job.getId());
return null;
}
});
}
示例8: clearDatabase
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
protected void clearDatabase() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE);
List<HistoricIncident> incidents = Context.getProcessEngineConfiguration().getHistoryService().createHistoricIncidentQuery().list();
for (HistoricIncident incident : incidents) {
commandContext.getHistoricIncidentManager().delete((HistoricIncidentEntity) incident);
}
return null;
}
});
}
示例9: acquireJobs
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
protected AcquiredJobs acquireJobs(
JobAcquisitionContext context,
JobAcquisitionStrategy acquisitionStrategy,
ProcessEngineImpl currentProcessEngine) {
CommandExecutor commandExecutor = currentProcessEngine.getProcessEngineConfiguration()
.getCommandExecutorTxRequired();
int numJobsToAcquire = acquisitionStrategy.getNumJobsToAcquire(currentProcessEngine.getName());
AcquiredJobs acquiredJobs = null;
if (numJobsToAcquire > 0) {
jobExecutor.logAcquisitionAttempt(currentProcessEngine);
acquiredJobs = commandExecutor.execute(jobExecutor.getAcquireJobsCmd(numJobsToAcquire));
}
else {
acquiredJobs = new AcquiredJobs(numJobsToAcquire);
}
context.submitAcquiredJobs(currentProcessEngine.getName(), acquiredJobs);
jobExecutor.logAcquiredJobs(currentProcessEngine, acquiredJobs.size());
jobExecutor.logAcquisitionFailureJobs(currentProcessEngine, acquiredJobs.getNumberOfJobsFailedToLock());
LOG.acquiredJobs(currentProcessEngine.getName(), acquiredJobs);
return acquiredJobs;
}
示例10: tearDown
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
@After
public void tearDown() throws Exception {
CommandExecutor commandExecutor = engineRule.getProcessEngineConfiguration().getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerActivateJobDefinitionHandler.TYPE);
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendJobDefinitionHandler.TYPE);
return null;
}
});
}
开发者ID:camunda,项目名称:camunda-bpm-platform,代码行数:12,代码来源:MultiTenancyJobDefinitionSuspensionStateTest.java
示例11: testSetProcessDefinitionVersionNonExistingPD
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
@Deployment(resources = {TEST_PROCESS})
public void testSetProcessDefinitionVersionNonExistingPD() {
// start process instance
ProcessInstance pi = runtimeService.startProcessInstanceByKey("receiveTask");
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
try {
commandExecutor.execute(new SetProcessDefinitionVersionCmd(pi.getId(), 23));
fail("ProcessEngineException expected");
} catch (ProcessEngineException ae) {
assertTextPresent("no processes deployed with key = 'receiveTask', version = '23'", ae.getMessage());
}
}
示例12: testSetProcessDefinitionVersionNonExistingPI
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
public void testSetProcessDefinitionVersionNonExistingPI() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
try {
commandExecutor.execute(new SetProcessDefinitionVersionCmd("42", 23));
fail("ProcessEngineException expected");
} catch (ProcessEngineException ae) {
assertTextPresent("No process instance found for id = '42'.", ae.getMessage());
}
}
示例13: execute
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
public Void execute(CommandContext commandContext) {
assertEquals(this, Context.getCommandInvocationContext().getCommand());
if (innerCommand != null) {
CommandExecutor commandExecutor = Context.getProcessEngineConfiguration().getCommandExecutorTxRequired();
commandExecutor.execute(innerCommand);
// should still be correct after command invocation
assertEquals(this, Context.getCommandInvocationContext().getCommand());
}
return null;
}
示例14: testSetProcessDefinitionVersionMigrateIncident
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
@Deployment(resources = TEST_PROCESS_ONE_JOB)
public void testSetProcessDefinitionVersionMigrateIncident() {
// given a process instance
ProcessInstance instance =
runtimeService.startProcessInstanceByKey("oneJobProcess", Variables.createVariables().putValue("shouldFail", true));
// with a failed job
executeAvailableJobs();
// and an incident
Incident incident = runtimeService.createIncidentQuery().singleResult();
assertNotNull(incident);
// and a second deployment of the process
org.camunda.bpm.engine.repository.Deployment deployment = repositoryService
.createDeployment()
.addClasspathResource(TEST_PROCESS_ONE_JOB)
.deploy();
ProcessDefinition newDefinition =
repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).singleResult();
assertNotNull(newDefinition);
// when the process instance is migrated
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new SetProcessDefinitionVersionCmd(instance.getId(), 2));
// then the the incident should also be migrated
Incident migratedIncident = runtimeService.createIncidentQuery().singleResult();
assertNotNull(migratedIncident);
assertEquals(newDefinition.getId(), migratedIncident.getProcessDefinitionId());
assertEquals(instance.getId(), migratedIncident.getProcessInstanceId());
assertEquals(instance.getId(), migratedIncident.getExecutionId());
repositoryService.deleteDeployment(deployment.getId(), true);
}
示例15: tearDown
import org.camunda.bpm.engine.impl.interceptor.CommandExecutor; //导入方法依赖的package包/类
@Override
public void tearDown() throws Exception {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
commandExecutor.execute(new Command<Object>() {
public Object execute(CommandContext commandContext) {
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerActivateProcessDefinitionHandler.TYPE);
commandContext.getHistoricJobLogManager().deleteHistoricJobLogsByHandlerType(TimerSuspendProcessDefinitionHandler.TYPE);
return null;
}
});
}