Java Code Examples for org.camunda.bpm.engine.variable.VariableMap#put()

The following examples show how to use org.camunda.bpm.engine.variable.VariableMap#put() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultDmnDecisionContext.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected void addResultToVariableContext(DmnDecisionResult evaluatedResult, VariableMap variableMap, DmnDecision evaluatedDecision) {
  List<Map<String, Object>> resultList = evaluatedResult.getResultList();

  if (resultList.isEmpty()) {
    return;
  } else if (resultList.size() == 1 && !isDecisionTableWithCollectOrRuleOrderHitPolicy(evaluatedDecision)) {
    variableMap.putAll(evaluatedResult.getSingleResult());
  } else {
    Set<String> outputs = new HashSet<String>();

    for (Map<String, Object> resultMap : resultList) {
      outputs.addAll(resultMap.keySet());
    }

    for (String output : outputs) {
      List<Object> values = evaluatedResult.collectEntries(output);
      variableMap.put(output, values);
    }
  }
}
 
Example 2
Source File: FileValueProcessSerializationTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testSerializeFileVariable() {
  BpmnModelInstance modelInstance = Bpmn.createExecutableProcess("process").startEvent().userTask().endEvent().done();
  org.camunda.bpm.engine.repository.Deployment deployment = repositoryService.createDeployment().addModelInstance("process.bpmn", modelInstance).deploy();
  VariableMap variables = Variables.createVariables();
  String filename = "test.txt";
  String type = "text/plain";
  FileValue fileValue = Variables.fileValue(filename).file("ABC".getBytes()).encoding("UTF-8").mimeType(type).create();
  variables.put("file", fileValue);
  runtimeService.startProcessInstanceByKey("process", variables);
  Task task = taskService.createTaskQuery().singleResult();
  VariableInstance result = runtimeService.createVariableInstanceQuery().processInstanceIdIn(task.getProcessInstanceId()).singleResult();
  FileValue value = (FileValue) result.getTypedValue();

  assertThat(value.getFilename(), is(filename));
  assertThat(value.getMimeType(), is(type));
  assertThat(value.getEncoding(), is("UTF-8"));
  assertThat(value.getEncodingAsCharset(), is(Charset.forName("UTF-8")));
  try (Scanner scanner = new Scanner(value.getValue())) {
    assertThat(scanner.nextLine(), is("ABC"));
  }

  // clean up
  repositoryService.deleteDeployment(deployment.getId(), true);
}
 
Example 3
Source File: GetHistoricDecisionInstancesForOptimizeTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN})
public void fishedAtParameterWorks() {
  // given start process and evaluate decision
  VariableMap variables = Variables.createVariables();
  variables.put("input1", null);
  Date now = new Date();
  ClockUtil.setCurrentTime(now);
  ProcessInstance firstProcessInstance =
    runtimeService.startProcessInstanceByKey("testProcess", variables);
  Date nowPlus2Seconds = new Date(now.getTime() + 2000L);
  ClockUtil.setCurrentTime(nowPlus2Seconds);
  runtimeService.startProcessInstanceByKey("testProcess", variables);

  // when
  List<HistoricDecisionInstance> decisionInstances =
    optimizeService.getHistoricDecisionInstances(null, now, 10);

  // then
  assertThat(decisionInstances.size(), is(1));
  HistoricDecisionInstance decisionInstance = decisionInstances.get(0);
  assertThat(decisionInstance.getProcessInstanceId(), is(firstProcessInstance.getId()));
}
 
