]> git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Module.js
Remove debug instruction and commented code
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-lib / slc / class / org / argeo / slc / ria / execution / Module.js
1 /**
2 * Wrapper for ExecutionModule server object
3 */
4 qx.Class.define("org.argeo.slc.ria.execution.Module", {
5
6 extend : qx.core.Object,
7
8 properties : {
9 /**
10 * The name of the module
11 */
12 name : {
13 check : "String",
14 init : ""
15 },
16 /**
17 * The version of the module
18 */
19 version : {
20 check : "String",
21 init : ""
22 },
23 /**
24 * All execution flows registered by their name
25 */
26 executionFlows : {
27 check : "Map",
28 init : {}
29 },
30 /**
31 * All execution specs registered by their name
32 */
33 executionSpecs : {
34 check : "Map",
35 init : {}
36 },
37 /**
38 * XML description (castor)
39 */
40 xmlNode : {
41 apply : "_applyXmlNode"
42 }
43 },
44
45 statics : {
46 XPATH_NAME : "slc:execution-module-descriptor/slc:name",
47 XPATH_VERSION : "slc:execution-module-descriptor/slc:version",
48 XPATH_EXECUTION_FLOWS : "slc:execution-module-descriptor/slc:executionFlows/slc:execution-flow-descriptor",
49 XPATH_EXECUTION_SPECS : "slc:execution-module-descriptor/slc:executionSpecs/slc:default-execution-spec"
50 },
51
52 construct : function(){
53 this.base(arguments);
54 },
55
56 members : {
57 /**
58 * Add an execution flow to this module
59 * @param executionFlow {org.argeo.slc.ria.execution.Flow}
60 */
61 addExecutionFlow : function(executionFlow){
62 var spec = this.getExecutionSpecByName(executionFlow.getExecutionSpecName());
63 if(spec){
64 executionFlow.setExecutionSpec(spec);
65 }else{
66 this.error("Warning, reference to an unknown ExecutionSpec : "+executionFlow.getExecutionSpecName());
67 }
68 this.getExecutionFlows()[executionFlow.getName()] = executionFlow;
69 },
70
71 /**
72 * Add an execution Spec to this module
73 * @param executionSpec {org.argeo.slc.ria.execution.Spec}
74 */
75 addExecutionSpec : function(executionSpec){
76 this.getExecutionSpecs()[executionSpec.getName()] = executionSpec;
77 },
78
79 getExecutionSpecByName : function(name){
80 return this.getExecutionSpecs()[name];
81 },
82
83 getExecutionFlowByName : function(name){
84 return this.getExecutionFlows()[name];
85 },
86
87 /**
88 * An xml node containing the castor mapped description of this object
89 * @param xmlNode {Node}
90 */
91 _applyXmlNode : function(xmlNode){
92 // Parse now
93 this.setName(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME));
94 this.setVersion(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_VERSION));
95 // Parse Specs first
96 var specs = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_EXECUTION_SPECS);
97 for(i=0; i< specs.length;i++){
98 var execSpec = new org.argeo.slc.ria.execution.Spec();
99 execSpec.setXmlNode(specs[i]);
100 this.addExecutionSpec(execSpec);
101 }
102 // Now parse Flows : to do AFTER specs
103 var flows = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_EXECUTION_FLOWS);
104 for(var i=0;i<flows.length;i++){
105 var execFlow = new org.argeo.slc.ria.execution.Flow();
106 execFlow.setXmlNode(flows[i]);
107 this.addExecutionFlow(execFlow);
108 }
109 }
110
111 }
112
113 });