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);
        }
    }
    
    public void refreshRemoveNewRowByKey (Key pRowKey){
        Row[] rows = this.findByKey(pRowKey,1);
        
        if (rows != null && rows.length == 1){
            Row row = rows[0];
            this.refreshRemoveNewRow(row);
        }
    }

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

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

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

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

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

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


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

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

    /**Sample exportable method.
     */
    public void sampleAddressesAndUsagesVOImplExportable() {
    }

    /**Sample exportable method.
     */
    public void sampleAddressesAndUsagesVOImplExportable2(String testParam1) {
    }
}