Example 4
Source File: EventSubProcessStartConditionalEventTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testNonInterruptingSetMultipleVariables() {
  BpmnModelInstance modelInstance = Bpmn.createExecutableProcess(CONDITIONAL_EVENT_PROCESS_KEY)
    .startEvent()
    .userTask(TASK_WITH_CONDITION_ID).name(TASK_WITH_CONDITION)
    .endEvent().done();
   deployConditionalEventSubProcess(modelInstance, CONDITIONAL_EVENT_PROCESS_KEY, false);

  //given
  ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CONDITIONAL_EVENT_PROCESS_KEY);
  TaskQuery taskQuery = taskService.createTaskQuery().processInstanceId(processInstance.getId());
  Task task = taskQuery.singleResult();

  //when multiple variable are set on task execution
  VariableMap variables = Variables.createVariables();
  variables.put("variable", 1);
  variables.put("variable1", 1);
  runtimeService.setVariables(task.getExecutionId(), variables);

  //then event sub process should be triggered more than once
  tasksAfterVariableIsSet = taskQuery.list();
  assertEquals(3, tasksAfterVariableIsSet.size());
}
 
Example 5
Source File: GetHistoricDecisionInstancesForOptimizeTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@Deployment(resources = {DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN})
public void maxResultsParameterWorks() {
  // given start process and evaluate decision
  VariableMap variables = Variables.createVariables();
  variables.put("input1", null);
  runtimeService.startProcessInstanceByKey("testProcess", variables);
  runtimeService.startProcessInstanceByKey("testProcess", variables);
  runtimeService.startProcessInstanceByKey("testProcess", variables);

  // when
  List<HistoricDecisionInstance> decisionInstances =
    optimizeService.getHistoricDecisionInstances(null, null, 2);

  // then
  assertThat(decisionInstances.size(), is(2));
}
 
Example 6
Source File: DefaultDmnDecisionContext.java    From camunda-engine-dmn with Apache License 2.0 6 votes vote down vote up
protected void addResultToVariableContext(DmnDecisionResult evaluatedResult, VariableMap variableMap, DmnDecision evaluatedDecision) {
  List<Map<String, Object>> resultList = evaluatedResult.getResultList();

  if (resultList.isEmpty()) {
    return;
  } else if (resultList.size() == 1 && !isDecisionTableWithCollectOrRuleOrderHitPolicy(evaluatedDecision)) {
    variableMap.putAll(evaluatedResult.getSingleResult());
  } else {
    Set<String> outputs = new HashSet<String>();

    for (Map<String, Object> resultMap : resultList) {
      outputs.addAll(resultMap.keySet());
    }

    for (String output : outputs) {
      List<Object> values = evaluatedResult.collectEntries(output);
      variableMap.put(output, values);
    }
  }
}
 
Example 7
Source File: DefaultDmnDecisionContext.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
protected VariableMap buildVariableMapFromVariableContext(VariableContext variableContext) {

    VariableMap variableMap = Variables.createVariables();

    Set<String> variables = variableContext.keySet();
    for(String variable: variables) {
      variableMap.put(variable, variableContext.resolve(variable));
    }

    return variableMap;
  }
 
Example 8
Source File: DefaultDmnDecisionContext.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected VariableMap buildVariableMapFromVariableContext(VariableContext variableContext) {

    VariableMap variableMap = Variables.createVariables();

    Set<String> variables = variableContext.keySet();
    for(String variable: variables) {
      variableMap.put(variable, variableContext.resolve(variable));
    }

    return variableMap;
  }
 
Example 9
Source File: DmnExampleVerifier.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public static void assertExample(DmnEngine engine, DmnDecision decision) {
  VariableMap variables = Variables.createVariables();
  variables.put("status", "bronze");
  variables.put("sum", 200);

  DmnDecisionTableResult results = engine.evaluateDecisionTable(decision, variables);
  assertThat(results)
    .hasSingleResult()
    .containsKeys("result", "reason")
    .containsEntry("result", "notok")
    .containsEntry("reason", "work on your status first, as bronze you're not going to get anything");

  variables.put("status", "silver");

  results = engine.evaluateDecisionTable(decision, variables);
  assertThat(results)
    .hasSingleResult()
    .containsKeys("result", "reason")
    .containsEntry("result", "ok")
    .containsEntry("reason", "you little fish will get what you want");

  variables.put("sum", 1200);

  results = engine.evaluateDecisionTable(decision, variables);
  assertThat(results)
    .hasSingleResult()
    .containsKeys("result", "reason")
    .containsEntry("result", "notok")
    .containsEntry("reason", "you took too much man, you took too much!");

  variables.put("status", "gold");
  variables.put("sum", 200);

  results = engine.evaluateDecisionTable(decision, variables);
  assertThat(results)
    .hasSingleResult()
    .containsKeys("result", "reason")
    .containsEntry("result", "ok")
    .containsEntry("reason", "you get anything you want");
}
 
