- 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
Order
in the viewindex
, the user must be redirected to the vieworderMaster
. -
When clicking on
Main Page
in the vieworderMaster
, the user must be redirected to the viewindex
. -
When clicking on
Add new order
in the vieworderMaster
, the user must be redirected to the vieworderDetail
. -
When clicking on
Edit
for a specific order in the vieworderMaster
, the user must be redirected to the vieworderDetail
. -
When clicking on
Delete
for a specific order in the vieworderMaster
, the user must be redirected to the vieworderMaster
. -
When clicking on
Add new order
in the vieworderMaster
, a new order must be created and added in the storeEMarketApp.store.orderList
. We are usingEMarketApp.store
as 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
Edit
for a specific order in the vieworderMaster
, the vieworderDetail
must display the details of the chosen order. -
When clicking on
Delete
for a specific order in the vieworderMaster
, the selected order must be deleted fromEMarketApp.store.orderList
. -
When clicking on
Show all orders
in the vieworderDetail
, the user must be redirected to the vieworderMaster
. -
When clicking on
Add new item
in the vieworderDetail
, the user must be redirected to the viewitemDetail
. -
When clicking on
Submit
in the viewitemDetail
, and there are no validation errors, the user must be redirected to the vieworderDetail
. -
When clicking on
Submit
in the viewitemDetail
, and there are validation errors, the user must be redirected to the viewitemDetail
. -
When clicking on
Cancel
in the viewitemDetail
, the user must be redirected to the vieworderDetail
. -
When adding a new item by clicking on
Add new item
in vieworderDetail
, a new objectOrderItem
must be created and linked to the form in the viewitemDetail
. -
When editing an existing item by clicking on
Edit
in vieworderDetail
, the correspondingOrderItem
must be fetched from its corresponding order, which is stored inEMarketApp.store.orderList
. -
When deleting an existing item by clicking on
Delete
in vieworderDetail
, the correspondingOrderItem
must be deleted from its corresponding order, which is stored inEMarketApp.store.orderList
. -
When adding a new item by clicking on
Submit
in viewitemDetail
, a newOrderItem
will be created and appended to theitemList
of the selected order (its identifier needs to be remembered when going fromorderDetail
toitemDetail
):- the
product
must reference the corresponding product inEMarketApp.store.productList
; - the
amount
must be set with the amount in the form in viewitemDetail
; - the
cost
must correspond toamount * product.price
.
- the
-
In view
itemDetail
, when submitting a new item, if the fieldamount
is empty an error must be displayed next to the fieldamount
. -
In view
itemDetail
, when submitting a new item, if theamount
provided is negative an error must be displayed next to the fieldamount
. -
When adding a new item by clicking on
Submit
in 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.