org.camunda.bpm.model.dmn.instance.Definitions Java Examples

The following examples show how to use org.camunda.bpm.model.dmn.instance.Definitions. 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 6 votes vote down vote up
protected DmnDecisionRequirementsGraph transformDefinitions(Definitions definitions) {
  DmnElementTransformHandler<Definitions, DmnDecisionRequirementsGraphImpl> handler = handlerRegistry.getHandler(Definitions.class);
  DmnDecisionRequirementsGraphImpl dmnDrg = handler.handleElement(this, definitions);

  // validate id of drd
  if (dmnDrg.getKey() == null) {
    throw LOG.drdIdIsMissing(dmnDrg);
  }

  Collection<Decision> decisions = definitions.getChildElementsByType(Decision.class);
  List<DmnDecision> dmnDecisions = transformDecisions(decisions);
  for (DmnDecision dmnDecision : dmnDecisions) {
    dmnDrg.addDecision(dmnDecision);
  }

  notifyTransformListeners(definitions, dmnDrg);
  return dmnDrg;
}
 
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 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 #4
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 #5
Source File: ExpressionLanguageTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
@DmnModelResource(resource = EXPRESSION_LANGUAGE_DMN)
public void shouldReadExpressionLanguage() {
  Definitions definitions = modelInstance.getDefinitions();
  assertThat(definitions.getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE);

  DecisionTable decisionTable = modelInstance.getModelElementById("decisionTable");
  Input input = decisionTable.getInputs().iterator().next();
  assertThat(input.getInputExpression().getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE);
  assertThat(input.getInputValues().getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE);
  Output output = decisionTable.getOutputs().iterator().next();
  assertThat(output.getOutputValues().getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE);

  Rule rule = decisionTable.getRules().iterator().next();
  InputEntry inputEntry = rule.getInputEntries().iterator().next();
  assertThat(inputEntry.getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE);
  OutputEntry outputEntry = rule.getOutputEntries().iterator().next();
  assertThat(outputEntry.getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE);
}
 
Example #6
Source File: DmnTransformListenerTest.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldVerifyDmnDecisionRequirementsGraph() {
  dmnEngine.parseDecisionRequirementsGraph(IoUtil.fileAsStream(DRG_EXAMPLE_DMN));  
  DmnDecisionRequirementsGraph dmnDecisionRequirementsGraph = listener.getDmnDecisionRequirementsGraph();
  Definitions definitions = listener.getDefinitions();
  assertThat(dmnDecisionRequirementsGraph.getKey())
    .isEqualTo(definitions.getId())
    .isEqualTo("dish");
  assertThat(dmnDecisionRequirementsGraph.getName())
    .isEqualTo(definitions.getName())
    .isEqualTo("Dish");
  assertThat(dmnDecisionRequirementsGraph.getDecisions().size()).isEqualTo(3);
  assertThat(dmnDecisionRequirementsGraph.getDecision("dish-decision")).isNotNull();
  assertThat(dmnDecisionRequirementsGraph.getDecision("season")).isNotNull();
  assertThat(dmnDecisionRequirementsGraph.getDecision("guestCount")).isNotNull();
}
 
Example #7
Source File: DefaultElementTransformHandlerRegistry.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected static Map<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler> getDefaultElementTransformHandlers() {
  Map<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler> handlers = new HashMap<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler>();

  handlers.put(Definitions.class, new DmnDecisionRequirementsGraphTransformHandler());
  handlers.put(Decision.class, new DmnDecisionTransformHandler());

  handlers.put(DecisionTable.class, new DmnDecisionTableTransformHandler());
  handlers.put(Input.class, new DmnDecisionTableInputTransformHandler());
  handlers.put(InputExpression.class, new DmnDecisionTableInputExpressionTransformHandler());
  handlers.put(Output.class, new DmnDecisionTableOutputTransformHandler());
  handlers.put(Rule.class, new DmnDecisionTableRuleTransformHandler());
  handlers.put(InputEntry.class, new DmnDecisionTableConditionTransformHandler());
  handlers.put(OutputEntry.class, new DmnLiternalExpressionTransformHandler());

  handlers.put(LiteralExpression.class, new DmnLiternalExpressionTransformHandler());
  handlers.put(Variable.class, new DmnVariableTransformHandler());

  return handlers;
}
 