Example 10
Source File: PurgeDatabaseTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
public void testPurgeWithAsyncProcessInstance() {
  // given process with variable and async process instance
  BpmnModelInstance test = Bpmn.createExecutableProcess(PROCESS_DEF_KEY)
    .startEvent()
    .camundaAsyncBefore()
    .userTask()
    .userTask()
    .endEvent()
    .done();
  engineRule.getRepositoryService().createDeployment().addModelInstance(PROCESS_MODEL_NAME, test).deploy();

  VariableMap variables = Variables.createVariables();
  variables.put("key", "value");
  engineRule.getRuntimeService().startProcessInstanceByKey(PROCESS_DEF_KEY, variables);
  Job job = engineRule.getManagementService().createJobQuery().singleResult();
  engineRule.getManagementService().executeJob(job.getId());
  Task task = engineRule.getTaskService().createTaskQuery().singleResult();
  engineRule.getTaskService().complete(task.getId());

  // when purge is executed
  ManagementServiceImpl managementService = (ManagementServiceImpl) engineRule.getManagementService();
  managementService.purge();

  // then no more data exist
  assertAndEnsureCleanDbAndCache(engineRule.getProcessEngine(), true);
}
 
Example 11
Source File: CamundaModelApiOrderEventHandler.java    From flowing-retail-old with Apache License 2.0 5 votes vote down vote up
private VariableMap getCorrelationKeys(JsonObject event) {
  VariableMap correlationKeys = Variables.createVariables();
  if (event.get("orderId") != null) {
    correlationKeys.put("orderId", event.getString("orderId"));
  } else if (event.get("refId") != null) {
    correlationKeys.put("orderId", event.getString("refId"));
  } else if (event.get("pickId") != null) {
    correlationKeys.put("pickId", event.getString("pickId"));
  } else if (event.get("shipmentId") != null) {
    correlationKeys.put("shipmentId", event.getString("shipmentId"));
  }
  return correlationKeys;
}
 
Example 12
Source File: GetHistoricDecisionInstancesForOptimizeTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@Deployment(resources = {DECISION_PROCESS, DECISION_SINGLE_OUTPUT_DMN})
public void decisionOutputInstanceProperties() {
  // given start process and evaluate decision
  VariableMap variables = Variables.createVariables();
  variables.put("input1", null);
  runtimeService.startProcessInstanceByKey("testProcess", variables);

  // when
  List<HistoricDecisionInstance> decisionInstances =
    optimizeService.getHistoricDecisionInstances(pastDate(), null, 10);

  // then
  assertThat(decisionInstances.size(), is(1));
  HistoricDecisionInstance decisionInstance = decisionInstances.get(0);
  List<HistoricDecisionOutputInstance> outputs = decisionInstance.getOutputs();
  assertThat(outputs, is(notNullValue()));
  assertThat(outputs.size(), is(1));

  HistoricDecisionOutputInstance output = outputs.get(0);
  assertThat(output.getDecisionInstanceId(), is(decisionInstance.getId()));
  assertThat(output.getClauseId(), is("out"));
  assertThat(output.getClauseName(), is("output"));

  assertThat(output.getRuleId(), is("rule"));
  assertThat(output.getRuleOrder(), is(1));

  assertThat(output.getVariableName(), is("result"));
}
 
