]> 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/Value.js
Change the generated XML for the execution message
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-lib / slc / class / org / argeo / slc / ria / execution / Value.js
index 6ce99a06cc65ab19dcb870bdd413eb6f26d61afc..8895df8b99eeee7bb07f267b4c9e145c7d683b09 100644 (file)
@@ -13,22 +13,40 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", {
                        check : "String",\r
                        init : ""\r
                },\r
+               /**\r
+                * The type of this value, for the moment "primitive" and "ref" are supported \r
+                */\r
                specType : {\r
                        check : "String",\r
                        init : ""                       \r
                },\r
+               /**\r
+                * Subtype, depending on the "type". \r
+                */\r
                specSubType : {\r
                        check : "String"\r
                },\r
+               /**\r
+                * Whether it is a parameter or not \r
+                */\r
                parameter : {\r
                        check : "Boolean"\r
                },\r
+               /**\r
+                * Whether it is frozen on the server, i.e. disabled in the form \r
+                */\r
                frozen : {\r
                        check : "Boolean"\r
                },\r
+               /**\r
+                * Should not be editable nor seeable, thus hidden \r
+                */\r
                hidden : {\r
                        check : "Boolean"\r
                },\r
+               /**\r
+                * The real value \r
+                */\r
                value : {\r
                        nullable : true\r
                },\r
@@ -77,6 +95,10 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", {
                        }\r
                },\r
                \r
+               /**\r
+                * Apply the value from the node\r
+                * @param xmlNode {Node} Castor representation of this object\r
+                */\r
                _applyXmlValue : function(xmlNode){\r
                        var xpath;\r
                        if(this.getSpecType() == "primitive"){\r
@@ -87,7 +109,11 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", {
                        this.setValue(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, xpath));\r
                },\r
                \r
-               toXml : function(){\r
+               /**\r
+                * Create an XML Representation of this value\r
+                * @return {String} The XML String\r
+                */\r
+               toAttributeXml : function(){\r
                        var valueTag = '<slc:value>'+this.getValue()+'</slc:value>';\r
                        var specAttribute = '';\r
                        if(this.getSpecType() == "primitive"){\r
@@ -96,6 +122,19 @@ qx.Class.define("org.argeo.slc.ria.execution.Value", {
                                specAttribute = '<slc:ref-spec-attribute isParameter="'+(this.getParameter()?"true":"false")+'" isFrozen="'+(this.getFrozen()?"true":"false")+'" isHidden="'+(this.getHidden()?"true":"false")+'" targetClassName="'+this.getSpecSubType()+'">'+valueTag+'</slc:ref-spec-attribute>';\r
                        }\r
                        return '<slc:value key="'+this.getKey()+'">'+specAttribute+'</slc:value>';\r
+               },\r
+               \r
+               toValueXml : function(){\r
+                       var valueTag = '';\r
+                       var specAttribute = '';\r
+                       if(this.getSpecType() == "primitive"){\r
+                               valueTag = '<slc:value>'+this.getValue()+'</slc:value>';\r
+                               specAttribute = '<slc:primitive-value type="'+this.getSpecSubType()+'">'+valueTag+'</slc:primitive-value>';\r
+                       }else if(this.getSpecType() == "ref"){\r
+                               valueTag = '<slc:label>'+this.getValue()+'</slc:label>';\r
+                               specAttribute = '<slc:ref-value >'+valueTag+'</slc:ref-value>';\r
+                       }\r
+                       return '<slc:value key="'+this.getKey()+'">'+specAttribute+'</slc:value>';                      \r
                }\r
        }       \r
        \r