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 aRole
identified by its unique identifier.org.springframework.http.ResponseEntity
<List<RoleResponseDTO>> findAll()
Retrieves allRoleResponseDTO
s.org.springframework.http.ResponseEntity
<org.springframework.data.web.PagedModel<RoleResponseDTO>> findAllPage
(org.springframework.data.domain.Pageable pageable) Retrieves a paginated list ofRoleResponseDTO
s.org.springframework.http.ResponseEntity
<RoleResponseDTO> Retrieves aRoleResponseDTO
by 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 existingRole
identified 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 aRoleResponseDTO
by its unique identifier.- Parameters:
id
- the unique identifier of the role; must not benull
- Returns:
ResponseEntity
containing theRoleResponseDTO
with 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
- theRoleRequestDTO
containing the role's details; must not benull
- Returns:
ResponseEntity
containing the createdRoleResponseDTO
with statusHttpStatus.CREATED
- Throws:
BadRequestException
- if therequest
isnull
or contains invalid data
-
updateById
@PutMapping("/{id}") public org.springframework.http.ResponseEntity<RoleResponseDTO> updateById(@Valid @RequestBody @Valid RoleRequestDTO request, @PathVariable UUID id) Updates an existingRole
identified by its unique identifier.- Parameters:
request
- theRoleRequestDTO
containing the updated role's details; must not benull
id
- the unique identifier of the role to update; must not benull
- Returns:
ResponseEntity
containing the updatedRoleResponseDTO
with statusHttpStatus.OK
- Throws:
NotFoundException
- if no role is found with the givenid
BadRequestException
- if therequest
isnull
or contains invalid data
-
delete
@DeleteMapping("/{id}") public org.springframework.http.ResponseEntity<Void> delete(@PathVariable UUID id) Deletes aRole
identified by its unique identifier.- Parameters:
id
- the unique identifier of the role to delete; must not benull
- Returns:
ResponseEntity
with statusHttpStatus.NO_CONTENT
- Throws:
NotFoundException
- if no role is found with the givenid
-
findAll
Retrieves allRoleResponseDTO
s.- Returns:
ResponseEntity
containing a list ofRoleResponseDTO
s 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 ofRoleResponseDTO
s.- Parameters:
pageable
- the pagination information; must not benull
- Returns:
ResponseEntity
containing aPagedModel
ofRoleResponseDTO
s with statusHttpStatus.OK
-