org.compiere.model.MInOutLine:
* fix db connection * organized imports
This commit is contained in:
parent
7afddb75ff
commit
5e3e989248
|
@ -16,11 +16,15 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.math.*;
|
import java.math.BigDecimal;
|
||||||
import java.sql.*;
|
import java.sql.ResultSet;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
import java.util.logging.*;
|
import java.util.Properties;
|
||||||
import org.compiere.util.*;
|
|
||||||
|
import org.compiere.util.DB;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
|
import org.compiere.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* InOut Line
|
* InOut Line
|
||||||
|
@ -41,39 +45,11 @@ public class MInOutLine extends X_M_InOutLine
|
||||||
public static MInOutLine[] getOfOrderLine (Properties ctx,
|
public static MInOutLine[] getOfOrderLine (Properties ctx,
|
||||||
int C_OrderLine_ID, String where, String trxName)
|
int C_OrderLine_ID, String where, String trxName)
|
||||||
{
|
{
|
||||||
ArrayList<MInOutLine> list = new ArrayList<MInOutLine>();
|
String whereClause = "C_OrderLine_ID=?" + (!Util.isEmpty(where, true) ? " AND "+where : "");
|
||||||
String sql = "SELECT * FROM M_InOutLine WHERE C_OrderLine_ID=?";
|
List<MInOutLine> list = new Query(ctx, Table_Name, whereClause, trxName)
|
||||||
if (where != null && where.length() > 0)
|
.setParameters(new Object[]{C_OrderLine_ID})
|
||||||
sql += " AND " + where;
|
.list();
|
||||||
PreparedStatement pstmt = null;
|
return list.toArray (new MInOutLine[list.size()]);
|
||||||
try
|
|
||||||
{
|
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
|
||||||
pstmt.setInt (1, C_OrderLine_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
|
||||||
while (rs.next ())
|
|
||||||
list.add(new MInOutLine(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)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
MInOutLine[] retValue = new MInOutLine[list.size ()];
|
|
||||||
list.toArray (retValue);
|
|
||||||
return retValue;
|
|
||||||
} // getOfOrderLine
|
} // getOfOrderLine
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -85,41 +61,8 @@ public class MInOutLine extends X_M_InOutLine
|
||||||
*/
|
*/
|
||||||
public static MInOutLine[] get (Properties ctx, int C_OrderLine_ID, String trxName)
|
public static MInOutLine[] get (Properties ctx, int C_OrderLine_ID, String trxName)
|
||||||
{
|
{
|
||||||
ArrayList<MInOutLine> list = new ArrayList<MInOutLine>();
|
return getOfOrderLine(ctx, C_OrderLine_ID, null, trxName);
|
||||||
String sql = "SELECT * FROM M_InOutLine WHERE C_OrderLine_ID=?";
|
} // get
|
||||||
PreparedStatement pstmt = null;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
pstmt = DB.prepareStatement (sql, trxName);
|
|
||||||
pstmt.setInt (1, C_OrderLine_ID);
|
|
||||||
ResultSet rs = pstmt.executeQuery ();
|
|
||||||
while (rs.next ())
|
|
||||||
list.add(new MInOutLine(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)
|
|
||||||
{
|
|
||||||
pstmt = null;
|
|
||||||
}
|
|
||||||
MInOutLine[] retValue = new MInOutLine[list.size ()];
|
|
||||||
list.toArray (retValue);
|
|
||||||
return retValue;
|
|
||||||
} // getOfOrderLine
|
|
||||||
|
|
||||||
/** Static Logger */
|
|
||||||
private static CLogger s_log = CLogger.getCLogger (MInOutLine.class);
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
|
|
Loading…
Reference in New Issue