Name
global.RankProcessor
Description
No description available
Script
var RankProcessor = Class.create();
RankProcessor.prototype = {
initialize: function(table, column, messages) {
RankDebugUtil.logMsg("Into RankProcessor.initialize -> " + table + " | " + column);
if (JSUtil.notNil(table)) {
this.TABLE = table;
}
if (JSUtil.notNil(column)) {
this.COLUMN = column;
}
if (JSUtil.notNil(messages)) {
this.messages = messages;
}
this.agileSeqeuncer = new SNC.AgileRankSequencer(this.TABLE, this.COLUMN);
this.maxValue = this.agileSeqeuncer.getMaxRank();
this.lastIndex = this.agileSeqeuncer.getLastIndex();
this.blockSize = this.agileSeqeuncer.getBlockSize();
this.rangeBlockSize = this.agileSeqeuncer.getRangeBlock();
},
generateNewIndex: function(_current) {
RankDebugUtil.logMsg("Into RankProcessor.generateNewIndex");
var nextIndex = this.agileSeqeuncer.getNewIndex();
if (JSUtil.notNil(nextIndex) && nextIndex != "rank_is_out_of_limit") {
_current.setValue(this.COLUMN, nextIndex);
} else {
_current.setValue(this.COLUMN, this.maxValue);
gs.addErrorMessage(this.messages.get(nextIndex));
}
},
moveBefore: function(sysId, otherSysId) {
RankDebugUtil.logMsg("Into RankProcessor.moveBefore ->" + sysId +
" - otherSysId: " + otherSysId);
if (JSUtil.notNil(sysId) && JSUtil.notNil(otherSysId))
return this.agileSeqeuncer.moveBefore(sysId, otherSysId);
},
moveBetween: function(sysId, moveBeforeStoryId, moveAfterStoryId) {
if (JSUtil.notNil(moveAfterStoryId))
return this.moveAfter(sysId, moveAfterStoryId);
else if (JSUtil.notNil(moveBeforeStoryId))
return this.moveBefore(sysId, moveBeforeStoryId);
return null;
},
moveAfter: function(sysId, otherSysId) {
RankDebugUtil.logMsg("Into RankProcessor.moveAfter ->" + sysId +
" - otherSysId: " + otherSysId);
if (JSUtil.notNil(sysId) && JSUtil.notNil(otherSysId))
return this.agileSeqeuncer.moveAfter(sysId, otherSysId);
},
fullResequence: function() {
RankDebugUtil.logMsg("Into RankProcessor.fullResequence");
this.agileSeqeuncer.fullResequence();
},
resequenceAndCompressBlock: function(lastUpdatedRank, blockSize, compress) {
RankDebugUtil.logMsg("Into RankProcessor.resequenceBlock -> " + lastUpdatedRank +
" | " + blockSize + " | " + compress);
this.agileSeqeuncer.resequenceAndCompressBlock(lastUpdatedRank, blockSize, compress);
},
reRankRecords: function(encodedQuery, sortByColumn, sortByOrder, maxLimit) {
if (!maxLimit || maxLimit == "undefined" || maxLimit == null) {
maxLimit = 1000;
}
return this.agileSeqeuncer.reRankRecords(encodedQuery, sortByColumn, sortByOrder, maxLimit);
},
populateGlobalRank: function(batchSize, startIndex, blockSize, encodedQuery, orderBy, orderDesc) {
RankDebugUtil.logMsg("Into RankProcessor.populateGlobalRank -> " + startIndex +
" | " + encodedQuery);
this.agileSeqeuncer.populateGlobalRank(batchSize, startIndex, blockSize, encodedQuery, orderBy, orderDesc);
},
type: 'RankProcessor'
};
Sys ID
b32ce2329f830300730e5bb0657fcf08