Package org.camunda.bpm.engine.impl.persistence.entity

Examples of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity


  @Override
  public void execute(ActivityExecution execution) throws Exception {
    final String activityRef = compensateEventDefinition.getActivityRef();

    ExecutionEntity scopeExecution = (ExecutionEntity) (execution.isConcurrent() && !execution.isScope() ? execution.getParent() : execution);

    List<CompensateEventSubscriptionEntity> eventSubscriptions;

    if(activityRef != null) {
      ActivityImpl activityToCompensate = scopeExecution.getProcessDefinition().findActivity(activityRef);
      String compensationHandlerId  = (String) activityToCompensate.getProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID);
      if(compensationHandlerId != null) {
        eventSubscriptions = scopeExecution.getCompensateEventSubscriptions(compensationHandlerId);
      } else {
        eventSubscriptions = scopeExecution.getCompensateEventSubscriptions(activityRef);
      }
    } else {
      eventSubscriptions = scopeExecution.getCompensateEventSubscriptions();
    }

    if(eventSubscriptions.isEmpty()) {
      leave(execution);
    } else {
View Full Code Here


  public void execute(DelegateExecution execution) throws Exception {
    String existingId = execution.getId();

    // insert an execution referencing the current execution

    ExecutionEntity newExecution = new ExecutionEntity();
    newExecution.setId("someId");
    newExecution.setParentId(existingId);

    DbEntityOperation insertOperation = new DbEntityOperation();
    insertOperation.setOperationType(DbOperationType.INSERT);
    insertOperation.setEntity(newExecution);
View Full Code Here

  @Deployment(resources={"org/camunda/bpm/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
  public void testQueryByActivityInstanceId() throws Exception {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");

    assertTrue(processInstance instanceof ExecutionEntity);
    ExecutionEntity execution = (ExecutionEntity) processInstance;
    String activityInstanceId = execution.getActivityInstanceId();

    assertEquals(1, taskService.createTaskQuery().activityInstanceIdIn(activityInstanceId).list().size());
  }
View Full Code Here

  @Deployment(resources={"org/camunda/bpm/engine/test/api/task/TaskQueryTest.testProcessDefinition.bpmn20.xml"})
  public void testQueryByMultipleActivityInstanceIds() throws Exception {
    ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("oneTaskProcess");

    assertTrue(processInstance1 instanceof ExecutionEntity);
    ExecutionEntity execution1 = (ExecutionEntity) processInstance1;
    String activityInstanceId1 = execution1.getActivityInstanceId();

    ProcessInstance processInstance2 = runtimeService.startProcessInstanceByKey("oneTaskProcess");

    assertTrue(processInstance2 instanceof ExecutionEntity);
    ExecutionEntity execution2 = (ExecutionEntity) processInstance2;
    String activityInstanceId2 = execution2.getActivityInstanceId();

    List<Task> result1 = taskService.createTaskQuery().activityInstanceIdIn(activityInstanceId1).list();
    assertEquals(1, result1.size());
    assertEquals(processInstance1.getId(), result1.get(0).getProcessInstanceId());
View Full Code Here

    this.processEngine = processEngine;
  }

  public Object get(String name, ObjectFactory<?> objectFactory) {

    ExecutionEntity executionEntity = null;
    try {
      logger.fine("returning scoped object having beanName '" + name + "' for conversation ID '" + this.getConversationId() + "'. ");

      ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
      executionEntity = (ExecutionEntity) processInstance;

      Object scopedObject = executionEntity.getVariable(name);
      if (scopedObject == null) {
        scopedObject = objectFactory.getObject();
        if (scopedObject instanceof ScopedObject) {
          ScopedObject sc = (ScopedObject) scopedObject;
          scopedObject = sc.getTargetObject();
          logger.fine("de-referencing " + ScopedObject.class.getName() + "#targetObject before persisting variable");
        }
        persistVariable(name, scopedObject);
      }
      return createDirtyCheckingProxy(name, scopedObject);
    } catch (Throwable th) {
      logger.warning("couldn't return value from process scope! " + ExceptionUtils.getFullStackTrace(th));
    } finally {
      if (executionEntity != null) {
        logger.fine("set variable '" + name + "' on executionEntity# " + executionEntity.getId());
      }
    }
    return null;
  }
View Full Code Here

    return proxyFactoryBean.getProxy(this.classLoader);
  }

  private void persistVariable(String variableName, Object scopedObject) {
    ProcessInstance processInstance = Context.getExecutionContext().getProcessInstance();
    ExecutionEntity executionEntity = (ExecutionEntity) processInstance;
    Assert.isTrue(scopedObject instanceof Serializable, "the scopedObject is not " + Serializable.class.getName() + "!");
    executionEntity.setVariable(variableName, scopedObject);
  }
View Full Code Here

    assertNotNull(job);
    assertEquals(pi.getProcessInstanceId(), job.getProcessInstanceId());

    assertEquals(4, job.getRetries());

    ExecutionEntity execution = fetchExecutionEntity(pi.getProcessInstanceId());
    assertEquals("failingServiceTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(3);

    job = refreshJob(job.getId());
    assertEquals(3, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingServiceTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(2);

    job = refreshJob(job.getId());
    assertEquals(2, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingServiceTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(1);

    job = refreshJob(job.getId());
    assertEquals(1, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingServiceTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(0);

    job = refreshJob(job.getId());
    assertEquals(0, job.getRetries());
    assertEquals(1, managementService.createJobQuery().withException().count());
    assertEquals(0, managementService.createJobQuery().withRetriesLeft().count());
    assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingServiceTask", execution.getActivityId());

  }
View Full Code Here

    assertNotNull(job);
    assertEquals(pi.getProcessInstanceId(), job.getProcessInstanceId());

    assertEquals(4, job.getRetries());

    ExecutionEntity execution = fetchExecutionEntity(pi.getProcessInstanceId());
    assertEquals("failingUserTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(3);

    job = refreshJob(job.getId());
    assertEquals(3, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingUserTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(2);

    job = refreshJob(job.getId());
    assertEquals(2, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingUserTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(1);

    job = refreshJob(job.getId());
    assertEquals(1, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingUserTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(0);

    job = refreshJob(job.getId());
    assertEquals(0, job.getRetries());
    assertEquals(1, managementService.createJobQuery().withException().count());
    assertEquals(0, managementService.createJobQuery().withRetriesLeft().count());
    assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingUserTask", execution.getActivityId());

  }
View Full Code Here

    assertNotNull(pi);

    waitForExecutedJobWithRetriesLeft(4);
    stillOneJobWithExceptionAndRetriesLeft();

    ExecutionEntity execution = fetchExecutionEntity(pi.getProcessInstanceId());
    assertEquals("failingBusinessRuleTask", execution.getActivityId());

    Job job = fetchJob(pi.getProcessInstanceId());
    assertNotNull(job);
    assertEquals(pi.getProcessInstanceId(), job.getProcessInstanceId());

    assertEquals(4, job.getRetries());

    waitForExecutedJobWithRetriesLeft(3);

    job = refreshJob(job.getId());
    assertEquals(3, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingBusinessRuleTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(2);

    job = refreshJob(job.getId());
    assertEquals(2, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingBusinessRuleTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(1);

    job = refreshJob(job.getId());
    assertEquals(1, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingBusinessRuleTask", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(0);

    job = refreshJob(job.getId());
    assertEquals(0, job.getRetries());
    assertEquals(1, managementService.createJobQuery().withException().count());
    assertEquals(0, managementService.createJobQuery().withRetriesLeft().count());
    assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingBusinessRuleTask", execution.getActivityId());

  }
View Full Code Here

    assertNotNull(pi);

    waitForExecutedJobWithRetriesLeft(4);
    stillOneJobWithExceptionAndRetriesLeft();

    ExecutionEntity execution = fetchExecutionEntity(pi.getProcessInstanceId());
    assertEquals("failingCallActivity", execution.getActivityId());

    Job job = fetchJob(pi.getProcessInstanceId());
    assertNotNull(job);
    assertEquals(pi.getProcessInstanceId(), job.getProcessInstanceId());

    assertEquals(4, job.getRetries());

    waitForExecutedJobWithRetriesLeft(3);

    job = refreshJob(job.getId());
    assertEquals(3, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingCallActivity", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(2);

    job = refreshJob(job.getId());
    assertEquals(2, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingCallActivity", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(1);

    job = refreshJob(job.getId());
    assertEquals(1, job.getRetries());
    stillOneJobWithExceptionAndRetriesLeft();

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingCallActivity", execution.getActivityId());

    waitForExecutedJobWithRetriesLeft(0);

    job = refreshJob(job.getId());
    assertEquals(0, job.getRetries());
    assertEquals(1, managementService.createJobQuery().withException().count());
    assertEquals(0, managementService.createJobQuery().withRetriesLeft().count());
    assertEquals(1, managementService.createJobQuery().noRetriesLeft().count());

    execution = refreshExecutionEntity(execution.getId());
    assertEquals("failingCallActivity", execution.getActivityId());

  }
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity

Copyright © 2018 www.massapicom. 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.