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

The following examples show how to use org.camunda.bpm.model.dmn.instance.Text. 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: LiteralExpressionImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(LiteralExpression.class, DMN_ELEMENT_LITERAL_EXPRESSION)
    .namespaceUri(DMN11_NS)
    .extendsType(Expression.class)
    .instanceProvider(new ModelTypeInstanceProvider<LiteralExpression>() {
      public LiteralExpression newInstance(ModelTypeInstanceContext instanceContext) {
        return new LiteralExpressionImpl(instanceContext);
      }
    });

  expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  textChild = sequenceBuilder.element(Text.class)
    .build();

  importedValuesChild = sequenceBuilder.element(ImportedValues.class)
    .build();

  typeBuilder.build();
}
 
Example #2
Source File: UnaryTestsImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(UnaryTests.class, DMN_ELEMENT_UNARY_TESTS)
    .namespaceUri(DMN11_NS)
    .extendsType(DmnElement.class)
    .instanceProvider(new ModelTypeInstanceProvider<UnaryTests>() {
      public UnaryTests newInstance(ModelTypeInstanceContext instanceContext) {
        return new UnaryTestsImpl(instanceContext);
      }
    });

  expressionLanguageAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_EXPRESSION_LANGUAGE)
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  textChild = sequenceBuilder.element(Text.class)
    .build();

  typeBuilder.build();
}
 
Example #3
Source File: TextAnnotationImpl.java    From camunda-bpm-platform with Apache License 2.0 6 votes vote down vote up
public static void registerType(ModelBuilder modelBuilder) {
  ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(TextAnnotation.class, DMN_ELEMENT_TEXT_ANNOTATION)
    .namespaceUri(DMN11_NS)
    .extendsType(Artifact.class)
    .instanceProvider(new ModelTypeInstanceProvider<TextAnnotation>() {
      public TextAnnotation newInstance(ModelTypeInstanceContext instanceContext) {
        return new TextAnnotationImpl(instanceContext);
      }
    });

  textFormatAttribute = typeBuilder.stringAttribute(DMN_ATTRIBUTE_TEXT_FORMAT)
    .defaultValue("text/plain")
    .build();

  SequenceBuilder sequenceBuilder = typeBuilder.sequence();

  textChild = sequenceBuilder.element(Text.class)
    .build();

  typeBuilder.build();
}
 
Example #4
Source File: DmnExpressionTransformHelper.java    From camunda-engine-dmn with Apache License 2.0 5 votes vote down vote up
protected static String getExpression(Text text) {
  if (text != null) {
    String textContent = text.getTextContent();
    if (textContent != null && !textContent.isEmpty()) {
      return textContent;
    }
  }
  return null;
}
 
Example #5
Source File: DmnExpressionTransformHelper.java    From camunda-bpm-platform with Apache License 2.0 5 votes vote down vote up
protected static String getExpression(Text text) {
  if (text != null) {
    String textContent = text.getTextContent();
    if (textContent != null && !textContent.isEmpty()) {
      return textContent;
    }
  }
  return null;
}
 
Example #6
Source File: TextImpl.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(Text.class, DMN_ELEMENT_TEXT)
    .namespaceUri(DMN11_NS)
    .instanceProvider(new ModelTypeInstanceProvider<Text>() {
      public Text newInstance(ModelTypeInstanceContext instanceContext) {
        return new TextImpl(instanceContext);
      }
    });

  typeBuilder.build();
}
 
Example #7
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 #8
Source File: XlsxWorksheetConverter.java    From camunda-dmn-xlsx with Apache License 2.0 4 votes vote down vote up
protected Text generateText(DmnModelInstance dmnModel, String content) {
  Text text = dmnModel.newInstance(Text.class);
  text.setTextContent(content);
  return text;
}
 
Example #9
Source File: LiteralExpressionImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public Text getText() {
  return textChild.getChild(this);
}
 
Example #10
Source File: LiteralExpressionImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setText(Text text) {
  textChild.setChild(this, text);
}
 
Example #11
Source File: UnaryTestsImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public Text getText() {
  return textChild.getChild(this);
}
 
Example #12
Source File: UnaryTestsImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setText(Text text) {
  textChild.setChild(this, text);
}
 
Example #13
Source File: TextAnnotationImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public Text getText() {
  return textChild.getChild(this);
}
 
Example #14
Source File: TextAnnotationImpl.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public void setText(Text text) {
  textChild.setChild(this, text);
}
 
Example #15
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);
}