From 013f7f76115340e27f993e1303c69a9488a16cef Mon Sep 17 00:00:00 2001 From: Yeser Amer Date: Fri, 15 Mar 2024 17:39:57 +0100 Subject: [PATCH] kie-issues#1012: Removing `kie-soup-commons` dependency in DashBuilder (#2199) --- .../dashbuilder/appformer/uberfire-api/pom.xml | 5 ----- .../main/java/org/uberfire/plugin/PluginUtil.java | 7 +++++-- .../uberfire/workbench/model/NamedPosition.java | 8 ++++++-- .../workbench/model/impl/PanelDefinitionImpl.java | 6 +++++- .../model/impl/PerspectiveDefinitionImpl.java | 7 ++++++- .../appformer/uberfire-client-api/pom.xml | 5 ----- .../appformer/uberfire-commons/pom.xml | 4 ---- .../org/uberfire/commons/UberfireCommons.gwt.xml | 2 -- .../uberfire-widgets-commons/pom.xml | 5 ----- .../ModalFooterForceSaveReOpenCancelButtons.java | 8 ++++++-- .../popups/footers/ModalFooterOKButton.java | 11 ++++++++--- .../footers/ModalFooterOKCancelButtons.java | 13 ++++++++----- .../footers/ModalFooterReOpenIgnoreButtons.java | 8 ++++++-- .../common/client/select/SelectOptionImpl.java | 9 +++++++-- .../uberfire-widgets-core-client/pom.xml | 5 ----- .../ext/widgets/core/client/tree/FSTreeItem.java | 7 +++++-- .../ext/widgets/core/client/tree/TreeItem.java | 7 +++++-- .../core/client/wizards/WizardPopupFooter.java | 15 ++++++++++----- .../uberfire-widgets-table/pom.xml | 5 +---- .../table/client/ResizableMovableHeader.java | 14 +++++++++----- .../pom.xml | 11 ----------- .../views/pfly/maximize/MaximizeToggleButton.java | 8 ++++++-- .../client/views/pfly/modal/Bs3Modal.java | 8 ++++++-- .../NotificationPopupsManagerView.java | 14 ++++++++------ .../client/views/pfly/tab/UberTabPanel.java | 7 +++++-- .../uberfire-workbench-client/pom.xml | 4 ---- .../org/uberfire/client/mvp/AbstractActivity.java | 8 ++++---- .../client/mvp/ActivityLifecycleError.java | 8 ++++++-- .../client/mvp/PerspectiveManagerImpl.java | 6 +++++- .../org/uberfire/client/mvp/PlaceManager.java | 7 +++++-- .../org/uberfire/client/mvp/PlaceManagerImpl.java | 6 +++++- .../client/workbench/PanelManagerImpl.java | 6 +++++- .../workbench/events/AbstractPlaceEvent.java | 10 +++++++--- .../panels/MaximizeToggleButtonPresenter.java | 11 +++++++---- .../impl/AbstractDockingWorkbenchPanelView.java | 6 +++++- .../widgets/common/ErrorPopupPresenter.java | 8 ++++++-- .../notifications/NotificationManager.java | 6 +++--- .../dashbuilder-dataset-client/pom.xml | 5 ----- .../dataset/client/DataSetClientServicesImpl.java | 7 +++++-- .../dashbuilder-displayer-client/pom.xml | 5 ----- .../displayer/client/widgets/DisplayerViewer.java | 8 ++++++-- .../dashbuilder-runtime-client/pom.xml | 7 ------- packages/dashbuilder/pom.xml | 12 ------------ 43 files changed, 181 insertions(+), 148 deletions(-) diff --git a/packages/dashbuilder/appformer/uberfire-api/pom.xml b/packages/dashbuilder/appformer/uberfire-api/pom.xml index 98c2f4b27e8..31e1ea9ab7c 100644 --- a/packages/dashbuilder/appformer/uberfire-api/pom.xml +++ b/packages/dashbuilder/appformer/uberfire-api/pom.xml @@ -43,11 +43,6 @@ uberfire-commons - - org.kie.soup - kie-soup-commons - - org.jboss.errai errai-common diff --git a/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/plugin/PluginUtil.java b/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/plugin/PluginUtil.java index e3a03ac256c..20b4055e73b 100644 --- a/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/plugin/PluginUtil.java +++ b/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/plugin/PluginUtil.java @@ -24,13 +24,12 @@ import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import jsinterop.annotations.JsIgnore; import jsinterop.annotations.JsType; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * Utilities for working with external (GWT-compiled) plugins. */ @@ -61,6 +60,10 @@ public static List ensureIterable(List externalList) { return Collections.unmodifiableList(tmp); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + /** * {@link Set} is a {@link JsType} but {@link Collection#iterator()} is * {@link JsIgnore}d and therefore not exported to JavaScript. diff --git a/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/NamedPosition.java b/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/NamedPosition.java index 86de84d170a..bc511acf5ff 100644 --- a/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/NamedPosition.java +++ b/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/NamedPosition.java @@ -20,11 +20,11 @@ package org.uberfire.workbench.model; +import java.util.Objects; + import org.jboss.errai.common.client.api.annotations.MapsTo; import org.jboss.errai.common.client.api.annotations.Portable; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * Represents the position of a child panel by name. For example, within a templated perspective, panels are positioned * by ErraiUI DataField names. @@ -54,6 +54,10 @@ public NamedPosition(@MapsTo("fieldName") String fieldName) { fieldName); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + /** * Returns the data field name this Position refers to. * diff --git a/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PanelDefinitionImpl.java b/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PanelDefinitionImpl.java index 7f8661fd6b6..d91410b9ca5 100644 --- a/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PanelDefinitionImpl.java +++ b/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PanelDefinitionImpl.java @@ -24,6 +24,7 @@ import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; +import java.util.Objects; import java.util.Set; import jsinterop.annotations.JsIgnore; @@ -37,7 +38,6 @@ import org.uberfire.workbench.model.PartDefinition; import org.uberfire.workbench.model.Position; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; import static org.uberfire.workbench.model.ContextDisplayMode.SHOW; /** @@ -242,6 +242,10 @@ public void setPanelType(String fqcn) { fqcn); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @Override @JsIgnore public Integer getHeight() { diff --git a/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PerspectiveDefinitionImpl.java b/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PerspectiveDefinitionImpl.java index ea822e192e3..901649b6f25 100644 --- a/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PerspectiveDefinitionImpl.java +++ b/packages/dashbuilder/appformer/uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PerspectiveDefinitionImpl.java @@ -19,13 +19,14 @@ package org.uberfire.workbench.model.impl; +import java.util.Objects; + import org.jboss.errai.common.client.api.annotations.Portable; import org.uberfire.workbench.model.ContextDefinition; import org.uberfire.workbench.model.ContextDisplayMode; import org.uberfire.workbench.model.PanelDefinition; import org.uberfire.workbench.model.PerspectiveDefinition; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; import static org.uberfire.workbench.model.ContextDisplayMode.SHOW; /** @@ -53,6 +54,10 @@ public PerspectiveDefinitionImpl(final String panelType) { this.root = root; } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @Override public String getName() { return name; diff --git a/packages/dashbuilder/appformer/uberfire-client-api/pom.xml b/packages/dashbuilder/appformer/uberfire-client-api/pom.xml index 87c8b60afca..5e8ed3e9457 100644 --- a/packages/dashbuilder/appformer/uberfire-client-api/pom.xml +++ b/packages/dashbuilder/appformer/uberfire-client-api/pom.xml @@ -65,11 +65,6 @@ errai-ioc - - org.kie.soup - kie-soup-commons - - com.google.elemental2 elemental2-dom diff --git a/packages/dashbuilder/appformer/uberfire-commons/pom.xml b/packages/dashbuilder/appformer/uberfire-commons/pom.xml index 0324d61423e..ab83c4fb1d1 100644 --- a/packages/dashbuilder/appformer/uberfire-commons/pom.xml +++ b/packages/dashbuilder/appformer/uberfire-commons/pom.xml @@ -42,10 +42,6 @@ jakarta.annotation jakarta.annotation-api - - org.kie.soup - kie-soup-commons - jakarta.enterprise jakarta.enterprise.cdi-api diff --git a/packages/dashbuilder/appformer/uberfire-commons/src/main/resources/org/uberfire/commons/UberfireCommons.gwt.xml b/packages/dashbuilder/appformer/uberfire-commons/src/main/resources/org/uberfire/commons/UberfireCommons.gwt.xml index 6cfef9853c5..9bb5befc31a 100644 --- a/packages/dashbuilder/appformer/uberfire-commons/src/main/resources/org/uberfire/commons/UberfireCommons.gwt.xml +++ b/packages/dashbuilder/appformer/uberfire-commons/src/main/resources/org/uberfire/commons/UberfireCommons.gwt.xml @@ -21,8 +21,6 @@ "http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd"> - - diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/pom.xml b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/pom.xml index ab5f23155d3..f579bf23dc1 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/pom.xml +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/pom.xml @@ -53,11 +53,6 @@ uberfire-commons - - org.kie.soup - kie-soup-commons - - org.uberfire uberfire-workbench-client diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterForceSaveReOpenCancelButtons.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterForceSaveReOpenCancelButtons.java index e20bd8ae2b4..fde0445ac0f 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterForceSaveReOpenCancelButtons.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterForceSaveReOpenCancelButtons.java @@ -19,6 +19,8 @@ package org.uberfire.ext.widgets.common.client.common.popups.footers; +import java.util.Objects; + import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.uibinder.client.UiBinder; @@ -30,8 +32,6 @@ import org.gwtbootstrap3.client.ui.ModalFooter; import org.uberfire.mvp.Command; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * A Modal Footer with OK and Cancel buttons */ @@ -66,6 +66,10 @@ public ModalFooterForceSaveReOpenCancelButtons(final Modal panel, add(uiBinder.createAndBindUi(this)); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @UiHandler("forceSaveButton") public void onForceSaveButtonClick(final ClickEvent e) { if (forceSaveCommand != null) { diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKButton.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKButton.java index 33109167842..e046550f023 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKButton.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKButton.java @@ -19,6 +19,8 @@ package org.uberfire.ext.widgets.common.client.common.popups.footers; +import java.util.Objects; + import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.uibinder.client.UiBinder; @@ -28,7 +30,7 @@ import com.google.gwt.user.client.ui.Widget; import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.ModalFooter; -import org.kie.soup.commons.validation.PortablePreconditions; + /** * A Modal Footer with a single OK button @@ -42,11 +44,14 @@ public class ModalFooterOKButton extends ModalFooter { Button okButton; public ModalFooterOKButton(final Command okCommand) { - this.okCommand = PortablePreconditions.checkNotNull("okCommand", - okCommand); + this.okCommand = checkNotNull("okCommand", okCommand); add(uiBinder.createAndBindUi(this)); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + public void enableOkButton(final boolean enabled) { okButton.setEnabled(enabled); } diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKCancelButtons.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKCancelButtons.java index bf00cfe5cd5..1cd7e00da9c 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKCancelButtons.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKCancelButtons.java @@ -19,6 +19,8 @@ package org.uberfire.ext.widgets.common.client.common.popups.footers; +import java.util.Objects; + import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.uibinder.client.UiBinder; @@ -28,7 +30,6 @@ import com.google.gwt.user.client.ui.Widget; import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.ModalFooter; -import org.kie.soup.commons.validation.PortablePreconditions; /** * A Modal Footer with OK and Cancel buttons @@ -46,13 +47,15 @@ public class ModalFooterOKCancelButtons extends ModalFooter { public ModalFooterOKCancelButtons(final Command okCommand, final Command cancelCommand) { - this.okCommand = PortablePreconditions.checkNotNull("okCommand", - okCommand); - this.cancelCommand = PortablePreconditions.checkNotNull("cancelCommand", - cancelCommand); + this.okCommand = checkNotNull("okCommand", okCommand); + this.cancelCommand = checkNotNull("cancelCommand", cancelCommand); add(uiBinder.createAndBindUi(this)); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + public void enableOkButton(final boolean enabled) { okButton.setEnabled(enabled); } diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterReOpenIgnoreButtons.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterReOpenIgnoreButtons.java index 5d72752c22c..491bea8244e 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterReOpenIgnoreButtons.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterReOpenIgnoreButtons.java @@ -19,6 +19,8 @@ package org.uberfire.ext.widgets.common.client.common.popups.footers; +import java.util.Objects; + import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.uibinder.client.UiBinder; @@ -30,8 +32,6 @@ import org.gwtbootstrap3.client.ui.ModalFooter; import org.uberfire.mvp.Command; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * A Modal Footer with OK and Cancel buttons */ @@ -61,6 +61,10 @@ public ModalFooterReOpenIgnoreButtons(final Modal panel, this.actionButton.setText(buttonText); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @UiHandler("actionButton") public void onActionButtonClick(final ClickEvent e) { if (actionCommand != null) { diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOptionImpl.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOptionImpl.java index 8d9aeddc0d9..66ba8524e03 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOptionImpl.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOptionImpl.java @@ -20,8 +20,6 @@ package org.uberfire.ext.widgets.common.client.select; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty; - public class SelectOptionImpl implements SelectOption { private final String selector; @@ -35,6 +33,13 @@ public SelectOptionImpl(String selector, this.name = name; } + private static String checkNotEmpty(String name, String parameter) { + if (parameter == null || parameter.trim().isEmpty()) { + throw new IllegalArgumentException("Parameter named '" + name + "' should be filled!"); + } + return parameter; + } + public String getSelector() { return selector; } diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/pom.xml b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/pom.xml index 56ec8b476c1..747c967fa49 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/pom.xml +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/pom.xml @@ -67,11 +67,6 @@ uberfire-commons - - org.kie.soup - kie-soup-commons - - org.uberfire uberfire-workbench-client diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/FSTreeItem.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/FSTreeItem.java index b00cb6118df..97faceea6dd 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/FSTreeItem.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/FSTreeItem.java @@ -20,14 +20,13 @@ package org.uberfire.ext.widgets.core.client.tree; +import java.util.Objects; import java.util.function.Supplier; import com.google.gwt.user.client.ui.FlowPanel; import org.gwtbootstrap3.client.ui.Icon; import org.gwtbootstrap3.client.ui.constants.IconType; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - public class FSTreeItem extends TreeItem { private final FSType fstype; @@ -54,6 +53,10 @@ public FSTreeItem(final FSType type, type); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + private static final Type createType(final FSType type) { switch (type) { case ITEM: diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/TreeItem.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/TreeItem.java index f4e8a19ef47..59532cbd305 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/TreeItem.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/TreeItem.java @@ -21,6 +21,7 @@ package org.uberfire.ext.widgets.core.client.tree; import java.util.Iterator; +import java.util.Objects; import java.util.function.Consumer; import java.util.function.Supplier; @@ -40,8 +41,6 @@ import org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute; import org.uberfire.ext.widgets.core.client.resources.TreeNavigatorResources; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - public class TreeItem extends Composite implements OuiaComponent { private static final String OUIA_COMPONENT_TYPE = "tree-item"; @@ -59,6 +58,10 @@ public class TreeItem extends Composite implements OuiaCompo private IsWidget icon; private FlowPanel item; + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + public TreeItem(final Type type, final String value, final String label, diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPopupFooter.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPopupFooter.java index 7966acfea62..d3d24d0f085 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPopupFooter.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPopupFooter.java @@ -19,6 +19,8 @@ package org.uberfire.ext.widgets.core.client.wizards; +import java.util.Objects; + import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.uibinder.client.UiBinder; @@ -29,7 +31,6 @@ import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.ModalFooter; import org.gwtbootstrap3.client.ui.constants.ButtonType; -import org.kie.soup.commons.validation.PortablePreconditions; /** * A Modal Footer used by the Wizard @@ -55,17 +56,21 @@ public WizardPopupFooter(final Command cmdPreviousButton, final Command cmdNextButton, final Command cmdCancelButton, final Command cmdFinishButton) { - this.cmdPreviousButton = PortablePreconditions.checkNotNull("cmdPreviousButton", + this.cmdPreviousButton = checkNotNull("cmdPreviousButton", cmdPreviousButton); - this.cmdNextButton = PortablePreconditions.checkNotNull("cmdNextButton", + this.cmdNextButton = checkNotNull("cmdNextButton", cmdNextButton); - this.cmdCancelButton = PortablePreconditions.checkNotNull("cmdCancelButton", + this.cmdCancelButton = checkNotNull("cmdCancelButton", cmdCancelButton); - this.cmdFinishButton = PortablePreconditions.checkNotNull("cmdFinishButton", + this.cmdFinishButton = checkNotNull("cmdFinishButton", cmdFinishButton); add(uiBinder.createAndBindUi(this)); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + public void enablePreviousButton(final boolean enabled) { btnPrevious.setEnabled(enabled); } diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-table/pom.xml b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-table/pom.xml index 58512edc731..5b3782c2182 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-table/pom.xml +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-table/pom.xml @@ -53,10 +53,7 @@ org.uberfire uberfire-commons - - org.kie.soup - kie-soup-commons - + org.uberfire uberfire-workbench-client-views-patternfly diff --git a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/ResizableMovableHeader.java b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/ResizableMovableHeader.java index efd65963d5d..c4c7f09a5b9 100644 --- a/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/ResizableMovableHeader.java +++ b/packages/dashbuilder/appformer/uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/ResizableMovableHeader.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.cell.client.Cell.Context; @@ -42,7 +43,6 @@ import com.google.gwt.user.client.Event.NativePreviewEvent; import com.google.gwt.user.client.Event.NativePreviewHandler; import org.gwtbootstrap3.client.ui.gwt.DataGrid; -import org.kie.soup.commons.validation.PortablePreconditions; import static com.google.gwt.dom.client.Style.Unit.PX; @@ -82,17 +82,21 @@ public ResizableMovableHeader(final String title, final UberfireColumnPicker columnPicker, final Column column) { super(new HeaderCell()); - this.title = PortablePreconditions.checkNotNull("title", + this.title = checkNotNull("title", title); - this.table = PortablePreconditions.checkNotNull("table", + this.table = checkNotNull("table", table); - this.columnPicker = PortablePreconditions.checkNotNull("columnPicker", + this.columnPicker = checkNotNull("columnPicker", columnPicker); - this.column = PortablePreconditions.checkNotNull("column", + this.column = checkNotNull("column", column); this.tableElement = table.getElement(); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + private static NativeEvent getEventAndPreventPropagation(final NativePreviewEvent event) { final NativeEvent nativeEvent = event.getNativeEvent(); nativeEvent.preventDefault(); diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/pom.xml b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/pom.xml index fb9df608da8..ff627faa548 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/pom.xml +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/pom.xml @@ -69,10 +69,6 @@ org.jboss.errai errai-ioc - - org.kie.soup - kie-soup-commons - com.allen-sauer.gwt.dnd gwt-dnd @@ -119,13 +115,6 @@ test - - org.kie.soup - kie-soup-commons - sources - test - - org.uberfire uberfire-api diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/maximize/MaximizeToggleButton.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/maximize/MaximizeToggleButton.java index 9da3ffd7257..9c58d943fa6 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/maximize/MaximizeToggleButton.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/maximize/MaximizeToggleButton.java @@ -20,6 +20,8 @@ package org.uberfire.client.views.pfly.maximize; +import java.util.Objects; + import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.shared.HandlerRegistration; @@ -31,8 +33,6 @@ import org.uberfire.client.workbench.panels.MaximizeToggleButtonPresenter.View; import org.uberfire.mvp.Command; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - public class MaximizeToggleButton extends Button implements View { private MaximizeToggleButtonPresenter presenter; @@ -63,6 +63,10 @@ public void init(MaximizeToggleButtonPresenter presenter) { presenter); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + /** * Normally invoked automatically when this button gets clicked. Exposed for testing purposes. */ diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/modal/Bs3Modal.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/modal/Bs3Modal.java index 26bfa8987b9..b679a27ed6c 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/modal/Bs3Modal.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/modal/Bs3Modal.java @@ -20,6 +20,8 @@ package org.uberfire.client.views.pfly.modal; +import java.util.Objects; + import javax.enterprise.context.Dependent; import com.google.gwt.core.client.GWT; @@ -42,8 +44,6 @@ import org.uberfire.mvp.Command; import org.uberfire.mvp.Commands; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * A modal dialog that floats above the workbench. Each instance can only be shown once. */ @@ -52,6 +52,10 @@ public class Bs3Modal extends Modal { private final ModalBody body = GWT.create(ModalBody.class); + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + /** * Used for enforcing the "only show one time" rule. */ diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/notifications/NotificationPopupsManagerView.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/notifications/NotificationPopupsManagerView.java index fc19823d23e..7eb5d4b5df4 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/notifications/NotificationPopupsManagerView.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/notifications/NotificationPopupsManagerView.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import javax.enterprise.context.Dependent; import javax.inject.Inject; @@ -30,7 +31,6 @@ import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Widget; import org.jboss.errai.ioc.client.container.SyncBeanDef; -import org.kie.soup.commons.validation.PortablePreconditions; import org.uberfire.client.mvp.Activity; import org.uberfire.client.mvp.ActivityBeansCache; import org.uberfire.client.mvp.PlaceManager; @@ -56,10 +56,14 @@ public class NotificationPopupsManagerView implements NotificationManager.View { @Override public void setContainer(final IsWidget container) { - this.container = PortablePreconditions.checkNotNull("container", + this.container = checkNotNull("container", container); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @Override public void setInitialSpacing(int spacing) { this.initialSpacing = spacing; @@ -204,10 +208,8 @@ private static class PopupHandle implements NotificationPopupHandle { PopupHandle(NotificationPopupView view, NotificationEvent event) { - this.view = PortablePreconditions.checkNotNull("view", - view); - this.event = PortablePreconditions.checkNotNull("event", - event); + this.view = checkNotNull("view", view); + this.event = checkNotNull("event", event); } } } diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/UberTabPanel.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/UberTabPanel.java index 033209d0738..4ae54e9be45 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/UberTabPanel.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/UberTabPanel.java @@ -27,6 +27,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Objects; import javax.annotation.PostConstruct; import javax.enterprise.context.Dependent; @@ -59,8 +60,6 @@ import org.uberfire.mvp.Command; import org.uberfire.workbench.model.PartDefinition; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * A wrapper around {@link TabPanelWithDropdowns} that adds the following capabilities: *
    @@ -100,6 +99,10 @@ public UberTabPanel(final PlaceManager panelManager, tabPanel); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @PostConstruct public void init() { this.dropdownTab = tabPanel.addDropdownTab("More..."); diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/pom.xml b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/pom.xml index 236ba3505a4..f75a5d265e9 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/pom.xml +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/pom.xml @@ -65,10 +65,6 @@ com.google.elemental2 elemental2-dom - - org.kie.soup - kie-soup-commons - org.uberfire uberfire-api diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractActivity.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractActivity.java index 277825a93ce..fb566779715 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractActivity.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractActivity.java @@ -19,9 +19,9 @@ package org.uberfire.client.mvp; -import org.uberfire.mvp.PlaceRequest; +import java.util.Objects; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; +import org.uberfire.mvp.PlaceRequest; /** * Implementation of behaviour common to all activity types. @@ -46,8 +46,8 @@ public abstract class AbstractActivity implements Activity { */ @Override public void onStartup(PlaceRequest place) { - this.place = checkNotNull("place", - place); + Objects.requireNonNull(place, "Parameter named 'place' should be not null!"); + this.place = place; } /** diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityLifecycleError.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityLifecycleError.java index 099f5918904..c63039b40d4 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityLifecycleError.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityLifecycleError.java @@ -20,9 +20,9 @@ package org.uberfire.client.mvp; -import org.uberfire.workbench.events.UberFireEvent; +import java.util.Objects; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; +import org.uberfire.workbench.events.UberFireEvent; /** * CDI event fired by the framework each time an Activity lifecycle method throws an exception. Observers of the event @@ -46,6 +46,10 @@ public class ActivityLifecycleError implements UberFireEvent { this.exception = exception; } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + /** * Returns the Activity instance that threw the exception. * diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PerspectiveManagerImpl.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PerspectiveManagerImpl.java index 8a8fcb5304c..07af7fba1fe 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PerspectiveManagerImpl.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PerspectiveManagerImpl.java @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.Iterator; +import java.util.Objects; import java.util.Set; import javax.enterprise.context.ApplicationScoped; @@ -40,7 +41,6 @@ import org.uberfire.workbench.model.PartDefinition; import org.uberfire.workbench.model.PerspectiveDefinition; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; import static org.uberfire.plugin.PluginUtil.ensureIterable; @ApplicationScoped @@ -67,6 +67,10 @@ public class PerspectiveManagerImpl implements PerspectiveManager { private PlaceRequest currentPerspectivePlaceRequest; + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @Override public void switchToPerspective(final PlaceRequest placeRequest, final PerspectiveActivity activity, diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManager.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManager.java index 24e085f59e0..5f27a666a89 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManager.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManager.java @@ -21,6 +21,7 @@ package org.uberfire.client.mvp; import java.util.List; +import java.util.Objects; import jsinterop.annotations.JsMethod; import jsinterop.annotations.JsType; @@ -33,8 +34,6 @@ import org.uberfire.workbench.model.PanelDefinition; import org.uberfire.workbench.model.PartDefinition; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * A Workbench-centric abstraction over the browser's history mechanism. Allows the application to initiate navigation * to any displayable thing: a {@link WorkbenchPerspective}, a {@link WorkbenchScreen}, a {@link WorkbenchPopup}, a @@ -93,6 +92,10 @@ default void executeOnCloseCallbacks(final PlaceRequest place) { } } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + List getOnOpenCallbacks(PlaceRequest place); List getOnCloseCallbacks(PlaceRequest place); diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManagerImpl.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManagerImpl.java index 879183c3a57..d36815d81b3 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManagerImpl.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManagerImpl.java @@ -26,6 +26,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.function.Predicate; import java.util.function.Supplier; @@ -73,7 +74,6 @@ import org.uberfire.workbench.model.impl.PartDefinitionImpl; import static java.util.Collections.unmodifiableCollection; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; import static org.uberfire.plugin.PluginUtil.ensureIterable; import static org.uberfire.plugin.PluginUtil.toInteger; @@ -586,6 +586,10 @@ public void registerPerspectiveCloseChain(final String perspectiveIdentifier, closeChain); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + /** * Returns all the PlaceRequests that map to activies that are currently in the open state and accessible * somewhere in the current perspective. diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/PanelManagerImpl.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/PanelManagerImpl.java index e6ea1dc0eee..20edff65498 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/PanelManagerImpl.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/PanelManagerImpl.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; +import java.util.Objects; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; @@ -68,7 +69,6 @@ import org.uberfire.workbench.model.impl.CustomPanelDefinitionImpl; import org.uberfire.workbench.model.impl.PanelDefinitionImpl; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; import static org.uberfire.plugin.PluginUtil.ensureIterable; /** @@ -266,6 +266,10 @@ public void addWorkbenchPart(final PlaceRequest place, selectPlaceEvent.fire(new SelectPlaceEvent(place)); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @Override public boolean removePartForPlace(PlaceRequest toRemove) { final PartDefinition removedPart = getPartForPlace(toRemove); diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/AbstractPlaceEvent.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/AbstractPlaceEvent.java index ddaf1b0d4f1..2f57ef43c29 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/AbstractPlaceEvent.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/AbstractPlaceEvent.java @@ -20,10 +20,11 @@ package org.uberfire.client.workbench.events; +import java.util.Objects; + import org.uberfire.mvp.PlaceRequest; import org.uberfire.workbench.events.UberFireEvent; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; /** * Created by Cristiano Nicolai. @@ -33,11 +34,14 @@ public abstract class AbstractPlaceEvent implements UberFireEvent { private final PlaceRequest place; AbstractPlaceEvent(final PlaceRequest place) { - checkNotNull("place", - place); + Objects.requireNonNull(place, "Parameter named 'place' should be not null!"); this.place = place; } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + public PlaceRequest getPlace() { return place; } diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/MaximizeToggleButtonPresenter.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/MaximizeToggleButtonPresenter.java index f339d4ec4d5..bd64303281e 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/MaximizeToggleButtonPresenter.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/MaximizeToggleButtonPresenter.java @@ -17,10 +17,10 @@ * under the License. */ - package org.uberfire.client.workbench.panels; -import org.kie.soup.commons.validation.PortablePreconditions; +import java.util.Objects; + import org.uberfire.client.mvp.UberView; import org.uberfire.mvp.Command; @@ -37,11 +37,14 @@ public class MaximizeToggleButtonPresenter { private Command unmaximizeCommand; public MaximizeToggleButtonPresenter(View view) { - this.view = PortablePreconditions.checkNotNull("view", - view); + this.view = checkNotNull("view", view); view.init(this); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + /** * Returns the currently registered maximize command. Can be used to check if there is currently a maximize command registered. */ diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractDockingWorkbenchPanelView.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractDockingWorkbenchPanelView.java index 5f90cd48c73..1ab4ed5e82a 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractDockingWorkbenchPanelView.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractDockingWorkbenchPanelView.java @@ -21,6 +21,7 @@ package org.uberfire.client.workbench.panels.impl; import java.util.IdentityHashMap; +import java.util.Objects; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; @@ -43,7 +44,6 @@ import org.uberfire.workbench.model.PanelDefinition; import org.uberfire.workbench.model.Position; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; import static org.uberfire.client.util.Layouts.setToFillParent; import static org.uberfire.client.util.Layouts.widthOrHeight; import static org.uberfire.plugin.PluginUtil.toInteger; @@ -278,6 +278,10 @@ public void addPanel(final PanelDefinition childPanelDef, scheduleResize(splitPanel); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + @Override public boolean removePanel(WorkbenchPanelView childView) { CompassPosition removalPosition = positionOf(childView); diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/common/ErrorPopupPresenter.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/common/ErrorPopupPresenter.java index 84d5a8c0b09..9997f6e331a 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/common/ErrorPopupPresenter.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/common/ErrorPopupPresenter.java @@ -19,6 +19,8 @@ package org.uberfire.client.workbench.widgets.common; +import java.util.Objects; + import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; @@ -26,8 +28,6 @@ import org.uberfire.mvp.Command; import org.uberfire.mvp.Commands; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * Shows simple text-only error messages in a modal popup dialog that sits above the workbench. * This is designed to be used only for reporting error conditions; to make a full-featured popup UI, see {@link WorkbenchPopup}. @@ -59,6 +59,10 @@ public void showMessage(final String msg, afterClose)); } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + /** * Shows the given message in a modal popup that appears above all other workbench contents. * diff --git a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/notifications/NotificationManager.java b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/notifications/NotificationManager.java index ad45f537c28..3bd03b392d4 100644 --- a/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/notifications/NotificationManager.java +++ b/packages/dashbuilder/appformer/uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/notifications/NotificationManager.java @@ -21,6 +21,7 @@ import java.util.HashMap; import java.util.Map; +import java.util.Objects; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Observes; @@ -31,7 +32,6 @@ import com.google.gwt.user.client.ui.RootPanel; import org.jboss.errai.ioc.client.container.SyncBeanDef; import org.jboss.errai.ioc.client.container.SyncBeanManager; -import org.kie.soup.commons.validation.PortablePreconditions; import org.uberfire.client.mvp.Activity; import org.uberfire.client.mvp.PlaceManager; import org.uberfire.client.mvp.WorkbenchActivity; @@ -202,8 +202,8 @@ private class HideNotificationCommand implements Command { private NotificationPopupHandle handle; HideNotificationCommand(final View notificationContainerView) { - this.notificationContainerView = PortablePreconditions.checkNotNull("notificationContainerView", - notificationContainerView); + Objects.requireNonNull(notificationContainerView, "notificationContainerView"); + this.notificationContainerView = notificationContainerView; } @Override diff --git a/packages/dashbuilder/dashbuilder-client/dashbuilder-dataset-client/pom.xml b/packages/dashbuilder/dashbuilder-client/dashbuilder-dataset-client/pom.xml index 05d070343b4..ea243e26a38 100644 --- a/packages/dashbuilder/dashbuilder-client/dashbuilder-dataset-client/pom.xml +++ b/packages/dashbuilder/dashbuilder-client/dashbuilder-dataset-client/pom.xml @@ -52,11 +52,6 @@ errai-ioc - - org.kie.soup - kie-soup-commons - - com.google.gwt gwt-user diff --git a/packages/dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/DataSetClientServicesImpl.java b/packages/dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/DataSetClientServicesImpl.java index 81fc63ae173..b2ac0d2938b 100644 --- a/packages/dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/DataSetClientServicesImpl.java +++ b/packages/dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/DataSetClientServicesImpl.java @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.event.Event; @@ -50,8 +51,6 @@ import org.jboss.errai.common.client.api.ErrorCallback; import org.jboss.errai.common.client.api.RemoteCallback; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - /** * Default implementation */ @@ -104,6 +103,10 @@ public DataSetClientServicesImpl(ClientDataSetManager clientDataSetManager, this.dataSetDefServices = dataSetDefServices; } + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + public boolean isPushRemoteDataSetEnabled() { return pushRemoteDataSetEnabled; } diff --git a/packages/dashbuilder/dashbuilder-client/dashbuilder-displayer-client/pom.xml b/packages/dashbuilder/dashbuilder-client/dashbuilder-displayer-client/pom.xml index 0560f535b87..f6fb7d7e1ec 100644 --- a/packages/dashbuilder/dashbuilder-client/dashbuilder-displayer-client/pom.xml +++ b/packages/dashbuilder/dashbuilder-client/dashbuilder-displayer-client/pom.xml @@ -63,11 +63,6 @@ uberfire-client-api - - org.kie.soup - kie-soup-commons - - com.google.gwt gwt-user diff --git a/packages/dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerViewer.java b/packages/dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerViewer.java index 94f38616d5f..70adccf54b9 100644 --- a/packages/dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerViewer.java +++ b/packages/dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerViewer.java @@ -19,6 +19,8 @@ package org.dashbuilder.displayer.client.widgets; +import java.util.Objects; + import javax.enterprise.context.Dependent; import javax.inject.Inject; @@ -36,8 +38,6 @@ import org.dashbuilder.displayer.client.resources.i18n.CommonConstants; import org.uberfire.mvp.Command; -import static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull; - @Dependent public class DisplayerViewer extends Composite { @@ -54,6 +54,10 @@ public class DisplayerViewer extends Composite { ClientRuntimeError displayerInitializationError; CommonConstants i18n = CommonConstants.INSTANCE; + private static T checkNotNull(String objName, T obj) { + return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!"); + } + DisplayerListener displayerListener = new AbstractDisplayerListener() { public void onDraw(Displayer displayer) { diff --git a/packages/dashbuilder/dashbuilder-runtime-parent/dashbuilder-runtime-client/pom.xml b/packages/dashbuilder/dashbuilder-runtime-parent/dashbuilder-runtime-client/pom.xml index c85da13486d..93b98607139 100644 --- a/packages/dashbuilder/dashbuilder-runtime-parent/dashbuilder-runtime-client/pom.xml +++ b/packages/dashbuilder/dashbuilder-runtime-parent/dashbuilder-runtime-client/pom.xml @@ -73,11 +73,6 @@ - - org.kie.soup - kie-soup-commons - provided - org.dashbuilder @@ -450,8 +445,6 @@ org.uberfire:uberfire-widgets-commons org.uberfire:uberfire-widgets-table - org.kie.soup:kie-soup-commons - org.uberfire:uberfire-commons org.uberfire:uberfire-api diff --git a/packages/dashbuilder/pom.xml b/packages/dashbuilder/pom.xml index cca3f99332b..cdf1bf5dc37 100644 --- a/packages/dashbuilder/pom.xml +++ b/packages/dashbuilder/pom.xml @@ -61,7 +61,6 @@ 4.13.2 3.14.0 3.6.0 - 7.59.0.Final 3.15.1.Final 4.15.0.Final 2.7 @@ -151,17 +150,6 @@ ${version.org.javassist} - - org.kie.soup - kie-soup-commons - ${version.org.kie} - - - org.kie.soup - kie-soup-commons - ${version.org.kie} - sources - org.assertj