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%2Fexecution%2FBatchEntrySpec.js;h=6269b49c064d5ac1411ec8071e8b7ef9dd79288d;hb=3e24f32c95b5ac3ec7fcae7000c4a8cfb857d514;hp=3bb37fcdcba615df1902d94f8fdbc1505e98ecb4;hpb=51d1c842e4e92cc65708b8bb88152d7344d43d04;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/BatchEntrySpec.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/BatchEntrySpec.js index 3bb37fcdc..6269b49c0 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/BatchEntrySpec.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/BatchEntrySpec.js @@ -5,15 +5,83 @@ qx.Class.define("org.argeo.slc.ria.execution.BatchEntrySpec", { extend : org.argeo.slc.ria.execution.Spec, properties : { + /** + * Reference module + */ module :{}, + /** + * Reference flow + */ flow : {}, + /** + * Original Spec (values shall stay untouched). + */ originalSpec : {} }, + /** + * Instance of BatchEntrySpec + * @param module {org.argeo.slc.ria.execution.Module} Reference module + * @param flow {org.argeo.slc.ria.execution.Flow} Reference flow + */ construct : function(module, flow){ this.base(arguments); this.setModule(module); this.setFlow(flow); this.setOriginalSpec(flow.getExecutionSpec()); + this.setName(flow.getExecutionSpec().getName()); + this.fetchInstanceValues(); + }, + + members : { + /** + * Create a label to display in the batch list. + * @return {String} The label + */ + getLabel : function(){ + var label = this.getModule().getName(); + label += "/" + this.getModule().getVersion(); + label += "/" + this.getFlow().getName(); + return label; + }, + + toXml : function(){ + var valuesXml = ''; + var values = this.getValues(); + for(var key in values){ + valuesXml += values[key].toValueXml(); + } + var execFlowDescXML = ''+valuesXml+''; + + var execSpecDescXML = this.getOriginalSpec().toXml(); + + var moduleData = ''+this.getModule().getName()+''+this.getModule().getVersion()+''; + + return ''+moduleData + execFlowDescXML + execSpecDescXML +''; + + }, + + /** + * Fetch the Spec Values with the Flow Values to make the current instance value + */ + fetchInstanceValues : function(){ + var specValues = this.getOriginalSpec().getValues(); + var flow = this.getFlow(); + var instanceValues = {}; + for(var key in specValues){ + var flowValue = flow.getValue( + key, + specValues[key].getSpecType(), + specValues[key].getSpecSubType() + ); + var instValue = specValues[key].clone(); + if(flowValue){ + instValue.setValue(flowValue); + } + instanceValues[key] = instValue; + } + this.setValues(instanceValues); + //this.debug(instanceValues); + } } }); \ No newline at end of file