Example #8
Source File: DefaultDmnTransform.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
protected DmnDecisionRequirementsGraph transformDefinitions(Definitions definitions) {
  DmnElementTransformHandler<Definitions, DmnDecisionRequirementsGraphImpl> handler = handlerRegistry.getHandler(Definitions.class);
  DmnDecisionRequirementsGraphImpl dmnDrg = handler.handleElement(this, definitions);

  // validate id of drd
  if (dmnDrg.getKey() == null) {
    throw LOG.drdIdIsMissing(dmnDrg);
  }

  Collection<Decision> decisions = definitions.getChildElementsByType(Decision.class);
  List<DmnDecision> dmnDecisions = transformDecisions(decisions);
  for (DmnDecision dmnDecision : dmnDecisions) {
    dmnDrg.addDecision(dmnDecision);
  }

  notifyTransformListeners(definitions, dmnDrg);
  return dmnDrg;
}
 
Example #9
Source File: DmnTransformListenerTest.java    From camunda-engine-dmn with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldVerifyDmnDecisionRequirementsGraph() {
  dmnEngine.parseDecisionRequirementsGraph(IoUtil.fileAsStream(DRG_EXAMPLE_DMN));  
  DmnDecisionRequirementsGraph dmnDecisionRequirementsGraph = listener.getDmnDecisionRequirementsGraph();
  Definitions definitions = listener.getDefinitions();
  assertThat(dmnDecisionRequirementsGraph.getKey())
    .isEqualTo(definitions.getId())
    .isEqualTo("dish");
  assertThat(dmnDecisionRequirementsGraph.getName())
    .isEqualTo(definitions.getName())
    .isEqualTo("Dish");
  assertThat(dmnDecisionRequirementsGraph.getDecisions().size()).isEqualTo(3);
  assertThat(dmnDecisionRequirementsGraph.getDecision("dish-decision")).isNotNull();
  assertThat(dmnDecisionRequirementsGraph.getDecision("season")).isNotNull();
  assertThat(dmnDecisionRequirementsGraph.getDecision("guestCount")).isNotNull();
}
 
Example #10
Source File: DefaultElementTransformHandlerRegistry.java    From camunda-engine-dmn with Apache License 2.0 6 votes vote down vote up
protected static Map<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler> getDefaultElementTransformHandlers() {
  Map<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler> handlers = new HashMap<Class<? extends DmnModelElementInstance>, DmnElementTransformHandler>();

  handlers.put(Definitions.class, new DmnDecisionRequirementsGraphTransformHandler());
  handlers.put(Decision.class, new DmnDecisionTransformHandler());

  handlers.put(DecisionTable.class, new DmnDecisionTableTransformHandler());
  handlers.put(Input.class, new DmnDecisionTableInputTransformHandler());
  handlers.put(InputExpression.class, new DmnDecisionTableInputExpressionTransformHandler());
  handlers.put(Output.class, new DmnDecisionTableOutputTransformHandler());
  handlers.put(Rule.class, new DmnDecisionTableRuleTransformHandler());
  handlers.put(InputEntry.class, new DmnDecisionTableConditionTransformHandler());
  handlers.put(OutputEntry.class, new DmnLiternalExpressionTransformHandler());

  handlers.put(LiteralExpression.class, new DmnLiternalExpressionTransformHandler());
  handlers.put(Variable.class, new DmnVariableTransformHandler());

  return handlers;
}
 
Example #11
Source File: DmnModelInstanceTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
public void testClone() throws Exception {

  DmnModelInstance modelInstance = Dmn.createEmptyModel();

  Definitions definitions = modelInstance.newInstance(Definitions.class);
  definitions.setId("TestId");
  modelInstance.setDefinitions(definitions);

  DmnModelInstance cloneInstance = modelInstance.clone();
  cloneInstance.getDefinitions().setId("TestId2");

  assertThat(modelInstance.getDefinitions().getId(), is(equalTo("TestId")));
  assertThat(cloneInstance.getDefinitions().getId(), is(equalTo("TestId2")));
}
 
Example #12
Source File: GenerateIdTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldNotGenerateIdsOnRead() {
  DmnModelInstance modelInstance = Dmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.dmn"));
  Definitions definitions = modelInstance.getDefinitions();
  assertThat(definitions.getId()).isNull();

  Decision decision = modelInstance.getModelElementsByType(Decision.class).iterator().next();
  assertThat(decision.getId()).isNull();

  DecisionTable decisionTable = modelInstance.getModelElementsByType(DecisionTable.class).iterator().next();
  assertThat(decisionTable.getId()).isNull();

  Output output = modelInstance.getModelElementsByType(Output.class).iterator().next();
  assertThat(output.getId()).isNull();
}
 
Example #13
Source File: GenerateIdTest.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldGenerateIdsOnCreate() {
  DmnModelInstance modelInstance = Dmn.createEmptyModel();
  Definitions definitions = modelInstance.newInstance(Definitions.class);
  assertThat(definitions.getId()).isNotNull();

  Decision decision = modelInstance.newInstance(Decision.class);
  assertThat(decision.getId()).isNotNull();

  DecisionTable decisionTable = modelInstance.newInstance(DecisionTable.class);
  assertThat(decisionTable.getId()).isNotNull();

  Output output = modelInstance.newInstance(Output.class);
  assertThat(output.getId()).isNotNull();
}
 
