org.camunda.bpm.model.dmn.HitPolicy Java Examples

The following examples show how to use org.camunda.bpm.model.dmn.HitPolicy. 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: DmnDecisionTableTransformHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected DmnHitPolicyHandler getHitPolicyHandler(DmnElementTransformContext context, DecisionTable decisionTable, DmnDecisionTableImpl dmnDecisionTable) {
  HitPolicy hitPolicy = decisionTable.getHitPolicy();
  if (hitPolicy == null) {
    // use default hit policy
    hitPolicy = HitPolicy.UNIQUE;
  }
  BuiltinAggregator aggregation = decisionTable.getAggregation();
  DmnHitPolicyHandler hitPolicyHandler = context.getHitPolicyHandlerRegistry().getHandler(hitPolicy, aggregation);
  if (hitPolicyHandler != null) {
    return hitPolicyHandler;
  }
  else {
    throw LOG.hitPolicyNotSupported(dmnDecisionTable, hitPolicy, aggregation);
  }
}
 
Example #2
Source File: DecisionDefinitionDeployerTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected static DmnModelInstance createDmnModelInstance() {
  DmnModelInstance modelInstance = Dmn.createEmptyModel();
  Definitions definitions = modelInstance.newInstance(Definitions.class);
  definitions.setId(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
  definitions.setName(DmnModelConstants.DMN_ELEMENT_DEFINITIONS);
  definitions.setNamespace(DmnModelConstants.CAMUNDA_NS);
  modelInstance.setDefinitions(definitions);

  Decision decision = modelInstance.newInstance(Decision.class);
  decision.setId("Decision-1");
  decision.setName("foo");
  decision.setCamundaHistoryTimeToLive(5);
  modelInstance.getDefinitions().addChildElement(decision);

  DecisionTable decisionTable = modelInstance.newInstance(DecisionTable.class);
  decisionTable.setId(DmnModelConstants.DMN_ELEMENT_DECISION_TABLE);
  decisionTable.setHitPolicy(HitPolicy.FIRST);
  decision.addChildElement(decisionTable);

  Input input = modelInstance.newInstance(Input.class);
  input.setId("Input-1");
  input.setLabel("Input");
  decisionTable.addChildElement(input);

  InputExpression inputExpression = modelInstance.newInstance(InputExpression.class);
  inputExpression.setId("InputExpression-1");
  Text inputExpressionText = modelInstance.newInstance(Text.class);
  inputExpressionText.setTextContent("input");
  inputExpression.setText(inputExpressionText);
  inputExpression.setTypeRef("string");
  input.setInputExpression(inputExpression);

  Output output = modelInstance.newInstance(Output.class);
  output.setName("output");
  output.setLabel("Output");
  output.setTypeRef("string");
  decisionTable.addChildElement(output);

  return modelInstance;
}
 
Example #3
Source File: DecisionTableTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public Collection<AttributeAssumption> getAttributesAssumptions() {
  return Arrays.asList(
    new AttributeAssumption("hitPolicy", false, false, HitPolicy.UNIQUE),
    new AttributeAssumption("aggregation"),
    new AttributeAssumption("preferredOrientation", false, false, DecisionTableOrientation.Rule_as_Row),
    new AttributeAssumption("outputLabel")
  );
}
 
Example #4
Source File: DecisionTableImpl.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(DecisionTable.class, DMN_ELEMENT_DECISION_TABLE)
    .namespaceUri(DMN11_NS)
    .extendsType(Expression.class)
    .instanceProvider(new ModelTypeInstanceProvider<DecisionTable>() {
      public DecisionTable newInstance(ModelTypeInstanceContext instanceContext) {
        return new DecisionTableImpl(instanceContext);
      }
    });

  hitPolicyAttribute = typeBuilder.namedEnumAttribute(DMN_ATTRIBUTE_HIT_POLICY, HitPolicy.class)
    .defaultValue(HitPolicy.UNIQUE)
    .build();

  aggregationAttribute = typeBuilder.enumAttribute(DMN_ATTRIBUTE_AGGREGATION, BuiltinAggregator.class)
    .build();

  preferredOrientationAttribute = typeBuilder.namedEnumAttribute(DMN_ATTRIBUTE_PREFERRED_ORIENTATION, DecisionTableOrientation.class)
    .defaultValue(DecisionTableOrientation.Rule_as_Row)
    .build();

  outputLabelAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_OUTPUT_LABEL)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  inputCollection = sequenceBuilder.elementCollection(Input.class)
    .build();

  outputCollection = sequenceBuilder.elementCollection(Output.class)
    .required()
    .build();

  ruleCollection = sequenceBuilder.elementCollection(Rule.class)
    .build();

  typeBuilder.build();
}
 
