]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/Flow.js
Empty value case
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-lib / slc / class / org / argeo / slc / ria / execution / Flow.js
index 4728fe9552d80bc492ccbc4196fc2ae4fe3dd83a..fae03fe39e6fb74587a972d8df3ce1b089772a32 100644 (file)
@@ -1,7 +1,7 @@
 /**\r
  * Wrapper for ExecutionFlow server object\r
  */\r
-qx.Class.define("org.argeo.slc.ria.module.ExecutionFlow", {\r
+qx.Class.define("org.argeo.slc.ria.execution.Flow", {\r
        \r
        extend : qx.core.Object,\r
        \r
@@ -23,7 +23,13 @@ qx.Class.define("org.argeo.slc.ria.module.ExecutionFlow", {
                 * Reference the actual ExecutionSpec object\r
                 */\r
                executionSpec : {\r
-                       check : "org.argeo.slc.ria.module.ExecutionSpec"\r
+                       check : "org.argeo.slc.ria.execution.Spec"\r
+               },\r
+               /**\r
+                * The values to init the ExecutionSpec\r
+                */\r
+               values : {\r
+                       check : "Node"\r
                },\r
                /**\r
                 * Castor representation of the object \r
@@ -34,12 +40,23 @@ qx.Class.define("org.argeo.slc.ria.module.ExecutionFlow", {
        },\r
        \r
        statics : {\r
+               /**\r
+                * Xpath to the name \r
+                */\r
                XPATH_NAME : "@name",\r
+               /**\r
+                * XPath to the ExecutionSpec name\r
+                */\r
                XPATH_EXEC_SPEC_NAME : "@executionSpec",\r
+               /**\r
+                * XPath to the values\r
+                */\r
                XPATH_VALUES : "slc:values"\r
        },\r
        \r
-       construct : function(){},\r
+       construct : function(){\r
+               this.base(arguments);\r
+       },\r
        \r
        members : {             \r
                /**\r
@@ -51,7 +68,25 @@ qx.Class.define("org.argeo.slc.ria.module.ExecutionFlow", {
                                name : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME),\r
                                executionSpecName : org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_EXEC_SPEC_NAME)\r
                        });\r
-               }               \r
+                       var values = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_VALUES);\r
+                       this.setValues(values[0]);\r
+               },\r
+               /**\r
+                * Get a given value inside the values map\r
+                * @param key {String} The key of the value \r
+                * @param specType {String} Expected type (currently "primitive" and "ref" are supported)\r
+                * @param specSubType {String} Expected subtype (depends on the type)\r
+                * @return {String} Value if it is set.\r
+                */\r
+               getValue: function(key, specType, specSubType){\r
+                       var xpath;\r
+                       if(specType == "primitive"){\r
+                               xpath = 'slc:value[@key="'+key+'"]/slc:primitive-value[@type="'+specSubType+'"]';\r
+                       }else if(specType == "ref"){\r
+                               xpath = 'slc:value[@key="'+key+'"]/slc:ref-value/slc:label';\r
+                       }\r
+                       return org.argeo.ria.util.Element.getSingleNodeText(this.getValues(), xpath);\r
+               }\r
        }       \r
        \r
 });
\ No newline at end of file