]> 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/Spec.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 / Spec.js
1 /**
2 * Wrapper for ExecutionSpec server object
3 */
4 qx.Class.define("org.argeo.slc.ria.execution.Spec", {
5
6 extend : qx.core.Object,
7
8 properties : {
9 /**
10 * Unique name of this spec
11 */
12 name : {
13 check : "String",
14 init : ""
15 },
16 /**
17 * Defined parameters
18 */
19 values : {
20 check : "Map",
21 init : {}
22 },
23 /**
24 * Castor representation of this object
25 */
26 xmlNode : {
27 apply : "_applyXmlNode"
28 }
29 },
30
31 statics : {
32 XPATH_NAME : "@name",
33 XPATH_VALUES : "slc:values/slc:value"
34 },
35
36 construct : function(){
37 this.base(arguments);
38 },
39
40 members : {
41 /**
42 * Init the object from an XML representation
43 * @param xmlNode {Node} Castor representation of this object
44 */
45 _applyXmlNode : function(xmlNode){
46 // Parse now
47 this.setName(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, this.self(arguments).XPATH_NAME));
48 var values = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_VALUES);
49 var parsedValues = {};
50 for(var i=0;i<values.length;i++){
51 //var valueNode = values[i];
52 var value = new org.argeo.slc.ria.execution.Value();
53 value.setXmlSpecNode(values[i]);
54 parsedValues[value.getKey()] = value;
55 }
56 this.setValues(parsedValues);
57 },
58 toXml : function(){
59 var valuesXml = '';
60 var values = this.getValues();
61 for(var key in values){
62 valuesXml += values[key].toXml();
63 }
64 return '<slc:default-execution-spec name="'+this.getName()+'"><slc:values>'+valuesXml+'</slc:values></slc:default-execution-spec>';
65 }
66 }
67
68 });