Search in sources :

Example 1 with KnowledgeSource

use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.

the class DMNMarshallerStandalone method stunnerToDDExt.

@SuppressWarnings("unchecked")
private static DMNShape stunnerToDDExt(final Definitions definitions, final View<? extends DMNElement> v) {
    final DMNShape result = new org.kie.dmn.model.v1_2.dmndi.DMNShape();
    result.setId("dmnshape-" + v.getDefinition().getId().getValue());
    result.setDmnElementRef(getDmnElementRef(definitions, v));
    final Bounds bounds = new org.kie.dmn.model.v1_2.dmndi.Bounds();
    result.setBounds(bounds);
    bounds.setX(xOfBound(upperLeftBound(v)));
    bounds.setY(yOfBound(upperLeftBound(v)));
    result.setStyle(new org.kie.dmn.model.v1_2.dmndi.DMNStyle());
    result.setDMNLabel(new org.kie.dmn.model.v1_2.dmndi.DMNLabel());
    if (v.getDefinition() instanceof Decision) {
        final Decision d = (Decision) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof InputData) {
        final InputData d = (InputData) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof BusinessKnowledgeModel) {
        final BusinessKnowledgeModel d = (BusinessKnowledgeModel) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof KnowledgeSource) {
        final KnowledgeSource d = (KnowledgeSource) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof TextAnnotation) {
        final TextAnnotation d = (TextAnnotation) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
    } else if (v.getDefinition() instanceof DecisionService) {
        final DecisionService d = (DecisionService) v.getDefinition();
        applyBounds(d.getDimensionsSet(), bounds);
        applyBackgroundStyles(d.getStylingSet(), result);
        applyFontStyle(d.getStylingSet(), result);
        final DMNDecisionServiceDividerLine dl = new org.kie.dmn.model.v1_2.dmndi.DMNDecisionServiceDividerLine();
        final org.kie.dmn.model.api.dmndi.Point leftPoint = new org.kie.dmn.model.v1_2.dmndi.Point();
        leftPoint.setX(v.getBounds().getUpperLeft().getX());
        final double dlY = v.getBounds().getUpperLeft().getY() + d.getDividerLineY().getValue();
        leftPoint.setY(dlY);
        dl.getWaypoint().add(leftPoint);
        final org.kie.dmn.model.api.dmndi.Point rightPoint = new org.kie.dmn.model.v1_2.dmndi.Point();
        rightPoint.setX(v.getBounds().getLowerRight().getX());
        rightPoint.setY(dlY);
        dl.getWaypoint().add(rightPoint);
        result.setDMNDecisionServiceDividerLine(dl);
    }
    return result;
}
Also used : Bounds(org.kie.dmn.model.api.dmndi.Bounds) DMNDecisionServiceDividerLine(org.kie.dmn.model.api.dmndi.DMNDecisionServiceDividerLine) Point(org.kie.dmn.model.api.dmndi.Point) ControlPoint(org.kie.workbench.common.stunner.core.graph.content.view.ControlPoint) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) DMNShape(org.kie.dmn.model.api.dmndi.DMNShape) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) TextAnnotation(org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)

Example 2 with KnowledgeSource

use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.

the class BusinessKnowledgeModelConverter method dmnFromNode.

