diff --git a/org.knime.base.filehandling.tests/files/node_settings/ModelToBinaryObjectNodeParameters.xml b/org.knime.base.filehandling.tests/files/node_settings/ModelToBinaryObjectNodeParameters.xml
new file mode 100644
index 00000000..4eb8ea3c
--- /dev/null
+++ b/org.knime.base.filehandling.tests/files/node_settings/ModelToBinaryObjectNodeParameters.xml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest.snap b/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest.snap
new file mode 100644
index 00000000..89f1fc53
--- /dev/null
+++ b/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest.snap
@@ -0,0 +1,42 @@
+{
+ "data" : {
+ "model" : {
+ "columnName" : ""
+ }
+ },
+ "schema" : {
+ "type" : "object",
+ "properties" : {
+ "model" : {
+ "type" : "object",
+ "properties" : {
+ "columnName" : {
+ "type" : "string",
+ "title" : "New column name",
+ "description" : "Name of the new column.",
+ "default" : ""
+ }
+ }
+ }
+ }
+ },
+ "ui_schema" : {
+ "elements" : [ {
+ "type" : "Control",
+ "scope" : "#/properties/model/properties/columnName"
+ } ]
+ },
+ "persist" : {
+ "type" : "object",
+ "properties" : {
+ "model" : {
+ "type" : "object",
+ "properties" : {
+ "columnName" : {
+ "configKey" : "columnname"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest0.settings.xml.snap b/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest0.settings.xml.snap
new file mode 100644
index 00000000..7c838538
--- /dev/null
+++ b/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest0.settings.xml.snap
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest1.snap b/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest1.snap
new file mode 100644
index 00000000..8e653e0e
--- /dev/null
+++ b/org.knime.base.filehandling.tests/files/test_snapshots/org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeParametersTest1.snap
@@ -0,0 +1,42 @@
+{
+ "data" : {
+ "model" : {
+ "columnName" : "model"
+ }
+ },
+ "schema" : {
+ "type" : "object",
+ "properties" : {
+ "model" : {
+ "type" : "object",
+ "properties" : {
+ "columnName" : {
+ "type" : "string",
+ "title" : "New column name",
+ "description" : "Name of the new column.",
+ "default" : ""
+ }
+ }
+ }
+ }
+ },
+ "ui_schema" : {
+ "elements" : [ {
+ "type" : "Control",
+ "scope" : "#/properties/model/properties/columnName"
+ } ]
+ },
+ "persist" : {
+ "type" : "object",
+ "properties" : {
+ "model" : {
+ "type" : "object",
+ "properties" : {
+ "columnName" : {
+ "configKey" : "columnname"
+ }
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/org.knime.base.filehandling.tests/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeParametersTest.java b/org.knime.base.filehandling.tests/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeParametersTest.java
new file mode 100644
index 00000000..90a43c4f
--- /dev/null
+++ b/org.knime.base.filehandling.tests/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeParametersTest.java
@@ -0,0 +1,92 @@
+/*
+ * ------------------------------------------------------------------------
+ *
+ * Copyright by KNIME AG, Zurich, Switzerland
+ * Website: http://www.knime.com; Email: contact@knime.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, Version 3, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see .
+ *
+ * Additional permission under GNU GPL version 3 section 7:
+ *
+ * KNIME interoperates with ECLIPSE solely via ECLIPSE's plug-in APIs.
+ * Hence, KNIME and ECLIPSE are both independent programs and are not
+ * derived from each other. Should, however, the interpretation of the
+ * GNU GPL Version 3 ("License") under any applicable laws result in
+ * KNIME and ECLIPSE being a combined program, KNIME AG herewith grants
+ * you the additional permission to use and propagate KNIME together with
+ * ECLIPSE with only the license terms in place for ECLIPSE applying to
+ * ECLIPSE and the GNU GPL Version 3 applying for KNIME, provided the
+ * license terms of ECLIPSE themselves allow for the respective use and
+ * propagation of ECLIPSE together with KNIME.
+ *
+ * Additional permission relating to nodes for KNIME that extend the Node
+ * Extension (and in particular that are based on subclasses of NodeModel,
+ * NodeDialog, and NodeView) and that only interoperate with KNIME through
+ * standard APIs ("Nodes"):
+ * Nodes are deemed to be separate and independent programs and to not be
+ * covered works. Notwithstanding anything to the contrary in the
+ * License, the License does not apply to Nodes, you are not required to
+ * license Nodes under the License, and you are granted a license to
+ * prepare and propagate Nodes, in each case even if such Nodes are
+ * propagated with or for interoperation with KNIME. The owner of a Node
+ * may freely choose the license terms applicable to such Node, including
+ * when such Node is propagated with or for interoperation with KNIME.
+ * ------------------------------------------------------------------------
+ */
+
+package org.knime.base.filehandling.binaryobjects.model.to.port;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import org.knime.core.node.InvalidSettingsException;
+import org.knime.core.node.NodeSettings;
+import org.knime.core.webui.node.dialog.SettingsType;
+import org.knime.core.webui.node.dialog.defaultdialog.NodeParametersUtil;
+import org.knime.testing.node.dialog.DefaultNodeSettingsSnapshotTest;
+import org.knime.testing.node.dialog.SnapshotTestConfiguration;
+
+/**
+ * Snapshot test for {@link ModelToBinaryObjectNodeParameters}.
+ *
+ * @author Tim Crundall, TNG Technology Consulting GmbH
+ */
+@SuppressWarnings({"restriction", "javadoc"})
+final class ModelToBinaryObjectNodeParametersTest extends DefaultNodeSettingsSnapshotTest {
+
+ ModelToBinaryObjectNodeParametersTest() {
+ super(getConfig());
+ }
+
+ private static SnapshotTestConfiguration getConfig() {
+ return SnapshotTestConfiguration.builder() //
+ .testJsonFormsForModel(ModelToBinaryObjectNodeParameters.class) //
+ .testJsonFormsWithInstance(SettingsType.MODEL, () -> readSettings()) //
+ .testNodeSettingsStructure(() -> readSettings()) //
+ .build();
+ }
+
+ private static ModelToBinaryObjectNodeParameters readSettings() {
+ try {
+ var path = getSnapshotPath(ModelToBinaryObjectNodeParameters.class).getParent().resolve("node_settings")
+ .resolve("ModelToBinaryObjectNodeParameters.xml");
+ try (var fis = new FileInputStream(path.toFile())) {
+ var nodeSettings = NodeSettings.loadFromXML(fis);
+ return NodeParametersUtil.loadSettings(nodeSettings.getNodeSettings(SettingsType.MODEL.getConfigKey()),
+ ModelToBinaryObjectNodeParameters.class);
+ }
+ } catch (IOException | InvalidSettingsException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+}
diff --git a/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeFactory.java b/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeFactory.java
index 03c7bb6c..97251639 100644
--- a/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeFactory.java
+++ b/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeFactory.java
@@ -47,17 +47,37 @@
*/
package org.knime.base.filehandling.binaryobjects.model.to.port;
+import static org.knime.node.impl.description.PortDescription.fixedPort;
+
+import java.util.List;
+import java.util.Map;
+
+import org.knime.core.node.NodeDescription;
import org.knime.core.node.NodeDialogPane;
import org.knime.core.node.NodeFactory;
import org.knime.core.node.NodeView;
+import org.knime.core.webui.node.dialog.NodeDialog;
+import org.knime.core.webui.node.dialog.NodeDialogFactory;
+import org.knime.core.webui.node.dialog.NodeDialogManager;
+import org.knime.core.webui.node.dialog.SettingsType;
+import org.knime.core.webui.node.dialog.defaultdialog.DefaultKaiNodeInterface;
+import org.knime.core.webui.node.dialog.defaultdialog.DefaultNodeDialog;
+import org.knime.core.webui.node.dialog.kai.KaiNodeInterface;
+import org.knime.core.webui.node.dialog.kai.KaiNodeInterfaceFactory;
+import org.knime.node.impl.description.DefaultNodeDescriptionUtil;
+import org.knime.node.impl.description.PortDescription;
/**
* NodeFactory for node.
*
*
* @author Eric Axt, KNIME GmbH, Konstanz, Germany
+ * @author Tim Crundall, TNG Technology Consulting GmbH
+ * @author AI Migration Pipeline v1.2
*/
-public final class ModelToBinaryObjectNodeFactory extends NodeFactory {
+@SuppressWarnings({"restriction", "removal"})
+public final class ModelToBinaryObjectNodeFactory extends NodeFactory
+ implements NodeDialogFactory, KaiNodeInterfaceFactory {
@Override
public ModelToBinaryObjectNodeModel createNodeModel() {
@@ -80,9 +100,51 @@ public boolean hasDialog() {
return true;
}
+ private static final String NODE_NAME = "Model to Binary Object";
+
+ private static final String NODE_ICON = "./modeltobinaryobjects16x16.png";
+
+ private static final String SHORT_DESCRIPTION = "Converts a model to a binary object cell.";
+
+ private static final String FULL_DESCRIPTION = "Converts a model to a binary object cell.";
+
+ private static final List INPUT_PORTS =
+ List.of(fixedPort("Input model", "Model that will be converted."));
+
+ private static final List OUTPUT_PORTS =
+ List.of(fixedPort("Output table", "Model turned into binary objects."));
+
@Override
public NodeDialogPane createNodeDialogPane() {
- return new ModelToBinaryObjectNodeDialog();
+ return NodeDialogManager.createLegacyFlowVariableNodeDialog(createNodeDialog());
+ }
+
+ @Override
+ public NodeDialog createNodeDialog() {
+ return new DefaultNodeDialog(SettingsType.MODEL, ModelToBinaryObjectNodeParameters.class);
+ }
+
+ @Override
+ public NodeDescription createNodeDescription() {
+ return DefaultNodeDescriptionUtil.createNodeDescription( //
+ NODE_NAME, //
+ NODE_ICON, //
+ INPUT_PORTS, //
+ OUTPUT_PORTS, //
+ SHORT_DESCRIPTION, //
+ FULL_DESCRIPTION, //
+ List.of(), //
+ ModelToBinaryObjectNodeParameters.class, //
+ null, //
+ NodeType.Manipulator, //
+ List.of(), //
+ null //
+ );
+ }
+
+ @Override
+ public KaiNodeInterface createKaiNodeInterface() {
+ return new DefaultKaiNodeInterface(Map.of(SettingsType.MODEL, ModelToBinaryObjectNodeParameters.class));
}
}
diff --git a/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeFactory.xml b/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeFactory.xml
deleted file mode 100644
index 869344ed..00000000
--- a/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeFactory.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- Model to Binary Object
-
-
- Converts a model to a binary object cell.
-
-
-
-
- Converts a model to a binary object cell.
-
-
-
-
-
-
-
-
- Model that will be converted.
-
-
- Model turned into binary
- objects.
-
-
-
diff --git a/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeDialog.java b/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeParameters.java
similarity index 76%
rename from org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeDialog.java
rename to org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeParameters.java
index 560ff3ec..6640f2f7 100644
--- a/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeDialog.java
+++ b/org.knime.base.filehandling/src/org/knime/base/filehandling/binaryobjects/model/to/port/ModelToBinaryObjectNodeParameters.java
@@ -1,5 +1,6 @@
/*
* ------------------------------------------------------------------------
+ *
* Copyright by KNIME AG, Zurich, Switzerland
* Website: http://www.knime.com; Email: contact@knime.com
*
@@ -41,35 +42,26 @@
* may freely choose the license terms applicable to such Node, including
* when such Node is propagated with or for interoperation with KNIME.
* ------------------------------------------------------------------------
- *
- * History
- * Oct 30, 2012 (Patrick Winter): created
*/
+
package org.knime.base.filehandling.binaryobjects.model.to.port;
-import org.knime.core.node.defaultnodesettings.DefaultNodeSettingsPane;
-import org.knime.core.node.defaultnodesettings.DialogComponentString;
+import org.knime.node.parameters.NodeParameters;
+import org.knime.node.parameters.Widget;
+import org.knime.node.parameters.migration.LoadDefaultsForAbsentFields;
+import org.knime.node.parameters.persistence.Persist;
/**
- * NodeDialog for the node.
+ * Node parameters for Model to Binary Object.
*
- *
- * @author Eric Axt, KNIME GmbH, Konstanz, Germany
+ * @author Tim Crundall, TNG Technology Consulting GmbH
+ * @author AI Migration Pipeline v1.2
*/
-final class ModelToBinaryObjectNodeDialog extends DefaultNodeSettingsPane {
-
- /**
- * New pane for configuring the node dialog.
- */
- protected ModelToBinaryObjectNodeDialog() {
- super();
- var columnname = SettingsFactory.createColumnNameSettings();
+@LoadDefaultsForAbsentFields
+final class ModelToBinaryObjectNodeParameters implements NodeParameters {
- // Column selection
- createNewGroup("New column");
+ @Widget(title = "New column name", description = "Name of the new column.")
+ @Persist(configKey = "columnname")
+ String m_columnName = "";
- // Column name
- addDialogComponent(new DialogComponentString(columnname, "Name", true, 20));
- closeCurrentGroup();
- }
}
diff --git a/org.knime.ext.box.authenticator.tests/META-INF/MANIFEST.MF b/org.knime.ext.box.authenticator.tests/META-INF/MANIFEST.MF
index 076d8e50..d18728fd 100644
--- a/org.knime.ext.box.authenticator.tests/META-INF/MANIFEST.MF
+++ b/org.knime.ext.box.authenticator.tests/META-INF/MANIFEST.MF
@@ -2,10 +2,10 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Unit-Tests for org.knime.ext.box.authenticator
Bundle-SymbolicName: org.knime.ext.box.authenticator.tests;singleton:=true
-Bundle-Version: 5.9.0.qualifier
+Bundle-Version: 5.12.0.qualifier
Bundle-Vendor: KNIME AG, Zurich, Switzerland
Bundle-RequiredExecutionEnvironment: JavaSE-17
-Fragment-Host: org.knime.ext.box.authenticator;bundle-version="[5.6.0,6.0.0)"
+Fragment-Host: org.knime.ext.box.authenticator;bundle-version="[5.12.0,6.0.0)"
Eclipse-BundleShape: dir
Automatic-Module-Name: org.knime.ext.box.authenticator.tests
Require-Bundle: org.knime.core.ui.testing;bundle-version="[5.6.0,6.0.0)",
diff --git a/org.knime.ext.box.authenticator.tests/files/test_snapshots/org.knime.ext.box.authenticator.node.BoxAuthenticatorSettingsTest.snap b/org.knime.ext.box.authenticator.tests/files/test_snapshots/org.knime.ext.box.authenticator.node.BoxAuthenticatorSettingsTest.snap
index 17433db6..3dbc59aa 100644
--- a/org.knime.ext.box.authenticator.tests/files/test_snapshots/org.knime.ext.box.authenticator.node.BoxAuthenticatorSettingsTest.snap
+++ b/org.knime.ext.box.authenticator.tests/files/test_snapshots/org.knime.ext.box.authenticator.node.BoxAuthenticatorSettingsTest.snap
@@ -1,7 +1,15 @@
{
"data" : {
"model" : {
- "boxApp" : { },
+ "boxApp" : {
+ "secret" : {
+ "credentials" : {
+ "isHiddenPassword" : false,
+ "isHiddenSecondFactor" : false,
+ "username" : ""
+ }
+ }
+ },
"authType" : "OAUTH",
"redirectUrl" : "http://localhost:33749/"
}
@@ -27,13 +35,55 @@
"boxApp" : {
"type" : "object",
"properties" : {
- "flowVariable" : {
- "type" : "string",
- "title" : "App ID and secret (flow variable)",
- "description" : "Specifies a credentials flow variable with the app/client ID and secret of the custom Box app.\nThese fields can be found in the configuration settings of your custom Box app.\n"
+ "secret" : {
+ "type" : "object",
+ "properties" : {
+ "credentials" : {
+ "type" : "object",
+ "properties" : {
+ "password" : {
+ "type" : "string",
+ "default" : ""
+ },
+ "secondFactor" : {
+ "type" : "string",
+ "default" : ""
+ },
+ "username" : {
+ "type" : "string",
+ "default" : ""
+ }
+ },
+ "default" : {
+ "isHiddenPassword" : false,
+ "isHiddenSecondFactor" : false,
+ "username" : ""
+ }
+ },
+ "flowVarName" : {
+ "type" : "string"
+ }
+ },
+ "title" : "App ID and secret",
+ "description" : "Specifies the app/client ID and secret of the custom Box app.\nThese fields can be found in the configuration settings of your custom Box app.\n",
+ "default" : {
+ "credentials" : {
+ "isHiddenPassword" : false,
+ "isHiddenSecondFactor" : false,
+ "username" : ""
+ }
+ }
}
},
- "default" : { }
+ "default" : {
+ "secret" : {
+ "credentials" : {
+ "isHiddenPassword" : false,
+ "isHiddenSecondFactor" : false,
+ "username" : ""
+ }
+ }
+ }
},
"enterpriseId" : {
"type" : "string",
@@ -62,11 +112,12 @@
"type" : "Section",
"elements" : [ {
"type" : "Control",
- "scope" : "#/properties/model/properties/boxApp/properties/flowVariable",
+ "scope" : "#/properties/model/properties/boxApp/properties/secret",
"options" : {
- "format" : "dropDown"
- },
- "providedOptions" : [ "possibleValues" ]
+ "passwordLabel" : "Secret",
+ "usernameLabel" : "ID",
+ "format" : "legacyCredentials"
+ }
} ]
}, {
"label" : "Authentication method",
@@ -131,10 +182,10 @@
} ],
"displayErrorMessage" : true,
"showTitleAndDescription" : false,
- "dependencies" : [ "#/properties/model/properties/boxApp/properties/flowVariable", "#/properties/model/properties/authType", "#/properties/model/properties/enterpriseId", "#/properties/model/properties/redirectUrl" ],
+ "dependencies" : [ "#/properties/model/properties/boxApp/properties/secret", "#/properties/model/properties/authType", "#/properties/model/properties/enterpriseId", "#/properties/model/properties/redirectUrl" ],
"updateOptions" : {
"updateHandler" : "org.knime.ext.box.authenticator.node.BoxAuthenticatorSettings$LoginUpdateHandler",
- "dependencies" : [ "#/properties/model/properties/boxApp/properties/flowVariable", "#/properties/model/properties/authType", "#/properties/model/properties/enterpriseId", "#/properties/model/properties/redirectUrl" ]
+ "dependencies" : [ "#/properties/model/properties/boxApp/properties/secret", "#/properties/model/properties/authType", "#/properties/model/properties/enterpriseId", "#/properties/model/properties/redirectUrl" ]
}
},
"rule" : {
@@ -160,7 +211,18 @@
"boxApp" : {
"type" : "object",
"properties" : {
- "flowVariable" : { }
+ "secret" : {
+ "type" : "object",
+ "properties" : {
+ "credentials" : { },
+ "flowVarName" : {
+ "configPaths" : [ ]
+ }
+ },
+ "deprecatedConfigKeys" : [ {
+ "deprecated" : [ [ "flowVariable" ] ]
+ } ]
+ }
}
},
"authType" : { },
@@ -173,12 +235,16 @@
}
}
},
- "initialUpdates" : [ {
- "scope" : "#/properties/model/properties/boxApp/properties/flowVariable",
- "providedOptionName" : "possibleValues",
- "values" : [ {
- "indices" : [ ],
- "value" : [ ]
- } ]
+ "globalUpdates" : [ {
+ "trigger" : {
+ "id" : "after-open-dialog"
+ },
+ "triggerInitially" : true,
+ "dependencies" : [ "#/properties/model/properties/boxApp" ]
+ }, {
+ "trigger" : {
+ "scope" : "#/properties/model/properties/boxApp"
+ },
+ "dependencies" : [ "#/properties/model/properties/boxApp" ]
} ]
}
\ No newline at end of file
diff --git a/org.knime.ext.box.authenticator.tests/pom.xml b/org.knime.ext.box.authenticator.tests/pom.xml
index 53362e9a..2a9c5e5d 100644
--- a/org.knime.ext.box.authenticator.tests/pom.xml
+++ b/org.knime.ext.box.authenticator.tests/pom.xml
@@ -15,7 +15,7 @@
eclipse-test-plugin
- 5.9.0
+ 5.12.0
src/eclipse
diff --git a/org.knime.ext.box.authenticator/META-INF/MANIFEST.MF b/org.knime.ext.box.authenticator/META-INF/MANIFEST.MF
index cd9934d2..c97acb87 100644
--- a/org.knime.ext.box.authenticator/META-INF/MANIFEST.MF
+++ b/org.knime.ext.box.authenticator/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Plugin for the Box Authenticator node
Bundle-SymbolicName: org.knime.ext.box.authenticator;singleton:=true
-Bundle-Version: 5.9.0.qualifier
+Bundle-Version: 5.12.0.qualifier
Bundle-Vendor: KNIME AG, Zurich, Switzerland
Require-Bundle: org.knime.workbench.repository;bundle-version="[5.9.0,6.0.0)",
org.knime.core;bundle-version="[5.9.0,6.0.0)",
diff --git a/org.knime.ext.box.authenticator/src-deprecated/org/knime/ext/box/authenticator/node/BoxAppSettings.java b/org.knime.ext.box.authenticator/src-deprecated/org/knime/ext/box/authenticator/node/BoxAppSettings.java
index fc3088e7..3ea181de 100644
--- a/org.knime.ext.box.authenticator/src-deprecated/org/knime/ext/box/authenticator/node/BoxAppSettings.java
+++ b/org.knime.ext.box.authenticator/src-deprecated/org/knime/ext/box/authenticator/node/BoxAppSettings.java
@@ -50,46 +50,71 @@
import org.knime.core.node.InvalidSettingsException;
import org.knime.core.node.workflow.CredentialsProvider;
+import org.knime.core.webui.node.dialog.defaultdialog.setting.credentials.LegacyCredentials;
+import org.knime.core.webui.node.dialog.defaultdialog.widget.validation.custom.CustomValidation;
+import org.knime.credentials.base.node.CredentialVariableMigration;
import org.knime.credentials.base.node.CredentialsSettings;
import org.knime.node.parameters.Widget;
-import org.knime.node.parameters.widget.choices.ChoicesProvider;
+import org.knime.node.parameters.migration.Migration;
+import org.knime.node.parameters.updates.ParameterReference;
+import org.knime.node.parameters.widget.credentials.Credentials;
+import org.knime.node.parameters.widget.credentials.CredentialsWidget;
/**
* Implementation of {@link CredentialsSettings} to supply the ID and secret of
* a confidential OAuth2 app.
*
+ * Any instance must be annotated with a {@code ValueReference} to {@link Ref}
+ * for the validation to work.
+ *
+ *
* @author Bjoern Lohrmann, KNIME GmbH
*/
@SuppressWarnings("restriction")
public class BoxAppSettings implements CredentialsSettings {
/**
- * The name of the Credentials flow variable.
+ * The credential
*/
- @Widget(title = "App ID and secret (flow variable)", //
+ @Widget(title = "App ID and secret", //
description = """
- Specifies a credentials flow variable with the app/client ID and secret of the custom Box app.
+ Specifies the app/client ID and secret of the custom Box app.
These fields can be found in the configuration settings of your custom Box app.
""")
- @ChoicesProvider(CredentialsFlowVarChoicesProvider.class)
- public String m_flowVariable;
+ @Migration(CredentialVariableMigration.class)
+ @CustomValidation(BoxCredentialValidator.class)
+ @CredentialsWidget(usernameLabel = "ID", passwordLabel = "Secret") // NOSONAR not a password
+
+ public LegacyCredentials m_secret = new LegacyCredentials(new Credentials());
+
+ /**
+ * Used to reference this class for the validation.
+ */
+ public interface Ref extends ParameterReference {
+ }
+
+ static final class BoxCredentialValidator extends AbstractCredentialsValidator {
+ BoxCredentialValidator() {
+ super(Ref.class);
+ }
+ }
@Override
- public String flowVariableName() {
- return m_flowVariable;
+ public LegacyCredentials getCredential() {
+ return m_secret;
}
/**
- * If a flow variable has been specified, this method validates that a username
- * and password are present in the flow variable. This method should be used
- * during the configure phase, to reduce logspam if the credentials flow
- * variable is not there yet.
+ * If a credential has been specified, this method validates that a username and
+ * password are present. This method should be used during the configure phase,
+ * to reduce logspam if the credential is not there yet.
*
* @param credsProvider
- * Used to access the flow variable.
+ * Used to access the credential.
* @throws InvalidSettingsException
- * when username or password was not present in the flow variable.
+ * when username or password was not present in the credential.
*/
+ @Override
public void validateOnConfigure(final CredentialsProvider credsProvider) throws InvalidSettingsException {
if (retrieve(credsProvider).isPresent()) {
validateLogin(credsProvider, "Client/App ID is required");
@@ -98,16 +123,15 @@ public void validateOnConfigure(final CredentialsProvider credsProvider) throws
}
/**
- * This method validates both presence and validity of a credentials flow
- * variable. This method should be used during the execute phase.
+ * This method validates both presence and validity of a credential. This method
+ * should be used during the execute phase.
*
* @param credsProvider
- * Used to access the flow variable.
+ * Used to access the credential.
* @throws InvalidSettingsException
- * when flow variable was not present or invalid.
+ * when credential was not present or invalid.
*/
public void validateOnExecute(final CredentialsProvider credsProvider) throws InvalidSettingsException {
- validateFlowVariable(credsProvider);
validateLogin(credsProvider, "Client/App ID is required");
validateSecret(credsProvider, "Client/App secret is required");
}
diff --git a/org.knime.ext.box.authenticator/src-deprecated/org/knime/ext/box/authenticator/node/BoxAuthenticatorSettings.java b/org.knime.ext.box.authenticator/src-deprecated/org/knime/ext/box/authenticator/node/BoxAuthenticatorSettings.java
index 26f3846f..0aa8cdb1 100644
--- a/org.knime.ext.box.authenticator/src-deprecated/org/knime/ext/box/authenticator/node/BoxAuthenticatorSettings.java
+++ b/org.knime.ext.box.authenticator/src-deprecated/org/knime/ext/box/authenticator/node/BoxAuthenticatorSettings.java
@@ -136,6 +136,7 @@ public EffectPredicate init(final PredicateInitializer i) {
}
@Layout(BoxAppSection.class)
+ @ValueReference(BoxAppSettings.Ref.class)
BoxAppSettings m_boxApp = new BoxAppSettings();
@Widget(title = "Type", description = "Authentication method to use.")