diff --git a/org.adempiere.base/src/org/eevolution/model/MPPProductBOM.java b/org.adempiere.base/src/org/eevolution/model/MPPProductBOM.java index 2a312fa7c0..ed94dd9e72 100644 --- a/org.adempiere.base/src/org/eevolution/model/MPPProductBOM.java +++ b/org.adempiere.base/src/org/eevolution/model/MPPProductBOM.java @@ -37,15 +37,30 @@ import org.compiere.util.Env; */ public class MPPProductBOM extends X_PP_Product_BOM { + /** * */ - private static final long serialVersionUID = -5770988975738210823L; + private static final long serialVersionUID = 1561124355655122911L; /** Cache */ private static CCache s_cache = new CCache(Table_Name, 40, 5); /** BOM Lines */ private List m_lines = null; + /** + * get the Product BOM for a product + * @param product + * @return return List with 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) * @param ctx diff --git a/org.adempiere.base/src/org/eevolution/model/MPPProductBOMLine.java b/org.adempiere.base/src/org/eevolution/model/MPPProductBOMLine.java index 0eeccd8e6a..96df7ec20e 100644 --- a/org.adempiere.base/src/org/eevolution/model/MPPProductBOMLine.java +++ b/org.adempiere.base/src/org/eevolution/model/MPPProductBOMLine.java @@ -10,7 +10,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * * 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 * * Teo Sarca, www.arhipac.ro * *****************************************************************************/ @@ -23,6 +23,7 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.util.Hashtable; +import java.util.List; import java.util.Properties; import javax.swing.tree.DefaultMutableTreeNode; @@ -31,6 +32,7 @@ import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.DBException; import org.compiere.model.MProduct; import org.compiere.model.MUOM; +import org.compiere.model.Query; import org.compiere.util.DB; import org.compiere.util.Env; @@ -48,12 +50,27 @@ import org.compiere.util.Env; */ public class MPPProductBOMLine extends X_PP_Product_BOMLine { + + /** * */ - private static final long serialVersionUID = -6729103151164195906L; + private static final long serialVersionUID = -5792418944606756221L; MPPProductBOM m_bom = null; + /** + * Get all the Product BOM line for a Component + * @param product Product + * @return list of MPPProductBOMLine + */ + public static List 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 * @param ctx context