Current ADempiere use DB.getNextID for get next sequence vs MSequence.getNextID, so in the future the developer need use only DB.getNextID

This commit is contained in:
vpj-cd 2008-09-09 18:26:55 +00:00
parent e1cf4390fa
commit cb40da8cc6
8 changed files with 11 additions and 11 deletions

View File

@ -100,7 +100,7 @@ public abstract class AbstractElementHandler implements ElementHandler {
//String sql2 = "SELECT MAX(AD_PACKAGE_IMP_DETAIL_ID) FROM AD_PACKAGE_IMP_DETAIL"; //String sql2 = "SELECT MAX(AD_PACKAGE_IMP_DETAIL_ID) FROM AD_PACKAGE_IMP_DETAIL";
//int id = DB.getSQLValue(m_trxName, sql2)+1; //int id = DB.getSQLValue(m_trxName, sql2)+1;
id = MSequence.getNextID (Env.getAD_Client_ID(ctx), "AD_Package_Imp_Detail", getTrxName(ctx)); id = DB.getNextID (Env.getAD_Client_ID(ctx), "AD_Package_Imp_Detail", getTrxName(ctx));
StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Detail") StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Detail")
.append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " ) .append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " )
@ -147,7 +147,7 @@ public abstract class AbstractElementHandler implements ElementHandler {
//String sql2 = "SELECT MAX(AD_PACKAGE_IMP_DETAIL_ID) FROM AD_PACKAGE_IMP_DETAIL"; //String sql2 = "SELECT MAX(AD_PACKAGE_IMP_DETAIL_ID) FROM AD_PACKAGE_IMP_DETAIL";
//int id = DB.getSQLValue(m_trxName,sql2)+1; //int id = DB.getSQLValue(m_trxName,sql2)+1;
id = MSequence.getNextID (Env.getAD_Client_ID(ctx), "AD_Package_Imp_Detail", getTrxName(ctx)); id = DB.getNextID (Env.getAD_Client_ID(ctx), "AD_Package_Imp_Detail", getTrxName(ctx));
StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Detail") StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Detail")
.append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " ) .append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " )
@ -249,7 +249,7 @@ public abstract class AbstractElementHandler implements ElementHandler {
StringBuffer sqlD = new StringBuffer("SELECT AD_Reference_ID FROM AD_COLUMN WHERE AD_Column_ID = '"+columnID+"'"); StringBuffer sqlD = new StringBuffer("SELECT AD_Reference_ID FROM AD_COLUMN WHERE AD_Column_ID = '"+columnID+"'");
int referenceID = DB.getSQLValue(getTrxName(ctx),sqlD.toString()); int referenceID = DB.getSQLValue(getTrxName(ctx),sqlD.toString());
idBackup = MSequence.getNextID (getClientId(ctx), "AD_Package_Imp_Backup", getTrxName(ctx)); idBackup = DB.getNextID (getClientId(ctx), "AD_Package_Imp_Backup", getTrxName(ctx));
sqlD = new StringBuffer("SELECT MAX(AD_PACKAGE_IMP_DETAIL_ID) FROM AD_PACKAGE_IMP_DETAIL"); sqlD = new StringBuffer("SELECT MAX(AD_PACKAGE_IMP_DETAIL_ID) FROM AD_PACKAGE_IMP_DETAIL");
int idDetail = DB.getSQLValue(getTrxName(ctx),sqlD.toString())+1; int idDetail = DB.getSQLValue(getTrxName(ctx),sqlD.toString())+1;

View File

@ -314,7 +314,7 @@ public class PackInHandler extends DefaultHandler {
+ "' AND PK_VERSION ='" + atts.getValue("Version") + "'"; + "' AND PK_VERSION ='" + atts.getValue("Version") + "'";
int PK_preInstalled = DB.getSQLValue(m_trxName,sql2); int PK_preInstalled = DB.getSQLValue(m_trxName,sql2);
AD_Package_Imp_ID = MSequence.getNextID (Env.getAD_Client_ID(m_ctx), "AD_Package_Imp", null); AD_Package_Imp_ID = DB.getNextID (Env.getAD_Client_ID(m_ctx), "AD_Package_Imp", null);
StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp") StringBuffer sqlB = new StringBuffer ("Insert INTO AD_Package_Imp")
.append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " ) .append( "(AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " )
@ -344,7 +344,7 @@ public class PackInHandler extends DefaultHandler {
log.info("Insert to Package import failed"); log.info("Insert to Package import failed");
if ( PK_preInstalled == -1){ if ( PK_preInstalled == -1){
AD_Package_Imp_Inst_ID = MSequence.getNextID (Env.getAD_Client_ID(m_ctx), "AD_Package_Imp_Inst", null); AD_Package_Imp_Inst_ID = DB.getNextID (Env.getAD_Client_ID(m_ctx), "AD_Package_Imp_Inst", null);
//Insert Package into package install log //Insert Package into package install log
sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Inst") sqlB = new StringBuffer ("Insert INTO AD_Package_Imp_Inst")

View File

@ -127,7 +127,7 @@ public class CodeSnipitElementHandler extends AbstractElementHandler {
int success = readReplace(targetDirectoryModified+sourceName, oldCode, newCode); int success = readReplace(targetDirectoryModified+sourceName, oldCode, newCode);
// Record in log // Record in log
int idBackup = MSequence.getNextID (getClientId(ctx), "AD_Package_Imp_Backup", getTrxName(ctx)); int idBackup = DB.getNextID (getClientId(ctx), "AD_Package_Imp_Backup", getTrxName(ctx));
if (success != -1){ if (success != -1){
try { try {
idDetail = record_log (ctx, 1, sourceName,"codesnipit", 0,0, Object_Status,sourceName,0); idDetail = record_log (ctx, 1, sourceName,"codesnipit", 0,0, Object_Status,sourceName,0);

View File

@ -139,7 +139,7 @@ public class DistFileElementHandler extends AbstractElementHandler {
//Copy File //Copy File
int success = copyFile (inputStream,outputStream); int success = copyFile (inputStream,outputStream);
//Record in log //Record in log
int idBackup = MSequence.getNextID (getClientId(ctx), "AD_Package_Imp_Backup", getTrxName(ctx)); int idBackup = DB.getNextID (getClientId(ctx), "AD_Package_Imp_Backup", getTrxName(ctx));
if (success != -1){ if (success != -1){
try { try {
idDetail = record_log (ctx, 1, fileName,"file", 0,0, Object_Status,fileName,0); idDetail = record_log (ctx, 1, fileName,"file", 0,0, Object_Status,fileName,0);

View File

@ -193,7 +193,7 @@ public class MenuElementHandler extends AbstractElementHandler {
+ (columnID == -1 ? "null" : columnID)); + (columnID == -1 ? "null" : columnID));
int referenceID = DB.getSQLValue(getTrxName(ctx), sql int referenceID = DB.getSQLValue(getTrxName(ctx), sql
.toString()); .toString());
int idBackup = MSequence.getNextID(Env int idBackup = DB.getNextID(Env
.getAD_Client_ID(ctx), "AD_Package_Imp_Backup", .getAD_Client_ID(ctx), "AD_Package_Imp_Backup",
getTrxName(ctx)); getTrxName(ctx));
if (referenceID == 20 || referenceID == 28) if (referenceID == 20 || referenceID == 28)

View File

@ -68,7 +68,7 @@ public class ProcessElementHandler extends AbstractElementHandler {
Object_Status = "Update"; Object_Status = "Update";
} else { } else {
m_Process = new X_AD_Process(ctx, id, getTrxName(ctx)); m_Process = new X_AD_Process(ctx, id, getTrxName(ctx));
id = MSequence.getNextID(Env.getAD_Client_ID(ctx), id = DB.getNextID(Env.getAD_Client_ID(ctx),
"AD_Process", getTrxName(ctx)); "AD_Process", getTrxName(ctx));
m_Process.setAD_Process_ID(id); m_Process.setAD_Process_ID(id);
Object_Status = "New"; Object_Status = "New";

View File

@ -181,7 +181,7 @@ public class PrepareMigrationScripts extends SvrProcess {
isFirstLine = false; isFirstLine = false;
} }
scanner.close(); scanner.close();
int seqID = MSequence.getNextID(0, "AD_MigrationScript", this int seqID = DB.getNextID(0, "AD_MigrationScript", this
.get_TrxName()); .get_TrxName());
String sql = "INSERT INTO ad_migrationscript (ad_client_id, ad_org_id, " String sql = "INSERT INTO ad_migrationscript (ad_client_id, ad_org_id, "
+ "ad_migrationscript_id, createdby, " + "ad_migrationscript_id, createdby, "

View File

@ -464,7 +464,7 @@ public class ServerBean implements SessionBean
throw new RuntimeException("Transaction lost - " + trxName); throw new RuntimeException("Transaction lost - " + trxName);
} }
} }
int retValue = MSequence.getNextID (AD_Client_ID, TableName, trxName); int retValue = DB.getNextID (AD_Client_ID, TableName, trxName);
log.finer("[" + m_no + "] " + TableName + " = " + retValue); log.finer("[" + m_no + "] " + TableName + " = " + retValue);
m_nextSeqCount++; m_nextSeqCount++;
return retValue; return retValue;