use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class DecisionTableEditorDefinition method getModelClass.
@Override
public Optional<DecisionTable> getModelClass() {
final DecisionTable dtable = new DecisionTable();
dtable.setHitPolicy(HitPolicy.ANY);
dtable.setPreferredOrientation(DecisionTableOrientation.RULE_AS_ROW);
final InputClause ic = new InputClause();
final LiteralExpression le = new LiteralExpression();
le.setText(INPUT_CLAUSE_EXPRESSION_TEXT);
ic.setInputExpression(le);
dtable.getInput().add(ic);
final OutputClause oc = new OutputClause();
oc.setName(OUTPUT_CLAUSE_NAME);
dtable.getOutput().add(oc);
final DecisionRule dr = new DecisionRule();
final UnaryTests drut = new UnaryTests();
drut.setText(INPUT_CLAUSE_UNARY_TEST_TEXT);
dr.getInputEntry().add(drut);
final LiteralExpression drle = new LiteralExpression();
drle.setText(OUTPUT_CLAUSE_EXPRESSION_TEXT);
dr.getOutputEntry().add(drle);
final Description d = new Description();
d.setValue(RULE_DESCRIPTION);
dr.setDescription(d);
dtable.getRule().add(dr);
return Optional.of(dtable);
}
use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class DecisionTableUIModelMapperTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
this.uiModel = new BaseGridData();
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendRow(new DMNGridRow());
this.uiModel.appendColumn(uiRowNumberColumn);
this.uiModel.appendColumn(uiInputClauseColumn);
this.uiModel.appendColumn(uiOutputClauseColumn);
this.uiModel.appendColumn(uiDescriptionColumn);
doReturn(0).when(uiRowNumberColumn).getIndex();
doReturn(1).when(uiInputClauseColumn).getIndex();
doReturn(2).when(uiOutputClauseColumn).getIndex();
doReturn(3).when(uiDescriptionColumn).getIndex();
this.dtable = new DecisionTable();
this.dtable.getInput().add(new InputClause());
this.dtable.getOutput().add(new OutputClause());
this.dtable.getRule().add(new DecisionRule() {
{
getInputEntry().add(new UnaryTests() {
{
setText("i1");
}
});
getOutputEntry().add(new LiteralExpression() {
{
setText("o1");
}
});
setDescription(new Description("desc1"));
}
});
this.dtable.getRule().add(new DecisionRule() {
{
getInputEntry().add(new UnaryTests() {
{
setText("i2");
}
});
getOutputEntry().add(new LiteralExpression() {
{
setText("o2");
}
});
setDescription(new Description("desc2"));
}
});
this.mapper = new DecisionTableUIModelMapper(() -> uiModel, () -> Optional.of(dtable), listSelector);
this.cellValueSupplier = Optional::empty;
}
use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class BusinessKnowledgeModelConverter method nodeFromDMN.
@Override
public Node<View<BusinessKnowledgeModel>, ?> nodeFromDMN(final org.kie.dmn.model.v1_1.BusinessKnowledgeModel dmn) {
@SuppressWarnings("unchecked") Node<View<BusinessKnowledgeModel>, ?> node = (Node<View<BusinessKnowledgeModel>, ?>) factoryManager.newElement(dmn.getId(), BusinessKnowledgeModel.class).asNode();
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
Name name = new Name(dmn.getName());
InformationItem informationItem = InformationItemPropertyConverter.wbFromDMN(dmn.getVariable());
FunctionDefinition functionDefinition = FunctionDefinitionPropertyConverter.wbFromDMN(dmn.getEncapsulatedLogic());
BusinessKnowledgeModel bkm = new BusinessKnowledgeModel(id, description, name, informationItem, functionDefinition, new BackgroundSet(), new FontSet(), new RectangleDimensionsSet());
node.getContent().setDefinition(bkm);
return node;
}
use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class DecisionRulePropertyConverter method wbFromDMN.
public static DecisionRule wbFromDMN(final org.kie.dmn.model.v1_1.DecisionRule dmn) {
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
DecisionRule result = new DecisionRule();
result.setId(id);
result.setDescription(description);
for (org.kie.dmn.model.v1_1.UnaryTests ie : dmn.getInputEntry()) {
result.getInputEntry().add(UnaryTestsPropertyConverter.wbFromDMN(ie));
}
for (org.kie.dmn.model.v1_1.LiteralExpression oe : dmn.getOutputEntry()) {
result.getOutputEntry().add(LiteralExpressionPropertyConverter.wbFromDMN(oe));
}
return result;
}
use of org.kie.workbench.common.dmn.api.property.dmn.Description in project kie-wb-common by kiegroup.
the class InputClausePropertyConverter method wbFromDMN.
public static InputClause wbFromDMN(final org.kie.dmn.model.v1_1.InputClause dmn) {
Id id = new Id(dmn.getId());
Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
LiteralExpression inputExpression = LiteralExpressionPropertyConverter.wbFromDMN(dmn.getInputExpression());
UnaryTests inputValues = UnaryTestsPropertyConverter.wbFromDMN(dmn.getInputValues());
InputClause result = new InputClause(id, description, inputExpression, inputValues);
return result;
}
Aggregations