package oracle.fodemo.storefront.store.queries;


import oracle.fodemo.storefront.store.queries.common.AddressesAndUsagesVO;

import oracle.jbo.Key;
import oracle.jbo.Row;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.server.ViewRowImpl;
// ---------------------------------------------------------------------
// ---    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 AddressesAndUsagesVOImpl extends ViewObjectImpl implements AddressesAndUsagesVO {
    /**This is the default constructor (do not remove).
     */
    public AddressesAndUsagesVOImpl() {
    }


    /**
     * This method should be called whenever a newly created Row should be discarded
     */
    private void refreshRemoveNewRow(Row row){
        
        if (((ViewRowImpl) row).getNewRowState() == Row.STATUS_INITIALIZED){
            row.refresh(Row.REFRESH_UNDO_CHANGES + Row.REFRESH_REMOVE_NEW_ROWS);    
        } else {
            row.refresh(Row.REFRESH_UNDO_CHANGES + Row.REFRESH_FORGET_NEW_ROWS);                    
        }
    }

    public void refreshRemoveNewCurrentRow(){
        Row row = this.getCurrentRow();
        if (row != null){
            this.refreshRemoveNewRow(row);
        }
    }

    /**
     * @param pRowKey
     */
    public void refreshRemoveNewRowByKey (Key pRowKey){
        Row[] rows = this.findByKey(pRowKey,1);
        
        if (rows != null && rows.length == 1){
            Row row = rows[0];
            this.refreshRemoveNewRow(row);
        }
    }

    /**
     * @return
     */
    @Override
    public Row createRow() {
        return super.createRow();
    }

    /**
     * @param key
     * @param maxNumOfRows
     * @return
     */
    @Override
    public Row[] findByKey(Key key, int maxNumOfRows) {
        return super.findByKey(key, maxNumOfRows);
    }

    /**
     * @param key
     * @param maxNumOfRows
     * @param skipWhere
     * @return
     */
    @Override
    public Row[] findByKey(Key key, int maxNumOfRows, boolean skipWhere) {
        return super.findByKey(key, maxNumOfRows, skipWhere);
    }

    /**
     * @param row
     * @return
     */
    @Override
    public boolean setCurrentRow(Row row) {
        return super.setCurrentRow(row);
    }

    /**
     * @param index
     * @return
     */
    @Override
    public boolean setCurrentRowAtRangeIndex(int index) {
        return super.setCurrentRowAtRangeIndex(index);
    }

    /**
     * @return
     */
    @Override
    public Row first() {
        return super.first();
    }


    /**
     * Returns the variable value for personid.
     * @return variable value for personid
     */
    public Integer getpersonid() {
        return (Integer)ensureVariableManager().getVariableValue("personid");
    }

    /**
     * Sets <code>value</code> for variable personid.
     * @param value value to bind as personid
     */
    public void setpersonid(Integer value) {
        ensureVariableManager().setVariableValue("personid", value);
    }

}