@Override
public org.kie.dmn.model.api.BusinessKnowledgeModel dmnFromNode(final Node<View<BusinessKnowledgeModel>, ?> node, final Consumer<ComponentWidths> componentWidthsConsumer) {
    final BusinessKnowledgeModel source = (BusinessKnowledgeModel) DefinitionUtils.getElementDefinition(node);
    final org.kie.dmn.model.api.BusinessKnowledgeModel result = new org.kie.dmn.model.v1_2.TBusinessKnowledgeModel();
    result.setId(source.getId().getValue());
    result.setDescription(DescriptionPropertyConverter.dmnFromWB(source.getDescription()));
    result.setName(source.getName().getValue());
    DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result);
    final org.kie.dmn.model.api.InformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source);
    if (variable != null) {
        variable.setParent(result);
    }
    result.setVariable(variable);
    final org.kie.dmn.model.api.FunctionDefinition functionDefinition = FunctionDefinitionPropertyConverter.dmnFromWB(source.getEncapsulatedLogic(), componentWidthsConsumer);
    final FunctionDefinition wbFunctionDefinition = source.getEncapsulatedLogic();
    if (Objects.nonNull(wbFunctionDefinition)) {
        final String uuid = wbFunctionDefinition.getId().getValue();
        if (Objects.nonNull(uuid)) {
            final ComponentWidths componentWidths = new ComponentWidths();
            componentWidths.setDmnElementRef(new QName(uuid));
            componentWidths.setWidths(new ArrayList<>(source.getEncapsulatedLogic().getComponentWidths()));
            componentWidthsConsumer.accept(componentWidths);
        }
    }
    if (functionDefinition != null) {
        functionDefinition.setParent(result);
    }
    result.setEncapsulatedLogic(functionDefinition);
    // DMN spec table 2: Requirements connection rules
    final List<Edge<?, ?>> inEdges = (List<Edge<?, ?>>) node.getInEdges();
    for (Edge<?, ?> e : inEdges) {
        final Node<?, ?> sourceNode = e.getSourceNode();
        if (sourceNode.getContent() instanceof View<?>) {
            final View<?> view = (View<?>) sourceNode.getContent();
            if (view.getDefinition() instanceof DRGElement) {
                final DRGElement drgElement = (DRGElement) view.getDefinition();
                if (drgElement instanceof BusinessKnowledgeModel) {
                    final org.kie.dmn.model.api.KnowledgeRequirement iReq = new org.kie.dmn.model.v1_2.TKnowledgeRequirement();
                    iReq.setId(e.getUUID());
                    final org.kie.dmn.model.api.DMNElementReference ri = new org.kie.dmn.model.v1_2.TDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredKnowledge(ri);
                    result.getKnowledgeRequirement().add(iReq);
                } else if (drgElement instanceof KnowledgeSource) {
                    final org.kie.dmn.model.api.AuthorityRequirement iReq = new org.kie.dmn.model.v1_2.TAuthorityRequirement();
                    iReq.setId(e.getUUID());
                    final org.kie.dmn.model.api.DMNElementReference ri = new org.kie.dmn.model.v1_2.TDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredAuthority(ri);
                    result.getAuthorityRequirement().add(iReq);
                } else if (drgElement instanceof DecisionService) {
                    if (e.getContent() instanceof View && ((View) e.getContent()).getDefinition() instanceof KnowledgeRequirement) {
                        final org.kie.dmn.model.api.KnowledgeRequirement iReq = new org.kie.dmn.model.v1_2.TKnowledgeRequirement();
                        iReq.setId(e.getUUID());
                        final org.kie.dmn.model.api.DMNElementReference ri = new org.kie.dmn.model.v1_2.TDMNElementReference();
                        ri.setHref(getHref(drgElement));
                        iReq.setRequiredKnowledge(ri);
                        result.getKnowledgeRequirement().add(iReq);
                    } else {
                        throw new UnsupportedOperationException("wrong model definition.");
                    }
                } else {
                    throw new UnsupportedOperationException("wrong model definition.");
                }
            }
        }
    }
    return result;
}
Also used : DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) ArrayList(java.util.ArrayList) List(java.util.List) QName(javax.xml.namespace.QName) View(org.kie.workbench.common.stunner.core.graph.content.view.View) KnowledgeRequirement(org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) HasComponentWidths(org.kie.workbench.common.dmn.api.definition.HasComponentWidths) ComponentWidths(org.kie.workbench.common.dmn.backend.definition.v1_1.dd.ComponentWidths) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement)

Example 3 with KnowledgeSource

use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.

the class KnowledgeSourceConverter method dmnFromNode.

