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);
}
}
}
}
}
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;
}
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);
}
Aggregations