X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2FSlcExecutionMessage.js;h=c9194f7f3eedce9d70747d5c1c02d2d87e4d6d3a;hb=a67cbae800900c1baab3d1eba0ea2b25b9b636a5;hp=1ef1b5ae9af87218d202be7bbdb58ffe383c048f;hpb=ad362af53b227d1ed89e9b46f0fee5b23e400488;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 1ef1b5ae9..c9194f7f3 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
@@ -5,7 +5,19 @@ qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", {
extend : qx.core.Object,
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,12 +54,15 @@ qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", {
check : "String",
init : "user"
},
+ date : {
+ check : "String",
+ init : new Date().toString()
+ },
/**
* Additionnal attributes as map of key/values
*/
attributes : {
- check : "Map",
- init : {}
+ check : "Map"
}
},
members : {
@@ -64,21 +79,37 @@ qx.Class.define("org.argeo.slc.ria.SlcExecutionMessage", {
*/
toXml : function (){
var builder = new qx.util.StringBuilder();
- builder.add('');
- builder.add(''+this.getStatus()+'');
- builder.add(''+this.getType()+'');
- builder.add(''+this.getHost()+'');
- builder.add(''+this.getUser()+'');
+ builder.add('');
+ builder.add(''+this.getStatus()+'');
+ builder.add(''+this.getType()+'');
+ builder.add(''+this.getHost()+'');
+ builder.add(''+this.getUser()+'');
var attr = this.getAttributes();
if(qx.lang.Object.getLength(attr)){
- builder.add('');
+ builder.add('');
for(var key in attr){
- builder.add(''+attr[key]+'');
+ builder.add(''+attr[key]+'');
}
- builder.add('');
+ builder.add('');
}
- builder.add('');
+ builder.add('');
return builder.get();
+ },
+
+ fromXml : function(slcExecXml){
+ var NSMap = {slc:"http://argeo.org/projects/slc/schemas"};
+ this.setStatus(org.argeo.ria.util.Element.getSingleNodeText(slcExecXml, "slc:status", NSMap));
+ this.setType(org.argeo.ria.util.Element.getSingleNodeText(slcExecXml, "slc:type", NSMap));
+ this.setHost(org.argeo.ria.util.Element.getSingleNodeText(slcExecXml, "slc:host", NSMap));
+ this.setUser(org.argeo.ria.util.Element.getSingleNodeText(slcExecXml, "slc:user", NSMap));
+ var attributes = org.argeo.ria.util.Element.selectNodes(slcExecXml, "slc:attribute", NSMap);
+ for(var i=0;i