IDEMPIERE-455 Discover and fix FindBugs problems / Pattern: SACM_STATIC_ARRAY_CREATED_IN_METHOD / Thanks to Richard Morales
This commit is contained in:
parent
f8a4523e49
commit
3109d2584e
|
@ -75,6 +75,23 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
m_DateValue = new Timestamp (System.currentTimeMillis());
|
||||
} // prepare
|
||||
|
||||
// Field to copy From Product if Import does not have value
|
||||
private String[] strFieldsToCopy = new String[] {
|
||||
"Value",
|
||||
"Name",
|
||||
"Description",
|
||||
"DocumentNote",
|
||||
"Help",
|
||||
"UPC",
|
||||
"SKU",
|
||||
"Classification",
|
||||
"ProductType",
|
||||
"Discontinued",
|
||||
"DiscontinuedBy",
|
||||
"DiscontinuedAt",
|
||||
"ImageURL",
|
||||
"DescriptionURL"
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform process.
|
||||
|
@ -183,20 +200,17 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
|
||||
|
||||
// Copy From Product if Import does not have value
|
||||
String[] strFields = new String[] {"Value","Name","Description","DocumentNote","Help",
|
||||
"UPC","SKU","Classification","ProductType",
|
||||
"Discontinued","DiscontinuedBy","DiscontinuedAt","ImageURL","DescriptionURL"};
|
||||
for (int i = 0; i < strFields.length; i++)
|
||||
for (int i = 0; i < strFieldsToCopy.length; i++)
|
||||
{
|
||||
sql = new StringBuilder ("UPDATE I_Product i ")
|
||||
.append("SET ").append(strFields[i]).append(" = (SELECT ").append(strFields[i]).append(" FROM M_Product p")
|
||||
.append("SET ").append(strFieldsToCopy[i]).append(" = (SELECT ").append(strFieldsToCopy[i]).append(" FROM M_Product p")
|
||||
.append(" WHERE i.M_Product_ID=p.M_Product_ID AND i.AD_Client_ID=p.AD_Client_ID) ")
|
||||
.append("WHERE M_Product_ID IS NOT NULL")
|
||||
.append(" AND ").append(strFields[i]).append(" IS NULL")
|
||||
.append(" AND ").append(strFieldsToCopy[i]).append(" IS NULL")
|
||||
.append(" AND I_IsImported='N'").append(clientCheck);
|
||||
no = DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
if (no != 0)
|
||||
log.fine(strFields[i] + " - default from existing Product=" + no);
|
||||
log.fine(strFieldsToCopy[i] + " - default from existing Product=" + no);
|
||||
}
|
||||
String[] numFields = new String[] {"C_UOM_ID","M_Product_Category_ID",
|
||||
"Volume","Weight","ShelfWidth","ShelfHeight","ShelfDepth","UnitsPerPallet"};
|
||||
|
|
|
@ -477,10 +477,8 @@ public abstract class Convert
|
|||
}
|
||||
}
|
||||
|
||||
private static boolean dontLog(String statement) {
|
||||
// Do not log *Access records - teo_Sarca BF [ 2782095 ]
|
||||
// IDEMPIERE-323 Migration script log AD_Document_Action_Access (nmicoud / CarlosRuiz_globalqss)
|
||||
String [] exceptionTables = new String[] {
|
||||
|
||||
private static String [] dontLogTables = new String[] {
|
||||
"AD_ACCESSLOG",
|
||||
"AD_ALERTPROCESSORLOG",
|
||||
"AD_CHANGELOG",
|
||||
|
@ -522,6 +520,11 @@ public abstract class Convert
|
|||
"T_TRANSACTION",
|
||||
"T_TRIALBALANCE"
|
||||
};
|
||||
|
||||
private static boolean dontLog(String statement) {
|
||||
// Do not log *Access records - teo_Sarca BF [ 2782095 ]
|
||||
// IDEMPIERE-323 Migration script log AD_Document_Action_Access (nmicoud / CarlosRuiz_globalqss)
|
||||
|
||||
String uppStmt = statement.toUpperCase().trim();
|
||||
// don't log selects
|
||||
if (uppStmt.startsWith("SELECT "))
|
||||
|
@ -532,16 +535,16 @@ public abstract class Convert
|
|||
// Don't log DELETE FROM Some_Table WHERE AD_Table_ID=? AND Record_ID=?
|
||||
if (uppStmt.startsWith("DELETE FROM ") && uppStmt.endsWith(" WHERE AD_TABLE_ID=? AND RECORD_ID=?"))
|
||||
return true;
|
||||
for (int i = 0; i < exceptionTables.length; i++) {
|
||||
if (uppStmt.startsWith("INSERT INTO " + exceptionTables[i] + " "))
|
||||
for (int i = 0; i < dontLogTables.length; i++) {
|
||||
if (uppStmt.startsWith("INSERT INTO " + dontLogTables[i] + " "))
|
||||
return true;
|
||||
if (uppStmt.startsWith("DELETE FROM " + exceptionTables[i] + " "))
|
||||
if (uppStmt.startsWith("DELETE FROM " + dontLogTables[i] + " "))
|
||||
return true;
|
||||
if (uppStmt.startsWith("DELETE " + exceptionTables[i] + " "))
|
||||
if (uppStmt.startsWith("DELETE " + dontLogTables[i] + " "))
|
||||
return true;
|
||||
if (uppStmt.startsWith("UPDATE " + exceptionTables[i] + " "))
|
||||
if (uppStmt.startsWith("UPDATE " + dontLogTables[i] + " "))
|
||||
return true;
|
||||
if (uppStmt.startsWith("INSERT INTO " + exceptionTables[i] + "("))
|
||||
if (uppStmt.startsWith("INSERT INTO " + dontLogTables[i] + "("))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1310,8 +1310,7 @@ public class MSequence extends X_AD_Sequence
|
|||
return retValue;
|
||||
}
|
||||
|
||||
private static boolean isExceptionCentralized(String tableName) {
|
||||
String [] exceptionTables = new String[] {
|
||||
private static String [] dontUseCentralized = new String[] {
|
||||
"AD_ACCESSLOG",
|
||||
"AD_ALERTPROCESSORLOG",
|
||||
"AD_CHANGELOG",
|
||||
|
@ -1348,8 +1347,11 @@ public class MSequence extends X_AD_Sequence
|
|||
"T_TRANSACTION",
|
||||
"T_TRIALBALANCE"
|
||||
};
|
||||
for (int i = 0; i < exceptionTables.length; i++) {
|
||||
if (tableName.equalsIgnoreCase(exceptionTables[i]))
|
||||
|
||||
private static boolean isExceptionCentralized(String tableName) {
|
||||
|
||||
for (String exceptionTable : dontUseCentralized) {
|
||||
if (tableName.equalsIgnoreCase(exceptionTable))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue