]> 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/Flow.js
Build XML String
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-lib / slc / class / org / argeo / slc / ria / execution / Flow.js
1 /**
2 * Wrapper for ExecutionFlow server object
3 */
4 qx.Class.define("org.argeo.slc.ria.execution.Flow", {
5
6 extend : qx.core.Object,
7
8 properties : {
9 /**
10 * Name of this Execution Flow
11 */
12 name : {
13 check : "String",
14 init : ""
15 },
16 /**
17 * Name of the associated spec, to be found in the module
18 */
19 executionSpecName : {
20 check : "String"
21 },
22 /**
23 * Reference the actual ExecutionSpec object
24 */
25 executionSpec : {
26 check : "org.argeo.slc.ria.execution.Spec"
27 },
28 values : {
29 check : "Node"
30 },
31 /**
32 * Castor representation of the object
33 */
34 xmlNode : {
35 apply : "_applyXmlNode"
36 }
37 },
38
39 statics : {
40 XPATH_NAME : "@name",
41 XPATH_EXEC_SPEC_NAME : "@executionSpec",
42 XPATH_VALUES : "slc:values"
43 },
44
45 construct : function(){
46 this.base(arguments);
47 },
48
49 members : {
50 /**
51 * Init the object from an XML representation
52 * @param xmlNode {Node} Castor representation of this object
53 */
54 _applyXmlNode : function(xmlNode){
55 this.set({
56 name : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME),
57 executionSpecName : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_EXEC_SPEC_NAME)
58 });
59 var values = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_VALUES);
60 this.setValues(values[0]);
61 },
62 getValue: function(key, specType, specSubType){
63 var xpath;
64 if(specType == "primitive"){
65 xpath = 'slc:value[@key="'+key+'"]/slc:primitive-value[@type="'+specSubType+'"]/slc:value';
66 }else if(specType == "ref"){
67 xpath = 'slc:value[@key="'+key+'"]/slc:ref-value/slc:label';
68 }
69 return org.argeo.ria.util.Element.getSingleNodeText(this.getValues(), xpath);
70 }
71 }
72
73 });