Java Code Examples for org.camunda.bpm.model.dmn.instance.Decision#setId()

The following examples show how to use org.camunda.bpm.model.dmn.instance.Decision#setId() . 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: DecisionDefinitionDeployerTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected static DmnModelInstance createDmnModelInstanceNegativeHistoryTimeToLive() {
  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);

  return modelInstance;
}
 
Example 2
Source File: DmnHelper.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public static DmnModelInstance createSimpleDmnModel(final String decisionKey) {
  final DmnModelInstance modelInstance = Dmn.createEmptyModel();

  final Definitions definitions = generateNamedElement(Definitions.class, "definitions", modelInstance);
  definitions.setNamespace(TEST_NAMESPACE);

  modelInstance.setDefinitions(definitions);

  Decision decision = generateNamedElement(Decision.class, "decision1", modelInstance);
  decision.setId(decisionKey);
  DecisionTable decisionTable = generateElement(DecisionTable.class, modelInstance);
  decision.setExpression(decisionTable);
  Output output = generateElement(Output.class, modelInstance);
  decisionTable.getOutputs().add(output);
  definitions.addChildElement(decision);
  return modelInstance;
}
 
Example 3
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;
}