-
Notifications
You must be signed in to change notification settings - Fork 0
Class PlantUML diagram
Jocilé Serra edited this page Jul 25, 2022
·
1 revision
@startuml
package entities #DDDDDD{
entity Product << entity >>{
- id : Long
- name : String
- description : String
- price : Double
- imgUrl : String
- date : Instant
- categories : Set<Category>
==
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
}
entity Category <<entity>>{
- id : Long
- name : String
- createdAt : Instant
- updatedAt : Instant
==
@Data
@AllArgsConstructor
@NoArgsConstructor
prePersist() void
preUpdate() void
}
}
package dto #DDDDDD{
class CategoryDTO{
- id : Long
- name : String
==
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
}
class ProductDTO{
- id : Long
- name : String
- description : String
- price : Double
- imgUrl : String
- date : Instant
- categories : Set<CategoryDTO>
==
@Getter
@Setter
@NoArgsConstructor
ProductDTO(id,name,description,price,imgUrl,date)
ProductDTO(entity)
}
}
package services #BBBBBB{
class ProductService{
- repository : ProductRepository
findAll() List<ProductDTO>
findAllPaged(pageable) Page<ProductDTO>
findById(id) ResponseEntity<ProductDTO>
insert(dto) ResponseEntity<ProductDTO>
update(dto) ResponseEntity<ProductDTO>
delete(id) ResponseEntity<void>
}
class CategoryService{
- repository : CategoryRepository
findAll() List<CategoryDTO>
findAllPaged(pageable) Page<CategoryDTO>
findById(id) ResponseEntity<CategoryDTO>
insert(dto) ResponseEntity<CategoryDTO>
update(dto) ResponseEntity<ategoryDTO>
delete(id) ResponseEntity<void>
}
package services.exceptions{
class ResourceNotFoundException <<RuntimeException>>{
ResourceNotFoundException(String message)
}
class DatabaseException <extends RuntimeException>{
DatabaseException(String message)
}
}
}
package resources #AAAAAA{
class ProductResource{
- service : ProducService
findAll() ResponseEntityPage<ProductDTO>
findById(id) ResponseEntity<ProductDTO>
insert(dto) ResponseEntity<ProductDTO>
update(dto) ResponseEntity<ProductDTO>
delete(id) ResponseEntity<void>
}
class CategoryResource{
- service : CategoryService
findAll() ResponseEntityPage<CategoryDTO>
findById(id) ResponseEntity<CategoryDTO>
insert(dto) ResponseEntity<CategoryDTO>
update(dto) ResponseEntity<CategoryDTO>
delete(id) ResponseEntity<void>
}
package Resources.exceptions{
class StandardError{
Instant timestamp
- Integer status
- String error
- String message
- String path
==
@NoArgsConstructor
@Getter
@Setter
}
class ResourceExceptionHandler{
handleEntityNotFound(e,,request)
}
}
}
package repositories #EEEEEE{
interface ProductRepository <extends JpaRepository>
interface CategoryRepository <extends JpaRepository>
}
Product *-- Category
ProductDTO *-- CategoryDTO
ProductDTO *-- Product
ProductDTO *-- Category
CategoryDTO *-- Category
ProductService *-- Category
ProductService *-- Product
ProductService *-- CategoryDTO
ProductService *-- ProductDTO
ProductService *-- CategoryRepository
ProductService *-- ProductRepository
ProductService *-- DatabaseException
ProductService *-- ResourceNotFoundException
ProductResource *-- ProductDTO
ProductResource *-- ProductService
CategoryService *-- Category
CategoryService *-- CategoryDTO
CategoryService *-- CategoryRepository
CategoryService *-- DatabaseException
CategoryService *-- ResourceNotFoundException
CategoryResource *-- CategoryDTO
CategoryResource *-- CategoryService
CategoryResource *-- EntityNotFoundException
CategoryResource *-- StandardError
ResourceExceptionHandler *-- DatabaseException
ResourceExceptionHandler *-- ResourceNotFoundException
@enduml
This project is under license from MIT and made with ❤️ by Jocile.