Search in sources :

Example 6 with ImportedValues

use of org.kie.dmn.model.api.ImportedValues in project kie-wb-common by kiegroup.

the class BaseLiteralExpressionPropertyConverterTest method testDMNFromWB.

@Test
public void testDMNFromWB() {
    final org.kie.workbench.common.dmn.api.definition.model.ImportedValues importedValues = new org.kie.workbench.common.dmn.api.definition.model.ImportedValues();
    importedValues.setImportedElement(IMPORTED_ELEMENT);
    final org.kie.workbench.common.dmn.api.definition.model.LiteralExpression wb = new org.kie.workbench.common.dmn.api.definition.model.LiteralExpression(new Id(UUID), new Description(DESCRIPTION), BuiltInType.BOOLEAN.asQName(), new Text(TEXT), importedValues, new ExpressionLanguage(EXPRESSION_LANGUAGE));
    final LiteralExpression dmn = LiteralExpressionPropertyConverter.dmnFromWB(wb);
    assertThat(dmn.getId()).isEqualTo(UUID);
    assertThat(dmn.getDescription()).isEqualTo(DESCRIPTION);
    assertThat(dmn.getTypeRef().getNamespaceURI()).isEmpty();
    assertThat(dmn.getTypeRef().getLocalPart()).isEqualTo(BuiltInType.BOOLEAN.getName());
    assertThat(dmn.getText()).isEqualTo(TEXT);
    assertThat(dmn.getImportedValues()).isNotNull();
    assertThat(dmn.getImportedValues().getImportedElement()).isEqualTo(IMPORTED_ELEMENT);
    assertThat(dmn.getExpressionLanguage()).isEqualTo(EXPRESSION_LANGUAGE);
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) TLiteralExpression(org.kie.dmn.model.v1_2.TLiteralExpression) IsLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression) LiteralExpression(org.kie.dmn.model.api.LiteralExpression) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage) ImportedValues(org.kie.dmn.model.api.ImportedValues) TImportedValues(org.kie.dmn.model.v1_2.TImportedValues) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) Test(org.junit.Test)

Example 7 with ImportedValues

use of org.kie.dmn.model.api.ImportedValues in project kie-wb-common by kiegroup.

the class BaseLiteralExpressionPropertyConverterTest method testWBFromDMN.

@Test
public void testWBFromDMN() {
    final LiteralExpression dmn = new TLiteralExpression();
    final QName typeRef = new QName(KIE.getUri(), LOCAL, KIE.getPrefix());
    final ImportedValues importedValues = new TImportedValues();
    importedValues.setImportedElement(IMPORTED_ELEMENT);
    dmn.setId(UUID);
    dmn.setDescription(DESCRIPTION);
    dmn.setTypeRef(typeRef);
    dmn.setText(TEXT);
    dmn.setImportedValues(importedValues);
    final T wb = convertWBFromDMN(dmn);
    assertThat(wb.getId().getValue()).isEqualTo(UUID);
    assertThat(wb.getDescription().getValue()).isEqualTo(DESCRIPTION);
    assertThat(wb.getTypeRef().getNamespaceURI()).isEqualTo(KIE.getUri());
    assertThat(wb.getTypeRef().getLocalPart()).isEqualTo(LOCAL);
    assertThat(wb.getTypeRef().getPrefix()).isEqualTo(KIE.getPrefix());
    assertThat(wb.getText().getValue()).isEqualTo(TEXT);
    assertThat(wb.getImportedValues().getImportedElement()).isEqualTo(IMPORTED_ELEMENT);
    assertThat(wb.getImportedValues().getParent()).isEqualTo(wb);
}
Also used : QName(javax.xml.namespace.QName) TLiteralExpression(org.kie.dmn.model.v1_2.TLiteralExpression) IsLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression) LiteralExpression(org.kie.dmn.model.api.LiteralExpression) ImportedValues(org.kie.dmn.model.api.ImportedValues) TImportedValues(org.kie.dmn.model.v1_2.TImportedValues) TImportedValues(org.kie.dmn.model.v1_2.TImportedValues) TLiteralExpression(org.kie.dmn.model.v1_2.TLiteralExpression) Test(org.junit.Test)

Example 8 with ImportedValues

use of org.kie.dmn.model.api.ImportedValues in project drools by kiegroup.

the class ImportedValuesConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    ImportedValues iv = (ImportedValues) parent;
    String expressionLanguage = reader.getAttribute(EXPRESSION_LANGUAGE);
    iv.setExpressionLanguage(expressionLanguage);
}
Also used : ImportedValues(org.kie.dmn.model.api.ImportedValues) TImportedValues(org.kie.dmn.model.v1_2.TImportedValues)

Example 9 with ImportedValues

use of org.kie.dmn.model.api.ImportedValues in project drools by kiegroup.

the class ImportedValuesConverter method writeChildren.

@Override
protected void writeChildren(HierarchicalStreamWriter writer, MarshallingContext context, Object parent) {
    super.writeChildren(writer, context, parent);
    ImportedValues iv = (ImportedValues) parent;
    writeChildrenNode(writer, context, iv.getImportedElement(), IMPORTED_ELEMENT);
}
Also used : ImportedValues(org.kie.dmn.model.api.ImportedValues) TImportedValues(org.kie.dmn.model.v1_2.TImportedValues)

Example 10 with ImportedValues

use of org.kie.dmn.model.api.ImportedValues in project drools by kiegroup.

the class ImportedValuesConverter method assignAttributes.

@Override
protected void assignAttributes(HierarchicalStreamReader reader, Object parent) {
    super.assignAttributes(reader, parent);
    ImportedValues iv = (ImportedValues) parent;
    String expressionLanguage = reader.getAttribute(EXPRESSION_LANGUAGE);
    iv.setExpressionLanguage(expressionLanguage);
}
Also used : TImportedValues(org.kie.dmn.model.v1_1.TImportedValues) ImportedValues(org.kie.dmn.model.api.ImportedValues)

Aggregations

ImportedValues (org.kie.dmn.model.api.ImportedValues)14 TImportedValues (org.kie.dmn.model.v1_2.TImportedValues)5 TImportedValues (org.kie.dmn.model.v1_1.TImportedValues)3 TImportedValues (org.kie.dmn.model.v1_3.TImportedValues)3 TImportedValues (org.kie.dmn.model.v1_4.TImportedValues)3 Test (org.junit.Test)2 LiteralExpression (org.kie.dmn.model.api.LiteralExpression)2 TLiteralExpression (org.kie.dmn.model.v1_2.TLiteralExpression)2 IsLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression)2 QName (javax.xml.namespace.QName)1 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)1 ExpressionLanguage (org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage)1 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)1 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)1