Package rs.etf.sab.operations
Interface OrderOperations
-
public interface OrderOperations
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
addArticle(int orderId, int articleId, int count)
Adds article to order.int
completeOrder(int orderId)
Sends order to the system.int
getBuyer(int orderId)
Gets buyer.java.math.BigDecimal
getDiscountSum(int orderId)
Gets calculated discount for the orderjava.math.BigDecimal
getFinalPrice(int orderId)
Gets calculated final price after all discounts.java.util.List<java.lang.Integer>
getItems(int orderId)
Get all items for order.int
getLocation(int orderId)
Gets location for an order.java.util.Calendar
getRecievedTime(int orderId)
Gets time when order arrived to buyer's city.java.util.Calendar
getSentTime(int orderId)
Gets order's sending timejava.lang.String
getState(int orderId)
Gets state of the order.int
removeArticle(int orderId, int articleId)
Removes article from order.
-
-
-
Method Detail
-
addArticle
int addArticle(int orderId, int articleId, int count)
Adds article to order. It adds articles only if there are enough of them in shop. If article is in order already, it only increases count.- Parameters:
orderId
- order idarticleId
- article idcount
- number of articles to be added- Returns:
- item id (item contains information about number of article instances in particular order), -1 if failure
-
removeArticle
int removeArticle(int orderId, int articleId)
Removes article from order.- Parameters:
orderId
- order idarticleId
- article id- Returns:
- 1 if success, -1 if failure
-
getItems
java.util.List<java.lang.Integer> getItems(int orderId)
Get all items for order.- Parameters:
orderId
- order's id- Returns:
- list of item ids for an order
-
completeOrder
int completeOrder(int orderId)
Sends order to the system. Order will be immediately sent.- Parameters:
orderId
- oreder id- Returns:
- 1 if success, -1 if failure
-
getFinalPrice
java.math.BigDecimal getFinalPrice(int orderId)
Gets calculated final price after all discounts.- Parameters:
orderId
- order id- Returns:
- final price. Sum that buyer have to pay. -1 if failure or if order is not completed
-
getDiscountSum
java.math.BigDecimal getDiscountSum(int orderId)
Gets calculated discount for the order- Parameters:
orderId
- order id- Returns:
- total discount, -1 if failure or if order is not completed
-
getState
java.lang.String getState(int orderId)
Gets state of the order.- Parameters:
orderId
- order's id- Returns:
- state of the order
-
getSentTime
java.util.Calendar getSentTime(int orderId)
Gets order's sending time- Parameters:
orderId
- order's id- Returns:
- order's sending time, null if failure
-
getRecievedTime
java.util.Calendar getRecievedTime(int orderId)
Gets time when order arrived to buyer's city.- Parameters:
orderId
- order id- Returns:
- order's recieve time, null if failure
-
getBuyer
int getBuyer(int orderId)
Gets buyer.- Parameters:
orderId
- order's id- Returns:
- buyer's id
-
getLocation
int getLocation(int orderId)
Gets location for an order. If order is assembled and order is moving from city C1 to city C2 then location of an order is city C1. If order is not yet assembled then location of the order is location of the shop (associated with order) that is closest to buyer's city. If order is in state "created" then location is -1.- Parameters:
orderId
- order's id- Returns:
- id of city, -1 if failure
-
-