use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.
the class InputDataTest method testConstructor.
@Test
public void testConstructor() {
final Id id = mock(Id.class);
final Description description = mock(Description.class);
final Name name = mock(Name.class);
final StylingSet stylingSet = mock(StylingSet.class);
final GeneralRectangleDimensionsSet dimensionsSet = mock(GeneralRectangleDimensionsSet.class);
final InformationItemPrimary variable = new InformationItemPrimary();
final InputData expectedParent = new InputData(id, description, name, variable, stylingSet, dimensionsSet);
final DMNModelInstrumentedBase actualParent = variable.getParent();
assertEquals(expectedParent, actualParent);
}
use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.
the class BusinessKnowledgeModelTest method testConstructor.
@Test
public void testConstructor() {
final Id id = mock(Id.class);
final Description description = mock(Description.class);
final Name name = mock(Name.class);
final FunctionDefinition functionDefinition = mock(FunctionDefinition.class);
final StylingSet stylingSet = mock(StylingSet.class);
final GeneralRectangleDimensionsSet dimensionsSet = mock(GeneralRectangleDimensionsSet.class);
final InformationItemPrimary variable = new InformationItemPrimary();
final BusinessKnowledgeModel expectedParent = new BusinessKnowledgeModel(id, description, name, variable, functionDefinition, stylingSet, dimensionsSet);
final DMNModelInstrumentedBase actualParent = variable.getParent();
assertEquals(expectedParent, actualParent);
}
use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.
the class KnowledgeSourceConverter method nodeFromDMN.
@Override
public Node<View<KnowledgeSource>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
final JSITKnowledgeSource dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
@SuppressWarnings("unchecked") final Node<View<KnowledgeSource>, ?> node = (Node<View<KnowledgeSource>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(KnowledgeSource.class)).asNode();
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final KnowledgeSourceType ksType = new KnowledgeSourceType(dmn.getType());
final LocationURI locationURI = new LocationURI(dmn.getLocationURI());
final KnowledgeSource ks = new KnowledgeSource(id, description, name, ksType, locationURI, new StylingSet(), new GeneralRectangleDimensionsSet());
ks.setDiagramId(nodeEntry.getDiagramId());
node.getContent().setDefinition(ks);
DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, ks);
return node;
}
use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.
the class InputDataConverter method nodeFromDMN.
@Override
public Node<View<InputData>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
final JSITInputData dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
@SuppressWarnings("unchecked") final Node<View<InputData>, ?> node = (Node<View<InputData>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(InputData.class)).asNode();
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn);
final InputData inputData = new InputData(id, description, name, informationItem, new StylingSet(), new GeneralRectangleDimensionsSet());
inputData.setDiagramId(nodeEntry.getDiagramId());
node.getContent().setDefinition(inputData);
if (Objects.nonNull(informationItem)) {
informationItem.setParent(inputData);
}
DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, inputData);
return node;
}
use of org.kie.workbench.common.dmn.api.property.dimensions.GeneralRectangleDimensionsSet in project kie-wb-common by kiegroup.
the class DecisionConverter method nodeFromDMN.
@Override
public Node<View<Decision>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
final JSITDecision dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
@SuppressWarnings("unchecked") final Node<View<Decision>, ?> node = (Node<View<Decision>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(Decision.class)).asNode();
final Id id = IdPropertyConverter.wbFromDMN(dmn.getId());
final Description description = DescriptionPropertyConverter.wbFromDMN(dmn.getDescription());
final Name name = new Name(dmn.getName());
final InformationItemPrimary informationItem = InformationItemPrimaryPropertyConverter.wbFromDMN(dmn.getVariable(), dmn);
Expression expression = null;
final JSITExpression jsiWrapped = dmn.getExpression();
if (Objects.nonNull(jsiWrapped)) {
final JSITExpression jsiExpression = Js.uncheckedCast(JsUtils.getUnwrappedElement(jsiWrapped));
expression = ExpressionPropertyConverter.wbFromDMN(jsiExpression, Js.uncheckedCast(dmn), nodeEntry.getComponentWidthsConsumer());
}
final Decision decision = new Decision(id, description, name, new Question(), new AllowedAnswers(), informationItem, expression, new StylingSet(), new GeneralRectangleDimensionsSet());
decision.setDiagramId(nodeEntry.getDiagramId());
decision.setQuestion(QuestionPropertyConverter.wbFromDMN(dmn.getQuestion()));
decision.setAllowedAnswers(AllowedAnswersPropertyConverter.wbFromDMN(dmn.getAllowedAnswers()));
node.getContent().setDefinition(decision);
if (Objects.nonNull(informationItem)) {
informationItem.setParent(decision);
}
if (Objects.nonNull(expression)) {
expression.setParent(decision);
}
DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decision);
return node;
}
Aggregations