org.camunda.bpm.engine.DecisionService Java Examples

The following examples show how to use org.camunda.bpm.engine.DecisionService. 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: OSGiDmnIntegrationTest.java    From camunda-bpm-platform-osgi with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldUseTheDmnTable(){
  DecisionService decisionService = processEngine.getDecisionService();
  VariableMap variableMap = Variables.createVariables().putValue("season", "Spring").putValue("guestCount", 10);
  DmnDecisionTableResult dishDecision = decisionService.evaluateDecisionTableByKey("dish", variableMap);
  String dish = dishDecision.getSingleEntry();

  assertThat(dish, is(equalTo("Stew")));
}
 
Example #2
Source File: DecisionDefinitionRestServiceInteractionTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
private void setUpDecisionService() {
  decisionEvaluationBuilderMock = mock(DecisionsEvaluationBuilder.class);
  when(decisionEvaluationBuilderMock.variables(anyMapOf(String.class, Object.class))).thenReturn(decisionEvaluationBuilderMock);

  decisionServiceMock = mock(DecisionService.class);
  when(decisionServiceMock.evaluateDecisionById(MockProvider.EXAMPLE_DECISION_DEFINITION_ID)).thenReturn(decisionEvaluationBuilderMock);
  when(decisionServiceMock.evaluateDecisionByKey(MockProvider.EXAMPLE_DECISION_DEFINITION_KEY)).thenReturn(decisionEvaluationBuilderMock);

  when(processEngine.getDecisionService()).thenReturn(decisionServiceMock);
}
 
Example #3
Source File: DecisionRequirementsDefinitionRestServiceInteractionTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void setUpRuntime() throws FileNotFoundException, URISyntaxException {
  DecisionRequirementsDefinition mockDecisionRequirementsDefinition = MockProvider.createMockDecisionRequirementsDefinition();

  setUpRuntimeData(mockDecisionRequirementsDefinition);
  decisionServiceMock = mock(DecisionService.class);
  when(processEngine.getDecisionService()).thenReturn(decisionServiceMock);
}
 
Example #4
Source File: FeelCustomFunctionConfigTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@Deployment(resources = {"org/camunda/bpm/engine/test/dmn/feel/custom_function.dmn"})
public void shouldRegisterCustomFunctions() {
  // given
  DecisionService decisionService = processEngine.getDecisionService();

  // when
  String result = decisionService.evaluateDecisionByKey("c")
      .evaluate()
      .getSingleEntry();

  // then
  assertThat(result).isEqualTo("foobar");
}
 
Example #5
Source File: SpringProcessEngineServicesConfiguration.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Bean(name = "decisionService")
@Override
public DecisionService getDecisionService() {
  return processEngine.getDecisionService();
}
 
Example #6
Source File: AbstractProcessEngineServicesDelegate.java    From camunda-bpm-assert-scenario with Apache License 2.0 4 votes vote down vote up
public DecisionService getDecisionService() {
  return processEngine.getDecisionService();
}
 
Example #7
Source File: EvaluateDecisionTableStep.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(PerfTestRunContext context) {
  DecisionService decisionService = processEngine.getDecisionService();

  decisionService.evaluateDecisionTableByKey(decisionDefinitionKey, variables);
}
 
Example #8
Source File: DecisionServiceDelegate.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
protected DmnDecisionTableResult evaluateDecision(DecisionService decisionService, VariableScope variableScope) {
  return decisionService.evaluateDecisionTableByKey("testDecision", variableScope.getVariables());
}
 
Example #9
Source File: DecisionServiceDelegate.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public boolean evaluate(DelegateCaseExecution caseExecution) {
  DecisionService decisionService = caseExecution.getProcessEngineServices().getDecisionService();
  DmnDecisionTableResult result = evaluateDecision(decisionService, caseExecution);
  DmnDecisionRuleResult singleResult = result.getSingleResult();
  return (Boolean) singleResult.getSingleEntry();
}
 
Example #10
Source File: DecisionServiceDelegate.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void notify(DelegateCaseExecution caseExecution) throws Exception {
  DecisionService decisionService = caseExecution.getProcessEngineServices().getDecisionService();
  evaluateDecision(decisionService, caseExecution);
}
 
Example #11
Source File: DecisionServiceDelegate.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public void execute(DelegateExecution execution) throws Exception {
  DecisionService decisionService = execution.getProcessEngineServices().getDecisionService();
  evaluateDecision(decisionService, execution);
}
 
Example #12
Source File: ProcessEngineRule.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setDecisionService(DecisionService decisionService) {
  this.decisionService = decisionService;
}
 
Example #13
Source File: ProcessEngineRule.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public DecisionService getDecisionService() {
  return decisionService;
}
 
Example #14
Source File: ProcessEngineImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Override
public DecisionService getDecisionService() {
  return decisionService;
}
 
Example #15
Source File: ProcessEngineConfigurationImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setDecisionService(DecisionService decisionService) {
  this.decisionService = decisionService;
}
 
Example #16
Source File: ProcessEngineConfigurationImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public DecisionService getDecisionService() {
  return decisionService;
}
 
Example #17
Source File: ProcessEngineServicesProducer.java    From camunda-bpm-platform with Apache License 2.0 votes vote down vote up
@Produces @Named @ApplicationScoped public DecisionService decisionService() { return processEngine().getDecisionService(); } 
Example #18
Source File: NamedProcessEngineServicesProducer.java    From camunda-bpm-platform with Apache License 2.0 votes vote down vote up
@Produces @ProcessEngineName("") public DecisionService decisionService(InjectionPoint ip) { return processEngine(ip).getDecisionService(); }