Example #5
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectMinResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, BuiltinAggregator.MIN);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isEqualTo("collectMe");
  assertThat(listener.evaluationEvent.getCollectResultValue()).isEqualTo(Variables.integerValue(10));
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #6
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectMaxResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, BuiltinAggregator.MAX);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isEqualTo("collectMe");
  assertThat(listener.evaluationEvent.getCollectResultValue()).isEqualTo(Variables.integerValue(50));
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #7
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectSumResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, BuiltinAggregator.SUM);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isEqualTo("collectMe");
  assertThat(listener.evaluationEvent.getCollectResultValue()).isEqualTo(Variables.integerValue(90));
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #8
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectCountResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, BuiltinAggregator.COUNT);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isEqualTo("collectMe");
  assertThat(listener.evaluationEvent.getCollectResultValue()).isEqualTo(Variables.integerValue(3));
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #9
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, null);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isNull();
  assertThat(listener.evaluationEvent.getCollectResultValue()).isNull();
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #10
Source File: DefaultHitPolicyHandlerRegistry.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected static Map<HitPolicyEntry, DmnHitPolicyHandler> getDefaultHandlers() {
  Map<HitPolicyEntry, DmnHitPolicyHandler> handlers = new HashMap<HitPolicyEntry, DmnHitPolicyHandler>();

  handlers.put(new HitPolicyEntry(HitPolicy.UNIQUE, null), new UniqueHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.FIRST, null), new FirstHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.ANY, null), new AnyHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.RULE_ORDER, null), new RuleOrderHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, null), new CollectHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, BuiltinAggregator.COUNT), new CollectCountHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, BuiltinAggregator.SUM), new CollectSumHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, BuiltinAggregator.MIN), new CollectMinHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, BuiltinAggregator.MAX), new CollectMaxHitPolicyHandler());

  return handlers;
}
 
Example #11
Source File: DmnTransformLogger.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
public DmnTransformException hitPolicyNotSupported(DmnDecisionTableImpl decisionTable, HitPolicy hitPolicy, BuiltinAggregator aggregation) {
  if (aggregation == null) {
    return new DmnTransformException(exceptionMessage(
      "007",
      "The hit policy '{}' of decision table '{}' is not supported.", hitPolicy, decisionTable)
    );
  }
  else {
    return new DmnTransformException(exceptionMessage(
      "007",
      "The hit policy '{}' with aggregation '{}' of decision table '{}' is not supported.", hitPolicy, aggregation, decisionTable)
    );
  }
}
 
Example #12
Source File: DmnDecisionTableTransformHandler.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
protected DmnHitPolicyHandler getHitPolicyHandler(DmnElementTransformContext context, DecisionTable decisionTable, DmnDecisionTableImpl dmnDecisionTable) {
  HitPolicy hitPolicy = decisionTable.getHitPolicy();
  if (hitPolicy == null) {
    // use default hit policy
    hitPolicy = HitPolicy.UNIQUE;
  }
  BuiltinAggregator aggregation = decisionTable.getAggregation();
  DmnHitPolicyHandler hitPolicyHandler = context.getHitPolicyHandlerRegistry().getHandler(hitPolicy, aggregation);
  if (hitPolicyHandler != null) {
    return hitPolicyHandler;
  }
  else {
    throw LOG.hitPolicyNotSupported(dmnDecisionTable, hitPolicy, aggregation);
  }
}
 
