package devguide.advanced.postingorder;

import oracle.jbo.AttributeList;
import oracle.jbo.Key;
import oracle.jbo.domain.DBSequence;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.server.AttributeDefImpl;
import oracle.jbo.server.EntityDefImpl;
import oracle.jbo.server.EntityImpl;
import oracle.jbo.server.TransactionEvent;
// ---------------------------------------------------------------------
// ---    File generated by Oracle ADF Business Components Design Time.
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class ProductsBaseImpl extends EntityImpl {
    public static final int PRODUCTID = 0;
    public static final int SUPPLIERID = 1;
    public static final int CATEGORYID = 2;
    public static final int PRODUCTNAME = 3;
    public static final int PRODUCTSTATUS = 4;
    public static final int COSTPRICE = 5;
    public static final int LISTPRICE = 6;
    public static final int MINPRICE = 7;
    public static final int WARRANTYPERIODMONTHS = 8;
    public static final int SHIPPINGCLASSCODE = 9;
    public static final int EXTERNALURL = 10;
    public static final int ATTRIBUTECATEGORY = 11;
    public static final int ATTRIBUTE1 = 12;
    public static final int ATTRIBUTE2 = 13;
    public static final int ATTRIBUTE3 = 14;
    public static final int ATTRIBUTE4 = 15;
    public static final int ATTRIBUTE5 = 16;
    public static final int ATTRIBUTE6 = 17;
    public static final int ATTRIBUTE7 = 18;
    public static final int ATTRIBUTE8 = 19;
    public static final int ATTRIBUTE9 = 20;
    public static final int ATTRIBUTE10 = 21;
    public static final int ATTRIBUTE11 = 22;
    public static final int ATTRIBUTE12 = 23;
    public static final int ATTRIBUTE13 = 24;
    public static final int ATTRIBUTE14 = 25;
    public static final int ATTRIBUTE15 = 26;
    public static final int CREATEDBY = 27;
    public static final int CREATIONDATE = 28;
    public static final int LASTUPDATEDBY = 29;
    public static final int LASTUPDATEDATE = 30;
    public static final int OBJECTVERSIONID = 31;
    public static final int SUPPLIERS = 32;
    private static EntityDefImpl mDefinitionObject;

    /**This is the default constructor (do not remove).
     */
    public ProductsBaseImpl() {
    }

    /**@return the definition object for this instance class.
     */
    public static synchronized EntityDefImpl getDefinitionObject() {
        if (mDefinitionObject == null) {
            mDefinitionObject = EntityDefImpl.findDefObject("devguide.advanced.postingorder.ProductsBase");
        }
        return mDefinitionObject;
    }

    /**Add attribute defaulting logic in this method.
     */
    protected void create(AttributeList attributeList) {
        super.create(attributeList);
    }

    /**Gets the attribute value for ProductId, using the alias name ProductId.
     */
    public DBSequence getProductId() {
        return (DBSequence)getAttributeInternal(PRODUCTID);
    }

    /**Sets <code>value</code> as the attribute value for ProductId.
     */
    public void setProductId(DBSequence value) {
        setAttributeInternal(PRODUCTID, value);
    }

    /**Gets the attribute value for SupplierId, using the alias name SupplierId.
     */
    public Number getSupplierId() {
        return (Number)getAttributeInternal(SUPPLIERID);
    }

    /**Sets <code>value</code> as the attribute value for SupplierId.
     */
    public void setSupplierId(Number value) {
        setAttributeInternal(SUPPLIERID, value);
    }

    /**Gets the attribute value for CategoryId, using the alias name CategoryId.
     */
    public Number getCategoryId() {
        return (Number)getAttributeInternal(CATEGORYID);
    }

    /**Sets <code>value</code> as the attribute value for CategoryId.
     */
    public void setCategoryId(Number value) {
        setAttributeInternal(CATEGORYID, value);
    }

    /**Gets the attribute value for ProductName, using the alias name ProductName.
     */
    public String getProductName() {
        return (String)getAttributeInternal(PRODUCTNAME);
    }

    /**Sets <code>value</code> as the attribute value for ProductName.
     */
    public void setProductName(String value) {
        setAttributeInternal(PRODUCTNAME, value);
    }

    /**Gets the attribute value for ProductStatus, using the alias name ProductStatus.
     */
    public String getProductStatus() {
        return (String)getAttributeInternal(PRODUCTSTATUS);
    }

    /**Sets <code>value</code> as the attribute value for ProductStatus.
     */
    public void setProductStatus(String value) {
        setAttributeInternal(PRODUCTSTATUS, value);
    }

    /**Gets the attribute value for CostPrice, using the alias name CostPrice.
     */
    public Number getCostPrice() {
        return (Number)getAttributeInternal(COSTPRICE);
    }

    /**Sets <code>value</code> as the attribute value for CostPrice.
     */
    public void setCostPrice(Number value) {
        setAttributeInternal(COSTPRICE, value);
    }

    /**Gets the attribute value for ListPrice, using the alias name ListPrice.
     */
    public Number getListPrice() {
        return (Number)getAttributeInternal(LISTPRICE);
    }

    /**Sets <code>value</code> as the attribute value for ListPrice.
     */
    public void setListPrice(Number value) {
        setAttributeInternal(LISTPRICE, value);
    }

    /**Gets the attribute value for MinPrice, using the alias name MinPrice.
     */
    public Number getMinPrice() {
        return (Number)getAttributeInternal(MINPRICE);
    }

    /**Sets <code>value</code> as the attribute value for MinPrice.
     */
    public void setMinPrice(Number value) {
        setAttributeInternal(MINPRICE, value);
    }

    /**Gets the attribute value for WarrantyPeriodMonths, using the alias name WarrantyPeriodMonths.
     */
    public Number getWarrantyPeriodMonths() {
        return (Number)getAttributeInternal(WARRANTYPERIODMONTHS);
    }

    /**Sets <code>value</code> as the attribute value for WarrantyPeriodMonths.
     */
    public void setWarrantyPeriodMonths(Number value) {
        setAttributeInternal(WARRANTYPERIODMONTHS, value);
    }

    /**Gets the attribute value for ShippingClassCode, using the alias name ShippingClassCode.
     */
    public String getShippingClassCode() {
        return (String)getAttributeInternal(SHIPPINGCLASSCODE);
    }

    /**Sets <code>value</code> as the attribute value for ShippingClassCode.
     */
    public void setShippingClassCode(String value) {
        setAttributeInternal(SHIPPINGCLASSCODE, value);
    }

    /**Gets the attribute value for ExternalUrl, using the alias name ExternalUrl.
     */
    public String getExternalUrl() {
        return (String)getAttributeInternal(EXTERNALURL);
    }

    /**Sets <code>value</code> as the attribute value for ExternalUrl.
     */
    public void setExternalUrl(String value) {
        setAttributeInternal(EXTERNALURL, value);
    }

    /**Gets the attribute value for AttributeCategory, using the alias name AttributeCategory.
     */
    public String getAttributeCategory() {
        return (String)getAttributeInternal(ATTRIBUTECATEGORY);
    }

    /**Sets <code>value</code> as the attribute value for AttributeCategory.
     */
    public void setAttributeCategory(String value) {
        setAttributeInternal(ATTRIBUTECATEGORY, value);
    }

    /**Gets the attribute value for Attribute1, using the alias name Attribute1.
     */
    public String getAttribute1() {
        return (String)getAttributeInternal(ATTRIBUTE1);
    }

    /**Sets <code>value</code> as the attribute value for Attribute1.
     */
    public void setAttribute1(String value) {
        setAttributeInternal(ATTRIBUTE1, value);
    }

    /**Gets the attribute value for Attribute2, using the alias name Attribute2.
     */
    public String getAttribute2() {
        return (String)getAttributeInternal(ATTRIBUTE2);
    }

    /**Sets <code>value</code> as the attribute value for Attribute2.
     */
    public void setAttribute2(String value) {
        setAttributeInternal(ATTRIBUTE2, value);
    }

    /**Gets the attribute value for Attribute3, using the alias name Attribute3.
     */
    public String getAttribute3() {
        return (String)getAttributeInternal(ATTRIBUTE3);
    }

    /**Sets <code>value</code> as the attribute value for Attribute3.
     */
    public void setAttribute3(String value) {
        setAttributeInternal(ATTRIBUTE3, value);
    }

    /**Gets the attribute value for Attribute4, using the alias name Attribute4.
     */
    public String getAttribute4() {
        return (String)getAttributeInternal(ATTRIBUTE4);
    }

    /**Sets <code>value</code> as the attribute value for Attribute4.
     */
    public void setAttribute4(String value) {
        setAttributeInternal(ATTRIBUTE4, value);
    }

    /**Gets the attribute value for Attribute5, using the alias name Attribute5.
     */
    public String getAttribute5() {
        return (String)getAttributeInternal(ATTRIBUTE5);
    }

    /**Sets <code>value</code> as the attribute value for Attribute5.
     */
    public void setAttribute5(String value) {
        setAttributeInternal(ATTRIBUTE5, value);
    }

    /**Gets the attribute value for Attribute6, using the alias name Attribute6.
     */
    public String getAttribute6() {
        return (String)getAttributeInternal(ATTRIBUTE6);
    }

    /**Sets <code>value</code> as the attribute value for Attribute6.
     */
    public void setAttribute6(String value) {
        setAttributeInternal(ATTRIBUTE6, value);
    }

    /**Gets the attribute value for Attribute7, using the alias name Attribute7.
     */
    public String getAttribute7() {
        return (String)getAttributeInternal(ATTRIBUTE7);
    }

    /**Sets <code>value</code> as the attribute value for Attribute7.
     */
    public void setAttribute7(String value) {
        setAttributeInternal(ATTRIBUTE7, value);
    }

    /**Gets the attribute value for Attribute8, using the alias name Attribute8.
     */
    public String getAttribute8() {
        return (String)getAttributeInternal(ATTRIBUTE8);
    }

    /**Sets <code>value</code> as the attribute value for Attribute8.
     */
    public void setAttribute8(String value) {
        setAttributeInternal(ATTRIBUTE8, value);
    }

    /**Gets the attribute value for Attribute9, using the alias name Attribute9.
     */
    public String getAttribute9() {
        return (String)getAttributeInternal(ATTRIBUTE9);
    }

    /**Sets <code>value</code> as the attribute value for Attribute9.
     */
    public void setAttribute9(String value) {
        setAttributeInternal(ATTRIBUTE9, value);
    }

    /**Gets the attribute value for Attribute10, using the alias name Attribute10.
     */
    public String getAttribute10() {
        return (String)getAttributeInternal(ATTRIBUTE10);
    }

    /**Sets <code>value</code> as the attribute value for Attribute10.
     */
    public void setAttribute10(String value) {
        setAttributeInternal(ATTRIBUTE10, value);
    }

    /**Gets the attribute value for Attribute11, using the alias name Attribute11.
     */
    public String getAttribute11() {
        return (String)getAttributeInternal(ATTRIBUTE11);
    }

    /**Sets <code>value</code> as the attribute value for Attribute11.
     */
    public void setAttribute11(String value) {
        setAttributeInternal(ATTRIBUTE11, value);
    }

    /**Gets the attribute value for Attribute12, using the alias name Attribute12.
     */
    public String getAttribute12() {
        return (String)getAttributeInternal(ATTRIBUTE12);
    }

    /**Sets <code>value</code> as the attribute value for Attribute12.
     */
    public void setAttribute12(String value) {
        setAttributeInternal(ATTRIBUTE12, value);
    }

    /**Gets the attribute value for Attribute13, using the alias name Attribute13.
     */
    public String getAttribute13() {
        return (String)getAttributeInternal(ATTRIBUTE13);
    }

    /**Sets <code>value</code> as the attribute value for Attribute13.
     */
    public void setAttribute13(String value) {
        setAttributeInternal(ATTRIBUTE13, value);
    }

    /**Gets the attribute value for Attribute14, using the alias name Attribute14.
     */
    public String getAttribute14() {
        return (String)getAttributeInternal(ATTRIBUTE14);
    }

    /**Sets <code>value</code> as the attribute value for Attribute14.
     */
    public void setAttribute14(String value) {
        setAttributeInternal(ATTRIBUTE14, value);
    }

    /**Gets the attribute value for Attribute15, using the alias name Attribute15.
     */
    public String getAttribute15() {
        return (String)getAttributeInternal(ATTRIBUTE15);
    }

    /**Sets <code>value</code> as the attribute value for Attribute15.
     */
    public void setAttribute15(String value) {
        setAttributeInternal(ATTRIBUTE15, value);
    }

    /**Gets the attribute value for CreatedBy, using the alias name CreatedBy.
     */
    public String getCreatedBy() {
        return (String)getAttributeInternal(CREATEDBY);
    }

    /**Sets <code>value</code> as the attribute value for CreatedBy.
     */
    public void setCreatedBy(String value) {
        setAttributeInternal(CREATEDBY, value);
    }

    /**Gets the attribute value for CreationDate, using the alias name CreationDate.
     */
    public Date getCreationDate() {
        return (Date)getAttributeInternal(CREATIONDATE);
    }

    /**Sets <code>value</code> as the attribute value for CreationDate.
     */
    public void setCreationDate(Date value) {
        setAttributeInternal(CREATIONDATE, value);
    }

    /**Gets the attribute value for LastUpdatedBy, using the alias name LastUpdatedBy.
     */
    public String getLastUpdatedBy() {
        return (String)getAttributeInternal(LASTUPDATEDBY);
    }

    /**Sets <code>value</code> as the attribute value for LastUpdatedBy.
     */
    public void setLastUpdatedBy(String value) {
        setAttributeInternal(LASTUPDATEDBY, value);
    }

    /**Gets the attribute value for LastUpdateDate, using the alias name LastUpdateDate.
     */
    public Date getLastUpdateDate() {
        return (Date)getAttributeInternal(LASTUPDATEDATE);
    }

    /**Sets <code>value</code> as the attribute value for LastUpdateDate.
     */
    public void setLastUpdateDate(Date value) {
        setAttributeInternal(LASTUPDATEDATE, value);
    }

    /**Gets the attribute value for ObjectVersionId, using the alias name ObjectVersionId.
     */
    public Number getObjectVersionId() {
        return (Number)getAttributeInternal(OBJECTVERSIONID);
    }

    /**Sets <code>value</code> as the attribute value for ObjectVersionId.
     */
    public void setObjectVersionId(Number value) {
        setAttributeInternal(OBJECTVERSIONID, value);
    }

    /**getAttrInvokeAccessor: generated method. Do not modify.
     */
    protected Object getAttrInvokeAccessor(int index, 
                                           AttributeDefImpl attrDef) throws Exception {
        switch (index) {
        case PRODUCTID:
            return getProductId();
        case SUPPLIERID:
            return getSupplierId();
        case CATEGORYID:
            return getCategoryId();
        case PRODUCTNAME:
            return getProductName();
        case PRODUCTSTATUS:
            return getProductStatus();
        case COSTPRICE:
            return getCostPrice();
        case LISTPRICE:
            return getListPrice();
        case MINPRICE:
            return getMinPrice();
        case WARRANTYPERIODMONTHS:
            return getWarrantyPeriodMonths();
        case SHIPPINGCLASSCODE:
            return getShippingClassCode();
        case EXTERNALURL:
            return getExternalUrl();
        case ATTRIBUTECATEGORY:
            return getAttributeCategory();
        case ATTRIBUTE1:
            return getAttribute1();
        case ATTRIBUTE2:
            return getAttribute2();
        case ATTRIBUTE3:
            return getAttribute3();
        case ATTRIBUTE4:
            return getAttribute4();
        case ATTRIBUTE5:
            return getAttribute5();
        case ATTRIBUTE6:
            return getAttribute6();
        case ATTRIBUTE7:
            return getAttribute7();
        case ATTRIBUTE8:
            return getAttribute8();
        case ATTRIBUTE9:
            return getAttribute9();
        case ATTRIBUTE10:
            return getAttribute10();
        case ATTRIBUTE11:
            return getAttribute11();
        case ATTRIBUTE12:
            return getAttribute12();
        case ATTRIBUTE13:
            return getAttribute13();
        case ATTRIBUTE14:
            return getAttribute14();
        case ATTRIBUTE15:
            return getAttribute15();
        case CREATEDBY:
            return getCreatedBy();
        case CREATIONDATE:
            return getCreationDate();
        case LASTUPDATEDBY:
            return getLastUpdatedBy();
        case LASTUPDATEDATE:
            return getLastUpdateDate();
        case OBJECTVERSIONID:
            return getObjectVersionId();
        case SUPPLIERS:
            return getSuppliers();
        default:
            return super.getAttrInvokeAccessor(index, attrDef);
        }
    }

    /**setAttrInvokeAccessor: generated method. Do not modify.
     */
    protected void setAttrInvokeAccessor(int index, Object value, 
                                         AttributeDefImpl attrDef) throws Exception {
        switch (index) {
        case PRODUCTID:
            setProductId((DBSequence)value);
            return;
        case SUPPLIERID:
            setSupplierId((Number)value);
            return;
        case CATEGORYID:
            setCategoryId((Number)value);
            return;
        case PRODUCTNAME:
            setProductName((String)value);
            return;
        case PRODUCTSTATUS:
            setProductStatus((String)value);
            return;
        case COSTPRICE:
            setCostPrice((Number)value);
            return;
        case LISTPRICE:
            setListPrice((Number)value);
            return;
        case MINPRICE:
            setMinPrice((Number)value);
            return;
        case WARRANTYPERIODMONTHS:
            setWarrantyPeriodMonths((Number)value);
            return;
        case SHIPPINGCLASSCODE:
            setShippingClassCode((String)value);
            return;
        case EXTERNALURL:
            setExternalUrl((String)value);
            return;
        case ATTRIBUTECATEGORY:
            setAttributeCategory((String)value);
            return;
        case ATTRIBUTE1:
            setAttribute1((String)value);
            return;
        case ATTRIBUTE2:
            setAttribute2((String)value);
            return;
        case ATTRIBUTE3:
            setAttribute3((String)value);
            return;
        case ATTRIBUTE4:
            setAttribute4((String)value);
            return;
        case ATTRIBUTE5:
            setAttribute5((String)value);
            return;
        case ATTRIBUTE6:
            setAttribute6((String)value);
            return;
        case ATTRIBUTE7:
            setAttribute7((String)value);
            return;
        case ATTRIBUTE8:
            setAttribute8((String)value);
            return;
        case ATTRIBUTE9:
            setAttribute9((String)value);
            return;
        case ATTRIBUTE10:
            setAttribute10((String)value);
            return;
        case ATTRIBUTE11:
            setAttribute11((String)value);
            return;
        case ATTRIBUTE12:
            setAttribute12((String)value);
            return;
        case ATTRIBUTE13:
            setAttribute13((String)value);
            return;
        case ATTRIBUTE14:
            setAttribute14((String)value);
            return;
        case ATTRIBUTE15:
            setAttribute15((String)value);
            return;
        case CREATEDBY:
            setCreatedBy((String)value);
            return;
        case CREATIONDATE:
            setCreationDate((Date)value);
            return;
        case LASTUPDATEDBY:
            setLastUpdatedBy((String)value);
            return;
        case LASTUPDATEDATE:
            setLastUpdateDate((Date)value);
            return;
        case OBJECTVERSIONID:
            setObjectVersionId((Number)value);
            return;
        default:
            super.setAttrInvokeAccessor(index, value, attrDef);
            return;
        }
    }

    /**Gets the associated entity oracle.jbo.server.EntityImpl.
     */
    public EntityImpl getSuppliers() {
        return (EntityImpl)getAttributeInternal(SUPPLIERS);
    }

    /**Sets <code>value</code> as the associated entity oracle.jbo.server.EntityImpl.
     */
    public void setSuppliers(EntityImpl value) {
        setAttributeInternal(SUPPLIERS, value);
    }

    /**Creates a Key object based on given key constituents.
     */
    public static Key createPrimaryKey(DBSequence productId) {
        return new Key(new Object[]{productId});
    }

    @Override
    public void postChanges(TransactionEvent transactionEvent) {
        /* If current entity is new or modified */
        if (getPostState() == STATUS_NEW || 
            getPostState() == STATUS_MODIFIED) {
            /* Get the associated supplier for the product */
            SuppliersImpl supplier = getSupplier();
            /* If there is an associated product */
            if (supplier != null) {
                /* And if it's post-status is NEW */
                if (supplier.getPostState() == STATUS_NEW) {
                    /*
        * Post the supplier first, before posting this
        * entity by calling super below
        */
                    supplier.postChanges(transactionEvent);
                }
            }
        }
        super.postChanges(transactionEvent);
    }
    
    /**Gets the associated entity ProductImpl
     */
    public SuppliersImpl getSupplier() {
      return (SuppliersImpl)getAttributeInternal(SUPPLIERS);
    }

    /**Sets <code>value</code> as the associated entity ProductImpl
     */
    public void setSupplier(SuppliersImpl value) {
      setAttributeInternal(SUPPLIERS, value);
    }
}