Example 13
Source File: CamundaBpmnOrderEventHandler.java    From flowing-retail-old with Apache License 2.0 5 votes vote down vote up
private VariableMap getCorrelationKeys(JsonObject event) {
  VariableMap correlationKeys = Variables.createVariables();
  if (event.get("orderId") != null) {
    correlationKeys.put("orderId", event.getString("orderId"));
  } else if (event.get("refId") != null) {
    correlationKeys.put("orderId", event.getString("refId"));
  } else if (event.get("pickId") != null) {
    correlationKeys.put("pickId", event.getString("pickId"));
  } else if (event.get("shipmentId") != null) {
    correlationKeys.put("shipmentId", event.getString("shipmentId"));
  }
  return correlationKeys;
}
 
Example 14
Source File: ProcessVariableMapTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Test
public void testProcessVariableMap() {
  BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);

  VariableMap variables = (VariableMap) getBeanInstance("processVariableMap");
  assertNotNull(variables);

  ///////////////////////////////////////////////////////////////////
  // Put a variable via BusinessProcess and get it via VariableMap //
  ///////////////////////////////////////////////////////////////////
  String aValue = "aValue";
  businessProcess.setVariable(VARNAME_1, Variables.stringValue(aValue));

  // Legacy API
  assertEquals(aValue, variables.get(VARNAME_1));

  // Typed variable API
  TypedValue aTypedValue = variables.getValueTyped(VARNAME_1);
  assertEquals(ValueType.STRING, aTypedValue.getType());
  assertEquals(aValue, aTypedValue.getValue());
  assertEquals(aValue, variables.getValue(VARNAME_1, String.class));

  // Type API with wrong type
  try {
    variables.getValue(VARNAME_1, Integer.class);
    fail("ClassCastException expected!");
  } catch(ClassCastException ex) {
    assertEquals("Cannot cast variable named 'aVariable' with value 'aValue' to type 'class java.lang.Integer'.", ex.getMessage());
  }

  ///////////////////////////////////////////////////////////////////
  // Put a variable via VariableMap and get it via BusinessProcess //
  ///////////////////////////////////////////////////////////////////
  String anotherValue = "anotherValue";
  variables.put(VARNAME_2, Variables.stringValue(anotherValue));

  // Legacy API
  assertEquals(anotherValue, businessProcess.getVariable(VARNAME_2));

  // Typed variable API
  TypedValue anotherTypedValue = businessProcess.getVariableTyped(VARNAME_2);
  assertEquals(ValueType.STRING, anotherTypedValue.getType());
  assertEquals(anotherValue, anotherTypedValue.getValue());
}
 
Example 15
Source File: ProcessVariableMapTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Test
@Deployment(resources = "org/camunda/bpm/engine/cdi/test/api/BusinessProcessBeanTest.test.bpmn20.xml")
public void testProcessVariableMapLocal() {
  BusinessProcess businessProcess = getBeanInstance(BusinessProcess.class);
  businessProcess.startProcessByKey("businessProcessBeanTest");

  VariableMap variables = (VariableMap) getBeanInstance("processVariableMapLocal");
  assertNotNull(variables);

  ///////////////////////////////////////////////////////////////////
  // Put a variable via BusinessProcess and get it via VariableMap //
  ///////////////////////////////////////////////////////////////////
  String aValue = "aValue";
  businessProcess.setVariableLocal(VARNAME_1, Variables.stringValue(aValue));

  // Legacy API
  assertEquals(aValue, variables.get(VARNAME_1));

  // Typed variable API
  TypedValue aTypedValue = variables.getValueTyped(VARNAME_1);
  assertEquals(ValueType.STRING, aTypedValue.getType());
  assertEquals(aValue, aTypedValue.getValue());
  assertEquals(aValue, variables.getValue(VARNAME_1, String.class));

  // Type API with wrong type
  try {
    variables.getValue(VARNAME_1, Integer.class);
    fail("ClassCastException expected!");
  } catch(ClassCastException ex) {
    assertEquals("Cannot cast variable named 'aVariable' with value 'aValue' to type 'class java.lang.Integer'.", ex.getMessage());
  }

  ///////////////////////////////////////////////////////////////////
  // Put a variable via VariableMap and get it via BusinessProcess //
  ///////////////////////////////////////////////////////////////////
  String anotherValue = "anotherValue";
  variables.put(VARNAME_2, Variables.stringValue(anotherValue));

  // Legacy API
  assertEquals(anotherValue, businessProcess.getVariableLocal(VARNAME_2));

  // Typed variable API
  TypedValue anotherTypedValue = businessProcess.getVariableLocalTyped(VARNAME_2);
  assertEquals(ValueType.STRING, anotherTypedValue.getType());
  assertEquals(anotherValue, anotherTypedValue.getValue());
}
 
