package oracle.fodemo.storefront.entities;

import oracle.jbo.Key;
import oracle.jbo.RowIterator;
import oracle.jbo.RowSet;
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.
// ---    Tue Sep 30 13:57:47 MDT 2008
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class PaymentOptionEOImpl extends EntityImpl {
    /**
     * This is the default constructor (do not remove).
     */
    private static EntityDefImpl mDefinitionObject;

    @Override
    public void postChanges(TransactionEvent e) {
        /* If current entity is new or modified */
        if (getPostState() == STATUS_NEW ||
        getPostState() == STATUS_MODIFIED) {
        /* Get the associated person for the paymentoption */
        PersonEOImpl person = getPerson();
        /* If there is an associated person */
        if (person != null) {
        /* And if it's post-status is NEW */
        if (person.getPostState() == STATUS_NEW) {
        /*
        * Post the person first, before posting this
        * entity by calling super below
        */
        person.postChanges(e);
        }
        }
        }
        super.postChanges(e);
        }    

    /**
     * AttributesEnum: generated enum for identifying attributes and accessors. Do not modify.
     */
    public enum AttributesEnum {
        PaymentOptionId {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getPaymentOptionId();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setPaymentOptionId((DBSequence)value);
            }
        }
        ,
        CustomerId {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getCustomerId();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setCustomerId((Number)value);
            }
        }
        ,
        PaymentTypeCode {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getPaymentTypeCode();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setPaymentTypeCode((String)value);
            }
        }
        ,
        BillingAddressId {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getBillingAddressId();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setBillingAddressId((Number)value);
            }
        }
        ,
        AccountNumber {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getAccountNumber();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setAccountNumber((Number)value);
            }
        }
        ,
        CardTypeCode {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getCardTypeCode();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setCardTypeCode((String)value);
            }
        }
        ,
        ExpireDate {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getExpireDate();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setExpireDate((Date)value);
            }
        }
        ,
        CheckDigits {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getCheckDigits();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setCheckDigits((Number)value);
            }
        }
        ,
        RoutingIdentifier {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getRoutingIdentifier();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setRoutingIdentifier((String)value);
            }
        }
        ,
        InstitutionName {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getInstitutionName();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setInstitutionName((String)value);
            }
        }
        ,
        ValidFromDate {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getValidFromDate();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setValidFromDate((Date)value);
            }
        }
        ,
        ValidToDate {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getValidToDate();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setValidToDate((Date)value);
            }
        }
        ,
        CreatedBy {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getCreatedBy();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setCreatedBy((String)value);
            }
        }
        ,
        CreationDate {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getCreationDate();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setAttributeInternal(index(), value);
            }
        }
        ,
        LastUpdatedBy {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getLastUpdatedBy();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setLastUpdatedBy((String)value);
            }
        }
        ,
        LastUpdateDate {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getLastUpdateDate();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setAttributeInternal(index(), value);
            }
        }
        ,
        ObjectVersionId {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getObjectVersionId();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setAttributeInternal(index(), value);
            }
        }
        ,
        Order {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getOrder();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setAttributeInternal(index(), value);
            }
        }
        ,
        Person {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getPerson();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setPerson((PersonEOImpl)value);
            }
        }
        ,
        PaymentTypesVA {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getPaymentTypesVA();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setAttributeInternal(index(), value);
            }
        }
        ,
        CreditCardTypesVA {
            public Object get(PaymentOptionEOImpl obj) {
                return obj.getCreditCardTypesVA();
            }

            public void put(PaymentOptionEOImpl obj, Object value) {
                obj.setAttributeInternal(index(), value);
            }
        }
        ;
        private static AttributesEnum[] vals = null;
        private static int firstIndex = 0;

        public abstract Object get(PaymentOptionEOImpl object);

        public abstract void put(PaymentOptionEOImpl object, Object value);

        public int index() {
            return AttributesEnum.firstIndex() + ordinal();
        }

        public static int firstIndex() {
            return firstIndex;
        }

        public static int count() {
            return AttributesEnum.firstIndex() + AttributesEnum.staticValues().length;
        }

        public static AttributesEnum[] staticValues() {
            if (vals == null) {
                vals = AttributesEnum.values();
            }
            return vals;
        }
    }
    public static final int PAYMENTOPTIONID = AttributesEnum.PaymentOptionId.index();
    public static final int CUSTOMERID = AttributesEnum.CustomerId.index();
    public static final int PAYMENTTYPECODE = AttributesEnum.PaymentTypeCode.index();
    public static final int BILLINGADDRESSID = AttributesEnum.BillingAddressId.index();
    public static final int ACCOUNTNUMBER = AttributesEnum.AccountNumber.index();
    public static final int CARDTYPECODE = AttributesEnum.CardTypeCode.index();
    public static final int EXPIREDATE = AttributesEnum.ExpireDate.index();
    public static final int CHECKDIGITS = AttributesEnum.CheckDigits.index();
    public static final int ROUTINGIDENTIFIER = AttributesEnum.RoutingIdentifier.index();
    public static final int INSTITUTIONNAME = AttributesEnum.InstitutionName.index();
    public static final int VALIDFROMDATE = AttributesEnum.ValidFromDate.index();
    public static final int VALIDTODATE = AttributesEnum.ValidToDate.index();
    public static final int CREATEDBY = AttributesEnum.CreatedBy.index();
    public static final int CREATIONDATE = AttributesEnum.CreationDate.index();
    public static final int LASTUPDATEDBY = AttributesEnum.LastUpdatedBy.index();
    public static final int LASTUPDATEDATE = AttributesEnum.LastUpdateDate.index();
    public static final int OBJECTVERSIONID = AttributesEnum.ObjectVersionId.index();
    public static final int ORDER = AttributesEnum.Order.index();
    public static final int PERSON = AttributesEnum.Person.index();
    public static final int PAYMENTTYPESVA = AttributesEnum.PaymentTypesVA.index();
    public static final int CREDITCARDTYPESVA = AttributesEnum.CreditCardTypesVA.index();

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

    /**
     * Gets the attribute value for PaymentOptionId, using the alias name PaymentOptionId.
     * @return the PaymentOptionId
     */
    public DBSequence getPaymentOptionId() {
        return (DBSequence)getAttributeInternal(PAYMENTOPTIONID);
    }

    /**
     * Sets <code>value</code> as the attribute value for PaymentOptionId.
     * @param value value to set the PaymentOptionId
     */
    public void setPaymentOptionId(DBSequence value) {
        setAttributeInternal(PAYMENTOPTIONID, value);
    }

    /**
     * Gets the attribute value for CustomerId, using the alias name CustomerId.
     * @return the CustomerId
     */
    public Number getCustomerId() {
        return (Number)getAttributeInternal(CUSTOMERID);
    }

    /**
     * Sets <code>value</code> as the attribute value for CustomerId.
     * @param value value to set the CustomerId
     */
    public void setCustomerId(Number value) {
        setAttributeInternal(CUSTOMERID, value);
    }

    /**
     * Gets the attribute value for PaymentTypeCode, using the alias name PaymentTypeCode.
     * @return the PaymentTypeCode
     */
    public String getPaymentTypeCode() {
        return (String)getAttributeInternal(PAYMENTTYPECODE);
    }

    /**
     * Sets <code>value</code> as the attribute value for PaymentTypeCode.
     * @param value value to set the PaymentTypeCode
     */
    public void setPaymentTypeCode(String value) {
        setAttributeInternal(PAYMENTTYPECODE, value);
    }

    /**
     * Gets the attribute value for BillingAddressId, using the alias name BillingAddressId.
     * @return the BillingAddressId
     */
    public Number getBillingAddressId() {
        return (Number)getAttributeInternal(BILLINGADDRESSID);
    }

    /**
     * Sets <code>value</code> as the attribute value for BillingAddressId.
     * @param value value to set the BillingAddressId
     */
    public void setBillingAddressId(Number value) {
        setAttributeInternal(BILLINGADDRESSID, value);
    }

    /**
     * Gets the attribute value for AccountNumber, using the alias name AccountNumber.
     * @return the AccountNumber
     */
    public Number getAccountNumber() {
        return (Number)getAttributeInternal(ACCOUNTNUMBER);
    }

    /**
     * Sets <code>value</code> as the attribute value for AccountNumber.
     * @param value value to set the AccountNumber
     */
    public void setAccountNumber(Number value) {
        setAttributeInternal(ACCOUNTNUMBER, value);
    }

    /**
     * Gets the attribute value for CardTypeCode, using the alias name CardTypeCode.
     * @return the CardTypeCode
     */
    public String getCardTypeCode() {
        return (String)getAttributeInternal(CARDTYPECODE);
    }

    /**
     * Sets <code>value</code> as the attribute value for CardTypeCode.
     * @param value value to set the CardTypeCode
     */
    public void setCardTypeCode(String value) {
        setAttributeInternal(CARDTYPECODE, value);
    }

    /**
     * Gets the attribute value for ExpireDate, using the alias name ExpireDate.
     * @return the ExpireDate
     */
    public Date getExpireDate() {
        return (Date)getAttributeInternal(EXPIREDATE);
    }

    /**
     * Sets <code>value</code> as the attribute value for ExpireDate.
     * @param value value to set the ExpireDate
     */
    public void setExpireDate(Date value) {
        setAttributeInternal(EXPIREDATE, value);
    }

    /**
     * Gets the attribute value for CheckDigits, using the alias name CheckDigits.
     * @return the CheckDigits
     */
    public Number getCheckDigits() {
        return (Number)getAttributeInternal(CHECKDIGITS);
    }

    /**
     * Sets <code>value</code> as the attribute value for CheckDigits.
     * @param value value to set the CheckDigits
     */
    public void setCheckDigits(Number value) {
        setAttributeInternal(CHECKDIGITS, value);
    }

    /**
     * Gets the attribute value for RoutingIdentifier, using the alias name RoutingIdentifier.
     * @return the RoutingIdentifier
     */
    public String getRoutingIdentifier() {
        return (String)getAttributeInternal(ROUTINGIDENTIFIER);
    }

    /**
     * Sets <code>value</code> as the attribute value for RoutingIdentifier.
     * @param value value to set the RoutingIdentifier
     */
    public void setRoutingIdentifier(String value) {
        setAttributeInternal(ROUTINGIDENTIFIER, value);
    }

    /**
     * Gets the attribute value for InstitutionName, using the alias name InstitutionName.
     * @return the InstitutionName
     */
    public String getInstitutionName() {
        return (String)getAttributeInternal(INSTITUTIONNAME);
    }

    /**
     * Sets <code>value</code> as the attribute value for InstitutionName.
     * @param value value to set the InstitutionName
     */
    public void setInstitutionName(String value) {
        setAttributeInternal(INSTITUTIONNAME, value);
    }

    /**
     * Gets the attribute value for ValidFromDate, using the alias name ValidFromDate.
     * @return the ValidFromDate
     */
    public Date getValidFromDate() {
        return (Date)getAttributeInternal(VALIDFROMDATE);
    }

    /**
     * Sets <code>value</code> as the attribute value for ValidFromDate.
     * @param value value to set the ValidFromDate
     */
    public void setValidFromDate(Date value) {
        setAttributeInternal(VALIDFROMDATE, value);
    }

    /**
     * Gets the attribute value for ValidToDate, using the alias name ValidToDate.
     * @return the ValidToDate
     */
    public Date getValidToDate() {
        return (Date)getAttributeInternal(VALIDTODATE);
    }

    /**
     * Sets <code>value</code> as the attribute value for ValidToDate.
     * @param value value to set the ValidToDate
     */
    public void setValidToDate(Date value) {
        setAttributeInternal(VALIDTODATE, value);
    }

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

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

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

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

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

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

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

    /**
     * getAttrInvokeAccessor: generated method. Do not modify.
     * @param index the index identifying the attribute
     * @param attrDef the attribute

     * @return the attribute value
     * @throws Exception
     */
    protected Object getAttrInvokeAccessor(int index,
                                           AttributeDefImpl attrDef) throws Exception {
        if ((index >= AttributesEnum.firstIndex()) && (index < AttributesEnum.count())) {
            return AttributesEnum.staticValues()[index - AttributesEnum.firstIndex()].get(this);
        }
        return super.getAttrInvokeAccessor(index, attrDef);
    }

    /**
     * setAttrInvokeAccessor: generated method. Do not modify.
     * @param index the index identifying the attribute
     * @param value the value to assign to the attribute
     * @param attrDef the attribute

     * @throws Exception
     */
    protected void setAttrInvokeAccessor(int index, Object value,
                                         AttributeDefImpl attrDef) throws Exception {
        if ((index >= AttributesEnum.firstIndex()) && (index < AttributesEnum.count())) {
            AttributesEnum.staticValues()[index - AttributesEnum.firstIndex()].put(this, value);
            return;
        }
        super.setAttrInvokeAccessor(index, value, attrDef);
    }

    /**
     * @return the associated entity oracle.jbo.RowIterator.
     */
    public RowIterator getOrder() {
        return (RowIterator)getAttributeInternal(ORDER);
    }

    /**
     * @return the associated entity PersonEOImpl.
     */
    public PersonEOImpl getPerson() {
        return (PersonEOImpl)getAttributeInternal(PERSON);
    }

    /**
     * Sets <code>value</code> as the associated entity PersonEOImpl.
     */
    public void setPerson(PersonEOImpl value) {
        setAttributeInternal(PERSON, value);
    }

    /**
     * Gets the view accessor <code>RowSet</code> PaymentTypesVA.
     */
    public RowSet getPaymentTypesVA() {
        return (RowSet)getAttributeInternal(PAYMENTTYPESVA);
    }

    /**
     * Gets the view accessor <code>RowSet</code> CreditCardTypesVA.
     */
    public RowSet getCreditCardTypesVA() {
        return (RowSet)getAttributeInternal(CREDITCARDTYPESVA);
    }

    /**
     * @param paymentOptionId key constituent

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

    /**
     * @return the definition object for this instance class.
     */
    public static synchronized EntityDefImpl getDefinitionObject() {
        if (mDefinitionObject == null) {
            mDefinitionObject = EntityDefImpl.findDefObject("oracle.fodemo.storefront.entities.PaymentOptionEO");
        }
        return mDefinitionObject;
    }
}
