Search in sources :

Example 1 with ImportedValues

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

the class ImportedValuesConverter method wbFromDMN.

public static ImportedValues wbFromDMN(final org.kie.dmn.model.api.ImportedValues dmn) {
    if (dmn == null) {
        return null;
    }
    final String namespace = dmn.getNamespace();
    final LocationURI locationURI = new LocationURI(dmn.getLocationURI());
    final String importType = dmn.getImportType();
    final String importedElement = dmn.getImportedElement();
    final ExpressionLanguage expressionLanguage = ExpressionLanguagePropertyConverter.wbFromDMN(dmn.getExpressionLanguage());
    final ImportedValues wb = new ImportedValues(namespace, locationURI, importType, importedElement, expressionLanguage);
    final String id = dmn.getId();
    final String name = dmn.getName();
    final String description = dmn.getDescription();
    final String fallbackUUID = UUID.randomUUID().toString();
    wb.setId(new Id(id != null ? id : fallbackUUID));
    wb.setName(new Name(name != null ? name : fallbackUUID));
    wb.setDescription(DescriptionPropertyConverter.wbFromDMN(description));
    return wb;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) ImportedValues(org.kie.workbench.common.dmn.api.definition.model.ImportedValues) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 2 with ImportedValues

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

the class LiteralExpressionPropertyConverter method wbFromDMN.

public static LiteralExpression wbFromDMN(final org.kie.dmn.model.api.LiteralExpression dmn) {
    if (dmn == null) {
        return null;
    }
    final Id id = new Id(dmn.getId());
    final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
    final QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef(), dmn);
    final Text text = new Text(dmn.getText() != null ? 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 (importedValues != null) {
        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) 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) 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)

Example 3 with ImportedValues

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

the class ImportedValuesConverter method wbFromDMN.

public static ImportedValues wbFromDMN(final JSITImportedValues dmn) {
    if (Objects.isNull(dmn)) {
        return null;
    }
    final String namespace = dmn.getNamespace();
    final LocationURI locationURI = new LocationURI(dmn.getLocationURI());
    final String importType = dmn.getImportType();
    final String importedElement = dmn.getImportedElement();
    final ExpressionLanguage expressionLanguage = ExpressionLanguagePropertyConverter.wbFromDMN(dmn.getExpressionLanguage());
    final ImportedValues wb = new ImportedValues(namespace, locationURI, importType, importedElement, expressionLanguage);
    final String name = dmn.getName();
    final String description = dmn.getDescription();
    wb.setId(IdPropertyConverter.wbFromDMN(dmn.getId()));
    wb.setName(new Name(Objects.nonNull(name) ? name : wb.getId().getValue()));
    wb.setDescription(DescriptionPropertyConverter.wbFromDMN(description));
    return wb;
}
Also used : LocationURI(org.kie.workbench.common.dmn.api.property.dmn.LocationURI) JSITImportedValues(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImportedValues) ImportedValues(org.kie.workbench.common.dmn.api.definition.model.ImportedValues) ExpressionLanguage(org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage) Name(org.kie.workbench.common.dmn.api.property.dmn.Name)

Example 4 with ImportedValues

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

the class InputClauseLiteralExpressionPropertyConverter method wbFromDMN.

public static InputClauseLiteralExpression 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(dmn.getText());
    final ImportedValues importedValues = ImportedValuesConverter.wbFromDMN(dmn.getImportedValues());
    final InputClauseLiteralExpression result = new InputClauseLiteralExpression(id, description, typeRef, text, importedValues);
    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) ImportedValues(org.kie.workbench.common.dmn.api.definition.model.ImportedValues) InputClauseLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.InputClauseLiteralExpression) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Example 5 with ImportedValues

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

the class OutputClauseLiteralExpressionPropertyConverter method wbFromDMN.

/**
 * Returns a non-null instance of OutputClauseLiteralExpression. The Properties Panel needs
 * non-null objects to bind therefore a concrete object must always be returned.
 * @param dmn
 * @return
 */
public static OutputClauseLiteralExpression wbFromDMN(final JSITLiteralExpression dmn) {
    if (Objects.isNull(dmn)) {
        return new OutputClauseLiteralExpression();
    }
    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(dmn.getText());
    final ImportedValues importedValues = ImportedValuesConverter.wbFromDMN(dmn.getImportedValues());
    final OutputClauseLiteralExpression result = new OutputClauseLiteralExpression(id, description, typeRef, text, importedValues);
    if (Objects.nonNull(importedValues)) {
        importedValues.setParent(result);
    }
    return result;
}
Also used : Description(org.kie.workbench.common.dmn.api.property.dmn.Description) OutputClauseLiteralExpression(org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression) QName(org.kie.workbench.common.dmn.api.property.dmn.QName) ImportedValues(org.kie.workbench.common.dmn.api.definition.model.ImportedValues) Text(org.kie.workbench.common.dmn.api.property.dmn.Text) Id(org.kie.workbench.common.dmn.api.property.dmn.Id)

Aggregations

ImportedValues (org.kie.workbench.common.dmn.api.definition.model.ImportedValues)8 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)7 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)6 QName (org.kie.workbench.common.dmn.api.property.dmn.QName)6 Text (org.kie.workbench.common.dmn.api.property.dmn.Text)6 ExpressionLanguage (org.kie.workbench.common.dmn.api.property.dmn.ExpressionLanguage)4 InputClauseLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.InputClauseLiteralExpression)2 IsLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.IsLiteralExpression)2 LiteralExpression (org.kie.workbench.common.dmn.api.definition.model.LiteralExpression)2 OutputClauseLiteralExpression (org.kie.workbench.common.dmn.api.definition.model.OutputClauseLiteralExpression)2 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)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)1