@Override
public org.kie.dmn.model.api.KnowledgeSource dmnFromNode(final Node<View<KnowledgeSource>, ?> node, final Consumer<ComponentWidths> componentWidthsConsumer) {
    final KnowledgeSource source = (KnowledgeSource) DefinitionUtils.getElementDefinition(node);
    final org.kie.dmn.model.api.KnowledgeSource result = new org.kie.dmn.model.v1_2.TKnowledgeSource();
    result.setId(source.getId().getValue());
    result.setDescription(DescriptionPropertyConverter.dmnFromWB(source.getDescription()));
    result.setName(source.getName().getValue());
    result.setType(source.getType().getValue());
    result.setLocationURI(source.getLocationURI().getValue());
    DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result);
    // DMN spec table 2: Requirements connection rules
    final List<Edge<?, ?>> inEdges = (List<Edge<?, ?>>) node.getInEdges();
    for (Edge<?, ?> e : inEdges) {
        final Node<?, ?> sourceNode = e.getSourceNode();
        if (sourceNode.getContent() instanceof View<?>) {
            final View<?> view = (View<?>) sourceNode.getContent();
            if (view.getDefinition() instanceof DRGElement) {
                final DRGElement drgElement = (DRGElement) view.getDefinition();
                if (drgElement instanceof Decision) {
                    final org.kie.dmn.model.api.AuthorityRequirement iReq = new org.kie.dmn.model.v1_2.TAuthorityRequirement();
                    iReq.setId(e.getUUID());
                    final org.kie.dmn.model.api.DMNElementReference ri = new org.kie.dmn.model.v1_2.TDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredDecision(ri);
                    result.getAuthorityRequirement().add(iReq);
                } else if (drgElement instanceof KnowledgeSource) {
                    final org.kie.dmn.model.api.AuthorityRequirement iReq = new org.kie.dmn.model.v1_2.TAuthorityRequirement();
                    iReq.setId(e.getUUID());
                    final org.kie.dmn.model.api.DMNElementReference ri = new org.kie.dmn.model.v1_2.TDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredAuthority(ri);
                    result.getAuthorityRequirement().add(iReq);
                } else if (drgElement instanceof InputData) {
                    final org.kie.dmn.model.api.AuthorityRequirement iReq = new org.kie.dmn.model.v1_2.TAuthorityRequirement();
                    iReq.setId(e.getUUID());
                    final org.kie.dmn.model.api.DMNElementReference ri = new org.kie.dmn.model.v1_2.TDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredInput(ri);
                    result.getAuthorityRequirement().add(iReq);
                } else {
                    throw new UnsupportedOperationException("wrong model definition.");
                }
            }
        }
    }
    return result;
}
Also used : KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) List(java.util.List) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) View(org.kie.workbench.common.stunner.core.graph.content.view.View) Decision(org.kie.workbench.common.dmn.api.definition.model.Decision) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement)

Example 4 with KnowledgeSource

use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.

the class BusinessKnowledgeModelConverter method dmnFromNode.

@Override
@SuppressWarnings("unchecked")
public JSITBusinessKnowledgeModel dmnFromNode(final Node<View<BusinessKnowledgeModel>, ?> node, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    final BusinessKnowledgeModel source = (BusinessKnowledgeModel) DefinitionUtils.getElementDefinition(node);
    final JSITBusinessKnowledgeModel result = new JSITBusinessKnowledgeModel();
    result.setId(source.getId().getValue());
    final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(source.getDescription()));
    description.ifPresent(result::setDescription);
    result.setName(source.getName().getValue());
    // Add because it is present in the original JSON when unmarshalling
    if (Objects.isNull(result.getKnowledgeRequirement())) {
        result.setKnowledgeRequirement(new ArrayList<>());
    }
    // Add because it is present in the original JSON when unmarshalling
    if (Objects.isNull(result.getAuthorityRequirement())) {
        result.setAuthorityRequirement(new ArrayList<>());
    }
    DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, result);
    final JSITInformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source);
    result.setVariable(variable);
    final JSITFunctionDefinition functionDefinition = FunctionDefinitionPropertyConverter.dmnFromWB(source.getEncapsulatedLogic(), componentWidthsConsumer);
    final FunctionDefinition wbFunctionDefinition = source.getEncapsulatedLogic();
    if (Objects.nonNull(wbFunctionDefinition)) {
        final String uuid = wbFunctionDefinition.getId().getValue();
        if (Objects.nonNull(uuid)) {
            final JSITComponentWidths componentWidths = new JSITComponentWidths();
            componentWidths.setDmnElementRef(uuid);
            source.getEncapsulatedLogic().getComponentWidths().stream().filter(Objects::nonNull).forEach(w -> componentWidths.addWidth(new Float(w)));
            componentWidthsConsumer.accept(componentWidths);
        }
    }
    result.setEncapsulatedLogic(functionDefinition);
    // DMN spec table 2: Requirements connection rules
    final List<Edge<?, ?>> inEdges = (List<Edge<?, ?>>) node.getInEdges();
    for (Edge<?, ?> e : inEdges) {
        final Node<?, ?> sourceNode = e.getSourceNode();
        if (sourceNode.getContent() instanceof View<?>) {
            final View<?> view = (View<?>) sourceNode.getContent();
            if (view.getDefinition() instanceof DRGElement) {
                final DRGElement drgElement = (DRGElement) view.getDefinition();
                if (drgElement instanceof BusinessKnowledgeModel) {
                    final JSITKnowledgeRequirement iReq = new JSITKnowledgeRequirement();
                    iReq.setId(getRawId(e.getUUID()));
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredKnowledge(ri);
                    result.addKnowledgeRequirement(iReq);
                } else if (drgElement instanceof KnowledgeSource) {
                    final JSITAuthorityRequirement iReq = new JSITAuthorityRequirement();
                    iReq.setId(getRawId(e.getUUID()));
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredAuthority(ri);
                    result.addAuthorityRequirement(iReq);
                } else if (drgElement instanceof DecisionService) {
                    if (e.getContent() instanceof View && ((View) e.getContent()).getDefinition() instanceof KnowledgeRequirement) {
                        final JSITKnowledgeRequirement iReq = new JSITKnowledgeRequirement();
                        iReq.setId(getRawId(e.getUUID()));
                        final JSITDMNElementReference ri = new JSITDMNElementReference();
                        ri.setHref(getHref(drgElement));
                        iReq.setRequiredKnowledge(ri);
                        result.addKnowledgeRequirement(iReq);
                    } else {
                        throw new UnsupportedOperationException("wrong model definition.");
                    }
                } else {
                    throw new UnsupportedOperationException("wrong model definition.");
                }
            }
        }
    }
    return result;
}
Also used : JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) JSITAuthorityRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITAuthorityRequirement) FunctionDefinition(org.kie.workbench.common.dmn.api.definition.model.FunctionDefinition) JSITFunctionDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition) ArrayList(java.util.ArrayList) List(java.util.List) JSITComponentWidths(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITComponentWidths) JSITFunctionDefinition(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITFunctionDefinition) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) View(org.kie.workbench.common.stunner.core.graph.content.view.View) KnowledgeRequirement(org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement) JSITKnowledgeRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeRequirement) JSITKnowledgeRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeRequirement) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) JSITBusinessKnowledgeModel(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement)

