+ openRealized : function(logData){\r
+ \r
+ // DEBUG PURPOSE\r
+ var CHECK_HOST = false;\r
+ \r
+ var uuid = logData[2];\r
+ var host = "charlie";// logData[1];\r
+ \r
+ \r
+ // 1. Check that both associated views are here\r
+ var batchView;\r
+ var flowsView;\r
+ try{\r
+ batchView = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneById("batch").getContent();\r
+ flowsView = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneById("selector").getContent();\r
+ }catch(e){\r
+ this.debug("Cannot find either bath or flows IView!");\r
+ }\r
+ if(!batchView || !flowsView) return; \r
+ \r
+ // 2. Check that at least a host with the same name exists.\r
+ var agentsMap = flowsView.getAgentsMap(); \r
+ var currentBatchId = batchView.getBatchAgentId();\r
+ if(currentBatchId != null){\r
+ var currentHost = agentsMap[currentBatchId];\r
+ if(currentHost != host){\r
+ this.error("Cannot re-open these flows on a different host. Please clear the batch first.");\r
+ return;\r
+ }\r
+ } \r
+ if(!qx.lang.Object.contains(agentsMap, host)){\r
+ this.error("Cannot find any agent running on '"+host+"'! Please start an agent on this host.");\r
+ return;\r
+ }\r
+ //console.log(currentBatchId);\r
+ if(currentBatchId == null){\r
+ var defaultId = qx.lang.Object.getKeyFromValue(agentsMap, host);\r
+ batchView.setBatchAgentId(defaultId);\r
+ }\r
+ \r
+ // 3. Call service to load execution message\r
+ var req = org.argeo.slc.ria.SlcApi.getRealizedFlowsService(uuid);\r
+ var handler = function(xmlDoc){ \r
+ var realizedFlows = org.argeo.ria.util.Element.selectNodes(xmlDoc, "slc:slc-execution/realized-flows/slc:realized-flow");\r
+ for(var i=0;i<realizedFlows.length;i++){\r
+ var newEntrySpec = new org.argeo.slc.ria.execution.BatchEntrySpec(null, null, realizedFlows[i]); \r
+ batchView.appendBatchEntrySpec(newEntrySpec);\r
+ } \r
+ };\r
+ req.addListener("completed", function(response){\r
+ handler(response.getContent());\r
+ });\r
+ // STUB CASE\r
+ req.addListener("failed", function(){\r
+ if(!window.xmlExecStub || !window.xmlExecStub[uuid]){ \r
+ return;\r
+ }\r
+ var xmlDoc = window.xmlExecStub[uuid];\r
+ handler(xmlDoc);\r
+ }); \r
+ req.send();\r
+ },\r
+ \r