X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2FSlcExecutionMessage.js;h=012ac49928bbc13f0f6e0449b01295a292858859;hb=86f06959d772c750a516780b448d5cbfa16cd48e;hp=c5f3ce199f91adf0c42b092847d5ab0c8eeee3b3;hpb=72ca14b0350ff133261b0e68070a28d08201e392;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcExecutionMessage.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcExecutionMessage.js index c5f3ce199..012ac4992 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcExecutionMessage.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcExecutionMessage.js @@ -3,9 +3,25 @@ */ qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", { extend : qx.core.Object, + /** + * New instance + * @param uuid {String} The Uuid of the message. If none is passed, one is generated. + */ construct : function(uuid){ this.base(arguments); - this.setUuid(uuid); + if(uuid){ + this.setUuid(uuid); + }else{ + var s = []; + var itoh = '0123456789ABCDEF'; + for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10); + s[14] = 4; // Set 4 high bits of time_high field to version + s[19] = (s[19] & 0x3) | 0x8; // Specify 2 high bits of clock sequence + for (var i = 0; i <36; i++) s[i] = itoh[s[i]]; + s[8] = s[13] = s[18] = s[23] = '-'; + this.setUuid(s.join('').toLowerCase()); + } + this.setAttributes({}); }, properties : { /** @@ -42,16 +58,27 @@ qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", { check : "String", init : "user" }, + /** + * Date of the message. now() by default. + */ + date : { + check : "String", + init : new Date().toString() + }, /** * Additionnal attributes as map of key/values */ attributes : { - check : "Map", - init : {} + check : "Map" } }, members : { + /** + * Add a free attribute to the message + * @param attName {String} Name + * @param attValue {String} Value + */ addAttribute: function(attName, attValue){ var attr = this.getAttributes(); attr[attName] = attValue; @@ -81,6 +108,10 @@ qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", { return builder.get(); }, + /** + * Parse an XML answer and fill the object with it. + * @param slcExecXml {String} An slcExecMessage mapped in XML. + */ fromXml : function(slcExecXml){ var NSMap = {slc:"http://argeo.org/projects/slc/schemas"}; this.setStatus(org.argeo.ria.util.Element.getSingleNodeText(slcExecXml, "slc:status", NSMap)); @@ -91,6 +122,10 @@ qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", { for(var i=0;i