Class OrderListState

  • All Implemented Interfaces:

    public class OrderListState
    extends java.lang.Object
    Session object for keeping track of the list of orders. The state of the list is preserved here instead of via url parameters, which can get messy. There are three types of state: Order State, Order Type, and pagination position. Also provides convenience methods for retrieving the right set of data for a particular state. TODO: this can be generalized to use a set of State objects, including Pagination. Think about design patterns in Fowler.
    See Also:
    Serialized Form
    • Field Detail

      • module

        public static final java.lang.String module

        public static final java.lang.String VIEW_INDEX_PARAM
        See Also:
        Constant Field Values
      • viewSize

        protected int viewSize
      • viewIndex

        protected int viewIndex
      • orderStatusState

        protected java.util.Map<java.lang.String,​java.lang.String> orderStatusState
      • orderTypeState

        protected java.util.Map<java.lang.String,​java.lang.String> orderTypeState
      • orderFilterState

        protected java.util.Map<java.lang.String,​java.lang.String> orderFilterState
      • orderListSize

        protected int orderListSize
      • parameterToOrderStatusId

        protected static final java.util.Map<java.lang.String,​java.lang.String> parameterToOrderStatusId
      • parameterToOrderTypeId

        protected static final java.util.Map<java.lang.String,​java.lang.String> parameterToOrderTypeId
      • parameterToFilterId

        protected static final java.util.Map<java.lang.String,​java.lang.String> parameterToFilterId
    • Constructor Detail

      • OrderListState

        protected OrderListState()
        Initializes the order list state with default values. Do not use directly, instead use getInstance().
    • Method Detail

      • getInstance

        public static OrderListState getInstance​(HttpServletRequest request)
        Retrieves the current user's OrderListState from the session or creates a new one with defaults.
      • update

        public void update​(HttpServletRequest request)
        Given a request, decides what state to change. If a parameter changeStatusAndTypeState is present with value "Y", the status and type state will be updated. Otherwise, if the viewIndex and viewSize parameters are present, the pagination changes.
      • getOrderStatusState

        public java.util.Map<java.lang.String,​java.lang.String> getOrderStatusState()
      • getOrderTypeState

        public java.util.Map<java.lang.String,​java.lang.String> getOrderTypeState()
      • getorderFilterState

        public java.util.Map<java.lang.String,​java.lang.String> getorderFilterState()
      • setStatus

        public void setStatus​(java.lang.String param,
                              boolean b)
      • setType

        public void setType​(java.lang.String param,
                            boolean b)
      • hasStatus

        public boolean hasStatus​(java.lang.String param)
      • hasType

        public boolean hasType​(java.lang.String param)
      • hasFilter

        public boolean hasFilter​(java.lang.String param)
      • hasAllStatus

        public boolean hasAllStatus()
      • getViewSize

        public int getViewSize()
      • getViewIndex

        public int getViewIndex()
      • getSize

        public int getSize()
      • hasPrevious

        public boolean hasPrevious()
      • hasNext

        public boolean hasNext()
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object