Revision 37397
Added by Michele Artini almost 9 years ago
WorkflowsController.java | ||
---|---|---|
55 | 55 |
import eu.dnetlib.msro.dispatcher.WorkflowDispatcher; |
56 | 56 |
import eu.dnetlib.msro.dispatcher.WorkflowRegistry; |
57 | 57 |
import eu.dnetlib.msro.worker.WorkflowConstants; |
58 |
import eu.dnetlib.rmi.object.manager.ProcessImageDesc; |
|
58 | 59 |
import eu.dnetlib.rmi.objects.is.BlackboardActionStatus; |
59 | 60 |
import eu.dnetlib.rmi.objects.is.DnetDataStructure; |
60 | 61 |
import eu.dnetlib.rmi.soap.exceptions.InformationServiceException; |
... | ... | |
242 | 243 |
* if (process != null) { for (Node node : process.getGraph().getNodes()) { if (node.getId() == nid) { return node.getName(); } } } |
243 | 244 |
* return "-"; } |
244 | 245 |
*/ |
245 |
@RequestMapping("/ui/wf_proc.img") |
|
246 |
public void showProcessWorkflow(final HttpServletResponse response, @RequestParam(value = "id", required = true) final String id) throws Exception { |
|
247 |
BufferedImage image = processGraphGenerator.getProcessImage(id); |
|
248 |
sendImage(response, image); |
|
249 |
} |
|
250 | 246 |
|
251 | 247 |
@RequestMapping("/ui/wf_proc.kill") |
252 | 248 |
public @ResponseBody |
... | ... | |
322 | 318 |
|
323 | 319 |
@RequestMapping("/ui/wf_journal.get") |
324 | 320 |
public @ResponseBody |
325 |
Map<String, Object> getWfJournalLog(@RequestParam(value = "id", required = true) final String id) throws Exception {
|
|
321 |
Map<String, Object> getWfJournalLog(@RequestParam(value = "proc", required = true) final String procId) throws Exception {
|
|
326 | 322 |
final Map<String, Object> res = Maps.newHashMap(); |
327 | 323 |
|
328 |
final Map<String, String> logs = dnetLogger.findOne("system:processId", id);
|
|
324 |
final Map<String, String> logs = dnetLogger.findOne("system:processId", procId);
|
|
329 | 325 |
|
330 | 326 |
if (logs != null && !logs.isEmpty()) { |
331 | 327 |
final List<String> keys = Lists.newArrayList(logs.keySet()); |
... | ... | |
341 | 337 |
res.put("journal", journalEntry); |
342 | 338 |
} |
343 | 339 |
|
344 |
final ProcessInfo process = wfRegistry.findProcess(id);
|
|
340 |
final ProcessInfo process = wfRegistry.findProcess(procId);
|
|
345 | 341 |
|
346 | 342 |
if (process != null) { |
347 |
/* |
|
348 |
* final String mapContent = process.getState() == ProcessState.Created ? "" : processGraphGenerator.getProcessImageMap(id); |
|
349 |
* |
|
350 |
* String status = ""; if (!process.isComplete()) { status = process.getState().toString().toUpperCase(); } else if |
|
351 |
* ("true".equals(process.getEnv().getAttribute(WorkflowConstants.SYSTEM_COMPLETED_SUCCESSFULLY))) { status = "SUCCESS"; } else |
|
352 |
* { status = "FAILURE"; } |
|
353 |
* |
|
354 |
* final String img = process.getState() == ProcessState.Created ? "../resources/img/notStarted.gif" : "wf_proc.img?id=" + id + |
|
355 |
* "&t=" + DateUtils.now(); |
|
356 |
* |
|
357 |
* final String name = process.getGraph().getName(); |
|
358 |
* |
|
359 |
* final long startDate = NumberUtils.toLong(process.getEnv().getAttribute(WorkflowConstants.SYSTEM_START_DATE), 0); final long |
|
360 |
* endDate = NumberUtils.toLong(process.getEnv().getAttribute(WorkflowConstants.SYSTEM_END_DATE), 0); |
|
361 |
* |
|
362 |
* final AtomicWorkflowDescriptor wf = new AtomicWorkflowDescriptor(id, name, status, mapContent, img, true, "auto", "RUNNING", |
|
363 |
* startDate, endDate); |
|
364 |
* |
|
365 |
* res.put("graph", wf); |
|
366 |
*/ |
|
367 |
// TODO |
|
343 |
if (process.getStatus() != BlackboardActionStatus.ASSIGNED) { |
|
344 |
final ProcessImageDesc desc = processGraphGenerator.getProcessImageDesc(procId); |
|
345 |
if (desc != null) { |
|
346 |
res.put("WF_IMAGE_BASE64", desc.getBase64()); |
|
347 |
res.put("WF_IMAGE_MAP", desc.getImageMap()); |
|
348 |
res.put("WF_IMAGE_FORMAT", desc.getFormat()); |
|
349 |
} |
|
350 |
} |
|
368 | 351 |
} |
369 | 352 |
|
370 | 353 |
return res; |
Also available in: Unified diff
process graph image