Example 5 with KnowledgeSource

use of org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource in project kie-wb-common by kiegroup.

the class DecisionConverter method dmnFromNode.

@Override
@SuppressWarnings("unchecked")
public JSITDecision dmnFromNode(final Node<View<Decision>, ?> node, final Consumer<JSITComponentWidths> componentWidthsConsumer) {
    final Decision source = (Decision) DefinitionUtils.getElementDefinition(node);
    final JSITDecision d = new JSITDecision();
    d.setId(source.getId().getValue());
    final Optional<String> description = Optional.ofNullable(DescriptionPropertyConverter.dmnFromWB(source.getDescription()));
    description.ifPresent(d::setDescription);
    d.setName(source.getName().getValue());
    final JSITInformationItem variable = InformationItemPrimaryPropertyConverter.dmnFromWB(source.getVariable(), source);
    d.setVariable(variable);
    final JSITExpression expression = ExpressionPropertyConverter.dmnFromWB(source.getExpression(), componentWidthsConsumer);
    d.setExpression(expression);
    final String question = QuestionPropertyConverter.dmnFromWB(source.getQuestion());
    if (!StringUtils.isEmpty(question)) {
        d.setQuestion(question);
    }
    final String allowedAnswers = AllowedAnswersPropertyConverter.dmnFromWB(source.getAllowedAnswers());
    if (!StringUtils.isEmpty(allowedAnswers)) {
        d.setAllowedAnswers(allowedAnswers);
    }
    // Add because it is present in the original JSON when unmarshalling
    if (Objects.isNull(d.getInformationRequirement())) {
        d.setInformationRequirement(new ArrayList<>());
    }
    // Add because it is present in the original JSON when unmarshalling
    if (Objects.isNull(d.getKnowledgeRequirement())) {
        d.setKnowledgeRequirement(new ArrayList<>());
    }
    // Add because it is present in the original JSON when unmarshalling
    if (Objects.isNull(d.getAuthorityRequirement())) {
        d.setAuthorityRequirement(new ArrayList<>());
    }
    // DMN spec table 2: Requirements connection rules
    final List<Edge<?, ?>> inEdges = (List<Edge<?, ?>>) node.getInEdges();
    for (Edge<?, ?> e : inEdges) {
        final Node<?, ?> sourceNode = e.getSourceNode();
        if (sourceNode.getContent() instanceof View<?>) {
            final View<?> view = (View<?>) sourceNode.getContent();
            if (view.getDefinition() instanceof DRGElement) {
                final DRGElement drgElement = (DRGElement) view.getDefinition();
                if (drgElement instanceof Decision) {
                    final JSITInformationRequirement iReq = new JSITInformationRequirement();
                    iReq.setId(getRawId(e.getUUID()));
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredDecision(ri);
                    d.addInformationRequirement(iReq);
                } else if (drgElement instanceof BusinessKnowledgeModel) {
                    final JSITKnowledgeRequirement iReq = new JSITKnowledgeRequirement();
                    iReq.setId(getRawId(e.getUUID()));
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredKnowledge(ri);
                    d.addKnowledgeRequirement(iReq);
                } else if (drgElement instanceof KnowledgeSource) {
                    final JSITAuthorityRequirement iReq = new JSITAuthorityRequirement();
                    iReq.setId(getRawId(e.getUUID()));
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredAuthority(ri);
                    d.addAuthorityRequirement(iReq);
                } else if (drgElement instanceof InputData) {
                    final JSITInformationRequirement iReq = new JSITInformationRequirement();
                    iReq.setId(getRawId(e.getUUID()));
                    final JSITDMNElementReference ri = new JSITDMNElementReference();
                    ri.setHref(getHref(drgElement));
                    iReq.setRequiredInput(ri);
                    d.addInformationRequirement(iReq);
                } else if (drgElement instanceof DecisionService) {
                    if (e.getContent() instanceof Child) {
                    // Stunner relationship of this Decision be encapsulated by the DecisionService, not managed here.
                    } else if (e.getContent() instanceof View && ((View) e.getContent()).getDefinition() instanceof KnowledgeRequirement) {
                        final JSITKnowledgeRequirement iReq = new JSITKnowledgeRequirement();
                        iReq.setId(getRawId(e.getUUID()));
                        final JSITDMNElementReference ri = new JSITDMNElementReference();
                        ri.setHref(getHref(drgElement));
                        iReq.setRequiredKnowledge(ri);
                        d.addKnowledgeRequirement(iReq);
                    } else {
                        throw new UnsupportedOperationException("wrong model definition.");
                    }
                } else {
                    throw new UnsupportedOperationException("wrong model definition.");
                }
            }
        }
    }
    DMNExternalLinksToExtensionElements.loadExternalLinksIntoExtensionElements(source, d);
    return d;
}
Also used : JSITInformationItem(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem) JSITDecision(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision) DecisionService(org.kie.workbench.common.dmn.api.definition.model.DecisionService) KnowledgeSource(org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource) JSITAuthorityRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITAuthorityRequirement) ArrayList(java.util.ArrayList) List(java.util.List) InputData(org.kie.workbench.common.dmn.api.definition.model.InputData) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child) JSITInformationRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationRequirement) Id(org.kie.workbench.common.dmn.api.property.dmn.Id) IdUtils.getRawId(org.kie.workbench.common.dmn.client.marshaller.common.IdUtils.getRawId) BindableAdapterUtils.getDefinitionId(org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId) Child(org.kie.workbench.common.stunner.core.graph.content.relationship.Child) JSITDMNElementReference(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElementReference) 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) KnowledgeRequirement(org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement) JSITKnowledgeRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeRequirement) JSITKnowledgeRequirement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeRequirement) BusinessKnowledgeModel(org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel) JSITExpression(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITExpression) Edge(org.kie.workbench.common.stunner.core.graph.Edge) DRGElement(org.kie.workbench.common.dmn.api.definition.model.DRGElement)

