|
@@ -1,10 +1,11 @@
|
|
|
function selectRows(cb){
|
|
|
this.config.print(this.fName+": selectRows");
|
|
|
let xRows=new Object();
|
|
|
+ let gObj=this;
|
|
|
xRows.schemaName=this.schemaName;
|
|
|
xRows.queryName=this.queryName;
|
|
|
- xRows.success=function(data){this.generateId(data);};
|
|
|
- xRows.failure=function(errorInfo){this.fail(errorInfo);};
|
|
|
+ xRows.success=cb;
|
|
|
+ xRows.failure=function(errorInfo){gObj.fail(errorInfo);};
|
|
|
LABKEY.Query.selectRows(xRows);
|
|
|
this.config.print(this.fName+": selectRows completed");
|
|
|
}
|
|
@@ -12,10 +13,11 @@ function selectRows(cb){
|
|
|
function insertRows(rows){
|
|
|
this.config.print(this.fName+": insertRows");
|
|
|
let iRows=new Object();
|
|
|
+ let gObj=this;
|
|
|
iRows.schemaName=this.schemaName;
|
|
|
iRows.queryName=this.queryName;
|
|
|
iRows.rows=rows;
|
|
|
- iRows.success=doNothing;
|
|
|
+ iRows.success=function(){gObj.doNothing();};
|
|
|
LABKEY.Query.insertRows(iRows);
|
|
|
}
|
|
|
|
|
@@ -55,12 +57,12 @@ function updateField(text){
|
|
|
|
|
|
function generateId(data){
|
|
|
this.config.print(this.fName+": generateId "+data.rows.length);
|
|
|
- //let k=this.findFirstAvailableKey(data.rows);
|
|
|
- //let row=this.generateObjectAtKey(k);
|
|
|
- //this.updateField(this.getCode(row));
|
|
|
- //let rows=new Array();
|
|
|
- //rows.push(row);
|
|
|
- //this.insertRows(rows);
|
|
|
+ let k=this.findFirstAvailableKey(data.rows);
|
|
|
+ let row=this.generateObjectAtKey(k);
|
|
|
+ this.updateField(this.getCode(row));
|
|
|
+ let rows=new Array();
|
|
|
+ rows.push(row);
|
|
|
+ this.insertRows(rows);
|
|
|
}
|
|
|
|
|
|
function doNothing(data){
|
|
@@ -71,15 +73,16 @@ function fail(errorInfo){
|
|
|
}
|
|
|
|
|
|
function execute(){
|
|
|
+ let gObj=this;
|
|
|
this.config.print(this.fName+": execute");
|
|
|
- this.selectRows(function(data){this.generateId(data);});
|
|
|
+ this.selectRows(function(data){gObj.generateId(data);});
|
|
|
}
|
|
|
|
|
|
function inspect(){
|
|
|
this.config.print(this.fName);
|
|
|
this.config.print("query: "+this.schemaName+'/'+this.queryName);
|
|
|
this.config.print("codeBase "+this.codeBase+" codeField "+this.codeField);
|
|
|
- this.config.print("version 24");
|
|
|
+ this.config.print("version 25");
|
|
|
}
|
|
|
|
|
|
//generic function for all functors
|