Skip to content

Commit

Permalink
kie-issues#1012: Removing kie-soup-commons dependency in DashBuilder (
Browse files Browse the repository at this point in the history
  • Loading branch information
yesamer authored Mar 15, 2024
1 parent 5831ab7 commit 013f7f7
Show file tree
Hide file tree
Showing 43 changed files with 181 additions and 148 deletions.
5 changes: 0 additions & 5 deletions packages/dashbuilder/appformer/uberfire-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,6 @@
<artifactId>uberfire-commons</artifactId>
</dependency>

<dependency>
<groupId>org.kie.soup</groupId>
<artifactId>kie-soup-commons</artifactId>
</dependency>

<dependency>
<groupId>org.jboss.errai</groupId>
<artifactId>errai-common</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -61,6 +60,10 @@ public static <T> List<T> ensureIterable(List<T> externalList) {
return Collections.unmodifiableList(tmp);
}

private static <T> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -54,6 +54,10 @@ public NamedPosition(@MapsTo("fieldName") String fieldName) {
fieldName);
}

private static <T> 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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

/**
Expand Down Expand Up @@ -242,6 +242,10 @@ public void setPanelType(String fqcn) {
fqcn);
}

private static <T> T checkNotNull(String objName, T obj) {
return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!");
}

@Override
@JsIgnore
public Integer getHeight() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -53,6 +54,10 @@ public PerspectiveDefinitionImpl(final String panelType) {
this.root = root;
}

private static <T> T checkNotNull(String objName, T obj) {
return Objects.requireNonNull(obj, "Parameter named '" + objName + "' should be not null!");
}

@Override
public String getName() {
return name;
Expand Down
5 changes: 0 additions & 5 deletions packages/dashbuilder/appformer/uberfire-client-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,6 @@
<artifactId>errai-ioc</artifactId>
</dependency>

<dependency>
<groupId>org.kie.soup</groupId>
<artifactId>kie-soup-commons</artifactId>
</dependency>

<dependency>
<groupId>com.google.elemental2</groupId>
<artifactId>elemental2-dom</artifactId>
Expand Down
4 changes: 0 additions & 4 deletions packages/dashbuilder/appformer/uberfire-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</dependency>
<dependency>
<groupId>org.kie.soup</groupId>
<artifactId>kie-soup-commons</artifactId>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd">
<module>

<inherits name='org.kie.soup.commons.KIESoupCommons' />

<source path='data' />
<source path='lifecycle' />
<source path='uuid' />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
<artifactId>uberfire-commons</artifactId>
</dependency>

<dependency>
<groupId>org.kie.soup</groupId>
<artifactId>kie-soup-commons</artifactId>
</dependency>

<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-workbench-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
*/
Expand Down Expand Up @@ -66,6 +66,10 @@ public ModalFooterForceSaveReOpenCancelButtons(final Modal panel,
add(uiBinder.createAndBindUi(this));
}

private static <T> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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> 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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
*/
Expand Down Expand Up @@ -61,6 +61,10 @@ public ModalFooterReOpenIgnoreButtons(final Modal panel,
this.actionButton.setText(buttonText);
}

private static <T> 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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@
<artifactId>uberfire-commons</artifactId>
</dependency>

<dependency>
<groupId>org.kie.soup</groupId>
<artifactId>kie-soup-commons</artifactId>
</dependency>

<dependency>
<groupId>org.uberfire</groupId>
<artifactId>uberfire-workbench-client</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<FSTreeItem> {

private final FSType fstype;
Expand All @@ -54,6 +53,10 @@ public FSTreeItem(final FSType type,
type);
}

private static <T> 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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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<I extends TreeItem> extends Composite implements OuiaComponent {

private static final String OUIA_COMPONENT_TYPE = "tree-item";
Expand All @@ -59,6 +58,10 @@ public class TreeItem<I extends TreeItem> extends Composite implements OuiaCompo
private IsWidget icon;
private FlowPanel item;

private static <T> 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,
Expand Down
Loading

0 comments on commit 013f7f7

Please sign in to comment.