use of org.knime.core.node.wizard.WizardViewResponse in project knime-core by knime.
the class WebResourceController method processViewRequestInternal.
/**
* Retrieves the response for a view request, which is from a node within a subnode
*
* @param subnodeID the node id of the subnode container
* @param nodeID the node id of the wizard node, as fetched from the combined view
* @param viewRequest the JSON serialized view request string
* @param exec the execution monitor to set progress and check possible cancellation
* @return a {@link WizardViewResponse} which is generated by the concrete node
* @throws ViewRequestHandlingException If the request handling or response generation fails for any
* reason.
* @throws InterruptedException If the thread handling the request is interrupted.
* @throws CanceledExecutionException If the handling of the request was canceled e.g. by user
* intervention.
* @since 3.7
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected WizardViewResponse processViewRequestInternal(final NodeID subnodeID, final String nodeID, final String viewRequest, final ExecutionMonitor exec) throws ViewRequestHandlingException, InterruptedException, CanceledExecutionException {
WorkflowManager manager = m_manager;
assert manager.isLockedByCurrentThread();
NodeID.NodeIDSuffix suffix = NodeID.NodeIDSuffix.fromString(nodeID);
NodeID id = suffix.prependParent(manager.getID());
WizardNode model = getWizardNodeForVerifiedID(subnodeID, id);
if (model == null || !(model instanceof WizardViewRequestHandler)) {
throw new ViewRequestHandlingException("Node model can not process view requests. Possible implementation error.");
}
WizardViewRequest req = ((WizardViewRequestHandler) model).createEmptyViewRequest();
try {
req.loadFromStream(new ByteArrayInputStream(viewRequest.getBytes(Charset.forName("UTF-8"))));
} catch (IOException ex) {
throw new ViewRequestHandlingException("Error deserializing request: " + ex.getMessage(), ex);
}
return (WizardViewResponse) ((WizardViewRequestHandler) model).handleRequest(req, exec);
}
Aggregations