Package com.alpaca.controller
Class RoleController
java.lang.Object
com.alpaca.controller.RoleController
REST controller for managing
Role entities.
Provides endpoints for CRUD operations and pagination of roles. Utilizes IRoleService
for business logic and IRoleMapper for DTO conversions.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Void> Deletes aRoleidentified by its unique identifier.org.springframework.http.ResponseEntity<List<RoleResponseDTO>> findAll()Retrieves allRoleResponseDTOs.org.springframework.http.ResponseEntity<org.springframework.data.web.PagedModel<RoleResponseDTO>> findAllPage(org.springframework.data.domain.Pageable pageable) Retrieves a paginated list ofRoleResponseDTOs.org.springframework.http.ResponseEntity<RoleResponseDTO> Retrieves aRoleResponseDTOby its unique identifier.org.springframework.http.ResponseEntity<RoleResponseDTO> save(@Valid RoleRequestDTO request) Creates a newRole.org.springframework.http.ResponseEntity<RoleResponseDTO> updateById(@Valid RoleRequestDTO request, UUID id) Updates an existingRoleidentified by its unique identifier.
-
Field Details
-
service
-
mapper
-
-
Constructor Details
-
RoleController
public RoleController()
-
-
Method Details
-
findById
@GetMapping("/{id}") public org.springframework.http.ResponseEntity<RoleResponseDTO> findById(@PathVariable UUID id) Retrieves aRoleResponseDTOby its unique identifier.- Parameters:
id- the unique identifier of the role; must not benull- Returns:
ResponseEntitycontaining theRoleResponseDTOwith statusHttpStatus.OK- Throws:
NotFoundException- if no role is found with the givenid
-
save
@PostMapping public org.springframework.http.ResponseEntity<RoleResponseDTO> save(@Valid @RequestBody @Valid RoleRequestDTO request) Creates a newRole.- Parameters:
request- theRoleRequestDTOcontaining the role's details; must not benull- Returns:
ResponseEntitycontaining the createdRoleResponseDTOwith statusHttpStatus.CREATED- Throws:
BadRequestException- if therequestisnullor contains invalid data
-
updateById
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<RoleResponseDTO> updateById(@Valid @RequestBody @Valid RoleRequestDTO request, @PathVariable UUID id) Updates an existingRoleidentified by its unique identifier.- Parameters:
request- theRoleRequestDTOcontaining the updated role's details; must not benullid- the unique identifier of the role to update; must not benull- Returns:
ResponseEntitycontaining the updatedRoleResponseDTOwith statusHttpStatus.OK- Throws:
NotFoundException- if no role is found with the givenidBadRequestException- if therequestisnullor contains invalid data
-
delete
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> delete(@PathVariable UUID id) Deletes aRoleidentified by its unique identifier.- Parameters:
id- the unique identifier of the role to delete; must not benull- Returns:
ResponseEntitywith statusHttpStatus.NO_CONTENT- Throws:
NotFoundException- if no role is found with the givenid
-
findAll
Retrieves allRoleResponseDTOs.- Returns:
ResponseEntitycontaining a list ofRoleResponseDTOs with statusHttpStatus.OK
-
findAllPage
@GetMapping("/page") public org.springframework.http.ResponseEntity<org.springframework.data.web.PagedModel<RoleResponseDTO>> findAllPage(org.springframework.data.domain.Pageable pageable) Retrieves a paginated list ofRoleResponseDTOs.- Parameters:
pageable- the pagination information; must not benull- Returns:
ResponseEntitycontaining aPagedModelofRoleResponseDTOs with statusHttpStatus.OK
-