Class AbstractCreateService<CreateForm extends AbstractCreateForm,Entity extends AbstractEntity,Model,CreateRepository extends org.springframework.data.repository.CrudRepository<Entity,Long>>    
java.lang.Object
fr.tiogars.architecture.create.services.AbstractCreateService<CreateForm,Entity,Model,CreateRepository>   
- Type Parameters:
- CreateForm- the type of the form used to create an entity
- Entity- the type of the entity being created
- Model- the type of the model used in the service
- CreateRepository- the type of the repository used for CRUD operations
public abstract class AbstractCreateService<CreateForm extends AbstractCreateForm,Entity extends AbstractEntity,Model,CreateRepository extends org.springframework.data.repository.CrudRepository<Entity,Long>>    
extends Object
Abstract class for create services.
 This class can be extended to implement specific create operations
 for different entities.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionThe CrudRepository used for database operations.
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor for the AbstractCreateService.AbstractCreateService(CreateRepository crudRepository) Constructor for the AbstractCreateService.
- 
Method SummaryModifier and TypeMethodDescriptioncreate(CreateForm createForm) Creates a new entity based on the provided CreateForm.abstract EntityConverts a CreateForm to an Entity.abstract ModeltoModel(CreateForm createForm) Converts a CreateForm to a Model.abstract ModelConverts an UpdateRequest to an Entity.abstract voidValidates the provided model.
- 
Field Details- 
crudRepositorypublic org.springframework.data.repository.CrudRepository<Entity extends AbstractEntity,Long> crudRepositoryThe CrudRepository used for database operations. This repository should be injected in the constructor and is used to perform CRUD operations on the entity type.
 
- 
- 
Constructor Details- 
AbstractCreateServicepublic AbstractCreateService()Default constructor for the AbstractCreateService. This constructor is provided for cases where dependency injection is not used.
- 
AbstractCreateServiceConstructor for the AbstractCreateService. Initializes the CrudRepository used for database operations.- Parameters:
- crudRepository- the CrudRepository for the entity
 
 
- 
- 
Method Details- 
toEntityConverts a CreateForm to an Entity. This method should be implemented by subclasses to define how the conversion is done.- Parameters:
- model- the model containing data to create the entity
- Returns:
- the entity created from the model
 
- 
toModelConverts an UpdateRequest to an Entity. This method should be implemented by subclasses to define how the conversion is done.- Parameters:
- entity- the entity
- Returns:
- the model
 
- 
toModelConverts a CreateForm to a Model. This method should be implemented by subclasses to define how the conversion is done.- Parameters:
- createForm- the form containing data to create the model
- Returns:
- the model created from the form
 
- 
validateValidates the provided model. This method should be implemented by subclasses to define how the validation is done.- Parameters:
- model- the model to validate
 
- 
createCreates a new entity based on the provided CreateForm.- Parameters:
- createForm- the form containing data to create the entity
- Returns:
- a response containing the ID of the created entity
 
 
-