Getting Comments from Meta information of a workflow

#1

Hi Team,

Is there a way to get the ‘Edit Meta Information…’ -> ‘Comments’ data of the workflow from a node’s model code in which it is part of?

Thanks
Ravikiran

0 Likes

#2

It looks like the information you want can probably be accessed through the org.knime.core.util.workflowalizer.WorkflowMetadata class. I think you need to get to that via the static reader method org.knime.core.util.workflowalizer.Workflowalizer#readWorkflow(Path).

You can get to the path of the workflow from its WorkflowContext - within the NodeModel implementation, something like:

NodeContext nodeCtx = NodeContect.getContext();
WorkflowManager wfm = nodeCtx.getWorkflowManager();
WorkflowContext wfCtx = wfm.getContext();

Things to note:

  1. You are heading well of the supported public API track here - in other words, something that works now could easily break later
  2. You may need to do more work to get to the root WorkflowManager for the containing workflow, for example if the node instance is in a metanode, subnode, wrapped metanode etc.

Steve

0 Likes

#3

Hi Steve,

Thanks a lot for the pointers.

Ravikiran

1 Like