Example #14
Source File: DmnEngineConfigurationBuilder.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
/**
 * Modify the given DMN engine configuration and return it.
 */
public DefaultDmnEngineConfiguration build() {

  List<DmnDecisionEvaluationListener> decisionEvaluationListeners = createCustomPostDecisionEvaluationListeners();
  dmnEngineConfiguration.setCustomPostDecisionEvaluationListeners(decisionEvaluationListeners);

  // override the decision table handler
  DmnTransformer dmnTransformer = dmnEngineConfiguration.getTransformer();
  dmnTransformer.getElementTransformHandlerRegistry().addHandler(Definitions.class, new DecisionRequirementsDefinitionTransformHandler());
  dmnTransformer.getElementTransformHandlerRegistry().addHandler(Decision.class, new DecisionDefinitionHandler());

  // do not override the script engine resolver if set
  if (dmnEngineConfiguration.getScriptEngineResolver() == null) {
    ensureNotNull("scriptEngineResolver", scriptEngineResolver);

    dmnEngineConfiguration.setScriptEngineResolver(scriptEngineResolver);
  }

  // do not override the el provider if set
  if (dmnEngineConfiguration.getElProvider() == null) {
    ensureNotNull("expressionManager", expressionManager);

    ProcessEngineElProvider elProvider = new ProcessEngineElProvider(expressionManager);
    dmnEngineConfiguration.setElProvider(elProvider);
  }

  if (dmnEngineConfiguration.getFeelCustomFunctionProviders() == null) {
    dmnEngineConfiguration.setFeelCustomFunctionProviders(feelCustomFunctionProviders);
  }

  return dmnEngineConfiguration;
}
 
Example #15
Source File: DmnDecisionRequirementsGraphTransformHandler.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
protected DmnDecisionRequirementsGraphImpl createFromDefinitions(DmnElementTransformContext context, Definitions definitions) {
  DmnDecisionRequirementsGraphImpl drd = createDmnElement();

  drd.setKey(definitions.getId());
  drd.setName(definitions.getName());

  return drd;
}
 
Example #16
Source File: DecisionRequirementsDefinitionTransformHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@Override
protected DmnDecisionRequirementsGraphImpl createFromDefinitions(DmnElementTransformContext context, Definitions definitions) {
  DecisionRequirementsDefinitionEntity entity = (DecisionRequirementsDefinitionEntity) super.createFromDefinitions(context, definitions);

  entity.setCategory(definitions.getNamespace());

  return entity;
}
 
Example #17
Source File: DmnDecisionRequirementsGraphTransformHandler.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected DmnDecisionRequirementsGraphImpl createFromDefinitions(DmnElementTransformContext context, Definitions definitions) {
  DmnDecisionRequirementsGraphImpl drd = createDmnElement();

  drd.setKey(definitions.getId());
  drd.setName(definitions.getName());

  return drd;
}
 
Example #18
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 #19
Source File: DefaultDmnTransform.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T extends DmnDecision> List<T> transformDecisions() {
  try {
    Definitions definitions = modelInstance.getDefinitions();
    Collection<Decision> decisions = definitions.getChildElementsByType(Decision.class);
    return (List<T>) transformDecisions(decisions);
  }
  catch (Exception e) {
    throw LOG.errorWhileTransformingDecisions(e);
  }
}
 
Example #20
Source File: DefaultDmnTransform.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T extends DmnDecision> List<T> transformDecisions() {
  try {
    Definitions definitions = modelInstance.getDefinitions();
    Collection<Decision> decisions = definitions.getChildElementsByType(Decision.class);
    return (List<T>) transformDecisions(decisions);
  }
  catch (Exception e) {
    throw LOG.errorWhileTransformingDecisions(e);
  }
}
 
Example #21
Source File: DefaultDmnTransform.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T extends DmnDecisionRequirementsGraph> T transformDecisionRequirementsGraph() {
  try {
    Definitions definitions = modelInstance.getDefinitions();
    return (T) transformDefinitions(definitions);
  }
  catch (Exception e) {
    throw LOG.errorWhileTransformingDefinitions(e);
  }
}
 
Example #22
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 #23
Source File: DefaultDmnTransform.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unchecked")
public <T extends DmnDecisionRequirementsGraph> T transformDecisionRequirementsGraph() {
  try {
    Definitions definitions = modelInstance.getDefinitions();
    return (T) transformDefinitions(definitions);
  }
  catch (Exception e) {
    throw LOG.errorWhileTransformingDefinitions(e);
  }
}
 
