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=07accaabbde7297dae82ec434fb88027a65fef23;hp=b81d86bc66d9f906b78d883c905313d3eb3aeda0;hpb=9fa32e016b61bccc61ae7aff9c70beec9e68f9e6;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 b81d86bc6..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,6 +58,9 @@ 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() @@ -50,12 +69,16 @@ qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", { * 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; @@ -85,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));