]> git.argeo.org Git - gpl/argeo-slc.git/blob - server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Flow.js
Add log4j for server JCR
[gpl/argeo-slc.git] / server / org.argeo.slc.ria / src / 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 description : {
17 check : "String",
18 init : ""
19 },
20 /**
21 * An optional path describing this flow
22 */
23 path : {
24 check : "String",
25 nullable : true
26 },
27 /**
28 * Name of the associated spec, to be found in the module
29 */
30 executionSpecName : {
31 check : "String"
32 },
33 /**
34 * Reference the actual ExecutionSpec object
35 */
36 executionSpec : {
37 check : "org.argeo.slc.ria.execution.Spec"
38 },
39 /**
40 * The values to init the ExecutionSpec
41 */
42 values : {
43 check : "Node",
44 nullable : true
45 },
46 /**
47 * Castor representation of the object
48 */
49 xmlNode : {
50 apply : "_applyXmlNode"
51 }
52 },
53
54 statics : {
55 /**
56 * Xpath to the name
57 */
58 XPATH_NAME : "@name",
59 /**
60 * Path to the description
61 */
62 XPATH_DESCRIPTION : "slc:description",
63 /**
64 * XPath to the ExecutionSpec name
65 */
66 XPATH_EXEC_SPEC_NAME : "@executionSpec",
67 /**
68 * XPath to the values
69 */
70 XPATH_VALUES : "slc:values",
71 /**
72 * An optional hierarchical path
73 */
74 XPATH_PATH : "@path"
75 },
76
77 construct : function(){
78 this.base(arguments);
79 },
80
81 members : {
82 /**
83 * Init the object from an XML representation
84 * @param xmlNode {Node} Castor representation of this object
85 */
86 _applyXmlNode : function(xmlNode){
87 this.set({
88 name : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME),
89 path : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_PATH),
90 description : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_DESCRIPTION) || "",
91 executionSpecName : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_EXEC_SPEC_NAME)
92 });
93 var values = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_VALUES);
94 if(values[0]){
95 this.setValues(values[0]);
96 }
97 },
98 /**
99 * Get a given value inside the values map
100 * @param key {String} The key of the value
101 * @param specType {String} Expected type (currently "primitive" and "ref" are supported)
102 * @param specSubType {String} Expected subtype (depends on the type)
103 * @return {String} Value if it is set.
104 */
105 getValue: function(key, specType, specSubType){
106 var xpath;
107 if(specType == "primitive"){
108 xpath = 'slc:value[@key="'+key+'"]/slc:primitive-value[@type="'+specSubType+'"]';
109 }else if(specType == "ref"){
110 xpath = 'slc:value[@key="'+key+'"]/slc:ref-value/@ref';
111 }
112 return org.argeo.ria.util.Element.getSingleNodeText(this.getValues(), xpath);
113 }
114 }
115
116 });