public void notify(DelegateCaseExecution caseExecution) throws Exception { String eventName = caseExecution.getEventName(); caseExecution.setVariable(eventName, true); }
public void notify(DelegateCaseExecution caseExecution) throws Exception { EVENT = caseExecution.getEventName(); COUNTER = COUNTER + 1; ON_CASE_EXECUTION_ID = caseExecution.getId(); }
public void notify(DelegateCaseExecution caseExecution) throws Exception { DecisionService decisionService = caseExecution.getProcessEngineServices().getDecisionService(); evaluateDecision(decisionService, caseExecution); }
@Override public void notify(DelegateCaseExecution caseExecution) throws Exception { caseExecution.setVariable("businessKey", caseExecution.getBusinessKey()); caseExecution.setVariable("caseBusinessKey", caseExecution.getCaseBusinessKey()); }
public void matches(DelegateCaseVariableInstance instance) { assertEquals(expectedEventName, instance.getEventName()); assertEquals(expectedVariableName, instance.getName()); assertEquals(expectedVariableValue, instance.getValue()); assertEquals(expectedProcessInstanceId, instance.getProcessInstanceId()); assertEquals(expectedExecutionId, instance.getExecutionId()); assertEquals(expectedCaseInstanceId, instance.getCaseInstanceId()); assertEquals(expectedCaseExecutionId, instance.getCaseExecutionId()); assertEquals(expectedTaskId, instance.getTaskId()); assertEquals(expectedActivityInstanceId, instance.getActivityInstanceId()); assertEquals(expectedSourceExecution.getId(), instance.getSourceExecution().getId()); assertEquals(expectedSourceExecution.getActivityId(), instance.getSourceExecution().getActivityId()); assertEquals(expectedSourceExecution.getActivityName(), instance.getSourceExecution().getActivityName()); assertEquals(expectedSourceExecution.getCaseDefinitionId(), instance.getSourceExecution().getCaseDefinitionId()); assertEquals(expectedSourceExecution.getCaseInstanceId(), instance.getSourceExecution().getCaseInstanceId()); assertEquals(expectedSourceExecution.getParentId(), instance.getSourceExecution().getParentId()); }
protected String getActivityIdExceptionMessage(VariableScope variableScope) { String activityId = null; String definitionIdMessage = ""; if (variableScope instanceof DelegateExecution) { activityId = ((DelegateExecution) variableScope).getCurrentActivityId(); definitionIdMessage = " in the process definition with id '" + ((DelegateExecution) variableScope).getProcessDefinitionId() + "'"; } else if (variableScope instanceof TaskEntity) { TaskEntity task = (TaskEntity) variableScope; if (task.getExecution() != null) { activityId = task.getExecution().getActivityId(); definitionIdMessage = " in the process definition with id '" + task.getProcessDefinitionId() + "'"; } if (task.getCaseExecution() != null) { activityId = task.getCaseExecution().getActivityId(); definitionIdMessage = " in the case definition with id '" + task.getCaseDefinitionId() + "'"; } } else if (variableScope instanceof DelegateCaseExecution) { activityId = ((DelegateCaseExecution) variableScope).getActivityId(); definitionIdMessage = " in the case definition with id '" + ((DelegateCaseExecution) variableScope).getCaseDefinitionId() + "'"; } if (activityId == null) { return ""; } else { return " while executing activity '" + activityId + "'" + definitionIdMessage; } }
public static SelectorBuilder selector(final DelegateCaseExecution delegateCaseExecution) { String typeName = extractTypeName(delegateCaseExecution); String element = delegateCaseExecution.getActivityId(); return selector() .context(Context.cmmn) .type(typeName) .caseDefinitionKey(GetProcessDefinitionKey.from(delegateCaseExecution)) .element(element) .event(delegateCaseExecution.getEventName()); }
public void notify(DelegateCaseExecution caseExecution, String event) { String eventCounterName = event + "EventCounter"; Integer eventCounter = (Integer) caseExecution.getVariable(eventCounterName); if (eventCounter == null) { eventCounter = 0; } Integer counter = (Integer) caseExecution.getVariable("eventCounter"); if (counter == null) { counter = 0; } caseExecution.setVariable(event, true); caseExecution.setVariable(eventCounterName, eventCounter + 1); caseExecution.setVariable("eventCounter", counter + 1); caseExecution.setVariable(event+"OnCaseExecutionId", caseExecution.getId()); }
public static String from(DelegateCaseExecution execution) { return new Adapter(cmmn, execution.getProcessEngineServices().getRepositoryService(), execution.getCaseDefinitionId()).get(); }
@Override public void notify(DelegateCaseExecution caseExecution) throws Exception { caseExecution.setVariable("var", "test"); }
@Override public void notify(DelegateCaseExecution delegateCaseExecution) throws Exception { logger.info("{} {}", delegateCaseExecution.getEventName(), delegateCaseExecution.getActivityName()); } }
@Test public void providerCalledWithSuperCaseInstance() { ContextLoggingTenantIdProvider tenantIdProvider = new ContextLoggingTenantIdProvider(); TestTenantIdProvider.delegate = tenantIdProvider; testRule.deploy(CMMN_SUBPROCESS_FILE, CMMN_FILE_WITH_MANUAL_ACTIVATION); CaseDefinition superCaseDefinition = engineRule.getRepositoryService().createCaseDefinitionQuery().caseDefinitionKey(CASE_DEFINITION_KEY).singleResult(); // if a case instance is created engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create(); startCaseTask(); // then the tenant id provider is passed in the case definition DelegateCaseExecution superCaseExecution = tenantIdProvider.caseParameters.get(1).getSuperCaseExecution(); assertThat(superCaseExecution, is(notNullValue())); assertThat(superCaseExecution.getCaseDefinitionId(), is(superCaseDefinition.getId())); }
public void notify(DelegateCaseExecution caseExecution) throws Exception { notify(caseExecution, caseExecution.getEventName()); }
public String getNewValue(DelegateCaseExecution caseExecution) { Object variableValue = caseService.getVariable(caseExecution.getId(), "var"); return variableValue.toString() + variableValue.toString(); } }
public void matches(DelegateCaseVariableInstance instance) { assertEquals(expectedEventName, instance.getEventName()); assertEquals(expectedVariableName, instance.getName()); assertEquals(expectedVariableValue, instance.getValue()); assertEquals(expectedProcessInstanceId, instance.getProcessInstanceId()); assertEquals(expectedExecutionId, instance.getExecutionId()); assertEquals(expectedCaseInstanceId, instance.getCaseInstanceId()); assertEquals(expectedCaseExecutionId, instance.getCaseExecutionId()); assertEquals(expectedTaskId, instance.getTaskId()); assertEquals(expectedActivityInstanceId, instance.getActivityInstanceId()); assertEquals(expectedSourceExecution.getId(), instance.getSourceExecution().getId()); assertEquals(expectedSourceExecution.getActivityId(), instance.getSourceExecution().getActivityId()); assertEquals(expectedSourceExecution.getActivityName(), instance.getSourceExecution().getActivityName()); assertEquals(expectedSourceExecution.getCaseDefinitionId(), instance.getSourceExecution().getCaseDefinitionId()); assertEquals(expectedSourceExecution.getCaseInstanceId(), instance.getSourceExecution().getCaseInstanceId()); assertEquals(expectedSourceExecution.getParentId(), instance.getSourceExecution().getParentId()); }
protected String getActivityIdExceptionMessage(VariableScope variableScope) { String activityId = null; String definitionIdMessage = ""; if (variableScope instanceof DelegateExecution) { activityId = ((DelegateExecution) variableScope).getCurrentActivityId(); definitionIdMessage = " in the process definition with id '" + ((DelegateExecution) variableScope).getProcessDefinitionId() + "'"; } else if (variableScope instanceof TaskEntity) { TaskEntity task = (TaskEntity) variableScope; if (task.getExecution() != null) { activityId = task.getExecution().getActivityId(); definitionIdMessage = " in the process definition with id '" + task.getProcessDefinitionId() + "'"; } if (task.getCaseExecution() != null) { activityId = task.getCaseExecution().getActivityId(); definitionIdMessage = " in the case definition with id '" + task.getCaseDefinitionId() + "'"; } } else if (variableScope instanceof DelegateCaseExecution) { activityId = ((DelegateCaseExecution) variableScope).getActivityId(); definitionIdMessage = " in the case definition with id '" + ((DelegateCaseExecution) variableScope).getCaseDefinitionId() + "'"; } if (activityId == null) { return ""; } else { return " while executing activity '" + activityId + "'" + definitionIdMessage; } }
public void notify(DelegateCaseExecution caseExecution, String event) { String eventCounterName = event + "EventCounter"; Integer eventCounter = (Integer) caseExecution.getVariable(eventCounterName); if (eventCounter == null) { eventCounter = 0; } Integer counter = (Integer) caseExecution.getVariable("eventCounter"); if (counter == null) { counter = 0; } caseExecution.setVariable(event, true); caseExecution.setVariable(eventCounterName, eventCounter + 1); caseExecution.setVariable("eventCounter", counter + 1); caseExecution.setVariable(event+"OnCaseExecutionId", caseExecution.getId()); }
public void notify(DelegateCaseExecution caseExecution) throws Exception { caseExecution.setVariable("listener", "listener-notified"); }
@Override public void notify(DelegateCaseExecution caseExecution) throws Exception { caseExecution.setVariable("businessKey", caseExecution.getBusinessKey()); caseExecution.setVariable("caseBusinessKey", caseExecution.getCaseBusinessKey()); }
@Test public void providerCalledWithSuperCaseInstance() { ContextLoggingTenantIdProvider tenantIdProvider = new ContextLoggingTenantIdProvider(); TestTenantIdProvider.delegate = tenantIdProvider; testRule.deploy(CMMN_SUBPROCESS_FILE, CMMN_FILE_WITH_MANUAL_ACTIVATION); CaseDefinition superCaseDefinition = engineRule.getRepositoryService().createCaseDefinitionQuery().caseDefinitionKey(CASE_DEFINITION_KEY).singleResult(); // if a case instance is created engineRule.getCaseService().withCaseDefinitionByKey(CASE_DEFINITION_KEY).create(); startCaseTask(); // then the tenant id provider is passed in the case definition DelegateCaseExecution superCaseExecution = tenantIdProvider.caseParameters.get(1).getSuperCaseExecution(); assertThat(superCaseExecution, is(notNullValue())); assertThat(superCaseExecution.getCaseDefinitionId(), is(superCaseDefinition.getId())); }