package oracle.fodemo.storefront.store.queries;

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

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

    public void showOrderItemsForOrderId(Long orderId){
        setApplyViewCriteriaName("findByOrderId");
        ensureVariableManager().setVariableValue("bvOrderId", orderId);
        executeQuery();
    }

    public void showOrderItemForOrderIdAndProductId(Long orderId, Integer productId){
        setApplyViewCriteriaName("findByOrderIdAndProductId");
        ensureVariableManager().setVariableValue("bvOrderId", orderId);
        ensureVariableManager().setVariableValue("bvProductId", productId);
        executeQuery();
    }

    public void setQuantityForCurrentRow(Integer newQuantity){
        Row currentRow = this.getCurrentRow();
        if(currentRow != null){
            currentRow.setAttribute("Quantity", newQuantity);
            this.getDBTransaction().commit();
        }
    }

    public void showAll() {
      setApplyViewCriteriaNames(null);
      executeQuery();
    }

    public void deleteCurrentItem(){
        Row currentRow = this.getCurrentRow();
        if(currentRow != null){
            currentRow.remove();
            this.getDBTransaction().commit();
        }
    }


    /**Gets the variable value for bvOrderId.
     */
    public String getbvOrderId() {
        return (String)ensureVariableManager().getVariableValue("bvOrderId");
    }

    /**Sets <code>value</code> for variable bvOrderId.
     */
    public void setbvOrderId(String value) {
        ensureVariableManager().setVariableValue("bvOrderId", value);
    }

    /**Gets the variable value for bvProductId.
     */
    public Number getbvProductId() {
        return (Number)ensureVariableManager().getVariableValue("bvProductId");
    }

    /**Sets <code>value</code> for variable bvProductId.
     */
    public void setbvProductId(Number value) {
        ensureVariableManager().setVariableValue("bvProductId", value);
    }

    /**Gets the bind variable value for paramLanguage.
     */
    public String getparamLanguage() {
        return (String)getNamedWhereClauseParam("paramLanguage");
    }

    /**Sets <code>value</code> for bind variable paramLanguage.
     */
    public void setparamLanguage(String value) {
        setNamedWhereClauseParam("paramLanguage", value);
    }

    /**Gets the variable value for bv_Language.
     */
    public String getbv_Language() {
        return (String)ensureVariableManager().getVariableValue("bv_Language");
    }

    /**Sets <code>value</code> for variable bv_Language.
     */
    public void setbv_Language(String value) {
        ensureVariableManager().setVariableValue("bv_Language", value);
    }

    /**Gets the bind variable value for bv_Language1.
     */
    public String getbv_Language1() {
        return (String)getNamedWhereClauseParam("bv_Language1");
    }

    /**Sets <code>value</code> for bind variable bv_Language1.
     */
    public void setbv_Language1(String value) {
        setNamedWhereClauseParam("bv_Language1", value);
    }
}
