use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class UnaryTestsPropertyConverter method wbFromDMN.
public static UnaryTests wbFromDMN(final org.kie.dmn.model.v1_1.UnaryTests dmn) {
if (dmn == null) {
return null;
}
Id id = new Id(dmn.getId());
Description description = new Description(dmn.getDescription());
UnaryTests result = new UnaryTests(id, description, dmn.getText(), dmn.getExpressionLanguage());
return result;
}
use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class AddDecisionRuleCommand method newGraphCommand.
@Override
protected Command<GraphCommandExecutionContext, RuleViolation> newGraphCommand(final AbstractCanvasHandler context) {
return new AbstractGraphCommand() {
@Override
protected CommandResult<RuleViolation> check(final GraphCommandExecutionContext context) {
return GraphCommandResultBuilder.SUCCESS;
}
@Override
public CommandResult<RuleViolation> execute(final GraphCommandExecutionContext context) {
dtable.getRule().add(uiRowIndex, rule);
for (int ie = 0; ie < dtable.getInput().size(); ie++) {
final UnaryTests ut = new UnaryTests();
ut.setText(AddInputClauseCommand.INPUT_CLAUSE_DEFAULT_VALUE);
rule.getInputEntry().add(ut);
}
for (int oe = 0; oe < dtable.getOutput().size(); oe++) {
final LiteralExpression le = new LiteralExpression();
le.setText(AddOutputClauseCommand.OUTPUT_CLAUSE_DEFAULT_VALUE);
rule.getOutputEntry().add(le);
}
final Description d = new Description();
d.setValue(DESCRIPTION_DEFAULT_VALUE);
rule.setDescription(d);
return GraphCommandResultBuilder.SUCCESS;
}
@Override
public CommandResult<RuleViolation> undo(final GraphCommandExecutionContext context) {
dtable.getRule().remove(rule);
return GraphCommandResultBuilder.SUCCESS;
}
};
}
use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class OutputClausePropertyConverter method wbFromDMN.
public static OutputClause wbFromDMN(final org.kie.dmn.model.v1_1.OutputClause dmn) {
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
UnaryTests outputValues = UnaryTestsPropertyConverter.wbFromDMN(dmn.getOutputValues());
LiteralExpression defaultOutputEntry = LiteralExpressionPropertyConverter.wbFromDMN(dmn.getDefaultOutputEntry());
QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
OutputClause result = new OutputClause();
result.setId(id);
result.setName(dmn.getName());
result.setDescription(description);
result.setOutputValues(outputValues);
result.setDefaultOutputEntry(defaultOutputEntry);
result.setTypeRef(typeRef);
return result;
}
use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class RelationPropertyConverter method wbFromDMN.
public static Relation wbFromDMN(final org.kie.dmn.model.v1_1.Relation dmn) {
Id id = new Id(dmn.getId());
Description description = new Description(dmn.getDescription());
QName typeRef = QNamePropertyConverter.wbFromDMN(dmn.getTypeRef());
List<org.kie.dmn.model.v1_1.InformationItem> column = dmn.getColumn();
List<org.kie.dmn.model.v1_1.List> row = dmn.getRow();
List<InformationItem> convertedColumn = column.stream().map(InformationItemPropertyConverter::wbFromDMN).collect(Collectors.toList());
List<org.kie.workbench.common.dmn.api.definition.v1_1.List> convertedRow = row.stream().map(ListPropertyConverter::wbFromDMN).collect(Collectors.toList());
Relation result = new Relation(id, description, typeRef, convertedColumn, convertedRow);
return result;
}
use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class TextAnnotationConverter method nodeFromDMN.
@Override
public Node<View<TextAnnotation>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.TextAnnotation dmn) {
@SuppressWarnings("unchecked") Node<View<TextAnnotation>, ?> node = (Node<View<TextAnnotation>, ?>) factoryManager.newElement(dmn.getId(), TextAnnotation.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Text text = new Text(dmn.getText());
TextFormat textFormat = new TextFormat(dmn.getTextFormat());
TextAnnotation textAnnotation = new TextAnnotation(id, description, text, textFormat, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(textAnnotation);
return node;
}
Aggregations