Adempiere 3.5.2a

org.compiere.model
Class MProduct

java.lang.Object
  extended by org.compiere.model.PO
      extended by org.compiere.model.X_M_Product
          extended by org.compiere.model.MProduct
All Implemented Interfaces:
Serializable, Comparator, I_M_Product, I_Persistent, Evaluatee

public class MProduct
extends X_M_Product

Product Model

Version:
$Id: MProduct.java,v 1.5 2006/07/30 00:51:05 jjanke Exp $
Author:
Jorg Janke, Teo Sarca, SC ARHIPAC SERVICE SRL
  • FR [ 1885153 ] Refactor: getMMPolicy code
  • BF [ 1885414 ] ASI should be always mandatory if CostingLevel is Batch/Lot
  • See Also:
    Serialized Form

    Field Summary
     
    Fields inherited from class org.compiere.model.X_M_Product
    M_PRODUCT_CATEGORY_ID_AD_Reference_ID, PRODUCTTYPE_AD_Reference_ID, PRODUCTTYPE_ExpenseType, PRODUCTTYPE_Item, PRODUCTTYPE_Online, PRODUCTTYPE_Resource, PRODUCTTYPE_Service, SALESREP_ID_AD_Reference_ID
     
    Fields inherited from class org.compiere.model.PO
    ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, log, p_ctx, p_info, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
     
    Fields inherited from interface org.compiere.model.I_M_Product
    accessLevel, COLUMNNAME_C_RevenueRecognition_ID, COLUMNNAME_C_SubscriptionType_ID, COLUMNNAME_C_TaxCategory_ID, COLUMNNAME_C_UOM_ID, COLUMNNAME_Classification, COLUMNNAME_Description, COLUMNNAME_DescriptionURL, COLUMNNAME_Discontinued, COLUMNNAME_DiscontinuedBy, COLUMNNAME_DocumentNote, COLUMNNAME_Group1, COLUMNNAME_Group2, COLUMNNAME_GuaranteeDays, COLUMNNAME_GuaranteeDaysMin, COLUMNNAME_Help, COLUMNNAME_ImageURL, COLUMNNAME_IsBOM, COLUMNNAME_IsDropShip, COLUMNNAME_IsExcludeAutoDelivery, COLUMNNAME_IsInvoicePrintDetails, COLUMNNAME_IsPickListPrintDetails, COLUMNNAME_IsPurchased, COLUMNNAME_IsSelfService, COLUMNNAME_IsSold, COLUMNNAME_IsStocked, COLUMNNAME_IsSummary, COLUMNNAME_IsVerified, COLUMNNAME_IsWebStoreFeatured, COLUMNNAME_LowLevel, COLUMNNAME_M_AttributeSet_ID, COLUMNNAME_M_AttributeSetInstance_ID, COLUMNNAME_M_FreightCategory_ID, COLUMNNAME_M_Locator_ID, COLUMNNAME_M_Product_Category_ID, COLUMNNAME_M_Product_ID, COLUMNNAME_Name, COLUMNNAME_Processing, COLUMNNAME_ProductType, COLUMNNAME_R_MailText_ID, COLUMNNAME_S_ExpenseType_ID, COLUMNNAME_S_Resource_ID, COLUMNNAME_SalesRep_ID, COLUMNNAME_ShelfDepth, COLUMNNAME_ShelfHeight, COLUMNNAME_ShelfWidth, COLUMNNAME_SKU, COLUMNNAME_UnitsPerPallet, COLUMNNAME_UPC, COLUMNNAME_Value, COLUMNNAME_VersionNo, COLUMNNAME_Volume, COLUMNNAME_Weight, Model, Table_ID, Table_Name
     
    Constructor Summary
    MProduct(MExpenseType et)
              Parent Constructor
    MProduct(MResource resource, MResourceType resourceType)
              Parent Constructor
    MProduct(Properties ctx, int M_Product_ID, String trxName)
              Standard Constructor
    MProduct(Properties ctx, ResultSet rs, String trxName)
              Load constructor
    MProduct(X_I_Product impP)
              Import Constructor
     
    Method Summary
    protected  boolean afterDelete(boolean success)
              After Delete
    protected  boolean afterSave(boolean newRecord, boolean success)
              After Save
    protected  boolean beforeDelete()
              Before Delete
    protected  boolean beforeSave(boolean newRecord)
              Before Save
    static MProduct get(Properties ctx, int M_Product_ID)
              Get MProduct from Cache
    static MProduct[] get(Properties ctx, String whereClause, String trxName)
              Get MProduct from Cache
     int getA_Asset_Group_ID()
              Create Asset Group for this product
     MAttributeInstance getAttributeInstance(String name, String trxName)
              Get attribute instance for this product by attribute name
     MAttributeSet getAttributeSet()
              Get Attribute Set
     String getMMPolicy()
              Gets Material Management Policy.
     MProductDownload[] getProductDownloads(boolean requery)
              Get Active(!)
     int getUOMPrecision()
              Get UOM Standard Precision
     String getUOMSymbol()
              Get UOM Symbol
     boolean hasDownloads()
              Does the product have downloads
    protected  boolean hasInventoryOrCost()
              HasInventoryOrCost
     boolean isASIMandatory(boolean isSOTrx)
              Check if ASI is mandatory
     boolean isCreateAsset()
              Create Asset for this product
     boolean isInstanceAttribute()
              Has the Product Instance Attribute
     boolean isItem()
              Product is Item
     boolean isOneAssetPerUOM()
              Create One Asset Per UOM
    static boolean isProductStocked(Properties ctx, int M_Product_ID)
              Is Product Stocked
     boolean isService()
              Is Service
     boolean isStocked()
              Product is an Item and Stocked
     boolean setExpenseType(MExpenseType parent)
              Set Expense Type
     boolean setResource(MResource parent)
              Set Resource
     boolean setResource(MResourceType parent)
              Set Resource Type
     String toString()
              String Representation
     
    Methods inherited from class org.compiere.model.X_M_Product
    get_AccessLevel, getC_RevenueRecognition_ID, getC_RevenueRecognition, getC_SubscriptionType_ID, getC_TaxCategory_ID, getC_TaxCategory, getC_UOM_ID, getC_UOM, getClassification, getDescription, getDescriptionURL, getDiscontinuedBy, getDocumentNote, getGroup1, getGroup2, getGuaranteeDays, getGuaranteeDaysMin, getHelp, getImageURL, getKeyNamePair, getLowLevel, getM_AttributeSet_ID, getM_AttributeSet, getM_AttributeSetInstance_ID, getM_FreightCategory_ID, getM_FreightCategory, getM_Locator_ID, getM_Product_Category_ID, getM_Product_Category, getM_Product_ID, getName, getProductType, getR_MailText_ID, getR_MailText, getS_ExpenseType_ID, getS_ExpenseType, getS_Resource_ID, getS_Resource, getSalesRep_ID, getShelfDepth, getShelfHeight, getShelfWidth, getSKU, getUnitsPerPallet, getUPC, getValue, getVersionNo, getVolume, getWeight, initPO, isBOM, isDiscontinued, isDropShip, isExcludeAutoDelivery, isInvoicePrintDetails, isPickListPrintDetails, isProcessing, isPurchased, isSelfService, isSold, isSummary, isVerified, isWebStoreFeatured, setC_RevenueRecognition_ID, setC_SubscriptionType_ID, setC_TaxCategory_ID, setC_UOM_ID, setClassification, setDescription, setDescriptionURL, setDiscontinued, setDiscontinuedBy, setDocumentNote, setGroup1, setGroup2, setGuaranteeDays, setGuaranteeDaysMin, setHelp, setImageURL, setIsBOM, setIsDropShip, setIsExcludeAutoDelivery, setIsInvoicePrintDetails, setIsPickListPrintDetails, setIsPurchased, setIsSelfService, setIsSold, setIsStocked, setIsSummary, setIsVerified, setIsWebStoreFeatured, setLowLevel, setM_AttributeSet_ID, setM_AttributeSetInstance_ID, setM_FreightCategory_ID, setM_Locator_ID, setM_Product_Category_ID, setM_Product_ID, setName, setProcessing, setProductType, setR_MailText_ID, setS_ExpenseType_ID, setS_Resource_ID, setSalesRep_ID, setShelfDepth, setShelfHeight, setShelfWidth, setSKU, setUnitsPerPallet, setUPC, setValue, setVersionNo, setVolume, setWeight
     
    Methods inherited from class org.compiere.model.PO
    compare, copyValues, copyValues, createAttachment, delete_Accounting, delete_Tree, delete, delete, deleteEx, deleteEx, dump, dump, equals, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_Table_ID, get_TableName, get_Translation, get_TrxName, get_Value, get_Value, get_ValueAsInt, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_new, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadComplete, loadDefaults, loadSpecial, lock, save, save, saveEx, saveEx, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_ColumnUpdateable, set_CustomColumn, set_TrxName, set_TrxName, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setDoc, setDocWorkflowMgr, setIsActive, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, unlock
     
    Methods inherited from class java.lang.Object
    clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
     
    Methods inherited from interface org.compiere.model.I_Persistent
    save
     

    Constructor Detail

    MProduct

    public MProduct(Properties ctx,
                    int M_Product_ID,
                    String trxName)
    Standard Constructor

    Parameters:
    ctx - context
    M_Product_ID - id
    trxName - transaction

    MProduct

    public MProduct(Properties ctx,
                    ResultSet rs,
                    String trxName)
    Load constructor

    Parameters:
    ctx - context
    rs - result set
    trxName - transaction

    MProduct

    public MProduct(MExpenseType et)
    Parent Constructor

    Parameters:
    et - parent

    MProduct

    public MProduct(MResource resource,
                    MResourceType resourceType)
    Parent Constructor

    Parameters:
    resource - parent
    resourceType - resource type

    MProduct

    public MProduct(X_I_Product impP)
    Import Constructor

    Parameters:
    impP - import
    Method Detail

    get

    public static MProduct get(Properties ctx,
                               int M_Product_ID)
    Get MProduct from Cache

    Parameters:
    ctx - context
    M_Product_ID - id
    Returns:
    MProduct

    get

    public static MProduct[] get(Properties ctx,
                                 String whereClause,
                                 String trxName)
    Get MProduct from Cache

    Parameters:
    ctx - context
    whereClause - sql where clause
    trxName - trx
    Returns:
    MProduct

    isProductStocked

    public static boolean isProductStocked(Properties ctx,
                                           int M_Product_ID)
    Is Product Stocked

    Parameters:
    ctx - context
    M_Product_ID - id
    Returns:
    true if found and stocked - false otherwise

    setExpenseType

    public boolean setExpenseType(MExpenseType parent)
    Set Expense Type

    Parameters:
    parent - expense type
    Returns:
    true if changed

    setResource

    public boolean setResource(MResource parent)
    Set Resource

    Parameters:
    parent - resource
    Returns:
    true if changed

    setResource

    public boolean setResource(MResourceType parent)
    Set Resource Type

    Parameters:
    parent - resource type
    Returns:
    true if changed

    getUOMPrecision

    public int getUOMPrecision()
    Get UOM Standard Precision

    Returns:
    UOM Standard Precision

    getA_Asset_Group_ID

    public int getA_Asset_Group_ID()
    Create Asset Group for this product

    Returns:
    asset group id

    isCreateAsset

    public boolean isCreateAsset()
    Create Asset for this product

    Returns:
    true if asset is created

    getAttributeSet

    public MAttributeSet getAttributeSet()
    Get Attribute Set

    Returns:
    set or null

    isInstanceAttribute

    public boolean isInstanceAttribute()
    Has the Product Instance Attribute

    Returns:
    true if instance attributes

    isOneAssetPerUOM

    public boolean isOneAssetPerUOM()
    Create One Asset Per UOM

    Returns:
    individual asset

    isItem

    public boolean isItem()
    Product is Item

    Returns:
    true if item

    isStocked

    public boolean isStocked()
    Product is an Item and Stocked

    Specified by:
    isStocked in interface I_M_Product
    Overrides:
    isStocked in class X_M_Product
    Returns:
    true if stocked and item

    isService

    public boolean isService()
    Is Service

    Returns:
    true if service (resource, online)

    getUOMSymbol

    public String getUOMSymbol()
    Get UOM Symbol

    Returns:
    UOM Symbol

    getProductDownloads

    public MProductDownload[] getProductDownloads(boolean requery)
    Get Active(!) Product Downloads

    Parameters:
    requery - requery
    Returns:
    array of downloads

    hasDownloads

    public boolean hasDownloads()
    Does the product have downloads

    Returns:
    true if downloads exists

    toString

    public String toString()
    String Representation

    Overrides:
    toString in class X_M_Product
    Returns:
    info

    beforeSave

    protected boolean beforeSave(boolean newRecord)
    Before Save

    Overrides:
    beforeSave in class PO
    Parameters:
    newRecord - new
    Returns:
    true

    hasInventoryOrCost

    protected boolean hasInventoryOrCost()
    HasInventoryOrCost

    Returns:
    true if it has Inventory or Cost

    afterSave

    protected boolean afterSave(boolean newRecord,
                                boolean success)
    After Save

    Overrides:
    afterSave in class PO
    Parameters:
    newRecord - new
    success - success
    Returns:
    success

    beforeDelete

    protected boolean beforeDelete()
    Before Delete

    Overrides:
    beforeDelete in class PO
    Returns:
    true if it can be deleted

    afterDelete

    protected boolean afterDelete(boolean success)
    After Delete

    Overrides:
    afterDelete in class PO
    Parameters:
    success -
    Returns:
    deleted

    getAttributeInstance

    public MAttributeInstance getAttributeInstance(String name,
                                                   String trxName)
    Get attribute instance for this product by attribute name

    Parameters:
    name -
    trxName -
    Returns:

    getMMPolicy

    public String getMMPolicy()
    Gets Material Management Policy. Tries: Product Category, Client (in this order)

    Returns:
    Material Management Policy

    isASIMandatory

    public boolean isASIMandatory(boolean isSOTrx)
    Check if ASI is mandatory

    Parameters:
    isSOTrx - is outgoing trx?
    Returns:
    true if ASI is mandatory, false otherwise

    Adempiere 3.5.2a

    Adempiere® is a registered trademark of ADempiere Business Inc. ©2004-2008 HumanFlash.com All rights reserved.