Example 16
Source File: CamundaBpmnOrderEventHandler.java    From flowing-retail-old with Apache License 2.0 4 votes vote down vote up
@Override
public boolean handleEvent(String type, String eventName, String transactionId, JsonObject event) {
  if ("Event".equals(type) && "OrderPlaced".equals(eventName)) {
    // Currently special handling to also persist the order

    Order order = parseOrder(event.getJsonObject("order"));
    // "Persist" order
    orderRepository.persistOrder(order);

    VariableMap variables = Variables.createVariables();
    variables.put("orderId", order.getId());
    variables.put("transactionId", transactionId);      
    engine.getRuntimeService().startProcessInstanceByKey("order", transactionId, variables);
    
    return true;
  } else {

    // Currently the transaction is NOT used for correlation, as we can assume
    // to hit some legacy system some time which is not able to handle it
    // That's why we only use it for tracking / monitoring purposes

    // Correlate by possible ids in this priority
    VariableMap correlationKeys = getCorrelationKeys(event);
  
    MessageCorrelationBuilder correlation = engine.getRuntimeService().createMessageCorrelation(eventName);
    ExecutionQuery query = engine.getRuntimeService().createExecutionQuery().messageEventSubscriptionName(eventName);
    
    for (String key : correlationKeys.keySet()) {
      correlation.processInstanceVariableEquals(key, correlationKeys.get(key));
      query.processVariableValueEquals(key, correlationKeys.get(key));
    }
    
    // if nobody waits for this event we consider it not to be for us
    if (query.count()==0) {
      return false;
    }

    // otherwise correlate it

    // add all possible additional correlation keys as variables to the flow
    VariableMap newVariables = getNewVariables(event);
    correlation.setVariables(newVariables);
    
    correlation.correlateWithResult();
    return true;      
  }
}
 
Example 17
Source File: InvoiceTestCase.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Deployment(resources= {"invoice.v1.bpmn", "invoiceBusinessDecisions.dmn"})
public void testHappyPathV1() {
  InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf");
  VariableMap variables = Variables.createVariables()
    .putValue("creditor", "Great Pizza for Everyone Inc.")
    .putValue("amount", 300.0d)
    .putValue("invoiceCategory", "Travel Expenses")
    .putValue("invoiceNumber", "GPFE-23232323")
    .putValue("invoiceDocument", fileValue("invoice.pdf")
      .file(invoiceInputStream)
      .mimeType("application/pdf")
      .create());

  ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables);

  Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
  assertEquals("approveInvoice", task.getTaskDefinitionKey());

  List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId());
  Set<String> approverGroups = new HashSet<String>();
  for (IdentityLink link : links) {
    approverGroups.add(link.getGroupId());
  }
  assertEquals(2, approverGroups.size());
  assertTrue(approverGroups.contains("accounting"));
  assertTrue(approverGroups.contains("sales"));

  variables.clear();
  variables.put("approved", Boolean.TRUE);
  taskService.complete(task.getId(), variables);

  task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();

  assertEquals("prepareBankTransfer", task.getTaskDefinitionKey());
  taskService.complete(task.getId());

  Job archiveInvoiceJob = managementService.createJobQuery().singleResult();
  assertNotNull(archiveInvoiceJob);
  managementService.executeJob(archiveInvoiceJob.getId());

  assertProcessEnded(pi.getId());
}
 
Example 18
Source File: HistoricDecisionInstanceQueryTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected VariableMap getVariables() {
  VariableMap variables = Variables.createVariables();
  variables.put("input1", "test");
  return variables;
}
 
