Interface OrderManager<T extends Order>


  • @Service
    public interface OrderManager<T extends Order>
    A service to manage Orders.
    Author:
    Thomas Dedek, Paul Henke, Oliver Gierke
    • Method Detail

      • save

        T save​(T order)
        Saves the given Order or persists changes to it.
        Parameters:
        order - the order to be saved, must not be null.
        Returns:
      • contains

        boolean contains​(OrderIdentifier orderIdentifier)
        Checks if this OrderManager contains an order.
        Parameters:
        orderIdentifier - the OrderIdentifier of the Order, must not be null.
        Returns:
        true if the OrderManager contains the order, false otherwise.
      • findBy

        org.springframework.data.util.Streamable<T> findBy​(OrderStatus orderStatus)
        Returns all Orders having the OrderStatus status. If no orders with the specified status exist, an empty Iterable is returned.
        Parameters:
        orderStatus - Denoting the OrderStatus on which the Orders will be requested.
        Returns:
        a Streamable containing all Orders with the specified OrderStatus
      • findBy

        org.springframework.data.util.Streamable<T> findBy​(Interval interval)
        Returns all Orders in between the Interval. So every entry with an time stamp <= to and >= from is returned. If no Orders within the specified time span exist, an empty Iterable is returned.
        Parameters:
        interval - The time interval to find Orders in, must not be null.
        Returns:
        a Streamable containing all Orders in the given Interval.
      • findBy

        org.springframework.data.util.Streamable<T> findBy​(UserAccount userAccount)
        Returns all Orders of the given UserAccount. If this user has no orders, an empty Iterable is returned.
        Parameters:
        userAccount - Denoting the UserAccount on which the orders will be requested, must not be null.
        Returns:
        a Streamable containing all orders of the specified user.
      • findBy

        org.springframework.data.util.Streamable<T> findBy​(UserAccount userAccount,
                                                           Interval interval)
        Returns all Orders from the given UserAccount in between the dates from and to, including from and to. So every entry with an time stamp <= to and >= from is returned. If this user has no Orders in this period, an empty Iterable is returned.
        Parameters:
        userAccount - The UserAccount whose Orders shall be returned, must not be null.
        interval - The time interval to find Orders in, must not be null.
        Returns:
        a Streamable containing all orders from the specified user in the specified period.
      • cancelOrder

        boolean cancelOrder​(T order)
        Cancels an Order, no matter what state it is in.
        Parameters:
        order - the order to be canceled, must not be null.
        Returns:
        true if the order could be canceled
        See Also:
        Order.OrderCancelled
      • delete

        T delete​(T order)
        Deletes the given Order.
        Parameters:
        order - must not be null.
        Returns:
        the deleted Order
        Since:
        7.1
      • findAll

        org.springframework.data.domain.Page<T> findAll​(org.springframework.data.domain.Pageable pageable)
        Returns the Page of orders specified by the given Pageable.
        Returns:
        the Page of orders specified by the given Pageable.
        Since:
        7.1