Search in sources :

Example 6 with DecisionServiceDividerLineY

use of org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY in project kie-wb-common by kiegroup.

the class DMNDecisionServiceSVGMutableShapeImplTest method testApplyCustomProperties.

@Test
public void testApplyCustomProperties() {
    final DecisionServiceDividerLineY divider = new DecisionServiceDividerLineY(25.0);
    when(decisionServiceDefinition.getDividerLineY()).thenReturn(divider);
    svgMutableShape.applyCustomProperties(decisionServiceNode, mutationContext);
    verify(view).setDividerLineY(eq(25.0));
}
Also used : DecisionServiceDividerLineY(org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY) Test(org.junit.Test)

Example 7 with DecisionServiceDividerLineY

use of org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY in project kie-wb-common by kiegroup.

the class DecisionServiceConverter method nodeFromDMN.

@Override
public Node<View<DecisionService>, ?> nodeFromDMN(final NodeEntry nodeEntry) {
    final JSITDecisionService dmn = Js.uncheckedCast(nodeEntry.getDmnElement());
    @SuppressWarnings("unchecked") final Node<View<DecisionService>, ?> node = (Node<View<DecisionService>, ?>) factoryManager.newElement(nodeEntry.getId(), getDefinitionId(DecisionService.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 List<DMNElementReference> outputDecision = new ArrayList<>();
    final List<DMNElementReference> encapsulatedDecision = new ArrayList<>();
    final List<DMNElementReference> inputDecision = new ArrayList<>();
    final List<DMNElementReference> inputData = new ArrayList<>();
    final List<JSITDMNElementReference> jsiOutputDecisions = dmn.getOutputDecision();
    if (Objects.nonNull(jsiOutputDecisions)) {
        for (int i = 0; i < jsiOutputDecisions.size(); i++) {
            final JSITDMNElementReference jsiOutputDecision = Js.uncheckedCast(jsiOutputDecisions.get(i));
            outputDecision.add(DMNElementReferenceConverter.wbFromDMN(jsiOutputDecision));
        }
    }
    final List<JSITDMNElementReference> jsiEncapsulatedDecisions = dmn.getEncapsulatedDecision();
    if (Objects.nonNull(jsiEncapsulatedDecisions)) {
        for (int i = 0; i < jsiEncapsulatedDecisions.size(); i++) {
            final JSITDMNElementReference jsiEncapsulatedDecision = Js.uncheckedCast(jsiEncapsulatedDecisions.get(i));
            encapsulatedDecision.add(DMNElementReferenceConverter.wbFromDMN(jsiEncapsulatedDecision));
        }
    }
    final List<JSITDMNElementReference> jsiInputDecisions = dmn.getInputDecision();
    if (Objects.nonNull(jsiInputDecisions)) {
        for (int i = 0; i < jsiInputDecisions.size(); i++) {
            final JSITDMNElementReference jsiInputDecision = Js.uncheckedCast(jsiInputDecisions.get(i));
            inputDecision.add(DMNElementReferenceConverter.wbFromDMN(jsiInputDecision));
        }
    }
    final List<JSITDMNElementReference> jsiInputDatas = dmn.getInputData();
    if (Objects.nonNull(jsiInputDatas)) {
        for (int i = 0; i < jsiInputDatas.size(); i++) {
            final JSITDMNElementReference jsiInputData = Js.uncheckedCast(jsiInputDatas.get(i));
            inputData.add(DMNElementReferenceConverter.wbFromDMN(jsiInputData));
        }
    }
    final DecisionService decisionService = new DecisionService(id, description, name, informationItem, outputDecision, encapsulatedDecision, inputDecision, inputData, new StylingSet(), new DecisionServiceRectangleDimensionsSet(), new DecisionServiceDividerLineY());
    decisionService.setDiagramId(nodeEntry.getDiagramId());
    node.getContent().setDefinition(decisionService);
    if (Objects.nonNull(informationItem)) {
        informationItem.setParent(decisionService);
    }
    DMNExternalLinksToExtensionElements.loadExternalLinksFromExtensionElements(dmn, decisionService);
    return node;
}
Also used : InformationItemPrimary(org.kie.workbench.common.dmn.api.definition.model.InformationItemPrimary) Description(org.kie.workbench.common.dmn.api.property.dmn.Description) Node(org.kie.workbench.common.stunner.core.graph.Node) ArrayList(java.util.ArrayList) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) View(org.kie.workbench.common.stunner.core.graph.content.view.View) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) Name(org.kie.workbench.common.dmn.api.property.dmn.Name) DecisionServiceDividerLineY(org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) DMNElementReference(org.kie.workbench.common.dmn.api.definition.model.DMNElementReference) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) BindableAdapterUtils.getDefinitionId(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId) DecisionServiceRectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.DecisionServiceRectangleDimensionsSet)

