Skip to content
Merged
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
2 changes: 1 addition & 1 deletion application/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JSON node documentation generator
Bundle-SymbolicName: de.philippkatz.knime.jsondocgen.application;singleton:=true
Bundle-Version: 1.15.0.qualifier
Bundle-Version: 1.16.0.qualifier
Bundle-Vendor: Philipp Katz; Selenium Nodes
Bundle-RequiredExecutionEnvironment: JavaSE-17
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.6.0,5.0.0)",
Expand Down
4 changes: 2 additions & 2 deletions application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>de.philippkatz.knime.jsondocgen.application</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>

<parent>
<groupId>de.philippkatz.knime.jsondocgen</groupId>
<artifactId>de.philippkatz.knime.jsondocgen</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
</parent>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@
import org.knime.core.node.context.ports.ConfigurablePortGroup;
import org.knime.core.node.context.ports.ModifiablePortsConfiguration;
import org.knime.core.node.context.ports.PortGroupConfiguration;
import org.knime.core.node.extension.InvalidNodeFactoryExtensionException;
import org.knime.core.node.extension.NodeFactoryExtensionManager;
import org.knime.core.node.port.PortObject;
import org.knime.core.node.port.PortObjectSpec;
import org.knime.core.node.port.PortType;
Expand All @@ -92,6 +94,7 @@
import org.knime.core.webui.node.dialog.kai.KaiNodeInterfaceFactory;
import org.knime.workbench.repository.RepositoryManager;
import org.knime.workbench.repository.model.Category;
import org.knime.workbench.repository.model.DefaultNodeTemplate;
import org.knime.workbench.repository.model.IContainerObject;
import org.knime.workbench.repository.model.IRepositoryObject;
import org.knime.workbench.repository.model.NodeTemplate;
Expand Down Expand Up @@ -129,6 +132,8 @@ public class JsonNodeDocuGenerator implements IApplication {

private static final String INCLUDE_DEPRECATED_ARG = "-includeDeprecated";

private static final String INCLUDE_HIDDEN_NODES_ARG = "-includeHidden";
Comment thread
qqilihq marked this conversation as resolved.

private static final String SKIP_NODE_DOCUMENTATION = "-skipNodeDocumentation";

private static final String SKIP_PORT_DOCUMENTATION = "-skipPortDocumentation";
Expand All @@ -151,6 +156,8 @@ private static void printUsage() {
+ " category-path (e.g. /community) : Only nodes within the specified category path will be considered. If not specified '/' is used.");
System.err.println(
"\t" + INCLUDE_DEPRECATED_ARG + " : Include nodes marked as 'deprecated' in the extension point.");
System.err.println(
"\t" + INCLUDE_HIDDEN_NODES_ARG + " : Include nodes marked as 'hidden' in the extension point.");
System.err.println("\t" + SKIP_NODE_DOCUMENTATION + " : Skip generating node documentation");
System.err.println("\t" + SKIP_PORT_DOCUMENTATION + " : Skip generating port documentation");
System.err.println("\t" + SKIP_SPLASH_ICONS + " : Skip extracting splash screen icons");
Expand All @@ -165,6 +172,8 @@ private static void printUsage() {
private String m_catPath = "/";

private boolean m_includeDeprecated = false;

private boolean m_includeHiddenNodes = false;

private boolean m_skipNodeDocumentation = false;

Expand Down Expand Up @@ -199,6 +208,8 @@ public Object start(final IApplicationContext context) throws Exception {
m_pluginIds.add(args[i + 1]);
} else if (args[i].equals(INCLUDE_DEPRECATED_ARG)) {
m_includeDeprecated = true;
} else if (args[i].equals(INCLUDE_HIDDEN_NODES_ARG)) {
m_includeHiddenNodes = true;
} else if (args[i].equals(SKIP_NODE_DOCUMENTATION)) {
m_skipNodeDocumentation = true;
} else if (args[i].equals(SKIP_PORT_DOCUMENTATION)) {
Expand Down Expand Up @@ -267,9 +278,16 @@ private void generate() throws Exception {
}
m_catPath = m_catPath.replaceAll("/", ".");

var hiddenNodeFactoryIds = Collections.<String>emptySet();

// add “hidden” nodes to the root
if (m_includeHiddenNodes) {
hiddenNodeFactoryIds = addHiddenNodes(root);
}

// recursively generate the node reference and the node description
// pages
generate(m_directory, root, null, rootCategoryDoc);
generate(root, null, rootCategoryDoc, hiddenNodeFactoryIds);

CategoryDoc rootCategory = rootCategoryDoc.build();
String resultJson = rootCategory.toJson();
Expand Down Expand Up @@ -331,6 +349,27 @@ private void generate() throws Exception {
}
}

@SuppressWarnings({ "removal", "unchecked" })
private static Set<String> addHiddenNodes(IRepositoryObject root) throws InvalidNodeFactoryExtensionException {
Set<String> hiddenNodeFactoryIds = new HashSet<String>();
for (var nodeFactoryExtension : NodeFactoryExtensionManager.getInstance().getNodeFactoryExtensions()) {
if (nodeFactoryExtension.isHidden()) {
var factory = nodeFactoryExtension.getFactory();
LOGGER.info("Add hidden node " + factory.getFactoryId());
var pluginID = nodeFactoryExtension.getPlugInSymbolicName();
var categoryPath = nodeFactoryExtension.getCategoryPath();
var node = new DefaultNodeTemplate((Class<NodeFactory<? extends NodeModel>>) factory.getClass(),
factory.getNodeName(), pluginID, categoryPath, factory.getType());
node.setAfterID(nodeFactoryExtension.getAfterID());
node.setDeprecated(nodeFactoryExtension.isDeprecated());
var parentContainer = ((Root) root).findContainer(node.getCategoryPath());
parentContainer.addChild(node);
hiddenNodeFactoryIds.add(factory.getFactoryId());
}
}
return hiddenNodeFactoryIds;
}

/**
* Process port type information (and recursively build the hierarchical
* documentation structure).
Expand Down Expand Up @@ -410,22 +449,23 @@ private static void processPorts(Collection<Class<? extends PortObject>> portObj
/**
* Recursively generates the nodes description documents and the menu entries.
*
* @param directory
* @param current
* @param parent
* parent repository object as some nodes pointing to "frequently
* used"-repository object as a parent
* @param parentCategory
* The parent category where to insert the JSON entry.
* @param hiddenNodeFactoryIds
* Node factory IDs which are marked as “hidden” (for setting the hidden flag.)
* @throws Exception
* @throws TransformerException
*
* @return true, if the element was added to the documentation, false if it has
* been skipped
*/
@SuppressWarnings({ "restriction", "unchecked" })
private boolean generate(final File directory, final IRepositoryObject current, final IRepositoryObject parent,
CategoryDocBuilder parentCategory) throws TransformerException, Exception {
private boolean generate(final IRepositoryObject current, final IRepositoryObject parent,
CategoryDocBuilder parentCategory, Set<String> hiddenNodeFactoryIds) throws TransformerException, Exception {

if (current instanceof NodeTemplate nodeTemplate) {

Expand Down Expand Up @@ -492,6 +532,9 @@ private boolean generate(final File directory, final IRepositoryObject current,
// so, do not overwrite with false, if already set to true
builder.setDeprecated(true);
}

builder.setHidden(hiddenNodeFactoryIds.contains(current.getID()));

if ((!deprecated || m_includeDeprecated)) {
parentCategory.addNode(builder.build());
}
Expand All @@ -518,7 +561,7 @@ private boolean generate(final File directory, final IRepositoryObject current,

boolean hasChildren = false;
for (IRepositoryObject repoObj : repoObjs) {
hasChildren = hasChildren | generate(directory, repoObj, current, newCategory);
hasChildren = hasChildren | generate(repoObj, current, newCategory, hiddenNodeFactoryIds);
}

if (hasChildren && current instanceof Category) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static List<MigrationRuleDoc> extractMigrationRules() {
// they replaced this in 5.2 but of course the “get all” is not accessible -
// facepalm; in case it gets removed, we'll need to build this ourselves or get
// it from the “generate node documenation” phase instead
@SuppressWarnings({ "removal" })
var nodeFactoryExtensions = NodeFactoryExtensionManager.getInstance().getNodeFactoryExtensions();

LOGGER.info(String.format("Generating %s migration rules", migrationRules.size()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public DynamicPortGroup(Integer insertBefore, String name, String groupIdentifie
public final List<View> views;
public final String type;
public final boolean deprecated;
/** @deprecated We no longer set this. */
/** @since v1.16 (undeprecated) */
public final boolean hidden;
public final InteractiveView interactiveView;
public final boolean streamable;
Expand Down
2 changes: 1 addition & 1 deletion feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<feature
id="de.philippkatz.knime.jsondocgen.feature"
label="NodePit JSON Documentation Generator"
version="1.15.0.qualifier"
version="1.16.0.qualifier"
provider-name="seleniumnodes.com; Philipp Katz">

<plugin
Expand Down
4 changes: 2 additions & 2 deletions feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>de.philippkatz.knime.jsondocgen.feature</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
<packaging>eclipse-feature</packaging>

<parent>
<groupId>de.philippkatz.knime.jsondocgen</groupId>
<artifactId>de.philippkatz.knime.jsondocgen</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
</parent>

</project>
4 changes: 2 additions & 2 deletions p2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>de.philippkatz.knime.jsondocgen.p2</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>

<parent>
<groupId>de.philippkatz.knime.jsondocgen</groupId>
<artifactId>de.philippkatz.knime.jsondocgen</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
</parent>

</project>
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.philippkatz.knime.jsondocgen</groupId>
<artifactId>de.philippkatz.knime.jsondocgen</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down Expand Up @@ -39,7 +39,7 @@
<artifact>
<groupId>de.philippkatz.knime.jsondocgen</groupId>
<artifactId>de.philippkatz.knime.jsondocgen.targetplatform</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
</artifact>
</target>
<environments>
Expand Down
2 changes: 1 addition & 1 deletion targetplatform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>de.philippkatz.knime.jsondocgen</groupId>
<artifactId>de.philippkatz.knime.jsondocgen</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
</parent>

</project>
4 changes: 2 additions & 2 deletions tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JSON node documentation generator tests
Bundle-SymbolicName: de.philippkatz.knime.jsondocgen.tests;singleton:=true
Bundle-Version: 1.15.0.qualifier
Bundle-Version: 1.16.0.qualifier
Bundle-Vendor: Philipp Katz; Selenium Nodes
Bundle-RequiredExecutionEnvironment: JavaSE-17
Fragment-Host: de.philippkatz.knime.jsondocgen.application;bundle-version="1.15.0"
Fragment-Host: de.philippkatz.knime.jsondocgen.application;bundle-version="1.16.0"
Require-Bundle: org.junit;bundle-version="4.12.0"
4 changes: 2 additions & 2 deletions tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

<modelVersion>4.0.0</modelVersion>
<artifactId>de.philippkatz.knime.jsondocgen.tests</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<parent>
<groupId>de.philippkatz.knime.jsondocgen</groupId>
<artifactId>de.philippkatz.knime.jsondocgen</artifactId>
<version>1.15.0-SNAPSHOT</version>
<version>1.16.0-SNAPSHOT</version>
</parent>

<build>
Expand Down