final Map<Input, Map<ClusterEntity, InputState>> globalInputs = Maps.newHashMap();
final List<InputState> localInputs = Lists.newArrayList();
try {
Node node = nodeService.loadNode(nodeId);
if (node == null) {
String message = "Did not find node.";
return status(404, views.html.errors.error.render(message, new RuntimeException(), request()));
}
for (InputState inputState : inputService.loadAllInputStates(node)) {
if (inputState.getInput().getGlobal() == false)
localInputs.add(inputState);
else {
Map<ClusterEntity, InputState> clusterEntityInputStateMap = Maps.newHashMap();
clusterEntityInputStateMap.put(node, inputState);
globalInputs.put(inputState.getInput(), clusterEntityInputStateMap);
}
}
BreadcrumbList bc = new BreadcrumbList();
bc.addCrumb("System", routes.SystemController.index(0));
bc.addCrumb("Nodes", routes.NodesController.nodes());
bc.addCrumb(node.getShortNodeId(), routes.NodesController.node(node.getNodeId()));
bc.addCrumb("Inputs", routes.InputsController.manage(node.getNodeId()));
return ok(views.html.system.inputs.manage.render(
currentUser(),
bc,
node,
globalInputs,
localInputs,
node.getAllInputTypeInformation()
));
} catch (IOException e) {
return status(500, views.html.errors.error.render(ApiClient.ERROR_MSG_IO, e, request()));
} catch (APIException e) {
String message = "Could not fetch system information. We expected HTTP 200, but got a HTTP " + e.getHttpCode() + ".";