Aggregations

KnowledgeSource (org.kie.workbench.common.dmn.api.definition.model.KnowledgeSource)23 BusinessKnowledgeModel (org.kie.workbench.common.dmn.api.definition.model.BusinessKnowledgeModel)16 Decision (org.kie.workbench.common.dmn.api.definition.model.Decision)16 InputData (org.kie.workbench.common.dmn.api.definition.model.InputData)16 Test (org.junit.Test)11 TextAnnotation (org.kie.workbench.common.dmn.api.definition.model.TextAnnotation)11 View (org.kie.workbench.common.stunner.core.graph.content.view.View)10 DecisionService (org.kie.workbench.common.dmn.api.definition.model.DecisionService)9 List (java.util.List)8 DRGElement (org.kie.workbench.common.dmn.api.definition.model.DRGElement)8 Edge (org.kie.workbench.common.stunner.core.graph.Edge)7 ArrayList (java.util.ArrayList)5 KnowledgeRequirement (org.kie.workbench.common.dmn.api.definition.model.KnowledgeRequirement)5 Node (org.kie.workbench.common.stunner.core.graph.Node)5 Id (org.kie.workbench.common.dmn.api.property.dmn.Id)4 StylingSet (org.kie.workbench.common.dmn.api.property.styling.StylingSet)4 BindableAdapterUtils.getDefinitionId (org.kie.workbench.common.stunner.core.definition.adapter.binding.BindableAdapterUtils.getDefinitionId)4 Description (org.kie.workbench.common.dmn.api.property.dmn.Description)3 KnowledgeSourceType (org.kie.workbench.common.dmn.api.property.dmn.KnowledgeSourceType)3 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)3