feat: Implementation of session facade design pattern #1278 (#3121)

* implementation of session facade #1278

* minor change

* readme updated

* addressed the comments regarding changing lists to maps and adding maven assembly plugin

---------

Co-authored-by: Ilkka Seppälä <iluwatar@users.noreply.github.com>
This commit is contained in:
Shahd Hossam
2025-01-11 17:45:01 +02:00
committed by GitHub
co-authored by Ilkka Seppälä
parent bcad5b1aa3
commit 8cb7c9ada6
17 changed files with 1180 additions and 0 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

@@ -0,0 +1,48 @@
@startuml
package com.iluwatar.sessionfacade {
class App {
+ App()
+ main(args : String[]) {static}
}
class CartService {
- LOGGER : Logger {static}
- cart : List<Product>
- productCatalog : List<Product>
+ CartService(cart : List<Product>, productCatalog : List<Product>)
+ addToCart(productId : int)
+ removeFromCart(productId : int)
}
class OrderService {
- LOGGER : Logger {static}
- cart : List<Product>
+ OrderService(cart : List<Product>)
+ order()
}
class PaymentService {
+ LOGGER : Logger {static}
+ PaymentService()
+ cashPayment()
+ creditCardPayment()
+ selectPaymentMethod(method : String)
}
class ProductCatalogService {
- products : List<Product>
+ ProductCatalogService(products : List<Product>)
}
class ShoppingFacade {
~ cart : List<Product>
~ cartService : CartService
~ orderService : OrderService
~ paymentService : PaymentService
~ productCatalog : List<Product>
+ ShoppingFacade()
+ addToCart(productId : int)
+ order()
+ removeFromCart(productId : int)
+ selectPaymentMethod(method : String)
}
}
ShoppingFacade --> "-cartService" CartService
ShoppingFacade --> "-paymentService" PaymentService
ShoppingFacade --> "-orderService" OrderService
@enduml