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

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


    assertEquals(1, newEventSubscriptions.size());
    assertEquals(2, newProcessDefinitions.size());
    for (ProcessDefinition processDefinition : newProcessDefinitions) {
      if(processDefinition.getVersion() == 1) {
        for (EventSubscription subscription : newEventSubscriptions) {
          EventSubscriptionEntity subscriptionEntity = (EventSubscriptionEntity) subscription;
          assertFalse(subscriptionEntity.getConfiguration().equals(processDefinition.getId()));
        }
      } else {
        for (EventSubscription subscription : newEventSubscriptions) {
          EventSubscriptionEntity subscriptionEntity = (EventSubscriptionEntity) subscription;
          assertTrue(subscriptionEntity.getConfiguration().equals(processDefinition.getId()));
        }
      }
    }
    assertFalse(eventSubscriptions.equals(newEventSubscriptions));
View Full Code Here


    return TYPE;
  }

  public void execute(String configuration, ExecutionEntity execution, CommandContext commandContext) {
    // lookup subscription:   
    EventSubscriptionEntity eventSubscription = commandContext.getEventSubscriptionManager()
      .findEventSubscriptionbyId(configuration);
   
    // if event subscription is null, ignore
    if(eventSubscription != null) {     
      eventSubscription.eventReceived(null, false);     
    }
   
  }
View Full Code Here

    }
    ensureNumberOfElements("More than one matching message subscription found for execution " + executionId,
        "eventSubscriptions", eventSubscriptions, 1);

    // there can be only one:
    EventSubscriptionEntity eventSubscriptionEntity = eventSubscriptions.get(0);

    HashMap<String, Object> payload = null;
    if (processVariables != null) {
      payload = new HashMap<String, Object>(processVariables);
    }

    eventSubscriptionEntity.eventReceived(payload, false);

    return null;
  }
View Full Code Here

    // -> has left the transaction using the "normal" sequence flow
    List<String> activeActivityIds = runtimeService.getActiveActivityIds(processInstance.getId());
    assertTrue(activeActivityIds.contains("afterSuccess"));
   
    // there is a compensate event subscription for the transaction under the process instance
    EventSubscriptionEntity eventSubscriptionEntity = (EventSubscriptionEntity) runtimeService.createEventSubscriptionQuery()
        .eventType("compensate").activityId("tx").executionId(processInstance.getId()).singleResult();
   
    // there is an event-scope execution associated with the event-subscription:
    assertNotNull(eventSubscriptionEntity.getConfiguration());
    Execution eventScopeExecution = runtimeService.createExecutionQuery().executionId(eventSubscriptionEntity.getConfiguration()).singleResult();
    assertNotNull(eventScopeExecution);
   
    // we still have compensate event subscriptions for the compensation handlers, only now they are part of the event scope
    assertEquals(5, runtimeService.createEventSubscriptionQuery().eventType("compensate").activityId("undoBookHotel").executionId(eventScopeExecution.getId()).count());
    assertEquals(1, runtimeService.createEventSubscriptionQuery().eventType("compensate").activityId("undoBookFlight").executionId(eventScopeExecution.getId()).count());
View Full Code Here

   * Creates and inserts a subscription entity depending on the message type of this declaration.
   * @param execution
   * @return subscription entity
   */
  private EventSubscriptionEntity createEventSubscription(ExecutionEntity execution) {
    EventSubscriptionEntity eventSubscriptionEntity = null;
    if (eventType.equals(MessageEventHandler.EVENT_HANDLER_TYPE)) {
      eventSubscriptionEntity = new MessageEventSubscriptionEntity(execution);
    } else if (eventType.equals(SignalEventHandler.EVENT_HANDLER_TYPE)) {
      eventSubscriptionEntity = new SignalEventSubscriptionEntity(execution);
    } else {
      throw new ProcessEngineException("Found event definition of unknown type: " + eventType);
    }

    eventSubscriptionEntity.setEventName(eventName);
    if (activityId != null) {
      ActivityImpl activity = execution.getProcessDefinition().findActivity(activityId);
      eventSubscriptionEntity.setActivity(activity);
    }

    eventSubscriptionEntity.insert();
    return eventSubscriptionEntity;
  }
View Full Code Here

    if (eventSubscriptions.isEmpty()) {
      throw new ProcessEngineException("Execution with id '" + executionId + "' does not have a subscription to a message event with name '" + messageName + "'");
    }

    // there can be only one:
    EventSubscriptionEntity eventSubscriptionEntity = eventSubscriptions.get(0);

    HashMap<String, Object> payload = null;
    if (processVariables != null) {
      payload = new HashMap<String, Object>(processVariables);
    }

    eventSubscriptionEntity.eventReceived(payload, false);

    return null;
  }
View Full Code Here

TOP

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

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.