org.camunda.bpm.model.dmn.impl.DmnModelConstants Java Examples

The following examples show how to use org.camunda.bpm.model.dmn.impl.DmnModelConstants. 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: DecisionDefinitionDeployerTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void testDeployEmptyDecisionDefinition() throws Exception {

  // given empty decision model
  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);

  // when decision model is deployed
  DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().addModelInstance("foo.dmn", modelInstance);
  DeploymentWithDefinitions deployment = testRule.deploy(deploymentBuilder);

  // then deployment contains no definitions
  assertNull(deployment.getDeployedDecisionDefinitions());
  assertNull(deployment.getDeployedDecisionRequirementsDefinitions());

  // and there are no persisted definitions
  assertNull(repositoryService.createDecisionDefinitionQuery()
    .decisionDefinitionResourceName("foo.dmn").singleResult());
}
 
Example #3
Source File: XlsxWorksheetConverter.java    From camunda-dmn-xlsx with Apache License 2.0 5 votes vote down vote up
protected DmnModelInstance initializeEmptyDmnModel() {
  DmnModelInstance dmnModel = Dmn.createEmptyModel();
  Definitions definitions = generateNamedElement(dmnModel, Definitions.class, "definitions");
  definitions.setNamespace(DmnModelConstants.CAMUNDA_NS);
  dmnModel.setDefinitions(definitions);

  return dmnModel;
}
 
Example #4
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 #5
Source File: DmnModelElementInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public String getDefaultNamespace() {
  return DmnModelConstants.DMN11_NS;
}