/******************************************************************************
 * Product: iDempiere ERP & CRM Smart Business Solution                       *
 * Copyright (C) 1999-2012 ComPiere, Inc. All Rights Reserved.                *
 * This program is free software, you can redistribute it and/or modify it    *
 * under the terms version 2 of the GNU General Public License as published   *
 * by the Free Software Foundation. This program is distributed in the hope   *
 * that it will be useful, but WITHOUT ANY WARRANTY, without even the implied *
 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.           *
 * See the GNU General Public License for more details.                       *
 * You should have received a copy of the GNU General Public License along    *
 * 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    *
 * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA        *
 * or via info@compiere.org or http://www.compiere.org/license.html           *
 *****************************************************************************/
/** Generated Model - DO NOT CHANGE */
package org.compiere.model;

import java.sql.ResultSet;
import java.util.Properties;
import org.compiere.util.KeyNamePair;

/** Generated Model for M_BOM
 *  @author iDempiere (generated)
 *  @version Release 11 - $Id$ */
@org.adempiere.base.Model(table="M_BOM")
public class X_M_BOM extends PO implements I_M_BOM, I_Persistent
{

	/**
	 *
	 */
	private static final long serialVersionUID = 20231222L;

    /** Standard Constructor */
    public X_M_BOM (Properties ctx, int M_BOM_ID, String trxName)
    {
      super (ctx, M_BOM_ID, trxName);
      /** if (M_BOM_ID == 0)
        {
			setBOMType (null);
// A
			setBOMUse (null);
// A
			setM_BOM_ID (0);
			setM_Product_ID (0);
			setName (null);
        } */
    }

    /** Standard Constructor */
    public X_M_BOM (Properties ctx, int M_BOM_ID, String trxName, String ... virtualColumns)
    {
      super (ctx, M_BOM_ID, trxName, virtualColumns);
      /** if (M_BOM_ID == 0)
        {
			setBOMType (null);
// A
			setBOMUse (null);
// A
			setM_BOM_ID (0);
			setM_Product_ID (0);
			setName (null);
        } */
    }

    /** Standard Constructor */
    public X_M_BOM (Properties ctx, String M_BOM_UU, String trxName)
    {
      super (ctx, M_BOM_UU, trxName);
      /** if (M_BOM_UU == null)
        {
			setBOMType (null);
// A
			setBOMUse (null);
// A
			setM_BOM_ID (0);
			setM_Product_ID (0);
			setName (null);
        } */
    }

    /** Standard Constructor */
    public X_M_BOM (Properties ctx, String M_BOM_UU, String trxName, String ... virtualColumns)
    {
      super (ctx, M_BOM_UU, trxName, virtualColumns);
      /** if (M_BOM_UU == null)
        {
			setBOMType (null);
// A
			setBOMUse (null);
// A
			setM_BOM_ID (0);
			setM_Product_ID (0);
			setName (null);
        } */
    }

    /** Load Constructor */
    public X_M_BOM (Properties ctx, ResultSet rs, String trxName)
    {
      super (ctx, rs, trxName);
    }

    /** AccessLevel
      * @return 3 - Client - Org
      */
    protected int get_AccessLevel()
    {
      return accessLevel.intValue();
    }

    /** Load Meta Data */
    protected POInfo initPO (Properties ctx)
    {
      POInfo poi = POInfo.getPOInfo (ctx, Table_ID, get_TrxName());
      return poi;
    }

    public String toString()
    {
      StringBuilder sb = new StringBuilder ("X_M_BOM[")
        .append(get_ID()).append(",Name=").append(getName()).append("]");
      return sb.toString();
    }

	/** BOMType AD_Reference_ID=347 */
	public static final int BOMTYPE_AD_Reference_ID=347;
	/** Current Active = A */
	public static final String BOMTYPE_CurrentActive = "A";
	/** Product Configure = C */
	public static final String BOMTYPE_ProductConfigure = "C";
	/** Future = F */
	public static final String BOMTYPE_Future = "F";
	/** Make-To-Kit = K */
	public static final String BOMTYPE_Make_To_Kit = "K";
	/** Maintenance = M */
	public static final String BOMTYPE_Maintenance = "M";
	/** Make-To-Order = O */
	public static final String BOMTYPE_Make_To_Order = "O";
	/** Previous = P */
	public static final String BOMTYPE_Previous = "P";
	/** Repair = R */
	public static final String BOMTYPE_Repair = "R";
	/** Previous, Spare = S */
	public static final String BOMTYPE_PreviousSpare = "S";
	/** Set BOM Type.
		@param BOMType Type of BOM
	*/
	public void setBOMType (String BOMType)
	{

		set_Value (COLUMNNAME_BOMType, BOMType);
	}

	/** Get BOM Type.
		@return Type of BOM
	  */
	public String getBOMType()
	{
		return (String)get_Value(COLUMNNAME_BOMType);
	}

