(transplanted from 29be438740607f8d178843f2d51435d9a5987659)
This commit is contained in:
vpj-cd 2011-03-25 21:59:05 -05:00
parent ce4d1b2ca3
commit 0fb211b646
2 changed files with 35 additions and 3 deletions

View File

@ -37,15 +37,30 @@ import org.compiere.util.Env;
*/ */
public class MPPProductBOM extends X_PP_Product_BOM public class MPPProductBOM extends X_PP_Product_BOM
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -5770988975738210823L; private static final long serialVersionUID = 1561124355655122911L;
/** Cache */ /** Cache */
private static CCache<Integer,MPPProductBOM> s_cache = new CCache<Integer,MPPProductBOM>(Table_Name, 40, 5); private static CCache<Integer,MPPProductBOM> s_cache = new CCache<Integer,MPPProductBOM>(Table_Name, 40, 5);
/** BOM Lines */ /** BOM Lines */
private List<MPPProductBOMLine> m_lines = null; private List<MPPProductBOMLine> m_lines = null;
/**
* get the Product BOM for a product
* @param product
* @return return List with <MPPProductBOM
*/
public static List<MPPProductBOM> getProductBOMs(MProduct product)
{
String whereClause = MPPProductBOM.COLUMNNAME_Value+"=? AND M_Product_ID=?";
return new Query (product.getCtx(), X_PP_Product_BOM.Table_Name, whereClause, product.get_TrxName())
.setClient_ID()
.setParameters(product.getValue(), product.getM_Product_ID())
.list();
}
/** /**
* Get Product BOM by ID (cached) * Get Product BOM by ID (cached)
* @param ctx * @param ctx

View File

@ -10,7 +10,7 @@
* with this program; if not, write to the Free Software Foundation, Inc., * * with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us * * For the text or an alternative of this public license, you may reach us *
* Copyright (C) 2003-2007 e-Evolution,SC. All Rights Reserved. * * Copyright (C) 2003-2010 e-Evolution,SC. All Rights Reserved. *
* Contributor(s): Victor Perez www.e-evolution.com * * Contributor(s): Victor Perez www.e-evolution.com *
* Teo Sarca, www.arhipac.ro * * Teo Sarca, www.arhipac.ro *
*****************************************************************************/ *****************************************************************************/
@ -23,6 +23,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.List;
import java.util.Properties; import java.util.Properties;
import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultMutableTreeNode;
@ -31,6 +32,7 @@ import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException; import org.adempiere.exceptions.DBException;
import org.compiere.model.MProduct; import org.compiere.model.MProduct;
import org.compiere.model.MUOM; import org.compiere.model.MUOM;
import org.compiere.model.Query;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.Env; import org.compiere.util.Env;
@ -48,12 +50,27 @@ import org.compiere.util.Env;
*/ */
public class MPPProductBOMLine extends X_PP_Product_BOMLine public class MPPProductBOMLine extends X_PP_Product_BOMLine
{ {
/** /**
* *
*/ */
private static final long serialVersionUID = -6729103151164195906L; private static final long serialVersionUID = -5792418944606756221L;
MPPProductBOM m_bom = null; MPPProductBOM m_bom = null;
/**
* Get all the Product BOM line for a Component
* @param product Product
* @return list of MPPProductBOMLine
*/
public static List<MPPProductBOMLine> getByProduct(MProduct product)
{
final String whereClause = MPPProductBOMLine.COLUMNNAME_M_Product_ID+"=?";
return new Query(product.getCtx(), MPPProductBOMLine.Table_Name, whereClause, product.get_TrxName())
.setParameters(product.getM_Product_ID())
.list();
}
/** /**
* Default Constructor * Default Constructor
* @param ctx context * @param ctx context