Example 19
Source File: InvoiceTestCase.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Deployment(resources= {"invoice.v2.bpmn", "reviewInvoice.bpmn", "invoiceBusinessDecisions.dmn"})
public void testNonSuccessfulPath() {
  InputStream invoiceInputStream = InvoiceProcessApplication.class.getClassLoader().getResourceAsStream("invoice.pdf");
  VariableMap variables = Variables.createVariables()
    .putValue("creditor", "Great Pizza for Everyone Inc.")
    .putValue("amount", 300.0d)
    .putValue("invoiceCategory", "Travel Expenses")
    .putValue("invoiceNumber", "GPFE-23232323")
    .putValue("invoiceDocument", fileValue("invoice.pdf")
      .file(invoiceInputStream)
      .mimeType("application/pdf")
      .create());

  ProcessInstance pi = runtimeService.startProcessInstanceByKey("invoice", variables);

  Task task = taskService.createTaskQuery().processInstanceId(pi.getId()).singleResult();
  assertEquals("approveInvoice", task.getTaskDefinitionKey());

  List<IdentityLink> links = taskService.getIdentityLinksForTask(task.getId());
  Set<String> approverGroups = new HashSet<String>();
  for (IdentityLink link : links) {
    approverGroups.add(link.getGroupId());
  }
  assertEquals(2, approverGroups.size());
  assertTrue(approverGroups.contains("accounting"));
  assertTrue(approverGroups.contains("sales"));

  variables.clear();
  variables.put("approved", Boolean.FALSE);
  taskService.complete(task.getId(), variables);

  task = taskService.createTaskQuery().singleResult();

  assertEquals("assignReviewer", task.getTaskDefinitionKey());
  variables.clear();
  variables.put("reviewer", "peter");
  taskService.complete(task.getId(), variables);

  task = taskService.createTaskQuery().singleResult();

  assertEquals("reviewInvoice", task.getTaskDefinitionKey());
  variables.clear();
  variables.put("clarified", Boolean.FALSE);
  taskService.complete(task.getId(), variables);

  assertProcessEnded(task.getProcessInstanceId());
  assertProcessEnded(pi.getId());
}
 
Example 20
Source File: CamundaModelApiOrderEventHandler.java    From flowing-retail-old with Apache License 2.0 4 votes vote down vote up
@Override
public boolean handleEvent(String type, String eventName, String transactionId, JsonObject event) {
  if ("Event".equals(type) && "OrderPlaced".equals(eventName)) {
    // Currently special handling to also persist the order

    Order order = parseOrder(event.getJsonObject("order"));
    // "Persist" order
    orderRepository.persistOrder(order);

    VariableMap variables = Variables.createVariables();
    variables.put("orderId", order.getId());
    variables.put("transactionId", transactionId);      
    engine.getRuntimeService().startProcessInstanceByKey("order", transactionId, variables);
    
    return true;
  } else {

    // Currently the transaction is NOT used for correlation, as we can assume
    // to hit some legacy system some time which is not able to handle it
    // That's why we only use it for tracking / monitoring purposes

    // Correlate by possible ids in this priority
    VariableMap correlationKeys = getCorrelationKeys(event);
  
    MessageCorrelationBuilder correlation = engine.getRuntimeService().createMessageCorrelation(eventName);
    ExecutionQuery query = engine.getRuntimeService().createExecutionQuery().messageEventSubscriptionName(eventName);
    
    for (String key : correlationKeys.keySet()) {
      correlation.processInstanceVariableEquals(key, correlationKeys.get(key));
      query.processVariableValueEquals(key, correlationKeys.get(key));
    }
    
    // if nobody waits for this event we consider it not to be for us
    if (query.count()==0) {
      return false;
    }

    // otherwise correlate it

    // add all possible additional correlation keys as variables to the flow
    VariableMap newVariables = getNewVariables(event);
    correlation.setVariables(newVariables);
    
    correlation.correlateWithResult();
    return true;      
  }
}