]>
git.argeo.org Git - gpl/argeo-slc.git/blob - server/org.argeo.slc.ria/src/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/BatchEntrySpec.js
4226699ceff2cb1dfff0c1ecc11b48b88f90933e
2 * Data model for an entry of the Batch list : original Spec, flow and module, and currently computed value.
4 qx
.Class
.define("org.argeo.slc.ria.execution.BatchEntrySpec", {
5 extend
: org
.argeo
.slc
.ria
.execution
.Spec
,
17 * Original Spec (values shall stay untouched).
23 * Instance of BatchEntrySpec
24 * @param module {org.argeo.slc.ria.execution.Module} Reference module
25 * @param flow {org.argeo.slc.ria.execution.Flow} Reference flow
27 construct : function(module
, flow
){
29 this.setModule(module
);
31 this.setOriginalSpec(flow
.getExecutionSpec());
32 this.setName(flow
.getExecutionSpec().getName());
33 this.fetchInstanceValues();
38 * Create a label to display in the batch list.
39 * @return {String} The label
41 getLabel : function(){
42 var label
= this.getModule().getName();
43 label
+= "/" + this.getModule().getVersion();
44 label
+= "/" + this.getFlow().getName();
50 var values
= this.getValues();
51 for(var key
in values
){
52 if(values
[key
].getValue() == null && !values
[key
].isFrozen() && !values
[key
].isHidden()){
53 throw new Error("Cannot send empty values! (Parameter "+key
+")");
55 valuesXml
+= values
[key
].toValueXml();
57 var execFlowDescXML
= '<slc:execution-flow-descriptor name="'+this.getFlow().getName()+'" executionSpec="'+this.getName()+'">';
58 if(this.getFlow().getDescription()!=""){
59 execFlowDescXML
+= '<slc:description>'+this.getFlow().getDescription()+'</slc:description>';
61 execFlowDescXML
+= '<slc:values>'+valuesXml
+'</slc:values></slc:execution-flow-descriptor>';
63 var execSpecDescXML
= this.getOriginalSpec().toXml();
65 var moduleData
= this.getModule().moduleDataToXml();
67 return '<slc:realized-flow>'+moduleData
+ execFlowDescXML
+ execSpecDescXML
+'</slc:realized-flow>';
72 * Fetch the Spec Values with the Flow Values to make the current instance value
74 fetchInstanceValues : function(){
75 var specValues
= this.getOriginalSpec().getValues();
76 var flow
= this.getFlow();
77 var instanceValues
= {};
78 for(var key
in specValues
){
79 var flowValue
= flow
.getValue(
81 specValues
[key
].getSpecType(),
82 specValues
[key
].getSpecSubType()
84 var instValue
= specValues
[key
].clone();
86 instValue
.setValue(flowValue
);
88 instanceValues
[key
] = instValue
;
90 this.setValues(instanceValues
);