Search in sources :

Example 11 with ExpressionLanguage

use of org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage in project kie-wb-common by kiegroup.

the class UnaryTestsTest method testCopy.

@Test
public void testCopy() {
    final UnaryTests source = new UnaryTests(new Id(UNARY_ID), new Description(DESCRIPTION), new Text(TEXT_VALUE), new ExpressionLanguage(EXPRESSION_LANGUAGE), NONE);
    final UnaryTests target = source.copy();
    assertNotNull(target);
    assertNotEquals(UNARY_ID, target.getId());
    assertEquals(DESCRIPTION, target.getDescription().getValue());
    assertEquals(TEXT_VALUE, target.getText().getValue());
    assertEquals(EXPRESSION_LANGUAGE, target.getExpressionLanguage().getValue());
    assertEquals(NONE, target.getConstraintType());
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage) Test(org.junit.Test)

Example 12 with ExpressionLanguage

use of org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage in project kie-wb-common by kiegroup.

the class LiteralExpressionPropertyConverter method wbFromDMN.

public static LiteralExpression wbFromDMN(final JSITLiteralExpression dmn) {
    if (Objects.isNull(dmn)) {
        return null;
    }
    final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
    final Text text = new Text(Objects.nonNull(dmn.getText()) ? dmn.getText() : "");
    final ExpressionLanguage expressionLanguage = ExpressionLanguagePropertyConverter.wbFromDMN(dmn.getExpressionLanguage());
    final ImportedValues importedValues = ImportedValuesConverter.wbFromDMN(dmn.getImportedValues());
    final LiteralExpression result = new LiteralExpression(id, description, typeRef, text, importedValues, expressionLanguage);
    if (Objects.nonNull(importedValues)) {
        importedValues.setParent(result);
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) JSITImportedValues(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImportedValues) ImportedValues(org.kie.workbench.common.dmn.api.definition.model.ImportedValues) IsLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression) LiteralExpression(org.kie.workbench.common.dmn.api.definition.model.LiteralExpression) JSITLiteralExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITLiteralExpression) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage)

Aggregations

ExpressionLanguage (org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage)12 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)10 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)8 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)8 Test (org.junit.Test)5 ImportedValues (org.kie.workbench.common.dmn.api.definition.model.ImportedValues)4 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)4 IsLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression)3 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)3 QName (javax.xml.namespace.QName)2 ConstraintType (org.kie.workbench.common.dmn.api.definition.model.ConstraintType)2 IsUnaryTests (org.kie.workbench.common.dmn.api.definition.model.IsUnaryTests)2 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)2 UnaryTests (org.kie.workbench.common.dmn.api.definition.model.UnaryTests)2 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)2 JSITImportedValues (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImportedValues)2 JSITLiteralExpression (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITLiteralExpression)2 ImportedValues (org.kie.dmn.model.api.ImportedValues)1 LiteralExpression (org.kie.dmn.model.api.LiteralExpression)1 TImportedValues (org.kie.dmn.model.v1_2.TImportedValues)1