Search in sources :

Example 11 with JSITDRGElement

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement in project kie-wb-common by kiegroup.

the class DMNMarshaller method addNodeToDefinitions.

void addNodeToDefinitions(final JSITDRGElement node, final JSITDefinitions definitions) {
    final JSINodeLocalPartName localPart = getLocalPart(node);
    final JSITDRGElement toAdd = getWrappedJSITDRGElement(node, localPart);
    definitions.addDrgElement(toAdd);
}
Also used : JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement)

Example 12 with JSITDRGElement

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement in project kie-wb-common by kiegroup.

the class DMNExternalLinksToExtensionElements method loadExternalLinksIntoExtensionElements.

static void loadExternalLinksIntoExtensionElements(final DRGElement source, final JSITDRGElement target) {
    if (Objects.isNull(source.getLinksHolder()) || Objects.isNull(source.getLinksHolder().getValue())) {
        return;
    }
    final DocumentationLinks links = source.getLinksHolder().getValue();
    final JSITDMNElement.JSIExtensionElements elements = getOrCreateExtensionElements(target);
    removeAllExistingLinks(elements);
    for (final DMNExternalLink link : links.getLinks()) {
        final JSITAttachment attachment = new JSITAttachment();
        attachment.setName(link.getDescription());
        attachment.setUrl(link.getUrl());
        final JSITAttachment wrappedAttachment = WrapperUtils.getWrappedJSITAttachment(attachment);
        elements.addAny(wrappedAttachment);
    }
    target.setExtensionElements(elements);
}
Also used : JSITDMNElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElement) JSITAttachment(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITAttachment) DocumentationLinks(org.kie.workbench.common.dmn.api.property.dmn.DocumentationLinks) DMNExternalLink(org.kie.workbench.common.dmn.api.property.dmn.DMNExternalLink)

Example 13 with JSITDRGElement

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement in project kie-wb-common by kiegroup.

the class DMNMarshallerImportsClientHelper method getImportedDRGElements.

@Override
public List<JSITDRGElement> getImportedDRGElements(final Map<JSITImport, JSITDefinitions> importDefinitions) {
    final List<JSITDRGElement> importedNodes = new ArrayList<>();
    for (final Map.Entry<JSITImport, JSITDefinitions> entry : importDefinitions.entrySet()) {
        final JSITImport anImport = Js.uncheckedCast(entry.getKey());
        final JSITDefinitions definitions = Js.uncheckedCast(entry.getValue());
        importedNodes.addAll(getDrgElementsWithNamespace(definitions, anImport));
    }
    return importedNodes;
}
Also used : JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement) ArrayList(java.util.ArrayList) JSITImport(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITImport) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) JSITDefinitions(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions)

Example 14 with JSITDRGElement

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement in project kie-wb-common by kiegroup.

the class DMNMarshaller method getExistingNode.

Optional<JSITDRGElement> getExistingNode(final JSITDefinitions definitions, final JSITDRGElement node) {
    final JSITDRGElement[] existingDRGElement = new JSITDRGElement[1];
    forEach(definitions.getDrgElement(), drgElement -> {
        if (Objects.equals(drgElement.getId(), node.getId())) {
            existingDRGElement[0] = drgElement;
        }
    });
    final JSITDRGElement value = Js.uncheckedCast(existingDRGElement[0]);
    return Optional.ofNullable(value);
}
Also used : JSITDRGElement(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement)

Aggregations

JSITDRGElement (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDRGElement)9 JSITDecision (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDecision)5 JSITDefinitions (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDefinitions)5 ArrayList (java.util.ArrayList)4 Test (org.junit.Test)3 JSITInputData (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInputData)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 JSITBusinessKnowledgeModel (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITBusinessKnowledgeModel)2 JSITInformationItem (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInformationItem)2 JSITInvocable (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITInvocable)2 JSITKnowledgeSource (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITKnowledgeSource)2 List (java.util.List)1 Objects (java.util.Objects)1 Optional (java.util.Optional)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 Consumer (java.util.function.Consumer)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 StreamSupport (java.util.stream.StreamSupport)1