Example 8 with DecisionServiceDividerLineY

use of org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY in project kie-wb-common by kiegroup.

the class StunnerConverter method ddExtAugmentStunner.

private void ddExtAugmentStunner(final Node currentNode, final JSIDMNShape shape) {
    final View content = (View) currentNode.getContent();
    final Bound ulBound = upperLeftBound(content);
    final Bound lrBound = lowerRightBound(content);
    final Object definition = content.getDefinition();
    if (definition instanceof Decision) {
        final Decision decision = (Decision) definition;
        internalAugment(shape, ulBound, decision.getDimensionsSet(), lrBound, decision.getStylingSet(), (line) -> {
        /*NOP*/
        });
    } else if (definition instanceof InputData) {
        final InputData inputData = (InputData) definition;
        internalAugment(shape, ulBound, inputData.getDimensionsSet(), lrBound, inputData.getStylingSet(), (line) -> {
        /*NOP*/
        });
    } else if (definition instanceof BusinessKnowledgeModel) {
        final BusinessKnowledgeModel businessKnowledgeModel = (BusinessKnowledgeModel) definition;
        internalAugment(shape, ulBound, businessKnowledgeModel.getDimensionsSet(), lrBound, businessKnowledgeModel.getStylingSet(), (line) -> {
        /*NOP*/
        });
    } else if (definition instanceof KnowledgeSource) {
        final KnowledgeSource knowledgeSource = (KnowledgeSource) definition;
        internalAugment(shape, ulBound, knowledgeSource.getDimensionsSet(), lrBound, knowledgeSource.getStylingSet(), (line) -> {
        /*NOP*/
        });
    } else if (definition instanceof TextAnnotation) {
        final TextAnnotation textAnnotation = (TextAnnotation) definition;
        internalAugment(shape, ulBound, textAnnotation.getDimensionsSet(), lrBound, textAnnotation.getStylingSet(), (line) -> {
        /*NOP*/
        });
    } else if (definition instanceof DecisionService) {
        final DecisionService decisionService = (DecisionService) definition;
        internalAugment(shape, ulBound, decisionService.getDimensionsSet(), lrBound, decisionService.getStylingSet(), (dividerLineY) -> decisionService.setDividerLineY(new DecisionServiceDividerLineY(dividerLineY - ulBound.getY())));
    }
}
Also used : TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) DefinitionUtils(org.kie.workbench.common.stunner.core.util.DefinitionUtils) KnowledgeSourceConverter(org.kie.workbench.common.dmn.client.marshaller.converters.KnowledgeSourceConverter) JSITTextAnnotation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation) PointUtils.upperLeftBound(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.upperLeftBound) JSITDecision(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision) BorderColour(org.kie.workbench.common.dmn.api.property.styling.BorderColour) FontStylingSetPropertyConverter(org.kie.workbench.common.dmn.client.marshaller.converters.dd.FontStylingSetPropertyConverter) FactoryManager(org.kie.workbench.common.stunner.core.api.FactoryManager) PointUtils.widthOfShape(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.widthOfShape) Height(org.kie.workbench.common.dmn.api.property.dimensions.Height) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) DecisionServiceConverter(org.kie.workbench.common.dmn.client.marshaller.converters.DecisionServiceConverter) JSIStyle(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.di.JSIStyle) PointUtils.lowerRightBound(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.lowerRightBound) Objects(java.util.Objects) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) TextAnnotationConverter(org.kie.workbench.common.dmn.client.marshaller.converters.TextAnnotationConverter) List(java.util.List) NodeConverter(org.kie.workbench.common.dmn.client.marshaller.converters.NodeConverter) BgColour(org.kie.workbench.common.dmn.api.property.styling.BgColour) DMNDiagramsSession(org.kie.workbench.common.dmn.client.docks.navigator.drds.DMNDiagramsSession) BusinessKnowledgeModelConverter(org.kie.workbench.common.dmn.client.marshaller.converters.BusinessKnowledgeModelConverter) Optional(java.util.Optional) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) JSITKnowledgeSource(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource) Node(org.kie.workbench.common.stunner.core.graph.Node) PointUtils.yOfShape(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.yOfShape) Width(org.kie.workbench.common.dmn.api.property.dimensions.Width) JSIDMNDecisionServiceDividerLine(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNDecisionServiceDividerLine) RectangleDimensionsSet(org.kie.workbench.common.dmn.api.property.dimensions.RectangleDimensionsSet) InputDataConverter(org.kie.workbench.common.dmn.client.marshaller.converters.InputDataConverter) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) JSIPoint(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dc.JSIPoint) View(org.kie.workbench.common.stunner.core.graph.content.view.View) PointUtils.heightOfShape(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.heightOfShape) Inject(javax.inject.Inject) Js(jsinterop.base.Js) Bound(org.kie.workbench.common.stunner.core.graph.content.Bound) PointUtils.xOfShape(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.xOfShape) DecisionServiceDividerLineY(org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY) StylingSet(org.kie.workbench.common.dmn.api.property.styling.StylingSet) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) DecisionConverter(org.kie.workbench.common.dmn.client.marshaller.converters.DecisionConverter) JSIDMNShape(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNShape) Consumer(java.util.function.Consumer) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) JsUtils(org.kie.workbench.common.dmn.webapp.kogito.marshaller.mapper.JsUtils) Dependent(javax.enterprise.context.Dependent) JSIDMNStyle(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmndi12.JSIDMNStyle) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) ColorUtils(org.kie.workbench.common.dmn.client.marshaller.converters.dd.ColorUtils) DecisionServiceDividerLineY(org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY) JSITKnowledgeSource(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) PointUtils.upperLeftBound(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.upperLeftBound) PointUtils.lowerRightBound(org.kie.workbench.common.dmn.client.marshaller.converters.dd.PointUtils.lowerRightBound) Bound(org.kie.workbench.common.stunner.core.graph.content.Bound) JSITInputData(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation) JSITTextAnnotation(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITTextAnnotation) View(org.kie.workbench.common.stunner.core.graph.content.view.View) JSITDecision(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) JSITDecisionService(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecisionService) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService)

Aggregations

DecisionServiceDividerLineY (org.kie.workbench.common.dmn.api.property.dmn.DecisionServiceDividerLineY)8 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)6 StylingSet (org.kie.workbench.common.dmn.api.property.styling.StylingSet)5 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)4 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)4 Node (org.kie.workbench.common.stunner.core.graph.Node)4 View (org.kie.workbench.common.stunner.core.graph.content.view.View)4 Optional (java.util.Optional)3 Test (org.junit.Test)3 DecisionServiceRectangleDimensionsSet (org.kie.workbench.common.dmn.api.property.dimensions.DecisionServiceRectangleDimensionsSet)3 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)3 BindableAdapterUtils.getDefinitionId (org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)3 Bound (org.kie.workbench.common.stunner.core.graph.content.Bound)3 ArrayList (java.util.ArrayList)2 List (java.util.List)2 Objects (java.util.Objects)2 Consumer (java.util.function.Consumer)2 Inject (javax.inject.Inject)2 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)2 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)2