{"title":"Java Snippet","nodeType":"Manipulator","id":"*QNB4FsAPnEAgOMVh","factoryName":"org.knime.base.node.jsnippet.JavaSnippetNodeFactory","factoryId":"org.knime.base.node.jsnippet.JavaSnippetNodeFactory","path":["Scripting","Java"],"owner":"knime","ownerAccountId":"account:team:b5f0848f-496d-4e6a-b869-fa3532248db7","description":"<p>This node allows you to execute arbitrary java code to create new columns or replace existing ones. Enter the java code in the text area.</p>\n            \t\t\t\n            <h3>Output Columns and Variables</h3>\n            \t\t\t\n            <p>Output columns are defined by creating and binding a java field for each column. The value assigned to this field will be written to the output.</p>\n            \t\t\t\n            <p>This node allows adding or modifying flow variables in the same manner.</p>\n            \t\t\t\n            <h3>Additional libraries</h3>\n            \t\t\t\n            <p>It is also possible to use external java libraries (libraries that are not part of java boot classpath). In order to include external jar or zip files, add their location in the &#34;Additional Libraries&#34; tab.</p>\n            \t\t\t\n            <p>Advanced users may want to make use of a library that is already present in the KNIME Analytics Platform installation as a bundle. Adding them to the list in the &#34;Additional Bundles&#34; tab will make them available to the java snippet&#39;s classpath.</p>\n            \t\t\t\n            <h3>Templates</h3>\n            \t\t\t\n            <p>You can define reusable templates with the &#34;Create templates...&#34; button. Templates are stored in the user&#39;s workspace by default and can be accessed via the &#34;Templates&#34; tab.</p>\n            \t\t\n        \n        ","shortDescription":"Calculates a new columns or flow variables based on\n\t\tjava code snippets.","keywords":[],"deprecated":false,"streamable":true,"tags":["Scripting","Java","Streamable"],"icon":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3hpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2J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BEMBACIDVMMMXImhgZGWG62QgZwoRLAmQIEPwCMpnJMgDJkL9kG4AHrIKGFwMLtoBBcgED2WFALGDBZgsxUQg3gBTFNHEBRkLCphkqBiI6sKZILEkZDNCSNUwext6NNSljcwHUm2FIms8CcTpY7j8eD4M0AqUZcaUHsAtokg5IAQABBgDSc3xHvbV83QAAAABJRU5ErkJggg==","views":[],"inPorts":[{"objectClass":"org.knime.core.node.BufferedDataTable","color":"000000","dataType":"Table","optional":false,"name":"An input table","description":"Input table."}],"outPorts":[{"objectClass":"org.knime.core.node.BufferedDataTable","color":"000000","dataType":"Table","optional":false,"name":"Appended table","description":"Input table with additional or replaced columns."}],"dynInPorts":[],"dynOutPorts":[],"additionalSiteInformation":{"url":"https://update.knime.com/analytics-platform/5.12","trusted":true,"enabledByDefault":true,"name":"KNIME Analytics Platform 5.12 Update Site","version":"5.12.0"},"dialog":[{"sectionName":"Java Snippet","sectionDescription":"Contains the Java code editor to edit the snippet.","fields":[{"name":"Column List","description":"This list contains the columns that are available in the input table. Double click any of the entries to insert a respective field in the code editor and insert the field name at the current cursor position (replacing the selection, if any).","optional":false},{"name":"Flow Variable List","description":"This list contains the flow variables that are currently available at the node input. Double click any of the entries to insert a respective field in the code editor and insert the field name at the current cursor position (replacing the selection, if any).","optional":false},{"name":"Snippet text area","description":"<p>Enter your java code here. You can access input columns or flow variables by defining them in the <b>&#34;Input&#34;</b> table of the dialog. Alternatively use the methods <i>getCell(name, type)</i> or <i>getFlowVariable(name, type)</i> where <i>name</i> is the name of the input column or the flow variable. You can use the following values for the <i>type</i> parameter.</p>\n<ul><li><i>tString</i> : String (f)</li><li><i>tInt</i> : Integer (f)</li><li><i>tDouble</i> : Double (f)</li><li><i>tLong</i> : Long</li><li><i>tBoolean</i> : Boolean</li><li><i>tDate</i> : java.util.Date</li><li><i>tCalendar</i> : java.util.Calendar</li><li><i>tXML</i> : org.w3c.document</li></ul>\n(f) These Types can be used for flow variables. \n<p><b>Java Snippet Code</b></p>\n<p>For columns:</p>\n<ul><li><i>getCell(name, type)*</i> : Get value of a cell by column name</li><li><i>isType(name, type)*</i> : Test for type by column name</li><li><i>isMissing(name)*</i> : Check if missing by column name</li><li><i>columnExists(name)*</i> : Check if column with given name exists</li><li><i>getColumnCount(index, type)</i> : Number of columns in the input table</li><li><i>getColumnName(index)</i> : Retrieve column name at index</li></ul>\n<p>For flow variables:</p>\n<ul><li><i>getFlowVariable(name, type)</i> : Get value of a flow variable by name</li><li><i>getFlowVariables(type)</i> : Get all flow variables by type. A name to value map is returned.</li><li><i>flowVariableExists(name)</i> : Check if a flow variable with given name exists</li><li><i>isFlowVariableOfType(name, type)</i> : Check if a flow variable is of type</li></ul>\n<p>* For these methods there is a variant that takes the column index instead of its name.</p>\n<p>Note that the snippet allows defining custom global variables and imports.</p>\n<p>Exceptions in the snippet are caught by the framework and will result in missing values for all output columns of the row being processed—unless there are flow variables defined by the snippet (in which case the execution will always fail). You can force the node to fail execution by throwing an exception of class <tt>Abort</tt> .</p>\n<p><b>Code Assistance</b></p>\n<p><i>CTRL&#43;SPACE</i> for auto completion will popup a list with all classes, methods and fields available at your current cursor location.</p>\n<p><i>ENTER</i> will generate missing import statements for a selected class.</p>","optional":false},{"name":"Input","description":"Define input fields for the snippet here. Every field will be populated with the data of the associated input column or flow variable during execution. For missing values in the input the field is set to <tt>null</tt> .","optional":false},{"name":"Output","description":"Define output columns and flow variables here. Every row in the <b>Output</b> table defines a java field bound to an output column or flow variable. Values assigned to this field in the snippet will show up at the output.","optional":false}]},{"sectionName":"Additional Libraries","sectionDescription":"This tab allows adding custom java library archives to make them available on the classpath of the java snippet.","fields":[{"name":"Library List","description":"List of libraries that will be present in the snippets classpath. Use the buttons below to add or remove libraries.","optional":false},{"name":"Add File(s)...","description":"Add a .jar or .zip file from your system.","optional":false},{"name":"Add KNIME URL...","description":"Add a KNIME protocol url to a .jar or .zip file. E.g. &#34;knime://knime.workflow/example.jar&#34;.","optional":false}]},{"sectionName":"Additional Bundles","sectionDescription":"This tab allows making installed bundles available on the classpath of the java snippet, allowing you to use classes e.g. from org.apache.commons, org.json, com.google.guava and more.\n<br />\nOnce a bundle has been added, its version will be saved with the settings. Should the bundle not be present on an installation the workflow is then opened with, the node will produce an error and not run.\n<br />\nShould the bundle be present but in another version, it will suffice as long as the major version did not change and the minor version is larger or equal to the version the workflow was saved with (&#34;semantic versioning&#34;).","fields":[{"name":"Active Bundles","description":"Bundles that have been manually added to the classpath of the snippet. Double click to remove bundles or use <i>DEL</i> or the &#34;Remove Selected Bundles&#34; button to remove a range of bundles.","optional":false},{"name":"Custom Type Bundles","description":"Bundles implicitly required by fields created for inputs and outputs. To make a bundle requirement explicit, double click to add it to &#34;Active Bundles&#34;.","optional":false},{"name":"Available Bundles List","description":"List of bundles available in the current KNIME Analytics Platform installation. Filter through the list using the field above and either double click, hit <i>ENTER</i> or use the &#34;Add Selected Bundles&#34; to add bundles to &#34;Active Bundles&#34;.","optional":false}]}],"links":[],"kudos":[{"accountId":"account:user:fd74d1b4-da47-4c58-86e7-4fdd8c45dce0","user":"lukass","date":"2022-05-10T13:04:39+00:00"}],"kudosCount":1,"bundleInformation":{"bundleVersion":"5.12.0.v202606171353","bundleName":"KNIME Java Snippet Nodes","bundleSymbolicName":"org.knime.jsnippets","bundleVendor":"KNIME AG, Zurich, Switzerland","featureSymbolicName":"org.knime.features.javasnippet","featureName":"KNIME Javasnippet","featureVersion":"5.12.0.v202606171353","featureVendor":"KNIME AG, Zurich, Switzerland","extensionId":"*hXfYFyb7ZzM0xseG"},"frequentSuccessors":[{"id":"*DOkyMaii62U05xZ1","factoryName":"org.knime.base.node.preproc.filter.column.DataColumnSpecFilterNodeFactory","probability":0.09823576583801123},{"id":"*5stmXk6zY_ORA4bC","factoryName":"org.knime.base.node.preproc.groupby.GroupByNodeFactory","probability":0.06655974338412189},{"id":"*ZgYyOm1P9VJVBE9e","factoryName":"org.knime.base.node.preproc.joiner.Joiner2NodeFactory","probability":0.066158781074579},{"id":"*jd2U-FYTI8jCbQls","factoryName":"org.knime.base.node.preproc.filter.row.RowFilterNodeFactory","probability":0.058340016038492384},{"id":"*QNB4FsAPnEAgOMVh","factoryName":"org.knime.base.node.jsnippet.JavaSnippetNodeFactory","probability":0.04971932638331997},{"id":"*0rhLXWO6OS1xMi8T","factoryName":"org.knime.base.node.preproc.append.row.AppendedRowsNodeFactory","probability":0.02706495589414595},{"id":"*PHWv6FsABEjrSc76","factoryName":"org.knime.base.node.preproc.rename.RenameNodeFactory","probability":0.025060144346431435},{"id":"*AApA5VHd41CVDe7u","factoryName":"org.knime.base.node.meta.looper.LoopEndNodeFactory","probability":0.022654370489174017},{"id":"*eOn8ibZnxIkY7XhT","factoryName":"org.knime.base.node.preproc.stringmanipulation.StringManipulationNodeFactory","probability":0.022052927024859663},{"id":"*Oy714gpoifm4PiOZ","factoryName":"org.knime.base.node.io.csvwriter.CSVWriterNodeFactory","probability":0.022052927024859663}]}
