Search in sources :

Example 1 with JSITAttachment

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

the class DMNExternalLinksToExtensionElements method loadExternalLinksFromExtensionElements.

static void loadExternalLinksFromExtensionElements(final JSITDRGElement source, final DRGElement target) {
    if (!Objects.isNull(source.getExtensionElements())) {
        final List<Object> extensions = source.getExtensionElements().getAny();
        if (!Objects.isNull(extensions)) {
            for (int i = 0; i < extensions.size(); i++) {
                final Object extension = extensions.get(i);
                if (JSITAttachment.instanceOf(extension)) {
                    final JSITAttachment jsiExtension = Js.uncheckedCast(extension);
                    final DMNExternalLink external = new DMNExternalLink();
                    external.setDescription(jsiExtension.getName());
                    external.setUrl(jsiExtension.getUrl());
                    target.getLinksHolder().getValue().addLink(external);
                }
            }
        }
    }
}
Also used : JSITAttachment(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITAttachment) DMNExternalLink(org.kie.workbench.common.dmn.api.property.dmn.DMNExternalLink)

Example 2 with JSITAttachment

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

the class WrapperUtils method getWrappedJSITAttachment.

public static JSITAttachment getWrappedJSITAttachment(final JSITAttachment attachment) {
    final JSITAttachment toReturn = Js.uncheckedCast(JsUtils.getWrappedElement(attachment));
    final JSIName jsiName = JSITAttachment.getJSIName();
    updateJSIName(jsiName, "kie", "attachment");
    JsUtils.setNameOnWrapped(toReturn, jsiName);
    return toReturn;
}
Also used : JSIName(org.kie.workbench.common.dmn.webapp.kogito.marshaller.mapper.JSIName) JSITAttachment(org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITAttachment)

Example 3 with JSITAttachment

use of org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITAttachment 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)

Aggregations

JSITAttachment (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.kie.JSITAttachment)3 DMNExternalLink (org.kie.workbench.common.dmn.api.property.dmn.DMNExternalLink)2 DocumentationLinks (org.kie.workbench.common.dmn.api.property.dmn.DocumentationLinks)1 JSITDMNElement (org.kie.workbench.common.dmn.webapp.kogito.marshaller.js.model.dmn12.JSITDMNElement)1 JSIName (org.kie.workbench.common.dmn.webapp.kogito.marshaller.mapper.JSIName)1