Example #13
Source File: XslxToDmnConversionTest.java    From camunda-dmn-xlsx with Apache License 2.0 5 votes vote down vote up
@Test
public void testConversionWithComplexHeaders() {
  XlsxConverter converter = new XlsxConverter();
  converter.setIoDetectionStrategy(new AdvancedSpreadsheetAdapter());
  InputStream inputStream = TestHelper.getClassPathResource("test6.xlsx");
  DmnModelInstance dmnModelInstance = converter.convert(inputStream);
  assertThat(dmnModelInstance).isNotNull();

  DecisionTable table = TestHelper.assertAndGetSingleDecisionTable(dmnModelInstance);
  assertThat(table).isNotNull();
  assertThat(table.getInputs()).hasSize(2);
  assertThat(table.getOutputs()).hasSize(2);
  assertThat(table.getRules()).hasSize(2);
  assertThat(table.getHitPolicy()).isEqualTo(HitPolicy.FIRST);

  Iterator<Input> inputIterator = table.getInputs().iterator();
  Input input = inputIterator.next();

  assertThat(input.getId()).isEqualTo("input1");
  assertThat(input.getLabel()).isEqualTo("InputLabel1");
  assertThat(input.getInputExpression().getTypeRef()).isEqualTo("string");
  assertThat(input.getTextContent()).isEqualTo("Exp1");

  input = inputIterator.next();
  assertThat(input.getId()).isEqualTo("input2");
  assertThat(input.getLabel()).isEqualTo("InputLabel2");
  assertThat(input.getInputExpression().getTypeRef()).isEqualTo("integer");
  assertThat(input.getInputExpression().getExpressionLanguage()).isEqualTo("javascript");
  assertThat(input.getInputExpression().getTextContent()).isEqualTo(JAVASCRIPT_SNIPPET);

  Iterator<Rule> ruleIterator = table.getRules().iterator();
  Rule rule = ruleIterator.next();
  assertThat(rule.getDescription().getTextContent()).isEqualTo("Comment1");

  InputEntry inputEntry = rule.getInputEntries().iterator().next();
  assertThat(inputEntry.getTextContent()).isEqualTo("\"Foo\"");

  rule = ruleIterator.next();
  assertThat(rule.getDescription().getTextContent()).isEqualTo("Another Comment");
}
 
Example #14
Source File: AdvancedSpreadsheetAdapter.java    From camunda-dmn-xlsx with Apache License 2.0 5 votes vote down vote up
public HitPolicy determineHitPolicy(Spreadsheet context) {
  if (context.getRows().size() < 4) {
    return null;
  }
  SpreadsheetRow row = context.getRows().get(4);
  if (row.getCell("A") != null) {
    final String hitPolicyString = context.resolveCellContent(row.getCell("A")).toUpperCase();
    return HitPolicy.valueOf(hitPolicyString);
  }
  else
  {
    return null;
  }
}
 
Example #15
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectMinResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, BuiltinAggregator.MIN);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isEqualTo("collectMe");
  assertThat(listener.evaluationEvent.getCollectResultValue()).isEqualTo(Variables.integerValue(10));
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #16
Source File: DmnTransformLogger.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
public DmnTransformException hitPolicyNotSupported(DmnDecisionTableImpl decisionTable, HitPolicy hitPolicy, BuiltinAggregator aggregation) {
  if (aggregation == null) {
    return new DmnTransformException(exceptionMessage(
      "007",
      "The hit policy '{}' of decision table '{}' is not supported.", hitPolicy, decisionTable)
    );
  }
  else {
    return new DmnTransformException(exceptionMessage(
      "007",
      "The hit policy '{}' with aggregation '{}' of decision table '{}' is not supported.", hitPolicy, aggregation, decisionTable)
    );
  }
}
 
Example #17
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectSumResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, BuiltinAggregator.SUM);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isEqualTo("collectMe");
  assertThat(listener.evaluationEvent.getCollectResultValue()).isEqualTo(Variables.integerValue(90));
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #18
Source File: DefaultHitPolicyHandlerRegistry.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
protected static Map<HitPolicyEntry, DmnHitPolicyHandler> getDefaultHandlers() {
  Map<HitPolicyEntry, DmnHitPolicyHandler> handlers = new HashMap<HitPolicyEntry, DmnHitPolicyHandler>();

  handlers.put(new HitPolicyEntry(HitPolicy.UNIQUE, null), new UniqueHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.FIRST, null), new FirstHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.ANY, null), new AnyHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.RULE_ORDER, null), new RuleOrderHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, null), new CollectHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, BuiltinAggregator.COUNT), new CollectCountHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, BuiltinAggregator.SUM), new CollectSumHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, BuiltinAggregator.MIN), new CollectMinHitPolicyHandler());
  handlers.put(new HitPolicyEntry(HitPolicy.COLLECT, BuiltinAggregator.MAX), new CollectMaxHitPolicyHandler());

  return handlers;
}
 