	/** BOMUse AD_Reference_ID=348 */
	public static final int BOMUSE_AD_Reference_ID=348;
	/** Master = A */
	public static final String BOMUSE_Master = "A";
	/** Engineering = E */
	public static final String BOMUSE_Engineering = "E";
	/** Manufacturing = M */
	public static final String BOMUSE_Manufacturing = "M";
	/** Planning = P */
	public static final String BOMUSE_Planning = "P";
	/** Quality = Q */
	public static final String BOMUSE_Quality = "Q";
	/** Set BOM Use.
		@param BOMUse The use of the Bill of Material
	*/
	public void setBOMUse (String BOMUse)
	{

		set_Value (COLUMNNAME_BOMUse, BOMUse);
	}

	/** Get BOM Use.
		@return The use of the Bill of Material
	  */
	public String getBOMUse()
	{
		return (String)get_Value(COLUMNNAME_BOMUse);
	}

	/** Set Description.
		@param Description Optional short description of the record
	*/
	public void setDescription (String Description)
	{
		set_Value (COLUMNNAME_Description, Description);
	}

	/** Get Description.
		@return Optional short description of the record
	  */
	public String getDescription()
	{
		return (String)get_Value(COLUMNNAME_Description);
	}

	/** Set Comment/Help.
		@param Help Comment or Hint
	*/
	public void setHelp (String Help)
	{
		set_Value (COLUMNNAME_Help, Help);
	}

	/** Get Comment/Help.
		@return Comment or Hint
	  */
	public String getHelp()
	{
		return (String)get_Value(COLUMNNAME_Help);
	}

	/** Set BOM.
		@param M_BOM_ID Bill of Material
	*/
	public void setM_BOM_ID (int M_BOM_ID)
	{
		if (M_BOM_ID < 1)
			set_ValueNoCheck (COLUMNNAME_M_BOM_ID, null);
		else
			set_ValueNoCheck (COLUMNNAME_M_BOM_ID, Integer.valueOf(M_BOM_ID));
	}

	/** Get BOM.
		@return Bill of Material
	  */
	public int getM_BOM_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_BOM_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set M_BOM_UU.
		@param M_BOM_UU M_BOM_UU
	*/
	public void setM_BOM_UU (String M_BOM_UU)
	{
		set_Value (COLUMNNAME_M_BOM_UU, M_BOM_UU);
	}

	/** Get M_BOM_UU.
		@return M_BOM_UU	  */
	public String getM_BOM_UU()
	{
		return (String)get_Value(COLUMNNAME_M_BOM_UU);
	}

	public org.compiere.model.I_M_ChangeNotice getM_ChangeNotice() throws RuntimeException
	{
		return (org.compiere.model.I_M_ChangeNotice)MTable.get(getCtx(), org.compiere.model.I_M_ChangeNotice.Table_ID)
			.getPO(getM_ChangeNotice_ID(), get_TrxName());
	}

	/** Set Change Notice.
		@param M_ChangeNotice_ID Bill of Materials (Engineering) Change Notice (Version)
	*/
	public void setM_ChangeNotice_ID (int M_ChangeNotice_ID)
	{
		if (M_ChangeNotice_ID < 1)
			set_Value (COLUMNNAME_M_ChangeNotice_ID, null);
		else
			set_Value (COLUMNNAME_M_ChangeNotice_ID, Integer.valueOf(M_ChangeNotice_ID));
	}

	/** Get Change Notice.
		@return Bill of Materials (Engineering) Change Notice (Version)
	  */
	public int getM_ChangeNotice_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_ChangeNotice_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	public org.compiere.model.I_M_Product getM_Product() throws RuntimeException
	{
		return (org.compiere.model.I_M_Product)MTable.get(getCtx(), org.compiere.model.I_M_Product.Table_ID)
			.getPO(getM_Product_ID(), get_TrxName());
	}

	/** Set Product.
		@param M_Product_ID Product, Service, Item
	*/
	public void setM_Product_ID (int M_Product_ID)
	{
		if (M_Product_ID < 1)
			set_ValueNoCheck (COLUMNNAME_M_Product_ID, null);
		else
			set_ValueNoCheck (COLUMNNAME_M_Product_ID, Integer.valueOf(M_Product_ID));
	}

	/** Get Product.
		@return Product, Service, Item
	  */
	public int getM_Product_ID()
	{
		Integer ii = (Integer)get_Value(COLUMNNAME_M_Product_ID);
		if (ii == null)
			 return 0;
		return ii.intValue();
	}

	/** Set Name.
		@param Name Alphanumeric identifier of the entity
	*/
	public void setName (String Name)
	{
		set_Value (COLUMNNAME_Name, Name);
	}

	/** Get Name.
		@return Alphanumeric identifier of the entity
	  */
	public String getName()
	{
		return (String)get_Value(COLUMNNAME_Name);
	}

    /** Get Record ID/ColumnName
        @return ID/ColumnName pair
      */
    public KeyNamePair getKeyNamePair()
    {
        return new KeyNamePair(get_ID(), getName());
    }

	/** Set Process Now.
		@param Processing Process Now
	*/
	public void setProcessing (boolean Processing)
	{
		set_Value (COLUMNNAME_Processing, Boolean.valueOf(Processing));
	}

	/** Get Process Now.
		@return Process Now	  */
	public boolean isProcessing()
	{
		Object oo = get_Value(COLUMNNAME_Processing);
		if (oo != null)
		{
			 if (oo instanceof Boolean)
				 return ((Boolean)oo).booleanValue();
			return "Y".equals(oo);
		}
		return false;
	}
}