IDEMPIERE-568 Review proper closing of JDBC statements and resultsets
This commit is contained in:
parent
cb10e71ad0
commit
f737c1fc87
|
@ -90,9 +90,6 @@ public class CalloutGLJournal extends CalloutEngine
|
|||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
C_Period_ID = rs.getInt(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -102,6 +99,8 @@ public class CalloutGLJournal extends CalloutEngine
|
|||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
if (C_Period_ID != 0)
|
||||
mTab.setValue("C_Period_ID", new Integer(C_Period_ID));
|
||||
|
|
|
@ -155,15 +155,16 @@ public class CalloutInventory extends CalloutEngine
|
|||
sql = "SELECT SUM(QtyOnHand) FROM M_StorageOnHand "
|
||||
+ "WHERE M_Product_ID=?" // 1
|
||||
+ " AND M_Locator_ID=?"; // 2
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, M_Product_ID);
|
||||
pstmt.setInt(2, M_Locator_ID);
|
||||
if (M_AttributeSetInstance_ID != 0)
|
||||
pstmt.setInt(3, M_AttributeSetInstance_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
bd = rs.getBigDecimal(1);
|
||||
|
@ -174,14 +175,19 @@ public class CalloutInventory extends CalloutEngine
|
|||
// for example when the locator has never stored a particular product.
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
throw new Exception(e.getLocalizedMessage());
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
return new BigDecimal(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,24 +88,30 @@ public class CalloutRequest extends CalloutEngine
|
|||
Integer R_StandardResponse_ID = (Integer)value;
|
||||
String sql = "SELECT Name, ResponseText FROM R_StandardResponse "
|
||||
+ "WHERE R_StandardResponse_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, R_StandardResponse_ID.intValue());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
String txt = rs.getString(2);
|
||||
txt = Env.parseContext(ctx, WindowNo, txt, false, true);
|
||||
mTab.setValue("Result", txt);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return "";
|
||||
} // copyResponse
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ public class ColumnSync extends SvrProcess
|
|||
|
||||
// Find Column in Database
|
||||
Connection conn = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
conn = DB.getConnectionRO();
|
||||
DatabaseMetaData md = conn.getMetaData();
|
||||
|
@ -98,7 +99,7 @@ public class ColumnSync extends SvrProcess
|
|||
int noColumns = 0;
|
||||
String sql = null;
|
||||
//
|
||||
ResultSet rs = md.getColumns(catalog, schema, tableName, null);
|
||||
rs = md.getColumns(catalog, schema, tableName, null);
|
||||
while (rs.next())
|
||||
{
|
||||
noColumns++;
|
||||
|
@ -111,7 +112,7 @@ public class ColumnSync extends SvrProcess
|
|||
sql = column.getSQLModify(table, column.isMandatory() != notNull);
|
||||
break;
|
||||
}
|
||||
rs.close();
|
||||
DB.close(rs);
|
||||
rs = null;
|
||||
|
||||
// No Table
|
||||
|
@ -149,6 +150,8 @@ public class ColumnSync extends SvrProcess
|
|||
}
|
||||
return sql;
|
||||
} finally {
|
||||
DB.close(rs);
|
||||
rs = null;
|
||||
if (conn != null) {
|
||||
try {
|
||||
conn.close();
|
||||
|
|
|
@ -193,6 +193,7 @@ public class CostUpdate extends SvrProcess
|
|||
sql += " AND M_Product_Category_ID=?";
|
||||
int counter = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
|
@ -202,28 +203,21 @@ public class CostUpdate extends SvrProcess
|
|||
pstmt.setInt (4, as.getAD_Client_ID());
|
||||
if (p_M_Product_Category_ID != 0)
|
||||
pstmt.setInt (5, p_M_Product_Category_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
if (createNew (new MProduct (getCtx(), rs, null), as))
|
||||
counter++;
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
log.info("#" + counter);
|
||||
|
@ -256,13 +250,14 @@ public class CostUpdate extends SvrProcess
|
|||
sql += " AND EXISTS (SELECT * FROM M_Product p "
|
||||
+ "WHERE c.M_Product_ID=p.M_Product_ID AND p.M_Product_Category_ID=?)";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, m_ce.getM_CostElement_ID());
|
||||
if (p_M_Product_Category_ID != 0)
|
||||
pstmt.setInt (2, p_M_Product_Category_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MCost cost = new MCost (getCtx(), rs, get_TrxName());
|
||||
|
@ -277,22 +272,15 @@ public class CostUpdate extends SvrProcess
|
|||
}
|
||||
}
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
log.info("#" + counter);
|
||||
|
@ -502,32 +490,26 @@ public class CostUpdate extends SvrProcess
|
|||
+ "FROM M_ProductPrice "
|
||||
+ "WHERE M_Product_ID=? AND M_PriceList_Version_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, cost.getM_Product_ID());
|
||||
pstmt.setInt (2, p_M_PriceList_Version_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
{
|
||||
retValue = rs.getBigDecimal(1);
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
|
@ -78,11 +78,12 @@ public class DocumentTypeVerify extends SvrProcess
|
|||
+ " AND rl.IsActive='Y' AND NOT EXISTS "
|
||||
+ " (SELECT * FROM C_DocType dt WHERE dt.AD_Client_ID=? AND rl.Value=dt.DocBaseType)";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, AD_Client_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
String name = rs.getString(2);
|
||||
|
@ -104,22 +105,15 @@ public class DocumentTypeVerify extends SvrProcess
|
|||
s_log.warning("Not created: " + name);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
} // createDocumentTypes
|
||||
|
@ -160,12 +154,13 @@ public class DocumentTypeVerify extends SvrProcess
|
|||
+ " (SELECT * FROM C_PeriodControl pc "
|
||||
+ "WHERE pc.C_Period_ID=p.C_Period_ID AND pc.DocBaseType=dt.DocBaseType)";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
int counter = 0;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, AD_Client_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
int Client_ID = rs.getInt(1);
|
||||
|
@ -184,22 +179,15 @@ public class DocumentTypeVerify extends SvrProcess
|
|||
else
|
||||
s_log.warning("Not saved: " + pc);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
if (sp != null)
|
||||
|
|
|
@ -203,6 +203,7 @@ public class DunningRunCreate extends SvrProcess
|
|||
PreparedStatement pstmt = null;
|
||||
PreparedStatement pstmt2 = null;
|
||||
ResultSet rs = null;
|
||||
ResultSet rs2 = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
|
@ -255,13 +256,14 @@ public class DunningRunCreate extends SvrProcess
|
|||
// SubQuery
|
||||
pstmt2.setInt (1, m_run.get_ID ());
|
||||
pstmt2.setInt (2, C_Invoice_ID);
|
||||
ResultSet rs2 = pstmt2.executeQuery ();
|
||||
rs2 = pstmt2.executeQuery ();
|
||||
if (rs2.next())
|
||||
{
|
||||
TimesDunned = rs2.getInt(1);
|
||||
DaysAfterLast = rs2.getInt(2);
|
||||
}
|
||||
rs2.close();
|
||||
DB.close(rs2);
|
||||
rs2 = null;
|
||||
// SubQuery
|
||||
|
||||
// Ensure that Daysbetween Dunning is enforced
|
||||
|
@ -298,7 +300,8 @@ public class DunningRunCreate extends SvrProcess
|
|||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null; pstmt2 = null;
|
||||
DB.close(rs2, pstmt2);
|
||||
rs = null; pstmt = null; rs2 = null; pstmt2 = null;
|
||||
}
|
||||
return count;
|
||||
} // addInvoices
|
||||
|
|
|
@ -112,10 +112,11 @@ public class FactAcctReset extends SvrProcess
|
|||
sql += " AND EXISTS (SELECT * FROM AD_Column c "
|
||||
+ "WHERE t.AD_Table_ID=c.AD_Table_ID AND c.ColumnName='Posted' AND c.IsActive='Y')";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
int AD_Table_ID = rs.getInt(1);
|
||||
|
@ -125,22 +126,15 @@ public class FactAcctReset extends SvrProcess
|
|||
else
|
||||
reset (TableName);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
|
|
|
@ -264,10 +264,12 @@ public class ImportAccount extends SvrProcess
|
|||
.append("FROM I_ElementValue ")
|
||||
.append("WHERE I_IsImported='N'").append(clientCheck)
|
||||
.append(" ORDER BY I_ElementValue_ID");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
X_I_ElementValue impEV = new X_I_ElementValue(getCtx(), rs, get_TrxName());
|
||||
|
@ -316,13 +318,17 @@ public class ImportAccount extends SvrProcess
|
|||
}
|
||||
}
|
||||
} // for all I_Product
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
throw new Exception ("create", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Set Error to indicator to not imported
|
||||
sql = new StringBuilder ("UPDATE I_ElementValue ")
|
||||
|
@ -362,8 +368,8 @@ public class ImportAccount extends SvrProcess
|
|||
int noParentUpdate = 0;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
//
|
||||
String updateSQL = "UPDATE AD_TreeNode SET Parent_ID=?, SeqNo=? "
|
||||
+ "WHERE AD_Tree_ID=? AND Node_ID=?";
|
||||
|
@ -391,13 +397,17 @@ public class ImportAccount extends SvrProcess
|
|||
if (no == 0)
|
||||
log.info("Parent not found for " + rs.getString(5));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "(ParentUpdateLoop) " + sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
addLog (0, null, new BigDecimal (noParentUpdate), "@ParentElementValue_ID@: @Updated@");
|
||||
|
||||
commitEx();
|
||||
|
@ -444,20 +454,26 @@ public class ImportAccount extends SvrProcess
|
|||
// **** Update Defaults
|
||||
StringBuilder sql = new StringBuilder ("SELECT C_AcctSchema_ID FROM C_AcctSchema_Element ")
|
||||
.append("WHERE C_Element_ID=?").append(clientCheck);
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt.setInt(1, m_C_Element_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
updateDefaultAccounts (rs.getInt(1));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Default Account DEFAULT_ACCT
|
||||
sql = new StringBuilder ("UPDATE C_AcctSchema_Element e ")
|
||||
|
@ -498,11 +514,13 @@ public class ImportAccount extends SvrProcess
|
|||
.append(" INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID) ")
|
||||
.append("WHERE i.I_IsImported='Y' AND Processing='Y'")
|
||||
.append(" AND i.C_ElementValue_ID IS NOT NULL AND C_Element_ID=?");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt.setInt(1, m_C_Element_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
int C_ElementValue_ID = rs.getInt(1);
|
||||
|
@ -521,13 +539,17 @@ public class ImportAccount extends SvrProcess
|
|||
log.log(Level.SEVERE, "Updated=" + no);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
addLog (0, null, new BigDecimal (counts[UPDATE_ERROR]), as.toString() + ": @Errors@");
|
||||
addLog (0, null, new BigDecimal (counts[UPDATE_YES]), as.toString() + ": @Updated@");
|
||||
addLog (0, null, new BigDecimal (counts[UPDATE_SAME]), as.toString() + ": OK");
|
||||
|
@ -562,10 +584,12 @@ public class ImportAccount extends SvrProcess
|
|||
.append(TableName).append(" x INNER JOIN C_ValidCombination vc ON (x.")
|
||||
.append(ColumnName).append("=vc.C_ValidCombination_ID) ")
|
||||
.append("WHERE x.C_AcctSchema_ID=").append(C_AcctSchema_ID);
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
int C_ValidCombination_ID = rs.getInt(1);
|
||||
|
@ -635,13 +659,17 @@ public class ImportAccount extends SvrProcess
|
|||
} // for all default accounts
|
||||
else
|
||||
log.log(Level.SEVERE, "Account not found " + sql);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
return retValue;
|
||||
} // updateDefaultAccount
|
||||
|
|
|
@ -329,11 +329,12 @@ public class ImportBankStatement extends SvrProcess
|
|||
PreparedStatement pupdt = DB.prepareStatement(updateSql.toString(), get_TrxName());
|
||||
|
||||
PreparedStatement pstmtDuplicates = null;
|
||||
ResultSet rs = null;
|
||||
no = 0;
|
||||
try
|
||||
{
|
||||
pstmtDuplicates = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmtDuplicates.executeQuery();
|
||||
rs = pstmtDuplicates.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
StringBuilder info = new StringBuilder("Line_ID=").append(rs.getInt(2)) // l.C_BankStatementLine_ID
|
||||
|
@ -343,18 +344,18 @@ public class ImportBankStatement extends SvrProcess
|
|||
pupdt.executeUpdate();
|
||||
no++;
|
||||
}
|
||||
rs.close();
|
||||
pstmtDuplicates.close();
|
||||
pupdt.close();
|
||||
|
||||
rs = null;
|
||||
pstmtDuplicates = null;
|
||||
pupdt = null;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "DetectDuplicates " + e.getMessage());
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmtDuplicates);
|
||||
rs = null;pstmtDuplicates = null;
|
||||
DB.close(pupdt);
|
||||
pupdt = null;
|
||||
}
|
||||
if (no != 0)
|
||||
log.info("Duplicates=" + no);
|
||||
|
||||
|
@ -374,7 +375,7 @@ public class ImportBankStatement extends SvrProcess
|
|||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
|
@ -508,18 +509,17 @@ public class ImportBankStatement extends SvrProcess
|
|||
line = null;
|
||||
|
||||
}
|
||||
|
||||
// Close database connection
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Set Error to indicator to not imported
|
||||
sql = new StringBuilder ("UPDATE I_BankStatement ")
|
||||
|
|
|
@ -236,10 +236,11 @@ public class ImportConversionRate extends SvrProcess
|
|||
.append("WHERE I_IsImported='N'").append (clientCheck)
|
||||
.append(" ORDER BY C_Currency_ID, C_Currency_ID_To, ValidFrom");
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
X_I_Conversion_Rate imp = new X_I_Conversion_Rate (getCtx(), rs, get_TrxName());
|
||||
|
@ -270,22 +271,15 @@ public class ImportConversionRate extends SvrProcess
|
|||
}
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -588,10 +588,11 @@ public class ImportGLJournal extends SvrProcess
|
|||
.append("FROM I_GLJournal ")
|
||||
.append("WHERE I_IsImported='N'").append (clientCheck);
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
{
|
||||
BigDecimal source = rs.getBigDecimal(1);
|
||||
|
@ -608,23 +609,17 @@ public class ImportGLJournal extends SvrProcess
|
|||
if (acct != null)
|
||||
addLog (0, null, acct, "@AmtAcctDr@ - @AmtAcctCr@");
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), ex);
|
||||
}
|
||||
try
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex1)
|
||||
{
|
||||
}
|
||||
pstmt = null;
|
||||
|
||||
// globalqss (moved the commit here to save the error messages)
|
||||
commitEx();
|
||||
|
@ -669,7 +664,7 @@ public class ImportGLJournal extends SvrProcess
|
|||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString (), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
//
|
||||
while (rs.next())
|
||||
{
|
||||
|
@ -831,23 +826,18 @@ public class ImportGLJournal extends SvrProcess
|
|||
noInsertLine++;
|
||||
}
|
||||
} // while records
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
}
|
||||
// clean up
|
||||
try
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex1)
|
||||
{
|
||||
}
|
||||
pstmt = null;
|
||||
|
||||
// Set Error to indicator to not imported
|
||||
sql = new StringBuilder ("UPDATE I_GLJournal ")
|
||||
|
|
|
@ -139,6 +139,7 @@ public class ImportInOutConfirm extends SvrProcess
|
|||
/*********************************************************************/
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
sql = new StringBuilder ("SELECT * FROM I_InOutLineConfirm ")
|
||||
.append("WHERE I_IsImported='N'").append (clientCheck)
|
||||
.append(" ORDER BY I_InOutLineConfirm_ID");
|
||||
|
@ -146,7 +147,7 @@ public class ImportInOutConfirm extends SvrProcess
|
|||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
X_I_InOutLineConfirm importLine = new X_I_InOutLineConfirm (getCtx(), rs, get_TrxName());
|
||||
|
@ -176,22 +177,15 @@ public class ImportInOutConfirm extends SvrProcess
|
|||
}
|
||||
}
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
StringBuilder msgreturn = new StringBuilder("@Updated@ #").append(no);
|
||||
|
|
|
@ -483,10 +483,12 @@ public class ImportInvoice extends SvrProcess
|
|||
// Go through Invoice Records w/o C_BPartner_ID
|
||||
sql = new StringBuilder ("SELECT * FROM I_Invoice ")
|
||||
.append("WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck);
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
X_I_Invoice imp = new X_I_Invoice (getCtx(), rs, get_TrxName());
|
||||
|
@ -593,14 +595,18 @@ public class ImportInvoice extends SvrProcess
|
|||
}
|
||||
imp.save ();
|
||||
} // for all new BPartners
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
//
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "CreateBP", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
sql = new StringBuilder ("UPDATE I_Invoice ")
|
||||
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ")
|
||||
.append("WHERE C_BPartner_ID IS NULL")
|
||||
|
@ -622,8 +628,8 @@ public class ImportInvoice extends SvrProcess
|
|||
.append(" ORDER BY C_BPartner_ID, C_BPartner_Location_ID, I_Invoice_ID");
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery ();
|
||||
// Group Change
|
||||
int oldC_BPartner_ID = 0;
|
||||
int oldC_BPartner_Location_ID = 0;
|
||||
|
@ -751,13 +757,17 @@ public class ImportInvoice extends SvrProcess
|
|||
}
|
||||
invoice.saveEx();
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "CreateInvoice", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Set Error to indicator to not imported
|
||||
sql = new StringBuilder ("UPDATE I_Invoice ")
|
||||
|
|
|
@ -499,10 +499,12 @@ public class ImportOrder extends SvrProcess
|
|||
// Go through Order Records w/o C_BPartner_ID
|
||||
sql = new StringBuilder ("SELECT * FROM I_Order ")
|
||||
.append("WHERE I_IsImported='N' AND C_BPartner_ID IS NULL").append (clientCheck);
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
X_I_Order imp = new X_I_Order (getCtx (), rs, get_TrxName());
|
||||
|
@ -610,14 +612,18 @@ public class ImportOrder extends SvrProcess
|
|||
}
|
||||
imp.save ();
|
||||
} // for all new BPartners
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
//
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "BP - " + sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
sql = new StringBuilder ("UPDATE I_Order ")
|
||||
.append("SET I_IsImported='E', I_ErrorMsg=I_ErrorMsg||'ERR=No BPartner, ' ")
|
||||
.append("WHERE C_BPartner_ID IS NULL")
|
||||
|
@ -639,8 +645,8 @@ public class ImportOrder extends SvrProcess
|
|||
.append(" ORDER BY C_BPartner_ID, BillTo_ID, C_BPartner_Location_ID, I_Order_ID");
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery ();
|
||||
//
|
||||
int oldC_BPartner_ID = 0;
|
||||
int oldBillTo_ID = 0;
|
||||
|
@ -779,13 +785,17 @@ public class ImportOrder extends SvrProcess
|
|||
}
|
||||
order.saveEx();
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "Order - " + sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Set Error to indicator to not imported
|
||||
sql = new StringBuilder ("UPDATE I_Order ")
|
||||
|
|
|
@ -413,11 +413,12 @@ public class ImportPayment extends SvrProcess
|
|||
|
||||
MBankAccount account = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
int noInsert = 0;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
|
@ -512,18 +513,17 @@ public class ImportPayment extends SvrProcess
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// Close database connection
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Set Error to indicator to not imported
|
||||
sql = new StringBuilder ("UPDATE I_Payment ")
|
||||
|
|
|
@ -385,20 +385,26 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
|
||||
// Get Default Tax Category
|
||||
int C_TaxCategory_ID = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
StringBuilder dbpst = new StringBuilder("SELECT C_TaxCategory_ID FROM C_TaxCategory WHERE IsDefault='Y'").append(clientCheck);
|
||||
PreparedStatement pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
C_TaxCategory_ID = rs.getInt(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
throw new Exception ("TaxCategory", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
log.fine("C_TaxCategory_ID=" + C_TaxCategory_ID);
|
||||
|
||||
ModelValidationEngine.get().fireImportValidate(this, null, null, ImportValidator.TIMING_AFTER_VALIDATE);
|
||||
|
@ -415,6 +421,8 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
log.fine("start inserting/updating ...");
|
||||
sql = new StringBuilder ("SELECT * FROM I_Product WHERE I_IsImported='N'")
|
||||
.append(clientCheck);
|
||||
PreparedStatement pstmt_setImported = null;
|
||||
PreparedStatement pstmt_insertProductPO = null;
|
||||
try
|
||||
{
|
||||
/* Insert Product from Import
|
||||
|
@ -468,7 +476,7 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
(sqlt, get_TrxName());
|
||||
*/
|
||||
// Insert Product from Import
|
||||
PreparedStatement pstmt_insertProductPO = DB.prepareStatement
|
||||
pstmt_insertProductPO = DB.prepareStatement
|
||||
("INSERT INTO M_Product_PO (M_Product_ID,C_BPartner_ID, "
|
||||
+ "AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,"
|
||||
+ "IsCurrentVendor,C_UOM_ID,C_Currency_ID,UPC,"
|
||||
|
@ -487,13 +495,13 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
+ "WHERE I_Product_ID=?", get_TrxName());
|
||||
|
||||
// Set Imported = Y
|
||||
PreparedStatement pstmt_setImported = DB.prepareStatement
|
||||
pstmt_setImported = DB.prepareStatement
|
||||
("UPDATE I_Product SET I_IsImported='Y', M_Product_ID=?, "
|
||||
+ "Updated=SysDate, Processed='Y' WHERE I_Product_ID=?", get_TrxName());
|
||||
|
||||
//
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
X_I_Product imp = new X_I_Product(getCtx(), rs, get_TrxName());
|
||||
|
@ -558,7 +566,11 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
DB.executeUpdate(sql0.toString(), get_TrxName());
|
||||
continue;
|
||||
}
|
||||
pstmt_updateProduct.close();
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt_updateProduct);
|
||||
pstmt_updateProduct = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Do we have PO Info
|
||||
|
@ -604,7 +616,11 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
DB.executeUpdate(sql0.toString(), get_TrxName());
|
||||
continue;
|
||||
}
|
||||
pstmt_updateProductPO.close();
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt_updateProductPO);
|
||||
pstmt_updateProductPO = null;
|
||||
}
|
||||
}
|
||||
if (no == 0) // Insert PO
|
||||
{
|
||||
|
@ -657,20 +673,19 @@ public class ImportProduct extends SvrProcess implements ImportProcess
|
|||
//
|
||||
commitEx();
|
||||
} // for all I_Product
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
|
||||
//
|
||||
// pstmt_insertProduct.close();
|
||||
// pstmt_updateProduct.close();
|
||||
pstmt_insertProductPO.close();
|
||||
// pstmt_updateProductPO.close();
|
||||
pstmt_setImported.close();
|
||||
//
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;pstmt = null;
|
||||
DB.close(pstmt_insertProductPO);
|
||||
pstmt_insertProductPO = null;
|
||||
DB.close(pstmt_setImported);
|
||||
pstmt_setImported = null;
|
||||
}
|
||||
|
||||
// Set Error to indicator to not imported
|
||||
sql = new StringBuilder ("UPDATE I_Product ")
|
||||
|
|
|
@ -265,6 +265,9 @@ public class ImportReportLine extends SvrProcess
|
|||
.append("FROM I_ReportLine ")
|
||||
.append("WHERE I_IsImported='N' AND PA_ReportLine_ID IS NULL")
|
||||
.append(" AND I_IsImported='N'").append(clientCheck);
|
||||
PreparedStatement pstmt_insertLine = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
// Insert ReportLine
|
||||
|
@ -283,10 +286,10 @@ public class ImportReportLine extends SvrProcess
|
|||
.append("WHERE PA_ReportLineSet_ID=? AND Name=? ") // #2..3
|
||||
//jz + clientCheck, get_TrxName());
|
||||
.append(clientCheck).append(")");
|
||||
PreparedStatement pstmt_insertLine = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
pstmt_insertLine = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
int PA_ReportLineSet_ID = rs.getInt(1);
|
||||
|
@ -311,15 +314,18 @@ public class ImportReportLine extends SvrProcess
|
|||
continue;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
//
|
||||
pstmt_insertLine.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, "Create ReportLine", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;pstmt = null;
|
||||
DB.close(pstmt_insertLine);
|
||||
pstmt_insertLine = null;
|
||||
}
|
||||
|
||||
// Set PA_ReportLine_ID (for newly created)
|
||||
sql = new StringBuilder ("UPDATE I_ReportLine i ")
|
||||
|
@ -356,6 +362,9 @@ public class ImportReportLine extends SvrProcess
|
|||
.append("WHERE PA_ReportLine_ID IS NOT NULL")
|
||||
.append(" AND I_IsImported='N'").append(clientCheck);
|
||||
|
||||
PreparedStatement pstmt_insertSource = null;
|
||||
PreparedStatement pstmt_deleteSource = null;
|
||||
PreparedStatement pstmt_setImported = null;
|
||||
try
|
||||
{
|
||||
// Insert ReportSource
|
||||
|
@ -370,7 +379,7 @@ public class ImportReportLine extends SvrProcess
|
|||
.append("WHERE I_ReportLine_ID=?")
|
||||
.append(" AND I_IsImported='N'")
|
||||
.append(clientCheck);
|
||||
PreparedStatement pstmt_insertSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
pstmt_insertSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
|
||||
// Update ReportSource
|
||||
//jz
|
||||
|
@ -391,17 +400,17 @@ public class ImportReportLine extends SvrProcess
|
|||
.append("WHERE C_ElementValue_ID IS NULL")
|
||||
.append(" AND PA_ReportSource_ID=?")
|
||||
.append(clientCheck);
|
||||
PreparedStatement pstmt_deleteSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
pstmt_deleteSource = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
//End afalcone 22/02/2007 - F.R. [ 1642250 ] Import ReportLine / Very Slow Reports
|
||||
|
||||
// Set Imported = Y
|
||||
PreparedStatement pstmt_setImported = DB.prepareStatement
|
||||
pstmt_setImported = DB.prepareStatement
|
||||
("UPDATE I_ReportLine SET I_IsImported='Y',"
|
||||
+ " PA_ReportSource_ID=?, "
|
||||
+ " Updated=SysDate, Processed='Y' WHERE I_ReportLine_ID=?", get_TrxName());
|
||||
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
int I_ReportLine_ID = rs.getInt(1);
|
||||
|
@ -461,7 +470,11 @@ public class ImportReportLine extends SvrProcess
|
|||
DB.executeUpdate(sql.toString(), get_TrxName());
|
||||
continue;
|
||||
}
|
||||
pstmt_updateSource.close();
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt_updateSource);
|
||||
pstmt_updateSource = null;
|
||||
}
|
||||
} // update source
|
||||
|
||||
// Set Imported to Y
|
||||
|
@ -481,17 +494,19 @@ public class ImportReportLine extends SvrProcess
|
|||
|
||||
commitEx();
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
//
|
||||
pstmt_insertSource.close();
|
||||
//jz pstmt_updateSource.close();
|
||||
pstmt_setImported.close();
|
||||
//
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;pstmt = null;
|
||||
DB.close(pstmt_insertSource);
|
||||
pstmt_insertSource = null;
|
||||
DB.close(pstmt_setImported);
|
||||
pstmt_setImported = null;
|
||||
}
|
||||
|
||||
// Set Error to indicator to not imported
|
||||
sql = new StringBuilder ("UPDATE I_ReportLine ")
|
||||
|
|
|
@ -209,9 +209,10 @@ public class InOutGenerate extends SvrProcess
|
|||
private String generate (PreparedStatement pstmt)
|
||||
{
|
||||
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ()) // Order
|
||||
{
|
||||
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
||||
|
@ -391,22 +392,15 @@ public class InOutGenerate extends SvrProcess
|
|||
}
|
||||
m_line += 1000;
|
||||
} // while order
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, m_sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
completeShipment();
|
||||
|
|
|
@ -200,6 +200,7 @@ public class InventoryCountCreate extends SvrProcess
|
|||
//
|
||||
int count = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
|
@ -213,7 +214,7 @@ public class InventoryCountCreate extends SvrProcess
|
|||
pstmt.setString(index++, p_ProductValue.toUpperCase());
|
||||
if (!p_DeleteOld)
|
||||
pstmt.setInt(index++, p_M_Inventory_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
int M_Product_ID = rs.getInt(1);
|
||||
|
@ -235,22 +236,15 @@ public class InventoryCountCreate extends SvrProcess
|
|||
M_AttributeSetInstance_ID, QtyOnHand, M_AttributeSet_ID);
|
||||
}
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
|
@ -354,17 +348,28 @@ public class InventoryCountCreate extends SvrProcess
|
|||
StringBuilder retString = new StringBuilder();
|
||||
String sql = " SELECT M_Product_Category_ID, M_Product_Category_Parent_ID FROM M_Product_Category";
|
||||
final Vector<SimpleTreeNode> categories = new Vector<SimpleTreeNode>(100);
|
||||
Statement stmt = DB.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
if(rs.getInt(1)==productCategoryId) {
|
||||
subTreeRootParentId = rs.getInt(2);
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
stmt = DB.createStatement();
|
||||
rs = stmt.executeQuery(sql);
|
||||
while (rs.next()) {
|
||||
if(rs.getInt(1)==productCategoryId) {
|
||||
subTreeRootParentId = rs.getInt(2);
|
||||
}
|
||||
categories.add(new SimpleTreeNode(rs.getInt(1), rs.getInt(2)));
|
||||
}
|
||||
categories.add(new SimpleTreeNode(rs.getInt(1), rs.getInt(2)));
|
||||
retString.append(getSubCategoriesString(productCategoryId, categories, subTreeRootParentId));
|
||||
} catch (SQLException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, stmt);
|
||||
rs = null;stmt = null;
|
||||
}
|
||||
retString.append(getSubCategoriesString(productCategoryId, categories, subTreeRootParentId));
|
||||
rs.close();
|
||||
stmt.close();
|
||||
return retString.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -136,11 +136,12 @@ public class InventoryCountUpdate extends SvrProcess
|
|||
//
|
||||
String sql = "SELECT * FROM M_InventoryLine WHERE M_Inventory_ID=? AND M_AttributeSetInstance_ID=0";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, p_M_Inventory_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MInventoryLine il = new MInventoryLine (getCtx(), rs, get_TrxName());
|
||||
|
@ -168,22 +169,15 @@ public class InventoryCountUpdate extends SvrProcess
|
|||
if (il.save())
|
||||
no++;
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
|
|
|
@ -191,9 +191,10 @@ public class InvoiceGenerate extends SvrProcess
|
|||
*/
|
||||
private String generate (PreparedStatement pstmt)
|
||||
{
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MOrder order = new MOrder (getCtx(), rs, get_TrxName());
|
||||
|
@ -320,22 +321,15 @@ public class InvoiceGenerate extends SvrProcess
|
|||
}
|
||||
} // complete Order
|
||||
} // for all orders
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
completeInvoice();
|
||||
|
|
|
@ -170,32 +170,26 @@ public class InvoiceWriteOff extends SvrProcess
|
|||
//
|
||||
int counter = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
if (writeOff(rs.getInt(1), rs.getString(2), rs.getTimestamp(3),
|
||||
rs.getInt(4), rs.getBigDecimal(6)))
|
||||
counter++;
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
// final
|
||||
|
|
|
@ -110,20 +110,26 @@ public class M_Product_BOM_Check extends SvrProcess
|
|||
|
||||
// Get count remaining on t_selection
|
||||
int countno = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
StringBuilder dbpst = new StringBuilder("SELECT COUNT(*) FROM T_Selection WHERE AD_PInstance_ID=").append(m_AD_PInstance_ID);
|
||||
PreparedStatement pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(dbpst.toString(), get_TrxName());
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
countno = rs.getInt(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
throw new Exception ("count t_selection", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
log.fine("Count T_Selection =" + countno);
|
||||
|
||||
if (countno == 0)
|
||||
|
|
|
@ -128,12 +128,13 @@ public class OrderBatchProcess extends SvrProcess
|
|||
int counter = 0;
|
||||
int errCounter = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt.setInt(1, p_C_DocTypeTarget_ID);
|
||||
pstmt.setString(2, p_DocStatus);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
if (process(new MOrder(getCtx(),rs, get_TrxName())))
|
||||
|
@ -141,22 +142,15 @@ public class OrderBatchProcess extends SvrProcess
|
|||
else
|
||||
errCounter++;
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
StringBuilder msgreturn = new StringBuilder("@Updated@=").append(counter).append(", @Errors@=").append(errCounter);
|
||||
|
|
|
@ -184,6 +184,7 @@ public class PaySelectionCreateFrom extends SvrProcess
|
|||
int lines = 0;
|
||||
int C_CurrencyTo_ID = psel.getC_Currency_ID();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
|
@ -207,7 +208,7 @@ public class PaySelectionCreateFrom extends SvrProcess
|
|||
else if (p_C_BP_Group_ID != 0)
|
||||
pstmt.setInt (index++, p_C_BP_Group_ID);
|
||||
//
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
int C_Invoice_ID = rs.getInt(1);
|
||||
|
@ -228,22 +229,15 @@ public class PaySelectionCreateFrom extends SvrProcess
|
|||
throw new IllegalStateException ("Cannot save MPaySelectionLine");
|
||||
}
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
StringBuilder msgreturn = new StringBuilder("@C_PaySelectionLine_ID@ - #").append(lines);
|
||||
|
|
|
@ -737,29 +737,23 @@ public class ReplenishReport extends SvrProcess
|
|||
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
||||
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
pstmt.setInt (1, getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
||||
|
@ -780,29 +774,23 @@ public class ReplenishReport extends SvrProcess
|
|||
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
||||
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
pstmt.setInt (1, getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
||||
|
|
|
@ -838,29 +838,23 @@ public class ReplenishReportProduction extends SvrProcess
|
|||
sql.append(" ORDER BY M_Warehouse_ID, M_WarehouseSource_ID, C_BPartner_ID");
|
||||
ArrayList<X_T_Replenish> list = new ArrayList<X_T_Replenish>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
pstmt.setInt (1, getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new X_T_Replenish (getCtx(), rs, get_TrxName()));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
X_T_Replenish[] retValue = new X_T_Replenish[list.size ()];
|
||||
|
|
|
@ -227,14 +227,17 @@ public class ReplicationLocal extends SvrProcess
|
|||
{
|
||||
while (rowset.next())
|
||||
mergeDataTable (rowset.getInt(1), rowset.getString(3), rowset.getInt(4));
|
||||
rowset.close();
|
||||
rowset = null;
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "mergeData", ex);
|
||||
m_replicated = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rowset);
|
||||
rowset = null;
|
||||
}
|
||||
} // mergeData
|
||||
|
||||
/**
|
||||
|
@ -318,9 +321,9 @@ public class ReplicationLocal extends SvrProcess
|
|||
rLog.setIsReplicated(replicated);
|
||||
if (result != null)
|
||||
rLog.setP_Msg("< " + result.toString());
|
||||
sourceRS.close();
|
||||
DB.close(sourceRS);
|
||||
sourceRS = null;
|
||||
targetRS.close();
|
||||
DB.close(targetRS);
|
||||
targetRS = null;
|
||||
}
|
||||
rLog.saveEx();
|
||||
|
@ -336,6 +339,7 @@ public class ReplicationLocal extends SvrProcess
|
|||
{
|
||||
ArrayList<String> list = new ArrayList<String>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
// Get Keys
|
||||
|
@ -344,14 +348,14 @@ public class ReplicationLocal extends SvrProcess
|
|||
+ " AND IsKey='Y'";
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, AD_Table_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(rs.getString(1));
|
||||
rs.close();
|
||||
|
||||
// no keys - search for parents
|
||||
if (list.size() == 0)
|
||||
{
|
||||
DB.close(rs);
|
||||
rs = null;
|
||||
sql = "SELECT ColumnName FROM AD_Column "
|
||||
+ "WHERE AD_Table_ID=?"
|
||||
+ " AND IsParent='Y'";
|
||||
|
@ -360,22 +364,17 @@ public class ReplicationLocal extends SvrProcess
|
|||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(rs.getString(1));
|
||||
rs.close();
|
||||
}
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "getKeyColumns", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Convert to Array
|
||||
|
@ -406,13 +405,17 @@ public class ReplicationLocal extends SvrProcess
|
|||
{
|
||||
while (rowset.next())
|
||||
sendUpdatesTable (rowset.getInt(1), rowset.getString(3), rowset.getInt(4));
|
||||
rowset.close();
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "sendUpdates", ex);
|
||||
m_replicated = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rowset);
|
||||
rowset = null;
|
||||
}
|
||||
} // sendUpdates
|
||||
|
||||
/**
|
||||
|
@ -534,6 +537,7 @@ public class ReplicationLocal extends SvrProcess
|
|||
Connection conn = DB.getConnectionRO();
|
||||
PreparedStatement pstmt = null;
|
||||
RowSet rowSet = null;
|
||||
ResultSet rs = null;
|
||||
//
|
||||
try
|
||||
{
|
||||
|
@ -557,7 +561,7 @@ public class ReplicationLocal extends SvrProcess
|
|||
}
|
||||
}
|
||||
//
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
rowSet = CCachedRowSet.getRowSet(rs);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -568,8 +572,8 @@ public class ReplicationLocal extends SvrProcess
|
|||
// Close Cursor
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
pstmt = null;
|
||||
DB.close(rs,pstmt);
|
||||
rs = null;pstmt = null;
|
||||
}
|
||||
|
||||
return rowSet;
|
||||
|
|
|
@ -352,16 +352,25 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
+ "and documentno = ? "
|
||||
+ "and startdate = ?";
|
||||
PreparedStatement pstmtdup = null;
|
||||
ResultSet rsdup = null;
|
||||
try
|
||||
{
|
||||
pstmtdup = DB.prepareStatement (sqldup, null);
|
||||
pstmtdup.setInt(1, getAD_Client_ID());
|
||||
pstmtdup.setString(2, hdrs[0].substring(0,30));
|
||||
pstmtdup.setTimestamp(3, new Timestamp(msg.getSentDate().getTime()));
|
||||
ResultSet rsdup = pstmtdup.executeQuery ();
|
||||
rsdup = pstmtdup.executeQuery ();
|
||||
if (rsdup.next ())
|
||||
retValuedup = rsdup.getInt(1);
|
||||
rsdup.close ();
|
||||
pstmtdup.close ();
|
||||
pstmtdup = null;
|
||||
} catch (SQLException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close (rsdup,pstmtdup);
|
||||
rsdup = null;pstmtdup = null;
|
||||
}
|
||||
if (retValuedup > 0) {
|
||||
log.info("request already existed for msg -> " + hdrs[0]);
|
||||
return true;
|
||||
|
@ -390,6 +399,9 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
+ " ) "
|
||||
+ " ) ";
|
||||
PreparedStatement pstmtupd = null;
|
||||
ResultSet rsupd = null;
|
||||
try
|
||||
{
|
||||
pstmtupd = DB.prepareStatement (sqlupd, null);
|
||||
pstmtupd.setInt(1, getAD_Client_ID());
|
||||
pstmtupd.setString(2, fromAddress);
|
||||
|
@ -398,12 +410,19 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
pstmtupd.setString(5, msg.getSubject());
|
||||
pstmtupd.setString(6, fromAddress);
|
||||
pstmtupd.setString(7, msg.getSubject());
|
||||
ResultSet rsupd = pstmtupd.executeQuery ();
|
||||
rsupd = pstmtupd.executeQuery ();
|
||||
if (rsupd.next ())
|
||||
request_upd = rsupd.getInt(1);
|
||||
rsupd.close ();
|
||||
pstmtupd.close ();
|
||||
pstmtupd = null;
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rsupd,pstmtupd);
|
||||
rsupd = null;pstmtupd = null;
|
||||
}
|
||||
if (request_upd > 0) {
|
||||
log.info("msg -> " + hdrs[0] + " is an answer for req " + request_upd);
|
||||
return updateRequest(request_upd, msg);
|
||||
|
@ -443,15 +462,25 @@ public class RequestEMailProcessor extends SvrProcess
|
|||
+ " WHERE UPPER (email) = UPPER (?) "
|
||||
+ " AND ad_client_id = ?";
|
||||
PreparedStatement pstmtu = null;
|
||||
ResultSet rsu = null;
|
||||
try
|
||||
{
|
||||
pstmtu = DB.prepareStatement (sqlu, null);
|
||||
pstmtu.setString(1, fromAddress);
|
||||
pstmtu.setInt(2, getAD_Client_ID());
|
||||
ResultSet rsu = pstmtu.executeQuery ();
|
||||
rsu = pstmtu.executeQuery ();
|
||||
if (rsu.next ())
|
||||
retValueu = rsu.getInt(1);
|
||||
rsu.close ();
|
||||
pstmtu.close ();
|
||||
pstmtu = null;
|
||||
}
|
||||
catch(SQLException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close (rsu,pstmtu);
|
||||
rsu = null;pstmtu = null;
|
||||
}
|
||||
if (retValueu > 0) {
|
||||
req.setAD_User_ID(retValueu);
|
||||
} else {
|
||||
|
|
|
@ -116,6 +116,7 @@ public class RequestInvoice extends SvrProcess
|
|||
.append("ORDER BY C_BPartner_ID");
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql.toString(), get_TrxName());
|
||||
|
@ -127,7 +128,7 @@ public class RequestInvoice extends SvrProcess
|
|||
pstmt.setInt (index++, p_R_Category_ID);
|
||||
if (p_C_BPartner_ID != 0)
|
||||
pstmt.setInt (index++, p_C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
int oldC_BPartner_ID = 0;
|
||||
while (rs.next ())
|
||||
{
|
||||
|
@ -145,22 +146,15 @@ public class RequestInvoice extends SvrProcess
|
|||
}
|
||||
invoiceDone();
|
||||
//
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log (Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
// R_Category_ID
|
||||
|
|
|
@ -167,11 +167,12 @@ public class SendMailText extends SvrProcess
|
|||
+ " AND u.EMail IS NOT NULL"
|
||||
+ " AND ci.R_InterestArea_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, m_R_InterestArea_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
Boolean ok = sendIndividualMail (rs.getString(1), rs.getInt(3), unsubscribe);
|
||||
|
@ -182,24 +183,18 @@ public class SendMailText extends SvrProcess
|
|||
else
|
||||
m_errors++;
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
// Clean Up
|
||||
try
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex1)
|
||||
{
|
||||
}
|
||||
pstmt = null;
|
||||
m_ia = null;
|
||||
} // sendInterestArea
|
||||
|
||||
|
@ -217,11 +212,12 @@ public class SendMailText extends SvrProcess
|
|||
+ " AND u.EMail IS NOT NULL"
|
||||
+ " AND bp.C_BP_Group_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, m_C_BP_Group_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
Boolean ok = sendIndividualMail (rs.getString(1), rs.getInt(3), null);
|
||||
|
@ -232,24 +228,18 @@ public class SendMailText extends SvrProcess
|
|||
else
|
||||
m_errors++;
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, ex);
|
||||
}
|
||||
// Clean Up
|
||||
try
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex1)
|
||||
{
|
||||
}
|
||||
pstmt = null;
|
||||
} // sendBPGroup
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,6 +51,8 @@ public class SynchronizeTerminology extends SvrProcess
|
|||
{
|
||||
//TODO Error handling
|
||||
String sql = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
int no;
|
||||
Trx trx = Trx.get(get_TrxName(), false);
|
||||
|
@ -60,8 +62,8 @@ public class SynchronizeTerminology extends SvrProcess
|
|||
+"(SELECT 1 FROM AD_ELEMENT e "
|
||||
+" WHERE UPPER(c.ColumnName)=UPPER(e.ColumnName))"
|
||||
+" AND c.isActive = 'Y'";
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next()){
|
||||
String columnName = rs.getString(1);
|
||||
String name = rs.getString(2);
|
||||
|
@ -74,8 +76,8 @@ public class SynchronizeTerminology extends SvrProcess
|
|||
elem.setPrintName(name);
|
||||
elem.saveEx();
|
||||
}
|
||||
pstmt.close();
|
||||
rs.close();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
trx.commit(true);
|
||||
// Create Elements for Process Parameters which are centrally maintained
|
||||
/* IDEMPIERE 109 - this create unwanted Element
|
||||
|
@ -844,6 +846,12 @@ public class SynchronizeTerminology extends SvrProcess
|
|||
log.log (Level.SEVERE, "@Failed@: "+e.getLocalizedMessage(), e);
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
return "@OK@";
|
||||
}
|
||||
|
|
|
@ -130,10 +130,11 @@ public class TreeMaintenance extends SvrProcess
|
|||
//
|
||||
boolean ok = true;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
int Node_ID = rs.getInt(1);
|
||||
|
@ -157,23 +158,16 @@ public class TreeMaintenance extends SvrProcess
|
|||
log.log(Level.SEVERE, "Could not add to " + tree + " Node_ID=" + Node_ID);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "verifyTree", e);
|
||||
ok = false;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
StringBuilder msglog = new StringBuilder().append(tree.getName()).append(" Inserted");
|
||||
|
|
|
@ -118,29 +118,23 @@ public class MTableAccess extends X_AD_Table_Access
|
|||
{
|
||||
String sql = "SELECT TableName FROM AD_Table WHERE AD_Table_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getAD_Table_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
m_tableName = rs.getString(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, "getTableName", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
// Get Clear Text
|
||||
|
|
|
@ -278,17 +278,19 @@ public class MTemplate extends X_CM_Template
|
|||
int[] AdCats = null;
|
||||
String sql = "SELECT count(*) FROM CM_Template_AD_Cat WHERE CM_Template_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
int numberAdCats = 0;
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName ());
|
||||
pstmt.setInt (1, get_ID ());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
{
|
||||
numberAdCats = rs.getInt (1);
|
||||
}
|
||||
rs.close ();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
AdCats = new int[numberAdCats];
|
||||
int i = 0;
|
||||
sql = "SELECT CM_Ad_Cat_ID FROM CM_Template_AD_Cat WHERE CM_Template_ID=?";
|
||||
|
@ -300,23 +302,16 @@ public class MTemplate extends X_CM_Template
|
|||
AdCats[i] = rs.getInt (1);
|
||||
i++;
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log (Level.SEVERE, sql, ex);
|
||||
}
|
||||
try
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
catch (SQLException ex1)
|
||||
{
|
||||
}
|
||||
pstmt = null;
|
||||
if (AdCats != null && AdCats.length > 0)
|
||||
{
|
||||
MAd[] returnAds = new MAd[AdCats.length];
|
||||
|
|
|
@ -117,34 +117,29 @@ public class MTimeExpense extends X_S_TimeExpense implements DocAction
|
|||
//
|
||||
String sql = "SELECT * FROM S_TimeExpenseLine WHERE S_TimeExpense_ID=? ORDER BY Line";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, get_TrxName());
|
||||
pstmt.setInt (1, getS_TimeExpense_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MTimeExpenseLine te = new MTimeExpenseLine(getCtx(), rs, get_TrxName());
|
||||
te.setC_Currency_Report_ID(C_Currency_ID);
|
||||
list.add(te);
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "getLines", ex);
|
||||
}
|
||||
try
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex1)
|
||||
{
|
||||
}
|
||||
pstmt = null;
|
||||
//
|
||||
m_lines = new MTimeExpenseLine[list.size()];
|
||||
list.toArray(m_lines);
|
||||
|
@ -176,30 +171,25 @@ public class MTimeExpense extends X_S_TimeExpense implements DocAction
|
|||
String sql = "SELECT M_Locator_ID FROM M_Locator "
|
||||
+ "WHERE M_Warehouse_ID=? AND IsActive='Y' ORDER BY IsDefault DESC, Created";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, getM_Warehouse_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
m_M_Locator_ID = rs.getInt(1);
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "getM_Locator_ID", ex);
|
||||
}
|
||||
try
|
||||
finally
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
catch (SQLException ex1)
|
||||
{
|
||||
}
|
||||
pstmt = null;
|
||||
//
|
||||
return m_M_Locator_ID;
|
||||
} // getM_Locator_ID
|
||||
|
|
|
@ -167,21 +167,27 @@ public class MTree extends MTree_Base
|
|||
String sql = "SELECT AD_Tree_ID, Name FROM AD_Tree "
|
||||
+ "WHERE AD_Client_ID=? AND TreeType=? AND IsActive='Y' AND IsAllNodes='Y' "
|
||||
+ "ORDER BY IsDefault DESC, AD_Tree_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, AD_Client_ID);
|
||||
pstmt.setString(2, TreeType);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
AD_Tree_ID = rs.getInt(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
return AD_Tree_ID;
|
||||
} // getDefaultAD_Tree_ID
|
||||
|
@ -225,18 +231,20 @@ public class MTree extends MTree_Base
|
|||
}
|
||||
log.finest(sql.toString());
|
||||
// The Node Loop
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
// load Node details - addToTree -> getNodeDetail
|
||||
getNodeDetails();
|
||||
//
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
pstmt = DB.prepareStatement(sql.toString(), get_TrxName());
|
||||
int idx = 1;
|
||||
if (AD_User_ID != -1 && getTreeType().equals(TREETYPE_Menu)) // IDEMPIERE 329 - nmicoud
|
||||
pstmt.setInt(idx++, AD_User_ID);
|
||||
pstmt.setInt(idx++, getAD_Tree_ID());
|
||||
// Get Tree & Bar
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
m_root = new MTreeNode (0, 0, getName(), getDescription(), 0, true, null, false, null);
|
||||
while (rs.next())
|
||||
{
|
||||
|
@ -250,8 +258,6 @@ public class MTree extends MTree_Base
|
|||
else
|
||||
addToTree (node_ID, parent_ID, seqNo, onBar); // calls getNodeDetail
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
//
|
||||
//closing the rowset will also close connection for oracle rowset implementation
|
||||
//m_nodeRowSet.close();
|
||||
|
@ -264,6 +270,12 @@ public class MTree extends MTree_Base
|
|||
m_nodeRowSet = null;
|
||||
m_nodeIdMap = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Done with loading - add remainder from buffer
|
||||
if (m_buffer.size() != 0)
|
||||
|
|
|
@ -48,30 +48,24 @@ public class MTree_Node extends X_AD_TreeNode
|
|||
MTree_Node retValue = null;
|
||||
String sql = "SELECT * FROM AD_TreeNode WHERE AD_Tree_ID=? AND Node_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, tree.get_TrxName());
|
||||
pstmt.setInt (1, tree.getAD_Tree_ID());
|
||||
pstmt.setInt (2, Node_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MTree_Node (tree.getCtx(), rs, tree.get_TrxName());
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
|
@ -48,30 +48,24 @@ public class MTree_NodeBP extends X_AD_TreeNodeBP
|
|||
MTree_NodeBP retValue = null;
|
||||
String sql = "SELECT * FROM AD_TreeNodeBP WHERE AD_Tree_ID=? AND Node_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, tree.get_TrxName());
|
||||
pstmt.setInt (1, tree.getAD_Tree_ID());
|
||||
pstmt.setInt (2, Node_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MTree_NodeBP (tree.getCtx(), rs, tree.get_TrxName());
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "get", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
|
@ -51,31 +51,25 @@ public class MTree_NodeCMC extends X_AD_TreeNodeCMC
|
|||
ArrayList<MTree_NodeCMC> list = new ArrayList<MTree_NodeCMC>();
|
||||
String sql = "SELECT * FROM AD_TreeNodeCMC WHERE AD_Tree_ID=? ORDER BY Node_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, AD_Tree_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
list.add (new MTree_NodeCMC (ctx, rs, trxName));
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
MTree_NodeCMC[] retValue = new MTree_NodeCMC[list.size ()];
|
||||
|
@ -95,30 +89,24 @@ public class MTree_NodeCMC extends X_AD_TreeNodeCMC
|
|||
MTree_NodeCMC retValue = null;
|
||||
String sql = "SELECT * FROM AD_TreeNodeCMC WHERE AD_Tree_ID=? AND Node_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, tree.get_TrxName());
|
||||
pstmt.setInt (1, tree.getAD_Tree_ID());
|
||||
pstmt.setInt (2, Node_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MTree_NodeCMC (tree.getCtx(), rs, tree.get_TrxName());
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "get", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
|
@ -51,31 +51,25 @@ public class MTree_NodeCMS extends X_AD_TreeNodeCMS
|
|||
ArrayList<MTree_NodeCMS> list = new ArrayList<MTree_NodeCMS>();
|
||||
String sql = "SELECT * FROM AD_TreeNodeCMS WHERE AD_Tree_ID=? ORDER BY Node_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, AD_Tree_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
list.add (new MTree_NodeCMS (ctx, rs, trxName));
|
||||
}
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log (Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
MTree_NodeCMS[] retValue = new MTree_NodeCMS[list.size ()];
|
||||
|
@ -94,30 +88,24 @@ public class MTree_NodeCMS extends X_AD_TreeNodeCMS
|
|||
MTree_NodeCMS retValue = null;
|
||||
String sql = "SELECT * FROM AD_TreeNodeCMS WHERE AD_Tree_ID=? AND Node_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, tree.get_TrxName());
|
||||
pstmt.setInt (1, tree.getAD_Tree_ID());
|
||||
pstmt.setInt (2, Node_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MTree_NodeCMS (tree.getCtx(), rs, tree.get_TrxName());
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "get", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
|
@ -48,30 +48,24 @@ public class MTree_NodeMM extends X_AD_TreeNodeMM
|
|||
MTree_NodeMM retValue = null;
|
||||
String sql = "SELECT * FROM AD_TreeNodeMM WHERE AD_Tree_ID=? AND Node_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, tree.get_TrxName());
|
||||
pstmt.setInt (1, tree.getAD_Tree_ID());
|
||||
pstmt.setInt (2, Node_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MTree_NodeMM (tree.getCtx(), rs, tree.get_TrxName());
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "get", e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
|
@ -48,30 +48,24 @@ public class MTree_NodePR extends X_AD_TreeNodePR
|
|||
MTree_NodePR retValue = null;
|
||||
String sql = "SELECT * FROM AD_TreeNodePR WHERE AD_Tree_ID=? AND Node_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, tree.get_TrxName());
|
||||
pstmt.setInt (1, tree.getAD_Tree_ID());
|
||||
pstmt.setInt (2, Node_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MTree_NodePR (tree.getCtx(), rs, tree.get_TrxName());
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
|
@ -63,29 +63,23 @@ public class MUserOrgAccess extends X_AD_User_OrgAccess
|
|||
{
|
||||
ArrayList<MUserOrgAccess> list = new ArrayList<MUserOrgAccess>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, id);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
list.add (new MUserOrgAccess(ctx, rs, null));
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
MUserOrgAccess[] retValue = new MUserOrgAccess[list.size ()];
|
||||
|
@ -190,32 +184,26 @@ public class MUserOrgAccess extends X_AD_User_OrgAccess
|
|||
+ "FROM AD_Client c INNER JOIN AD_Org o ON (c.AD_Client_ID=o.AD_Client_ID) "
|
||||
+ "WHERE o.AD_Org_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, getAD_Org_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
m_clientName = rs.getString(1);
|
||||
m_orgName = rs.getString(2);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,6 +95,7 @@ public class MWarehousePrice extends X_RV_WarehousePrice
|
|||
+ " - " + finalSQL);
|
||||
ArrayList<MWarehousePrice> list = new ArrayList<MWarehousePrice>();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(finalSQL, trxName);
|
||||
|
@ -109,25 +110,18 @@ public class MWarehousePrice extends X_RV_WarehousePrice
|
|||
pstmt.setString(index++, UPC);
|
||||
if (SKU != null && SKU.length() > 0)
|
||||
pstmt.setString(index++, SKU);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new MWarehousePrice(ctx, rs, trxName));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, finalSQL, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
|
@ -191,31 +185,25 @@ public class MWarehousePrice extends X_RV_WarehousePrice
|
|||
String sql = "SELECT * FROM RV_WarehousePrice "
|
||||
+ "WHERE M_Product_ID=? AND M_PriceList_Version_ID=? AND M_Warehouse_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, trxName);
|
||||
pstmt.setInt (1, product.getM_Product_ID());
|
||||
pstmt.setInt(2, M_PriceList_Version_ID);
|
||||
pstmt.setInt(3, M_Warehouse_ID);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
if (rs.next ())
|
||||
retValue = new MWarehousePrice(product.getCtx(), rs, trxName);
|
||||
rs.close ();
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return retValue;
|
||||
|
|
|
@ -71,29 +71,23 @@ public class MWebProjectDomain extends X_CM_WebProject_Domain
|
|||
MWebProjectDomain thisWebProjectDomain = null;
|
||||
String sql = "SELECT * FROM CM_WebProject_Domain WHERE lower(FQDN) LIKE ? ORDER by CM_WebProject_Domain_ID DESC";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setString(1, ServerName);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
thisWebProjectDomain = (new MWebProjectDomain(ctx, rs, trxName));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return thisWebProjectDomain;
|
||||
|
|
|
@ -133,14 +133,16 @@ public class ScheduleUtil
|
|||
+ " AND DateTo >= ?" // #2 start
|
||||
+ " AND DateFrom <= ?" // #3 end
|
||||
+ " AND IsActive='Y'";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
// log.fine( sql, "ID=" + S_Resource_ID + ", Start=" + m_startDate + ", End=" + m_endDate);
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, m_S_Resource_ID);
|
||||
pstmt.setTimestamp(2, m_startDate);
|
||||
pstmt.setTimestamp(3, m_endDate);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
ma = new MAssignmentSlot (TimeUtil.getDay(rs.getTimestamp(2)),
|
||||
|
@ -153,8 +155,6 @@ public class ScheduleUtil
|
|||
else
|
||||
list.add(ma);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -163,6 +163,13 @@ public class ScheduleUtil
|
|||
Msg.getMsg (m_ctx, "ResourceUnAvailable"), e.toString(),
|
||||
MAssignmentSlot.STATUS_UnAvailable);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
if (ma != null && !getAll)
|
||||
return new MAssignmentSlot[] {ma};
|
||||
|
||||
|
@ -180,10 +187,10 @@ public class ScheduleUtil
|
|||
Timestamp startDay = TimeUtil.getDay(m_startDate);
|
||||
Timestamp endDay = TimeUtil.getDay(m_endDate);
|
||||
// log.fine( sql, "Start=" + startDay + ", End=" + endDay);
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setTimestamp(1, startDay);
|
||||
pstmt.setTimestamp(2, endDay);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
Timestamp date = rs.getTimestamp(2);
|
||||
|
@ -194,8 +201,6 @@ public class ScheduleUtil
|
|||
log.finer("- NonBusinessDay " + ma);
|
||||
list.add(ma);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -204,6 +209,12 @@ public class ScheduleUtil
|
|||
Msg.getMsg(m_ctx, "NonBusinessDay"), e.toString(),
|
||||
MAssignmentSlot.STATUS_NonBusinessDay);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
if (ma != null && !getAll)
|
||||
return new MAssignmentSlot[] {ma};
|
||||
|
||||
|
@ -217,9 +228,9 @@ public class ScheduleUtil
|
|||
+ "WHERE S_ResourceType_ID=?";
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, m_S_ResourceType_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
m_typeName = rs.getString(1);
|
||||
|
@ -259,8 +270,6 @@ public class ScheduleUtil
|
|||
} // DaySlot
|
||||
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -269,6 +278,12 @@ public class ScheduleUtil
|
|||
Msg.getMsg(m_ctx, "ResourceNotInSlotDay"), e.toString(),
|
||||
MAssignmentSlot.STATUS_NonBusinessDay);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
if (ma != null && !getAll)
|
||||
return new MAssignmentSlot[] {ma};
|
||||
|
||||
|
@ -281,11 +296,11 @@ public class ScheduleUtil
|
|||
+ " AND IsActive='Y'";
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt = DB.prepareStatement(sql, trxName);
|
||||
pstmt.setInt(1, m_S_Resource_ID);
|
||||
pstmt.setTimestamp(2, m_startDate);
|
||||
pstmt.setTimestamp(3, m_endDate);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
MResourceAssignment mAssignment =
|
||||
|
@ -295,8 +310,6 @@ public class ScheduleUtil
|
|||
break;
|
||||
list.add(ma);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -305,6 +318,12 @@ public class ScheduleUtil
|
|||
Msg.translate(m_ctx, "S_R"), e.toString(),
|
||||
MAssignmentSlot.STATUS_NotConfirmed);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
if (ma != null && !getAll)
|
||||
return new MAssignmentSlot[] {ma};
|
||||
|
||||
|
@ -578,11 +597,13 @@ public class ScheduleUtil
|
|||
+ " AND r.S_ResourceType_ID=rt.S_ResourceType_ID",
|
||||
"r", MRole.SQL_FULLYQUALIFIED, MRole.SQL_RO);
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, S_Resource_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
if (!"Y".equals(rs.getString(1))) // Active
|
||||
|
@ -597,14 +618,18 @@ public class ScheduleUtil
|
|||
}
|
||||
else
|
||||
m_isAvailable = false;
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
m_isAvailable = false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_S_Resource_ID = S_Resource_ID;
|
||||
} // getBaseInfo
|
||||
|
||||
|
|
|
@ -1184,12 +1184,13 @@ public class DocumentEngine implements DocAction
|
|||
+ "WHERE l.AD_Ref_List_ID=t.AD_Ref_List_ID"
|
||||
+ " AND t.AD_Language='" + Env.getAD_Language(Env.getCtx()) + "'"
|
||||
+ " AND l.AD_Reference_ID=? ORDER BY t.Name";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, DocAction.AD_REFERENCE_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
String value = rs.getString(1);
|
||||
|
@ -1202,13 +1203,17 @@ public class DocumentEngine implements DocAction
|
|||
v_name.add(name);
|
||||
v_description.add(description);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -54,15 +54,16 @@ public class ProcessInfoUtil
|
|||
String sql = "SELECT Result, ErrorMsg FROM AD_PInstance "
|
||||
+ "WHERE AD_PInstance_ID=?"
|
||||
+ " AND Result IS NOT NULL";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement (sql,
|
||||
pstmt = DB.prepareStatement (sql,
|
||||
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, null);
|
||||
for (int noTry = 0; noTry < noRetry; noTry++)
|
||||
{
|
||||
pstmt.setInt(1, pi.getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
// we have a result
|
||||
|
@ -76,16 +77,14 @@ public class ProcessInfoUtil
|
|||
pi.setSummary(Msg.getMsg(Env.getCtx(), "Failure"), true);
|
||||
}
|
||||
String Message = rs.getString(2);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
//
|
||||
if (Message != null)
|
||||
pi.addSummary (" (" + Msg.parseTranslation(Env.getCtx(), Message) + ")");
|
||||
// s_log.fine("setSummaryFromDB - " + Message);
|
||||
return;
|
||||
}
|
||||
|
||||
rs.close();
|
||||
DB.close(rs);
|
||||
rs = null;
|
||||
// sleep
|
||||
try
|
||||
{
|
||||
|
@ -97,7 +96,6 @@ public class ProcessInfoUtil
|
|||
s_log.log(Level.SEVERE, "Sleep Thread", ie);
|
||||
}
|
||||
}
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -105,6 +103,11 @@ public class ProcessInfoUtil
|
|||
pi.setSummary (e.getLocalizedMessage(), true);
|
||||
return;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs,pstmt);
|
||||
rs = null;pstmt = null;
|
||||
}
|
||||
pi.setSummary (Msg.getMsg(Env.getCtx(), "Timeout"), true);
|
||||
} // setSummaryFromDB
|
||||
|
||||
|
@ -119,23 +122,28 @@ public class ProcessInfoUtil
|
|||
+ "FROM AD_PInstance_Log "
|
||||
+ "WHERE AD_PInstance_ID=? "
|
||||
+ "ORDER BY Log_ID";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, pi.getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()){
|
||||
// int Log_ID, int P_ID, Timestamp P_Date, BigDecimal P_Number, String P_Msg, AD_Table_ID, Record_ID
|
||||
pi.addLog (rs.getInt(1), rs.getInt(2), rs.getTimestamp(3), rs.getBigDecimal(4), rs.getString(5), rs.getInt(6), rs.getInt(7));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, "setLogFromDB", e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
} // getLogFromDB
|
||||
|
||||
/**
|
||||
|
@ -207,11 +215,13 @@ public class ProcessInfoUtil
|
|||
+ " INNER JOIN AD_PInstance i ON (p.AD_PInstance_ID=i.AD_PInstance_ID) "
|
||||
+ "WHERE p.AD_PInstance_ID=? "
|
||||
+ "ORDER BY p.SeqNo";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, pi.getAD_PInstance_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
String ParameterName = rs.getString(1);
|
||||
|
@ -241,13 +251,17 @@ public class ProcessInfoUtil
|
|||
if (pi.getAD_User_ID() == null)
|
||||
pi.setAD_User_ID(rs.getInt(12));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
ProcessInfoParameter[] pars = new ProcessInfoParameter[list.size()];
|
||||
list.toArray(pars);
|
||||
|
|
|
@ -66,16 +66,14 @@ public class MReportColumnSet extends X_PA_ReportColumnSet
|
|||
ArrayList<MReportColumn> list = new ArrayList<MReportColumn>();
|
||||
String sql = "SELECT * FROM PA_ReportColumn WHERE PA_ReportColumnSet_ID=? AND IsActive='Y' ORDER BY SeqNo";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getPA_ReportColumnSet_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new MReportColumn (getCtx(), rs, null));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -83,13 +81,8 @@ public class MReportColumnSet extends X_PA_ReportColumnSet
|
|||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
|
|
|
@ -84,16 +84,14 @@ public class MReportLine extends X_PA_ReportLine
|
|||
ArrayList<MReportSource> list = new ArrayList<MReportSource>();
|
||||
String sql = "SELECT * FROM PA_ReportSource WHERE PA_ReportLine_ID=? AND IsActive='Y'";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getPA_ReportLine_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new MReportSource (getCtx(), rs, null));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -101,13 +99,8 @@ public class MReportLine extends X_PA_ReportLine
|
|||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
|
|
|
@ -68,16 +68,14 @@ public class MReportLineSet extends X_PA_ReportLineSet
|
|||
+ "WHERE PA_ReportLineSet_ID=? AND IsActive='Y' "
|
||||
+ "ORDER BY SeqNo";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getPA_ReportLineSet_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new MReportLine (getCtx(), rs, get_TrxName()));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -85,13 +83,8 @@ public class MReportLineSet extends X_PA_ReportLineSet
|
|||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
|
|
|
@ -170,21 +170,27 @@ public class MReportTree
|
|||
String sql = "SELECT AD_Tree_ID, Name FROM AD_Tree "
|
||||
+ "WHERE AD_Client_ID=? AND TreeType=? AND IsActive='Y' AND IsAllNodes='Y' "
|
||||
+ "ORDER BY IsDefault DESC, AD_Tree_ID"; // assumes first is primary tree
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, AD_Client_ID);
|
||||
pstmt.setString(2, m_TreeType);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
AD_Tree_ID = rs.getInt(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
return AD_Tree_ID;
|
||||
} // getDefaultAD_Tree_ID
|
||||
|
|
|
@ -245,19 +245,17 @@ public class TrialBalance extends SvrProcess
|
|||
|
||||
String sql = "SELECT StartDate, EndDate FROM C_Period WHERE C_Period_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, p_C_Period_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
p_DateAcct_From = rs.getTimestamp(1);
|
||||
p_DateAcct_To = rs.getTimestamp(2);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -265,13 +263,8 @@ public class TrialBalance extends SvrProcess
|
|||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
} // setDateAcct
|
||||
|
|
|
@ -123,10 +123,12 @@ public class RModelData
|
|||
// FillData
|
||||
int index = 0; // rowset index
|
||||
m_rows.clear();
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
Statement stmt = DB.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(finalSQL);
|
||||
stmt = DB.createStatement();
|
||||
rs = stmt.executeQuery(finalSQL);
|
||||
while (rs.next())
|
||||
{
|
||||
ArrayList<Object> row = new ArrayList<Object>(size);
|
||||
|
@ -163,8 +165,6 @@ public class RModelData
|
|||
}
|
||||
m_rows.add(row);
|
||||
}
|
||||
rs.close();
|
||||
stmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -174,6 +174,12 @@ public class RModelData
|
|||
log.log(Level.SEVERE, "Index=" + index + "," + rc, e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, stmt);
|
||||
rs = null;
|
||||
stmt = null;
|
||||
}
|
||||
process();
|
||||
} // query
|
||||
|
||||
|
|
|
@ -101,14 +101,26 @@ public class CCachedRowSet extends CachedRowSetImpl implements CachedRowSet
|
|||
{
|
||||
if (db.getName().equals(Database.DB_ORACLE))
|
||||
{
|
||||
Statement stmt = conn.createStatement
|
||||
(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
ResultSet rs = stmt.executeQuery(sql);
|
||||
CachedRowSetImpl crs = new CachedRowSetImpl();
|
||||
crs.populate(rs);
|
||||
rs.close();
|
||||
stmt.close();
|
||||
return crs;
|
||||
Statement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
stmt = conn.createStatement
|
||||
(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
|
||||
rs = stmt.executeQuery(sql);
|
||||
CachedRowSetImpl crs = new CachedRowSetImpl();
|
||||
crs.populate(rs);
|
||||
return crs;
|
||||
} catch (SQLException e)
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, stmt);
|
||||
rs = null;
|
||||
stmt = null;
|
||||
}
|
||||
}
|
||||
CachedRowSet crs = get();
|
||||
crs.setConcurrency(ResultSet.CONCUR_READ_ONLY);
|
||||
|
|
|
@ -194,11 +194,13 @@ public class GenericPaymentExport implements PaymentExport
|
|||
+ " AND a.C_Region_ID=r.C_Region_ID(+)"
|
||||
+ " AND a.C_Country_ID=cc.C_Country_ID "
|
||||
+ "ORDER BY l.IsBillTo DESC";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
//
|
||||
if (rs.next())
|
||||
{
|
||||
|
@ -233,13 +235,17 @@ public class GenericPaymentExport implements PaymentExport
|
|||
if (bp[BP_REFNO] == null)
|
||||
bp[BP_REFNO] = "";
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
s_log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return bp;
|
||||
} // getBPartnerInfo
|
||||
|
||||
|
|
|
@ -476,9 +476,6 @@ public class WebInfo
|
|||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add (new MRequestType (m_ctx, rs, null));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
@ -511,16 +511,14 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
"ORDER BY m.Created DESC";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, get_TrxName());
|
||||
pstmt.setInt(1, getDD_Order_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new MMovement(getCtx(), rs, get_TrxName()));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -528,13 +526,8 @@ public class MDDOrder extends X_DD_Order implements DocAction
|
|||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
|
|
|
@ -81,17 +81,19 @@ public class CalloutAsset extends CalloutEngine {
|
|||
{
|
||||
Integer A_Depreciation_Table_Header_ID = (Integer)value;
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
if (A_Depreciation_Table_Header_ID != null){
|
||||
if (A_Depreciation_Table_Header_ID != null){
|
||||
String SQL = "SELECT A_Term "
|
||||
+ "FROM A_Depreciation_Table_Header "
|
||||
+ "WHERE A_Depreciation_Table_Header_ID='"
|
||||
+A_Depreciation_Table_Header_ID
|
||||
+"'";
|
||||
|
||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null); // arhipac: compatibility
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(SQL, null); // arhipac: compatibility
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
// Charges - Set Context
|
||||
|
@ -99,15 +101,19 @@ public class CalloutAsset extends CalloutEngine {
|
|||
mTab.setValue ("A_DEPRECIATION_MANUAL_PERIOD", rs.getString("A_Term"));
|
||||
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.info("PeriodType "+ e);
|
||||
return e.getLocalizedMessage();
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return "";
|
||||
} // Period Type
|
||||
|
||||
|
@ -131,6 +137,8 @@ public class CalloutAsset extends CalloutEngine {
|
|||
{
|
||||
Object A_Depreciation_ID = value;
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
String SQL = "SELECT DepreciationType "
|
||||
|
@ -138,8 +146,8 @@ public class CalloutAsset extends CalloutEngine {
|
|||
+ "WHERE A_Depreciation_ID="
|
||||
+ A_Depreciation_ID;
|
||||
|
||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null); // arhipac: compatibility
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(SQL, null); // arhipac: compatibility
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
{
|
||||
// Charges - Set Context
|
||||
|
@ -160,14 +168,18 @@ public class CalloutAsset extends CalloutEngine {
|
|||
mTab.setValue ("A_Depreciation_Table_Header_ID", null);
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.info("PeriodType "+ e);
|
||||
return e.getLocalizedMessage();
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
return "";
|
||||
} // Period Type
|
||||
|
||||
|
|
|
@ -202,7 +202,6 @@ public class AcctProcessor extends AdempiereServer
|
|||
if (!ok)
|
||||
countError[i]++;
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -211,6 +210,8 @@ public class AcctProcessor extends AdempiereServer
|
|||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
} // for tableID
|
||||
|
|
|
@ -102,6 +102,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
if (m_model.getR_RequestType_ID() != 0)
|
||||
sql += " AND R_RequestType_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
int count = 0;
|
||||
int countEMails = 0;
|
||||
try
|
||||
|
@ -110,7 +111,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
pstmt.setInt (1, m_model.getAD_Client_ID());
|
||||
if (m_model.getR_RequestType_ID() != 0)
|
||||
pstmt.setInt(2, m_model.getR_RequestType_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MRequest request = new MRequest (getCtx(), rs, null);
|
||||
|
@ -129,7 +130,6 @@ public class RequestProcessor extends AdempiereServer
|
|||
count++;
|
||||
}
|
||||
}
|
||||
rs.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -137,7 +137,9 @@ public class RequestProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_summary.append("New Due #").append(count);
|
||||
if (countEMails > 0)
|
||||
|
@ -164,7 +166,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
pstmt.setInt (1, m_model.getAD_Client_ID());
|
||||
if (m_model.getR_RequestType_ID() != 0)
|
||||
pstmt.setInt(2, m_model.getR_RequestType_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MRequest request = new MRequest (getCtx(), rs, null);
|
||||
|
@ -184,7 +186,6 @@ public class RequestProcessor extends AdempiereServer
|
|||
count++;
|
||||
}
|
||||
}
|
||||
rs.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -192,7 +193,9 @@ public class RequestProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_summary.append("New Overdue #").append(count);
|
||||
if (countEMails > 0)
|
||||
|
@ -223,7 +226,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
pstmt.setInt(1, m_model.getAD_Client_ID());
|
||||
if (m_model.getR_RequestType_ID() != 0)
|
||||
pstmt.setInt(2, m_model.getR_RequestType_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
MRequest request = new MRequest (getCtx(), rs, null);
|
||||
|
@ -241,7 +244,6 @@ public class RequestProcessor extends AdempiereServer
|
|||
request.saveEx();
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -249,7 +251,9 @@ public class RequestProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_summary.append("Alerts #").append(count);
|
||||
if (countEMails > 0)
|
||||
|
@ -278,14 +282,13 @@ public class RequestProcessor extends AdempiereServer
|
|||
pstmt.setInt(1, m_model.getAD_Client_ID());
|
||||
if (m_model.getR_RequestType_ID() != 0)
|
||||
pstmt.setInt(2, m_model.getR_RequestType_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
MRequest request = new MRequest (getCtx(), rs, null);
|
||||
if (escalate(request))
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -293,7 +296,9 @@ public class RequestProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_summary.append("Escalated #").append(count).append(" - ");
|
||||
} // Esacalate
|
||||
|
@ -322,7 +327,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
pstmt.setInt(1, m_model.getAD_Client_ID());
|
||||
if (m_model.getR_RequestType_ID() != 0)
|
||||
pstmt.setInt(2, m_model.getR_RequestType_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
MRequest request = new MRequest (getCtx(), rs, null);
|
||||
|
@ -339,7 +344,6 @@ public class RequestProcessor extends AdempiereServer
|
|||
count++;
|
||||
}
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -347,7 +351,9 @@ public class RequestProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_summary.append("Inactivity #").append(count);
|
||||
if (countEMails > 0)
|
||||
|
@ -430,12 +436,13 @@ public class RequestProcessor extends AdempiereServer
|
|||
+ ") "
|
||||
+ "ORDER BY R_Status_ID";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
MStatus status = null;
|
||||
MStatus next = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MRequest r = new MRequest(getCtx(), rs, null);
|
||||
|
@ -456,7 +463,6 @@ public class RequestProcessor extends AdempiereServer
|
|||
if (r.save())
|
||||
count++;
|
||||
}
|
||||
rs.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -464,7 +470,9 @@ public class RequestProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
m_summary.append("Status Timeout #").append(count)
|
||||
|
@ -492,10 +500,11 @@ public class RequestProcessor extends AdempiereServer
|
|||
int failure = 0;
|
||||
//
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MRequest r = new MRequest (getCtx(), rs, null);
|
||||
|
@ -512,7 +521,6 @@ public class RequestProcessor extends AdempiereServer
|
|||
else
|
||||
failure++;
|
||||
}
|
||||
rs.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -520,7 +528,9 @@ public class RequestProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
m_summary.append("Auto Change Request #").append(count);
|
||||
|
@ -555,13 +565,14 @@ public class RequestProcessor extends AdempiereServer
|
|||
if (m_model.getR_RequestType_ID() != 0)
|
||||
sql += " AND R_RequestType_ID=?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, m_model.getAD_Client_ID());
|
||||
if (m_model.getR_RequestType_ID() != 0)
|
||||
pstmt.setInt(2, m_model.getR_RequestType_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
MRequest request = new MRequest (ctx, rs, null);
|
||||
|
@ -577,7 +588,6 @@ public class RequestProcessor extends AdempiereServer
|
|||
else
|
||||
notFound++;
|
||||
}
|
||||
rs.close();
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
|
@ -585,9 +595,10 @@ public class RequestProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
pstmt = null;
|
||||
//
|
||||
if (changed == 0 && notFound == 0)
|
||||
m_summary.append("No unallocated Requests");
|
||||
|
|
|
@ -103,13 +103,14 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
+ " AND wfn.Action='Z'" // sleeping
|
||||
+ " AND (wf.AD_WorkflowProcessor_ID IS NULL OR wf.AD_WorkflowProcessor_ID=?))";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
int count = 0;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt (1, m_model.getAD_Client_ID());
|
||||
pstmt.setInt (2, m_model.getAD_WorkflowProcessor_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MWFActivity activity = new MWFActivity (getCtx(), rs, null);
|
||||
|
@ -117,7 +118,6 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
// saves and calls MWFProcess.checkActivities();
|
||||
count++;
|
||||
}
|
||||
rs.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -125,7 +125,9 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_summary.append("Wakeup #").append(count).append (" - ");
|
||||
} // wakeup
|
||||
|
@ -144,12 +146,13 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
+ "WHERE a.AD_WF_Node_ID=wfn.AD_WF_Node_ID AND wf.AD_WorkflowProcessor_ID=?"
|
||||
+ " AND wfn.DynPriorityUnit IS NOT NULL AND wfn.DynPriorityChange IS NOT NULL)";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
int count = 0;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt(1, m_model.getAD_WorkflowProcessor_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MWFActivity activity = new MWFActivity (getCtx(), rs, null);
|
||||
|
@ -162,7 +165,6 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
activity.saveEx();
|
||||
count++;
|
||||
}
|
||||
rs.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -170,7 +172,9 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
m_summary.append("DynPriority #").append(count).append (" - ");
|
||||
|
@ -200,12 +204,13 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
int count = 0;
|
||||
int countEMails = 0;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt (1, m_model.getAlertOverPriority());
|
||||
pstmt.setInt (2, m_model.getAD_WorkflowProcessor_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
MWFActivity activity = new MWFActivity (getCtx(), rs, null);
|
||||
|
@ -216,8 +221,6 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
activity.saveEx();
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -225,7 +228,9 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_summary.append("OverPriority #").append(count);
|
||||
if (countEMails > 0)
|
||||
|
@ -250,13 +255,14 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
+ " AND wfn.Action<>'Z'" // not sleeping
|
||||
+ " AND (wf.AD_WorkflowProcessor_ID IS NULL OR wf.AD_WorkflowProcessor_ID=?))";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
int count = 0;
|
||||
int countEMails = 0;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement (sql, null);
|
||||
pstmt.setInt(1, m_model.getAD_WorkflowProcessor_ID());
|
||||
ResultSet rs = pstmt.executeQuery ();
|
||||
rs = pstmt.executeQuery ();
|
||||
while (rs.next ())
|
||||
{
|
||||
MWFActivity activity = new MWFActivity (getCtx(), rs, null);
|
||||
|
@ -267,7 +273,6 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
activity.saveEx();
|
||||
count++;
|
||||
}
|
||||
rs.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -275,7 +280,9 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
m_summary.append("EndWaitTime #").append(count);
|
||||
|
@ -306,7 +313,7 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt (1, m_model.getAD_WorkflowProcessor_ID());
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
MWFActivity activity = new MWFActivity (getCtx(), rs, null);
|
||||
|
@ -317,8 +324,6 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
activity.saveEx();
|
||||
count++;
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
|
@ -326,7 +331,9 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
}
|
||||
finally
|
||||
{
|
||||
DB.close(pstmt);
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
m_summary.append("Inactivity #").append(count);
|
||||
if (countEMails > 0)
|
||||
|
|
|
@ -380,13 +380,15 @@ public class Viewer extends CFrame
|
|||
+ "WHERE c.AD_Table_ID=? AND c.IsKey='Y'"
|
||||
+ " AND et.AD_Language=? "
|
||||
+ "ORDER BY 3";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, m_reportEngine.getPrintFormat().getAD_Table_ID());
|
||||
if (trl)
|
||||
pstmt.setString(2, Env.getAD_Language(Env.getCtx()));
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
String tableName = rs.getString(2);
|
||||
|
@ -396,13 +398,17 @@ public class Viewer extends CFrame
|
|||
name += "/" + poName;
|
||||
comboDrill.addItem(new ValueNamePair (tableName, name));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
if (comboDrill.getItemCount() == 1)
|
||||
{
|
||||
labelDrill.setVisible(false);
|
||||
|
@ -434,11 +440,13 @@ public class Viewer extends CFrame
|
|||
+ "ORDER BY Name",
|
||||
"AD_PrintFormat", MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||
int AD_Table_ID = m_reportEngine.getPrintFormat().getAD_Table_ID();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, AD_Table_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
KeyNamePair pp = new KeyNamePair(rs.getInt(1), rs.getString(2));
|
||||
|
@ -446,13 +454,17 @@ public class Viewer extends CFrame
|
|||
if (rs.getInt(1) == AD_PrintFormat_ID)
|
||||
selectValue = pp;
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
// IDEMPIERE-297 - Check for Table Access and Window Access for New Report
|
||||
if ( MRole.getDefault().isTableAccess(MPrintFormat.Table_ID, false)
|
||||
&& MRole.getDefault().getWindowAccess(WINDOW_PRINTFORMAT))
|
||||
|
@ -1151,11 +1163,13 @@ public class Viewer extends CFrame
|
|||
if (!Env.isBaseLanguage(Env.getCtx(), "AD_Tab"))
|
||||
sql = "SELECT Name, TableName FROM AD_Tab_vt WHERE AD_Tab_ID=?"
|
||||
+ " AND AD_Language='" + Env.getAD_Language(Env.getCtx()) + "' " + ASPFilter;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, AD_Tab_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
//
|
||||
if (rs.next())
|
||||
{
|
||||
|
@ -1163,13 +1177,17 @@ public class Viewer extends CFrame
|
|||
tableName = rs.getString(2);
|
||||
}
|
||||
//
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
GridField[] findFields = null;
|
||||
if (tableName != null)
|
||||
|
@ -1250,19 +1268,25 @@ public class Viewer extends CFrame
|
|||
ArrayList<ValueNamePair> list = new ArrayList<ValueNamePair>();
|
||||
ValueNamePair pp = null;
|
||||
String sql = "SELECT Name, AD_Language FROM AD_Language WHERE IsSystemLanguage='Y' ORDER BY 1";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
list.add(new ValueNamePair (rs.getString(2), rs.getString(1)));
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
if (list.size() == 0)
|
||||
{
|
||||
ADialog.warn(m_WindowNo, this, "NoTranslation");
|
||||
|
|
|
@ -366,11 +366,13 @@ public class VInOutInvoiceGen extends CPanel
|
|||
int row = 0;
|
||||
miniTable.setRowCount(row);
|
||||
// Execute
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt = DB.prepareStatement(sql.toString(), null);
|
||||
pstmt.setInt(1, AD_Client_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
//
|
||||
while (rs.next())
|
||||
{
|
||||
|
@ -387,13 +389,17 @@ public class VInOutInvoiceGen extends CPanel
|
|||
// prepare next
|
||||
row++;
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql.toString(), e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
miniTable.autoSize();
|
||||
// statusBar.setStatusDB(String.valueOf(miniTable.getRowCount()));
|
||||
|
|
|
@ -143,24 +143,20 @@ public abstract class CreateFromInvoice extends CreateFrom
|
|||
+ "WHERE inv.M_RMA_ID=r.M_RMA_ID AND inv.DocStatus IN ('CO', 'CL'))";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sqlStmt, null);
|
||||
pstmt.setInt(1, C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
list.add(new KeyNamePair(rs.getInt(1), rs.getString(2)));
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
log.log(Level.SEVERE, sqlStmt.toString(), e);
|
||||
} finally {
|
||||
if (pstmt != null) {
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (Exception ex) {
|
||||
log.severe("Could not close prepared statement");
|
||||
}
|
||||
}
|
||||
} finally{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
return list;
|
||||
|
|
|
@ -98,24 +98,20 @@ public abstract class CreateFromShipment extends CreateFrom
|
|||
+ "AND rl.M_InOutLine_ID IS NOT NULL)";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sqlStmt, null);
|
||||
pstmt.setInt(1, C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next()) {
|
||||
list.add(new KeyNamePair(rs.getInt(1), rs.getString(2)));
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
log.log(Level.SEVERE, sqlStmt.toString(), e);
|
||||
} finally {
|
||||
if (pstmt != null) {
|
||||
try {
|
||||
pstmt.close();
|
||||
} catch (Exception ex) {
|
||||
log.severe("Could not close prepared statement");
|
||||
}
|
||||
}
|
||||
} finally{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
return list;
|
||||
|
|
|
@ -123,11 +123,12 @@ public class RequestOrderRefTag extends TagSupport
|
|||
+ "WHERE C_BPartner_ID=? "
|
||||
+ "ORDER BY CreatedBy DESC";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, C_BPartner_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
o = new option (rs.getString(1));
|
||||
|
@ -137,9 +138,6 @@ public class RequestOrderRefTag extends TagSupport
|
|||
o.addElement(Util.maskHTML(display));
|
||||
list.add(o);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -147,16 +145,10 @@ public class RequestOrderRefTag extends TagSupport
|
|||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// Return to Array and return
|
||||
option options[] = new option [list.size()];
|
||||
list.toArray(options);
|
||||
|
|
|
@ -93,20 +93,18 @@ public class RequestTypeTag extends TagSupport
|
|||
+ "WHERE AD_Client_ID=? AND IsActive='Y' AND IsSelfService='Y' "
|
||||
+ "ORDER BY IsDefault DESC, Name";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, AD_Client_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
option o = new option (rs.getString(1));
|
||||
o.addElement(Util.maskHTML(rs.getString(2)));
|
||||
list.add(o);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -114,13 +112,8 @@ public class RequestTypeTag extends TagSupport
|
|||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close ();
|
||||
}
|
||||
catch (Exception e)
|
||||
{}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
|
|
|
@ -223,14 +223,14 @@ public class CompiereService {
|
|||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
loginInfo = rs.getString(1);
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
|
||||
// not verified
|
||||
|
|
Loading…
Reference in New Issue