]>
git.argeo.org Git - gpl/argeo-slc.git/blob - server/org.argeo.slc.ria/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Module.js
2 * Wrapper for ExecutionModule server object
4 qx
.Class
.define("org.argeo.slc.ria.execution.Module", {
6 extend
: qx
.core
.Object
,
10 * The name of the module
17 * The version of the module
24 * All execution flows registered by their name
30 * All execution specs registered by their name
36 * XML description (castor)
39 apply
: "_applyXmlNode"
44 XPATH_NAME
: "slc:execution-module-descriptor/slc:name",
45 XPATH_VERSION
: "slc:execution-module-descriptor/slc:version",
46 XPATH_EXECUTION_FLOWS
: "slc:execution-module-descriptor/slc:execution-flows/slc:execution-flow-descriptor",
47 XPATH_EXECUTION_SPECS
: "slc:execution-module-descriptor/slc:execution-specs/slc:default-execution-spec"
50 construct : function(){
52 this.setExecutionFlows({});
53 this.setExecutionSpecs({});
58 * Add an execution flow to this module
59 * @param executionFlow {org.argeo.slc.ria.execution.Flow} An instance of execution.Flow
61 addExecutionFlow : function(executionFlow
){
62 var spec
= this.getExecutionSpecByName(executionFlow
.getExecutionSpecName());
64 executionFlow
.setExecutionSpec(spec
);
66 this.error("Warning, reference to an unknown ExecutionSpec : "+executionFlow
.getExecutionSpecName());
68 this.getExecutionFlows()[executionFlow
.getName()] = executionFlow
;
72 * Add an execution Spec to this module
73 * @param executionSpec {org.argeo.slc.ria.execution.Spec} An instance of ExecutionSpec
75 addExecutionSpec : function(executionSpec
){
76 this.getExecutionSpecs()[executionSpec
.getName()] = executionSpec
;
79 * Find an execution spec by its name
80 * @param name {String} Name of the spec
81 * @return {org.argeo.slc.ria.execution.Spec} The spec
83 getExecutionSpecByName : function(name
){
84 return this.getExecutionSpecs()[name
];
88 * Find an execution flow by its name
89 * @param name {String} name of the flow
90 * @return {org.argeo.slc.ria.execution.Flow} The flow
92 getExecutionFlowByName : function(name
){
93 return this.getExecutionFlows()[name
];
97 * An xml node containing the castor mapped description of this object
98 * @param xmlNode {Node}
100 _applyXmlNode : function(xmlNode
){
102 this.setName(org
.argeo
.ria
.util
.Element
.getSingleNodeText(xmlNode
, this.self(arguments
).XPATH_NAME
));
103 this.setVersion(org
.argeo
.ria
.util
.Element
.getSingleNodeText(xmlNode
, this.self(arguments
).XPATH_VERSION
));
105 var specs
= org
.argeo
.ria
.util
.Element
.selectNodes(xmlNode
, this.self(arguments
).XPATH_EXECUTION_SPECS
);
106 for(i
=0; i
< specs
.length
;i
++){
107 var execSpec
= new org
.argeo
.slc
.ria
.execution
.Spec();
108 execSpec
.setXmlNode(specs
[i
]);
109 this.addExecutionSpec(execSpec
);
111 // Now parse Flows : to do AFTER specs
112 var flows
= org
.argeo
.ria
.util
.Element
.selectNodes(xmlNode
, this.self(arguments
).XPATH_EXECUTION_FLOWS
);
113 for(var i
=0;i
<flows
.length
;i
++){
114 var execFlow
= new org
.argeo
.slc
.ria
.execution
.Flow();
115 execFlow
.setXmlNode(flows
[i
]);
116 this.addExecutionFlow(execFlow
);