Example #24
Source File: DefaultDmnTransform.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
protected void notifyTransformListeners(Definitions definitions, DmnDecisionRequirementsGraphImpl dmnDecisionRequirementsGraph) {
  for (DmnTransformListener transformListener : transformListeners) {
    transformListener.transformDecisionRequirementsGraph(definitions, dmnDecisionRequirementsGraph);
  }
}
 
Example #25
Source File: ExpressionLanguageTest.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
@Test
public void shouldWriteExpressionLanguage() throws Exception {
  modelInstance = Dmn.createEmptyModel();
  Definitions definitions = generateNamedElement(Definitions.class, "definitions");
  definitions.setNamespace(TEST_NAMESPACE);
  definitions.setExpressionLanguage(EXPRESSION_LANGUAGE);
  modelInstance.setDocumentElement(definitions);

  Decision decision = generateNamedElement(Decision.class, "Check Order");
  definitions.addChildElement(decision);

  DecisionTable decisionTable = generateElement(DecisionTable.class);
  decision.addChildElement(decisionTable);

  Input input = generateElement(Input.class);
  decisionTable.getInputs().add(input);
  InputExpression inputExpression = generateElement(InputExpression.class);
  inputExpression.setExpressionLanguage(EXPRESSION_LANGUAGE);
  input.setInputExpression(inputExpression);
  InputValues inputValues = generateElement(InputValues.class);
  inputValues.setExpressionLanguage(EXPRESSION_LANGUAGE);
  inputValues.setText(generateElement(Text.class));
  input.setInputValues(inputValues);

  Output output = generateElement(Output.class);
  decisionTable.getOutputs().add(output);
  OutputValues outputValues = generateElement(OutputValues.class);
  outputValues.setExpressionLanguage(EXPRESSION_LANGUAGE);
  outputValues.setText(generateElement(Text.class));
  output.setOutputValues(outputValues);

  Rule rule = generateElement(Rule.class);
  decisionTable.getRules().add(rule);
  InputEntry inputEntry = generateElement(InputEntry.class);
  inputEntry.setExpressionLanguage(EXPRESSION_LANGUAGE);
  inputEntry.setText(generateElement(Text.class));
  rule.getInputEntries().add(inputEntry);
  OutputEntry outputEntry = generateElement(OutputEntry.class);
  outputEntry.setExpressionLanguage(EXPRESSION_LANGUAGE);
  rule.getOutputEntries().add(outputEntry);

  assertModelEqualsFile(EXPRESSION_LANGUAGE_DMN);
}
 
Example #26
Source File: DmnDecisionRequirementsGraphTransformHandler.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public DmnDecisionRequirementsGraphImpl handleElement(DmnElementTransformContext context, Definitions definitions) {
  return createFromDefinitions(context, definitions);
}
 
Example #27
Source File: DmnTransformListenerTest.java    From camunda-engine-dmn with Apache License 2.0 4 votes vote down vote up
public Definitions getDefinitions() {
  return definitions;
}
 
Example #28
Source File: DmnModelInstanceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setDefinitions(Definitions definitions) {
  setDocumentElement(definitions);
}
 
Example #29
Source File: DmnModelInstanceImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public Definitions getDefinitions() {
  return (Definitions) getDocumentElement();
}
 
Example #30
Source File: DefinitionsImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Definitions.class, DMN_ELEMENT_DEFINITIONS)
    .namespaceUri(DMN11_NS)
    .extendsType(NamedElement.class)
    .instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<Definitions>() {
      public Definitions newInstance(ModelTypeInstanceContext instanceContext) {
        return new DefinitionsImpl(instanceContext);
      }
    });

  expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE)
    .defaultValue("http://www.omg.org/spec/FEEL/20140401")
    .build();

  typeLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_TYPE_LANGUAGE)
    .defaultValue("http://www.omg.org/spec/FEEL/20140401")
    .build();

  namespaceAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_NAMESPACE)
    .required()
    .build();

  exporterAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPORTER)
    .build();

  exporterVersionAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPORTER_VERSION)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  importCollection = sequenceBuilder.elementCollection(Import.class)
    .build();

  itemDefinitionCollection = sequenceBuilder.elementCollection(ItemDefinition.class)
    .build();

  drgElementCollection = sequenceBuilder.elementCollection(DrgElement.class)
    .build();

  artifactCollection = sequenceBuilder.elementCollection(Artifact.class)
    .build();

  elementCollectionCollection = sequenceBuilder.elementCollection(ElementCollection.class)
    .build();

  businessContextElementCollection = sequenceBuilder.elementCollection(BusinessContextElement.class)
    .build();

  typeBuilder.build();
}