// Get the referenced PipelineStage, if possible private PipelineStage getPipelineStage(int p, int s) { try { Configuration config = Configuration.getInstance(); List<Pipeline> pipelines = config.getPipelines(); Pipeline pipe = pipelines.get(p); List<PipelineStage> stages = pipe.getStages(); return stages.get(s); } catch (Exception ex) { } return null; }
// Get the script file, if possible private File getScriptFile(int p, int s) { try { Configuration config = Configuration.getInstance(); List<Pipeline> pipelines = config.getPipelines(); Pipeline pipe = pipelines.get(p); List<PipelineStage> stages = pipe.getStages(); PipelineStage stage = stages.get(s); if (stage instanceof ScriptableDicom) { return ((ScriptableDicom) stage).getScriptFile(); } } catch (Exception ex) { } return null; }
private int getQuarantineTotal(Pipeline pipe) { int count = 0; if (pipe != null) { for (PipelineStage stage : pipe.getStages()) { Quarantine q = stage.getQuarantine(); if (q != null) count += q.getSize(); } } return count; }
private String getPipelineSummary(Pipeline pipe) { StringBuffer sb = new StringBuffer(); sb.append("<tr>"); sb.append("<td class=\"name\">" + pipe.getName() + "</td>"); sb.append("<td class=\"number\">" + String.format("%,d", getImportQueueTotal(pipe)) + "</td>"); sb.append("<td class=\"number\">" + String.format("%,d", getExportQueueTotal(pipe)) + "</td>"); sb.append("<td class=\"number\">" + String.format("%,d", getQuarantineTotal(pipe)) + "</td>"); sb.append("</tr>\n"); return sb.toString(); }
private String makeList() { StringBuffer sb = new StringBuffer(); Configuration config = Configuration.getInstance(); List<Pipeline> pipelines = config.getPipelines(); int count = 0; if (pipelines.size() != 0) { sb.append("<table border=\"1\" width=\"100%\">\n"); for (int p = 0; p < pipelines.size(); p++) { Pipeline pipe = pipelines.get(p); List<PipelineStage> stages = pipe.getStages(); for (int s = 0; s < stages.size(); s++) { PipelineStage stage = stages.get(s); File scriptFile = null; if (stage instanceof ScriptableDicom) scriptFile = ((ScriptableDicom) stage).getScriptFile(); if ((scriptFile != null) && scriptFile.exists()) { String scriptPath = scriptFile.getAbsolutePath(); scriptPath = scriptPath.replace("\\", "/"); sb.append("<tr>\n"); sb.append("<td class=\"list\">" + pipe.getPipelineName() + "</td>\n"); sb.append("<td class=\"list\">" + stage.getName() + "</td>\n"); sb.append( "<td class=\"list\"><a href=\"/" + context + "?p=" + p + "&s=" + s + (home.equals("") ? "&suppress" : "") + "\">" + scriptPath + "</a></td>\n"); sb.append("</tr>\n"); count++; } } } sb.append("</table>"); } if (count == 0) sb.append("<p>The pipeline contains no DICOM anonymizers.</p>"); return sb.toString(); }
private int getExportQueueTotal(Pipeline pipe) { int count = 0; if (pipe != null) { for (PipelineStage stage : pipe.getStages()) { if (stage instanceof ExportService) { count += ((ExportService) stage).getQueueSize(); } } } return count; }
private String getPipelinePage(int p) { Pipeline pipe = getPipeline(p); if (pipe != null) { StringBuffer sb = new StringBuffer(responseHead("Pipeline Summary")); sb.append("<table class=\"summary\">" + tableHeadings() + "\n"); sb.append(getPipelineSummary(pipe)); sb.append("</table>\n"); sb.append("</center>"); sb.append("<hr/>"); sb.append("<div id=\"status\" class=\"status\">"); for (PipelineStage stage : pipe.getStages()) { sb.append(stage.getStatusHTML()); } sb.append("</div>"); sb.append("<center>"); sb.append(responseTail()); return sb.toString(); } return getAllPipelinesPage(); }