mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-10-14 14:17:46 +00:00
feat: Implemented Monolithic Architecture according to the guidelines provided by issue #2664 (#3111)
* added a pom.xml file for the monolithic structure, set up MVC file structure, and added basic model files using H2 database since its light and efficient * added a pom.xml file for the monolithic structure, set up MVC file structure, and added basic model files using H2 database since its light and efficient * Added "controllers" and repository classes to communicate with database to maintain code cleanliness * added application.properties file for springboot, added controller classes and used the CLI main class from the previous submission and enhanced upon it * fixed checkstyle comments * fixed testing class * automatically generated puml * Readme File Added Detailed Readme File in the md format * attempting to fix some debugging issues added more test cases, and tried to fix pom.xml * dropped change * another attempted fix * added more test cases * Fixes Renamed the main module/directory. Added more content to the readme.md file. fixed the orElseThrow statements Fixes Renamed the main module/directory. Added more content to the readme.md file. fixed the orElseThrow statements * fixed naming and readme file --------- Co-authored-by: Ilkka Seppälä <iluwatar@users.noreply.github.com>
This commit is contained in:
1 parent
9ad38a4f3c
commit
a25b6a003d
20 files changed
+1495
-1
No files matched your search
@@ -0,0 +1,123 @@
|
||||
@startuml
|
||||
package com.iluwatar.monolithic.model {
|
||||
class Orders {
|
||||
- id : Long
|
||||
- product : Products
|
||||
- quantity : Integer
|
||||
- totalPrice : Double
|
||||
- user : User
|
||||
+ Orders()
|
||||
+ Orders(id : Long, user : User, product : Products, quantity : Integer, totalPrice : Double)
|
||||
# canEqual(other : Object) : boolean
|
||||
+ equals(o : Object) : boolean
|
||||
+ getId() : Long
|
||||
+ getProduct() : Products
|
||||
+ getQuantity() : Integer
|
||||
+ getTotalPrice() : Double
|
||||
+ getUser() : User
|
||||
+ hashCode() : int
|
||||
+ setId(id : Long)
|
||||
+ setProduct(product : Products)
|
||||
+ setQuantity(quantity : Integer)
|
||||
+ setTotalPrice(totalPrice : Double)
|
||||
+ setUser(user : User)
|
||||
+ toString() : String
|
||||
}
|
||||
class Products {
|
||||
- description : String
|
||||
- id : Long
|
||||
- name : String
|
||||
- price : Double
|
||||
- stock : Integer
|
||||
+ Products()
|
||||
+ Products(id : Long, name : String, description : String, price : Double, stock : Integer)
|
||||
# canEqual(other : Object) : boolean
|
||||
+ equals(o : Object) : boolean
|
||||
+ getDescription() : String
|
||||
+ getId() : Long
|
||||
+ getName() : String
|
||||
+ getPrice() : Double
|
||||
+ getStock() : Integer
|
||||
+ hashCode() : int
|
||||
+ setDescription(description : String)
|
||||
+ setId(id : Long)
|
||||
+ setName(name : String)
|
||||
+ setPrice(price : Double)
|
||||
+ setStock(stock : Integer)
|
||||
+ toString() : String
|
||||
}
|
||||
class User {
|
||||
- email : String
|
||||
- id : Long
|
||||
- name : String
|
||||
- password : String
|
||||
+ User()
|
||||
+ User(id : Long, name : String, email : String, password : String)
|
||||
# canEqual(other : Object) : boolean
|
||||
+ equals(o : Object) : boolean
|
||||
+ getEmail() : String
|
||||
+ getId() : Long
|
||||
+ getName() : String
|
||||
+ getPassword() : String
|
||||
+ hashCode() : int
|
||||
+ setEmail(email : String)
|
||||
+ setId(id : Long)
|
||||
+ setName(name : String)
|
||||
+ setPassword(password : String)
|
||||
+ toString() : String
|
||||
}
|
||||
}
|
||||
package com.iluwatar.monolithic.repository {
|
||||
interface OrderRepo {
|
||||
}
|
||||
interface ProductRepo {
|
||||
}
|
||||
interface UserRepo {
|
||||
+ findByEmail(String) : User {abstract}
|
||||
}
|
||||
}
|
||||
package com.iluwatar.monolithic.controller {
|
||||
class OrderCon {
|
||||
- orderRepository : OrderRepo
|
||||
- productRepository : ProductRepo
|
||||
- userRepository : UserRepo
|
||||
+ OrderCon(orderRepository : OrderRepo, userRepository : UserRepo, productRepository : ProductRepo)
|
||||
+ placeOrder(userId : Long, productId : Long, quantity : Integer) : Orders
|
||||
}
|
||||
class ProductCon {
|
||||
- productRepository : ProductRepo
|
||||
+ ProductCon(productRepository : ProductRepo)
|
||||
+ addProduct(product : Products) : Products
|
||||
+ getAllProducts() : List<Products>
|
||||
}
|
||||
class UserCon {
|
||||
- userRepository : UserRepo
|
||||
+ UserCon(userRepository : UserRepo)
|
||||
+ registerUser(user : User) : User
|
||||
}
|
||||
}
|
||||
package com.iluwatar.monolithic {
|
||||
class EcommerceApp {
|
||||
- log : Logger {static}
|
||||
- orderService : OrderCon
|
||||
- productService : ProductCon
|
||||
- userService : UserCon
|
||||
+ EcommerceApp(userService : UserCon, productService : ProductCon, orderService : OrderCon)
|
||||
# addProduct(scanner : Scanner)
|
||||
+ main(args : String[]) {static}
|
||||
# placeOrder(scanner : Scanner)
|
||||
# registerUser(scanner : Scanner)
|
||||
+ run(args : String[])
|
||||
}
|
||||
}
|
||||
UserCon --> "-userRepository" UserRepo
|
||||
Orders --> "-user" User
|
||||
OrderCon --> "-productRepository" ProductRepo
|
||||
OrderCon --> "-userRepository" UserRepo
|
||||
OrderCon --> "-orderRepository" OrderRepo
|
||||
EcommerceApp --> "-userService" UserCon
|
||||
EcommerceApp --> "-productService" ProductCon
|
||||
ProductCon --> "-productRepository" ProductRepo
|
||||
Orders --> "-product" Products
|
||||
EcommerceApp --> "-orderService" OrderCon
|
||||
@enduml
|
||||
@@ -0,0 +1,123 @@
|
||||
@startuml
|
||||
package com.iluwatar.monolithic.model {
|
||||
class Orders {
|
||||
- id : Long
|
||||
- product : Products
|
||||
- quantity : Integer
|
||||
- totalPrice : Double
|
||||
- user : User
|
||||
+ Orders()
|
||||
+ Orders(id : Long, user : User, product : Products, quantity : Integer, totalPrice : Double)
|
||||
# canEqual(other : Object) : boolean
|
||||
+ equals(o : Object) : boolean
|
||||
+ getId() : Long
|
||||
+ getProduct() : Products
|
||||
+ getQuantity() : Integer
|
||||
+ getTotalPrice() : Double
|
||||
+ getUser() : User
|
||||
+ hashCode() : int
|
||||
+ setId(id : Long)
|
||||
+ setProduct(product : Products)
|
||||
+ setQuantity(quantity : Integer)
|
||||
+ setTotalPrice(totalPrice : Double)
|
||||
+ setUser(user : User)
|
||||
+ toString() : String
|
||||
}
|
||||
class Products {
|
||||
- description : String
|
||||
- id : Long
|
||||
- name : String
|
||||
- price : Double
|
||||
- stock : Integer
|
||||
+ Products()
|
||||
+ Products(id : Long, name : String, description : String, price : Double, stock : Integer)
|
||||
# canEqual(other : Object) : boolean
|
||||
+ equals(o : Object) : boolean
|
||||
+ getDescription() : String
|
||||
+ getId() : Long
|
||||
+ getName() : String
|
||||
+ getPrice() : Double
|
||||
+ getStock() : Integer
|
||||
+ hashCode() : int
|
||||
+ setDescription(description : String)
|
||||
+ setId(id : Long)
|
||||
+ setName(name : String)
|
||||
+ setPrice(price : Double)
|
||||
+ setStock(stock : Integer)
|
||||
+ toString() : String
|
||||
}
|
||||
class User {
|
||||
- email : String
|
||||
- id : Long
|
||||
- name : String
|
||||
- password : String
|
||||
+ User()
|
||||
+ User(id : Long, name : String, email : String, password : String)
|
||||
# canEqual(other : Object) : boolean
|
||||
+ equals(o : Object) : boolean
|
||||
+ getEmail() : String
|
||||
+ getId() : Long
|
||||
+ getName() : String
|
||||
+ getPassword() : String
|
||||
+ hashCode() : int
|
||||
+ setEmail(email : String)
|
||||
+ setId(id : Long)
|
||||
+ setName(name : String)
|
||||
+ setPassword(password : String)
|
||||
+ toString() : String
|
||||
}
|
||||
}
|
||||
package com.iluwatar.monolithic.repository {
|
||||
interface OrderRepo {
|
||||
}
|
||||
interface ProductRepo {
|
||||
}
|
||||
interface UserRepo {
|
||||
+ findByEmail(String) : User {abstract}
|
||||
}
|
||||
}
|
||||
package com.iluwatar.monolithic.controller {
|
||||
class OrderCon {
|
||||
- orderRepository : OrderRepo
|
||||
- productRepository : ProductRepo
|
||||
- userRepository : UserRepo
|
||||
+ OrderCon(orderRepository : OrderRepo, userRepository : UserRepo, productRepository : ProductRepo)
|
||||
+ placeOrder(userId : Long, productId : Long, quantity : Integer) : Orders
|
||||
}
|
||||
class ProductCon {
|
||||
- productRepository : ProductRepo
|
||||
+ ProductCon(productRepository : ProductRepo)
|
||||
+ addProduct(product : Products) : Products
|
||||
+ getAllProducts() : List<Products>
|
||||
}
|
||||
class UserCon {
|
||||
- userRepository : UserRepo
|
||||
+ UserCon(userRepository : UserRepo)
|
||||
+ registerUser(user : User) : User
|
||||
}
|
||||
}
|
||||
package com.iluwatar.monolithic {
|
||||
class EcommerceApp {
|
||||
- log : Logger {static}
|
||||
- orderService : OrderCon
|
||||
- productService : ProductCon
|
||||
- userService : UserCon
|
||||
+ EcommerceApp(userService : UserCon, productService : ProductCon, orderService : OrderCon)
|
||||
# addProduct(scanner : Scanner)
|
||||
+ main(args : String[]) {static}
|
||||
# placeOrder(scanner : Scanner)
|
||||
# registerUser(scanner : Scanner)
|
||||
+ run(args : String[])
|
||||
}
|
||||
}
|
||||
UserCon --> "-userRepository" UserRepo
|
||||
Orders --> "-user" User
|
||||
OrderCon --> "-productRepository" ProductRepo
|
||||
OrderCon --> "-userRepository" UserRepo
|
||||
OrderCon --> "-orderRepository" OrderRepo
|
||||
EcommerceApp --> "-userService" UserCon
|
||||
Orders --> "-product" Products
|
||||
ProductCon --> "-productRepository" ProductRepo
|
||||
EcommerceApp --> "-productService" ProductCon
|
||||
EcommerceApp --> "-orderService" OrderCon
|
||||
@enduml
|
||||
Reference in new issue
Block a user