- Controllers(Request mappings)
- Views(JSP,JSTL)
- Controllers(Forms)
- Spring Architecture/Validation
The system had to be completed by developing code for the business logic/validation requirements stated below in the following classes
- Controller class eMarket.controller.OrderController
- Controller class eMarket.controller.ItemController
- Validator class eMarket.controller.ItemValidator
-
When clicking on
Orderin the viewindex, the user must be redirected to the vieworderMaster. -
When clicking on
Main Pagein the vieworderMaster, the user must be redirected to the viewindex. -
When clicking on
Add new orderin the vieworderMaster, the user must be redirected to the vieworderDetail. -
When clicking on
Editfor a specific order in the vieworderMaster, the user must be redirected to the vieworderDetail. -
When clicking on
Deletefor a specific order in the vieworderMaster, the user must be redirected to the vieworderMaster. -
When clicking on
Add new orderin the vieworderMaster, a new order must be created and added in the storeEMarketApp.store.orderList. We are usingEMarketApp.storeas an abstraction of a data store that we will replace with a real database in sprint 4. The date of the new order must be the system date, the one that appears in the viewindex. -
When the list of orders is displayed in the view
orderMaster, the following information must be displayed for each order inEMarketApp.store.orderList:id: identifierdate: date of creationdescription: descriptioncost: sum of the cost for each item in the order (item.product.price * item.amount)
-
When clicking on
Editfor a specific order in the vieworderMaster, the vieworderDetailmust display the details of the chosen order. -
When clicking on
Deletefor a specific order in the vieworderMaster, the selected order must be deleted fromEMarketApp.store.orderList. -
When clicking on
Show all ordersin the vieworderDetail, the user must be redirected to the vieworderMaster. -
When clicking on
Add new itemin the vieworderDetail, the user must be redirected to the viewitemDetail. -
When clicking on
Submitin the viewitemDetail, and there are no validation errors, the user must be redirected to the vieworderDetail. -
When clicking on
Submitin the viewitemDetail, and there are validation errors, the user must be redirected to the viewitemDetail. -
When clicking on
Cancelin the viewitemDetail, the user must be redirected to the vieworderDetail. -
When adding a new item by clicking on
Add new itemin vieworderDetail, a new objectOrderItemmust be created and linked to the form in the viewitemDetail. -
When editing an existing item by clicking on
Editin vieworderDetail, the correspondingOrderItemmust be fetched from its corresponding order, which is stored inEMarketApp.store.orderList. -
When deleting an existing item by clicking on
Deletein vieworderDetail, the correspondingOrderItemmust be deleted from its corresponding order, which is stored inEMarketApp.store.orderList. -
When adding a new item by clicking on
Submitin viewitemDetail, a newOrderItemwill be created and appended to theitemListof the selected order (its identifier needs to be remembered when going fromorderDetailtoitemDetail):- the
productmust reference the corresponding product inEMarketApp.store.productList; - the
amountmust be set with the amount in the form in viewitemDetail; - the
costmust correspond toamount * product.price.
- the
-
In view
itemDetail, when submitting a new item, if the fieldamountis empty an error must be displayed next to the fieldamount. -
In view
itemDetail, when submitting a new item, if theamountprovided is negative an error must be displayed next to the fieldamount. -
When adding a new item by clicking on
Submitin viewitemDetail, the system should check if there is an active deal for the selected product inEMarketApp.store.dealList. In that case the discounted cost should be computed by applying the discount with the formula(product.price - deal.discount * product.price) * amount. Feel free to refactor the formula using your algebra skills. A deal is active for an order when:- the start date of the deal is before or equal to the order creation date, and there is no end date for the deal;
- the start date of the deal is before or equal to the order date, and the end date of the deal is after or equal to the order creation date.
-
In the view
orderDetail, display the cost of each item after applying discounts if there are active deals for the product of the order item. -
In the view
orderMaster, display the cost of the deal after applying discounts to each line item.