]> git.argeo.org Git - gpl/argeo-slc.git/blob - BatchEntrySpec.js
dcf22c82db5f16c61849649a7552b742ce3c18ca
[gpl/argeo-slc.git] / BatchEntrySpec.js
1 /**
2 * Data model for an entry of the Batch list : original Spec, flow and module, and currently computed value.
3 */
4 qx.Class.define("org.argeo.slc.ria.execution.BatchEntrySpec", {
5 extend : org.argeo.slc.ria.execution.Spec,
6
7 properties : {
8 module :{},
9 flow : {},
10 originalSpec : {}
11 },
12
13 construct : function(module, flow){
14 this.base(arguments);
15 this.setModule(module);
16 this.setFlow(flow);
17 this.setOriginalSpec(flow.getExecutionSpec());
18 this.setName(flow.getExecutionSpec().getName());
19 this.fetchInstanceValues();
20 },
21
22 members : {
23
24 getLabel : function(){
25 var label = this.getModule().getName();
26 label += "/" + this.getModule().getVersion();
27 label += "/" + this.getFlow().getName();
28 return label;
29 },
30
31 /*
32 toXml : function(){
33 return this.getLabel() + "\n";
34 },
35 */
36
37 /**
38 * Fetch the Spec Values with the Flow Values to make the current instance value
39 */
40 fetchInstanceValues : function(){
41 var specValues = this.getOriginalSpec().getValues();
42 var flow = this.getFlow();
43 var instanceValues = {};
44 for(var key in specValues){
45 var flowValue = flow.getValue(
46 key,
47 specValues[key].getSpecType(),
48 specValues[key].getSpecSubType()
49 );
50 var instValue = specValues[key].clone();
51 if(flowValue){
52 instValue.setValue(flowValue);
53 }
54 instanceValues[key] = instValue;
55 }
56 this.setValues(instanceValues);
57 this.debug(instanceValues);
58 }
59 }
60 });