Peer review for 11749 - FR: [ 2214883 ] Remove SQL code and Replace for Query

raising an exception is very different than a log.warning
Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=2214883
This commit is contained in:
Carlos Ruiz 2010-03-26 18:23:03 +00:00
parent 7a43a63e53
commit 0ef28240fd
1 changed files with 12 additions and 6 deletions

View File

@ -21,6 +21,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import java.util.logging.Level; import java.util.logging.Level;
@ -48,12 +49,10 @@ import org.compiere.util.Msg;
*/ */
public class MInvoiceLine extends X_C_InvoiceLine public class MInvoiceLine extends X_C_InvoiceLine
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = 4264055057724565805L; private static final long serialVersionUID = -5113860437274708398L;
/** /**
* Get Invoice Line referencing InOut Line * Get Invoice Line referencing InOut Line
@ -65,9 +64,16 @@ public class MInvoiceLine extends X_C_InvoiceLine
if (sLine == null) if (sLine == null)
return null; return null;
final String whereClause = I_M_InOutLine.COLUMNNAME_M_InOutLine_ID+"=?"; final String whereClause = I_M_InOutLine.COLUMNNAME_M_InOutLine_ID+"=?";
MInvoiceLine retValue = new Query(sLine.getCtx(),I_C_InvoiceLine.Table_Name,whereClause,sLine.get_TrxName()) List<MInvoiceLine> list = new Query(sLine.getCtx(),I_C_InvoiceLine.Table_Name,whereClause,sLine.get_TrxName())
.setParameters(sLine.getM_InOutLine_ID()) .setParameters(sLine.getM_InOutLine_ID())
.firstOnly(); .list();
MInvoiceLine retValue = null;
if (list.size() > 0) {
retValue = list.get(0);
if (list.size() > 1)
s_log.warning("More than one C_InvoiceLine of " + sLine);
}
return retValue; return retValue;
} // getOfInOutLine } // getOfInOutLine