Java Code Examples for org.camunda.bpm.model.dmn.instance.Rule#getInputEntries()

The following examples show how to use org.camunda.bpm.model.dmn.instance.Rule#getInputEntries() . 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: DefaultDmnTransform.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
protected DmnDecisionTableRuleImpl transformDecisionTableRule(Rule rule) {
  DmnElementTransformHandler<Rule, DmnDecisionTableRuleImpl> handler = handlerRegistry.getHandler(Rule.class);
  DmnDecisionTableRuleImpl dmnRule = handler.handleElement(this, rule);

  // validate rule id
  if (dmnRule.getId() == null) {
    throw LOG.decisionTableRuleIdIsMissing(decision, dmnRule);
  }

  List<DmnDecisionTableInputImpl> inputs = this.decisionTable.getInputs();
  List<InputEntry> inputEntries = new ArrayList<InputEntry>(rule.getInputEntries());
  if (inputs.size() != inputEntries.size()) {
    throw LOG.differentNumberOfInputsAndInputEntries(inputs.size(), inputEntries.size(), dmnRule);
  }

  for (InputEntry inputEntry : inputEntries) {
    parent = dmnRule;

    DmnExpressionImpl condition = transformInputEntry(inputEntry);
    dmnRule.getConditions().add(condition);
  }

  List<DmnDecisionTableOutputImpl> outputs = this.decisionTable.getOutputs();
  List<OutputEntry> outputEntries = new ArrayList<OutputEntry>(rule.getOutputEntries());
  if (outputs.size() != outputEntries.size()) {
    throw LOG.differentNumberOfOutputsAndOutputEntries(outputs.size(), outputEntries.size(), dmnRule);
  }

  for (OutputEntry outputEntry : outputEntries) {
    parent = dmnRule;
    DmnExpressionImpl conclusion = transformOutputEntry(outputEntry);
    dmnRule.getConclusions().add(conclusion);
  }

  return dmnRule;
}
 
Example 2
Source File: DefaultDmnTransform.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected DmnDecisionTableRuleImpl transformDecisionTableRule(Rule rule) {
  DmnElementTransformHandler<Rule, DmnDecisionTableRuleImpl> handler = handlerRegistry.getHandler(Rule.class);
  DmnDecisionTableRuleImpl dmnRule = handler.handleElement(this, rule);

  // validate rule id
  if (dmnRule.getId() == null) {
    throw LOG.decisionTableRuleIdIsMissing(decision, dmnRule);
  }

  List<DmnDecisionTableInputImpl> inputs = this.decisionTable.getInputs();
  List<InputEntry> inputEntries = new ArrayList<InputEntry>(rule.getInputEntries());
  if (inputs.size() != inputEntries.size()) {
    throw LOG.differentNumberOfInputsAndInputEntries(inputs.size(), inputEntries.size(), dmnRule);
  }

  for (InputEntry inputEntry : inputEntries) {
    parent = dmnRule;

    DmnExpressionImpl condition = transformInputEntry(inputEntry);
    dmnRule.getConditions().add(condition);
  }

  List<DmnDecisionTableOutputImpl> outputs = this.decisionTable.getOutputs();
  List<OutputEntry> outputEntries = new ArrayList<OutputEntry>(rule.getOutputEntries());
  if (outputs.size() != outputEntries.size()) {
    throw LOG.differentNumberOfOutputsAndOutputEntries(outputs.size(), outputEntries.size(), dmnRule);
  }

  for (OutputEntry outputEntry : outputEntries) {
    parent = dmnRule;
    DmnExpressionImpl conclusion = transformOutputEntry(outputEntry);
    dmnRule.getConclusions().add(conclusion);
  }

  return dmnRule;
}