package org.ofbiz.order.order;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.ofbiz.entity.GenericValue;

public class OrderItemUtil {

	public static final String PRODUCT_ORDER_ITEM_TYPE = "PRODUCT_ORDER_ITEM";
	public static final String RENTAL_ORDER_ITEM_TYPE = "RENTAL_ORDER_ITEM";

	public static final String inject(HttpServletRequest request,
			HttpServletResponse response) {
		OrderItemUtil orderItemUtil = new OrderItemUtil();
		request.setAttribute("orderItemUtil", orderItemUtil);
		return "success";
	}

	public static boolean isRentalOrderItem(GenericValue item){
    	return RENTAL_ORDER_ITEM_TYPE.equals(item.getString("orderItemTypeId"));
    }

    public static boolean isProductOrderItem(GenericValue item){
    	return PRODUCT_ORDER_ITEM_TYPE.equals(item.getString("orderItemTypeId"));
    }
    
    public static OrderItemUtil getInstance(){
    	return new OrderItemUtil();
    }

}
