use of org.kie.workbench.common.dmn.api.definition.model.DecisionService in project kie-wb-common by kiegroup.
the class DMNDecisionServiceSVGShapeDefImplTest method testNewViewInstance.
@Test
public void testNewViewInstance() {
final DecisionService decisionService = new DecisionService();
shapeDef.newViewInstance(viewFactory, decisionService);
verify(viewFactory).decisionService();
verify(viewResource).build(decisionService.getDimensionsSet().getWidth().getValue(), decisionService.getDimensionsSet().getHeight().getValue(), true);
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionService in project kie-wb-common by kiegroup.
the class WrapperUtils method stunnerToDDExt.
private static JSIDMNShape stunnerToDDExt(final JSIDMNDiagram diagram, final List<String> dmnDiagramElementIds, final Definitions definitionsStunnerPojo, final View<? extends DMNElement> v, final String namespaceURI) {
final JSIDMNShape result = new JSIDMNShape();
final DMNElement definition = v.getDefinition();
final String dmnElementId = definition.getId().getValue();
final String shapeId = getShapeId(diagram, dmnDiagramElementIds, dmnElementId);
result.setId(shapeId);
result.setDmnElementRef(getDmnElementRef(definitionsStunnerPojo, v, namespaceURI));
final JSIBounds bounds = new JSIBounds();
result.setBounds(bounds);
bounds.setX(xOfBound(upperLeftBound(v)));
bounds.setY(yOfBound(upperLeftBound(v)));
result.setDMNLabel(new JSIDMNLabel());
// TODO {gcardosi}: HARDCODED
result.setIsCollapsed(false);
final JSIDMNStyle style = new JSIDMNStyle();
if (v.getDefinition() instanceof Decision) {
final Decision d = (Decision) v.getDefinition();
applyBounds(d.getDimensionsSet(), bounds);
applyStylingStyles(d.getStylingSet(), style);
} else if (v.getDefinition() instanceof InputData) {
InputData d = (InputData) v.getDefinition();
applyBounds(d.getDimensionsSet(), bounds);
applyStylingStyles(d.getStylingSet(), style);
} else if (v.getDefinition() instanceof BusinessKnowledgeModel) {
final BusinessKnowledgeModel d = (BusinessKnowledgeModel) v.getDefinition();
applyBounds(d.getDimensionsSet(), bounds);
applyStylingStyles(d.getStylingSet(), style);
} else if (v.getDefinition() instanceof KnowledgeSource) {
final KnowledgeSource d = (KnowledgeSource) v.getDefinition();
applyBounds(d.getDimensionsSet(), bounds);
applyStylingStyles(d.getStylingSet(), style);
} else if (v.getDefinition() instanceof TextAnnotation) {
final TextAnnotation d = (TextAnnotation) v.getDefinition();
applyBounds(d.getDimensionsSet(), bounds);
applyStylingStyles(d.getStylingSet(), style);
} else if (v.getDefinition() instanceof DecisionService) {
final DecisionService d = (DecisionService) v.getDefinition();
applyBounds(d.getDimensionsSet(), bounds);
applyStylingStyles(d.getStylingSet(), style);
final JSIDMNDecisionServiceDividerLine dl = new JSIDMNDecisionServiceDividerLine();
final JSIPoint leftPoint = new JSIPoint();
leftPoint.setX(v.getBounds().getUpperLeft().getX());
final double dlY = v.getBounds().getUpperLeft().getY() + d.getDividerLineY().getValue();
leftPoint.setY(dlY);
dl.addWaypoint(leftPoint);
final JSIPoint rightPoint = new JSIPoint();
rightPoint.setX(v.getBounds().getLowerRight().getX());
rightPoint.setY(dlY);
dl.addWaypoint(rightPoint);
result.setDMNDecisionServiceDividerLine(dl);
}
result.setStyle(getWrappedJSIDMNStyle(style));
return result;
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionService in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method check_decisionservice_1outputDecision1encapsulatedDecision.
@SuppressWarnings("unchecked")
private void check_decisionservice_1outputDecision1encapsulatedDecision(Graph<?, Node<?, ?>> graph) {
Node<?, ?> node = graph.getNode("_659a06e2-ae80-496c-8783-f790a640bb49");
assertNodeContentDefinitionIs(node, DecisionService.class);
DecisionService definition = ((View<DecisionService>) node.getContent()).getDefinition();
assertEquals(1, definition.getEncapsulatedDecision().size());
assertEquals("#" + "_afce4fb3-9a7c-4791-bbfe-63d4b76bd61a", definition.getEncapsulatedDecision().get(0).getHref());
assertEquals(1, definition.getInputData().size());
assertEquals("#" + "_dd5b090f-6d52-4bd8-8c7f-0c469983d44e", definition.getInputData().get(0).getHref());
assertEquals(1, definition.getOutputDecision().size());
assertEquals("#" + "_3a69915a-30af-4de3-a07f-6be514f53caa", definition.getOutputDecision().get(0).getHref());
assertEquals(0, definition.getInputDecision().size());
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionService in project kie-wb-common by kiegroup.
the class DMNMarshallerStandaloneTest method check_decisionservice_1outputDecision.
@SuppressWarnings("unchecked")
private void check_decisionservice_1outputDecision(Graph<?, Node<?, ?>> graph) {
Node<?, ?> node = graph.getNode("_659a06e2-ae80-496c-8783-f790a640bb49");
assertNodeContentDefinitionIs(node, DecisionService.class);
DecisionService definition = ((View<DecisionService>) node.getContent()).getDefinition();
assertEquals(0, definition.getEncapsulatedDecision().size());
assertEquals(0, definition.getInputData().size());
assertEquals(1, definition.getOutputDecision().size());
assertEquals("#" + "_3a69915a-30af-4de3-a07f-6be514f53caa", definition.getOutputDecision().get(0).getHref());
assertEquals(1, definition.getInputDecision().size());
assertEquals("#" + "_afce4fb3-9a7c-4791-bbfe-63d4b76bd61a", definition.getInputDecision().get(0).getHref());
}
use of org.kie.workbench.common.dmn.api.definition.model.DecisionService in project kie-wb-common by kiegroup.
the class DecisionServiceConverterTest method testDMNFromWB.
@Test
public void testDMNFromWB() {
final DecisionService wb = new DecisionService();
final InformationItemPrimary informationItem = new InformationItemPrimary();
wb.getId().setValue(DECISION_SERVICE_UUID);
wb.getName().setValue(DECISION_SERVICE_NAME);
wb.getDescription().setValue(DECISION_SERVICE_DESCRIPTION);
wb.setVariable(informationItem);
final Node<View<DecisionService>, ?> node = new NodeImpl<>(UUID.uuid());
final View<DecisionService> view = new ViewImpl<>(wb, Bounds.create());
node.setContent(view);
final org.kie.dmn.model.api.DecisionService dmn = converter.dmnFromNode(node, componentWidthsConsumer);
assertThat(dmn).isNotNull();
assertThat(dmn.getId()).isNotNull();
assertThat(dmn.getId()).isEqualTo(DECISION_SERVICE_UUID);
assertThat(dmn.getName()).isNotNull();
assertThat(dmn.getName()).isEqualTo(DECISION_SERVICE_NAME);
assertThat(dmn.getDescription()).isNotNull();
assertThat(dmn.getDescription()).isEqualTo(DECISION_SERVICE_DESCRIPTION);
assertThat(dmn.getVariable()).isNotNull();
assertThat(dmn.getVariable().getName()).isEqualTo(DECISION_SERVICE_NAME);
verifyNoMoreInteractions(componentWidthsConsumer);
}
Aggregations