Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.knime.org/2008/09/XMLConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.knime.org/2008/09/XMLConfig http://www.knime.org/XMLConfig_2008_09.xsd" key="settings.xml">
<entry key="node_file" type="xstring" value="settings.xml"/>
<config key="flow_stack"/>
<config key="internal_node_subsettings">
<entry key="memory_policy" type="xstring" value="CacheSmallInMemory"/>
</config>
<config key="model">
<config key="columnname_Internals">
<entry key="SettingsModelID" type="xstring" value="SMID_string"/>
<entry key="EnabledStatus" type="xboolean" value="true"/>
</config>
<entry key="columnname" type="xstring" value="model"/>
</config>
<entry key="customDescription" type="xstring" isnull="true" value=""/>
<entry key="state" type="xstring" value="IDLE"/>
<entry key="factory" type="xstring" value="org.knime.base.filehandling.binaryobjects.model.to.port.ModelToBinaryObjectNodeFactory"/>
<entry key="node-name" type="xstring" value="Model to Binary Object"/>
<entry key="node-bundle-name" type="xstring" value="KNIME File Handling Nodes"/>
<entry key="node-bundle-symbolic-name" type="xstring" value="org.knime.base.filehandling"/>
<entry key="node-bundle-vendor" type="xstring" value="KNIME AG, Zurich, Switzerland"/>
<entry key="node-bundle-version" type="xstring" value="5.11.0.v202603201205"/>
<entry key="node-feature-name" type="xstring" isnull="true" value=""/>
<entry key="node-feature-symbolic-name" type="xstring" isnull="true" value=""/>
<entry key="node-feature-vendor" type="xstring" isnull="true" value=""/>
<entry key="node-feature-version" type="xstring" value="0.0.0"/>
<config key="factory_settings"/>
<entry key="name" type="xstring" value="Model to Binary Object"/>
<entry key="hasContent" type="xboolean" value="false"/>
<entry key="isInactive" type="xboolean" value="false"/>
<config key="ports">
<config key="port_1">
<entry key="index" type="xint" value="1"/>
<entry key="port_dir_location" type="xstring" isnull="true" value=""/>
</config>
</config>
<config key="filestores">
<entry key="file_store_location" type="xstring" isnull="true" value=""/>
<entry key="file_store_id" type="xstring" isnull="true" value=""/>
</config>
</config>
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="http://www.knime.org/2008/09/XMLConfig" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.knime.org/2008/09/XMLConfig http://www.knime.org/XMLConfig_2008_09.xsd" key="test">
<entry key="columnname" type="xstring" value="model"/>
</config>
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses>.
*
* 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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small thing: put the imports in the right order

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

/**
* <code>NodeFactory</code> 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<ModelToBinaryObjectNodeModel> {
@SuppressWarnings({"restriction", "removal"})
public final class ModelToBinaryObjectNodeFactory extends NodeFactory<ModelToBinaryObjectNodeModel>
implements NodeDialogFactory, KaiNodeInterfaceFactory {

@Override
public ModelToBinaryObjectNodeModel createNodeModel() {
Expand All @@ -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<PortDescription> INPUT_PORTS =
List.of(fixedPort("Input model", "Model that will be converted."));

private static final List<PortDescription> 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));
}

}

This file was deleted.

Loading