Example #19
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectCountResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, BuiltinAggregator.COUNT);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isEqualTo("collectMe");
  assertThat(listener.evaluationEvent.getCollectResultValue()).isEqualTo(Variables.integerValue(3));
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #20
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, null);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isNull();
  assertThat(listener.evaluationEvent.getCollectResultValue()).isNull();
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #21
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
@Test
@DecisionResource(resource = DMN_FILE)
public void testCollectMaxResult() {
  setDecisionTableHitPolicy(HitPolicy.COLLECT, BuiltinAggregator.MAX);
  evaluateDecisionTable(true, "bar", true, "hello");
  assertThat(listener.evaluationEvent.getCollectResultName()).isEqualTo("collectMe");
  assertThat(listener.evaluationEvent.getCollectResultValue()).isEqualTo(Variables.integerValue(50));
  List<DmnEvaluatedDecisionRule> matchingRules = listener.evaluationEvent.getMatchingRules();
  assertThat(matchingRules).hasSize(4);
  assertThat(matchingRules.get(0).getId()).isEqualTo("rule3");
  assertThat(matchingRules.get(1).getId()).isEqualTo("rule4");
  assertThat(matchingRules.get(2).getId()).isEqualTo("rule5");
  assertThat(matchingRules.get(3).getId()).isEqualTo("rule6");
}
 
Example #22
Source File: DmnHitPolicyLogger.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public DmnHitPolicyException anyHitPolicyRequiresThatAllOutputsAreEqual(List<DmnEvaluatedDecisionRule> matchingRules) {
  return new DmnHitPolicyException(exceptionMessage(
    "002",
    "Hit policy '{}' only allows multiple matching rules with equal output. Matching rules: '{}'.", HitPolicy.ANY, matchingRules)
  );
}
 
Example #23
Source File: DecisionTableImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setHitPolicy(HitPolicy hitPolicy) {
  hitPolicyAttribute.setValue(this, hitPolicy);
}
 
Example #24
Source File: DecisionTableImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public HitPolicy getHitPolicy() {
  return hitPolicyAttribute.getValue(this);
}
 
Example #25
Source File: DmnDecisionTableEvaluationListenerTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setDecisionTableHitPolicy(HitPolicy hitPolicy, BuiltinAggregator aggregator) {
  DmnHitPolicyHandler handler = hitPolicyHandlerRegistry.getHandler(hitPolicy, aggregator);
  assertThat(handler).isNotNull();
  DmnDecisionTableImpl decisionTable = (DmnDecisionTableImpl) this.decision.getDecisionLogic();
  decisionTable.setHitPolicyHandler(handler);
}
 
Example #26
Source File: DefaultHitPolicyHandlerRegistry.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public DmnHitPolicyHandler getHandler(HitPolicy hitPolicy, BuiltinAggregator builtinAggregator) {
  return handlers.get(new HitPolicyEntry(hitPolicy, builtinAggregator));
}
 
Example #27
Source File: DefaultHitPolicyHandlerRegistry.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public void addHandler(HitPolicy hitPolicy, BuiltinAggregator builtinAggregator, DmnHitPolicyHandler hitPolicyHandler) {
  handlers.put(new HitPolicyEntry(hitPolicy, builtinAggregator), hitPolicyHandler);
}
 
Example #28
Source File: DmnHitPolicyLogger.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public DmnHitPolicyException uniqueHitPolicyOnlyAllowsSingleMatchingRule(List<DmnEvaluatedDecisionRule> matchingRules) {
  return new DmnHitPolicyException(exceptionMessage(
    "001",
    "Hit policy '{}' only allows a single rule to match. Actually match rules: '{}'.", HitPolicy.UNIQUE, matchingRules)
  );
}
 
Example #29
Source File: DmnHitPolicyLogger.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public DmnHitPolicyException anyHitPolicyRequiresThatAllOutputsAreEqual(List<DmnEvaluatedDecisionRule> matchingRules) {
  return new DmnHitPolicyException(exceptionMessage(
    "002",
    "Hit policy '{}' only allows multiple matching rules with equal output. Matching rules: '{}'.", HitPolicy.ANY, matchingRules)
  );
}
 
Example #30
Source File: HitPolicyEntry.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public HitPolicy getHitPolicy() {
  return hitPolicy;
}