use of org.knime.node.v28.KnimeNodeDocument in project GenericKnimeNodes by genericworkflownodes.
the class DynamicGenericNodeFactory method createNodeDescription.
@Override
protected NodeDescription createNodeDescription() {
try {
INodeConfiguration cfg = getNodeConfiguration();
KnimeNodeDocument doc = org.knime.node.v28.KnimeNodeDocument.Factory.newInstance();
Document domDoc = (Document) doc.getDomNode();
// Node
KnimeNode node = doc.addNewKnimeNode();
node.setDeprecated(m_deprecated);
node.setName(cfg.getName());
node.setIcon(getIconPath());
node.setType(KnimeNode.Type.MANIPULATOR);
node.setShortDescription(cfg.getDescription());
FullDescription fullDescr = node.addNewFullDescription();
// Intro
Intro intro = fullDescr.addNewIntro();
intro.addNewP().getDomNode().appendChild(domDoc.createTextNode(cfg.getManual()));
// Options
for (Parameter<?> p : cfg.getParameters()) {
Option option = fullDescr.addNewOption();
option.setName(p.getKey());
option.getDomNode().appendChild(domDoc.createTextNode(p.getDescription()));
}
// Ports
Ports ports = node.addNewPorts();
int index = 0;
for (Port p : cfg.getInputPorts()) {
InPort ip = ports.addNewInPort();
ip.setIndex(new BigInteger(Integer.toString(index++)));
String mimetypes = mimetypes2String(p.getMimeTypes());
ip.setName(p.getName() + mimetypes);
ip.getDomNode().appendChild(domDoc.createTextNode(p.getDescription() + mimetypes));
}
index = 0;
for (Port p : cfg.getOutputPorts()) {
OutPort op = ports.addNewOutPort();
op.setIndex(new BigInteger(Integer.toString(index++)));
String mimetypes = mimetypes2String(p.getMimeTypes());
op.setName(p.getName() + mimetypes);
op.getDomNode().appendChild(domDoc.createTextNode(p.getDescription() + mimetypes));
}
return new NodeDescription28Proxy(doc);
} catch (Exception e) {
logger.error("Dynamic node description instantiation failed", e);
}
return null;
}
use of org.knime.node.v28.KnimeNodeDocument in project knime-core by knime.
the class DynamicNodeFactory method createNodeDescription.
/**
* {@inheritDoc}
*
* In case of dynamic nodes the procedure is roughly as follows:
* <ol>
* <li>Create a KnimeNodeDocument in the desired version (preferably the latest)
* <li>Populate the document</li>
* <li>Use one of the node description proxies (e.g. {@link NodeDescription28Proxy}) in order to return the
* {@link NodeDescription}</li>
* </ol>
*/
@SuppressWarnings("deprecation")
@Override
protected NodeDescription createNodeDescription() {
KnimeNodeDocument doc = KnimeNodeDocument.Factory.newInstance();
addNodeDescription(doc);
return new NodeDescription27Proxy(doc);
}
Aggregations