Class DePermissionRequestRepositoryImpl
java.lang.Object
energy.eddie.regionconnector.de.eta.persistence.DePermissionRequestRepositoryImpl
- All Implemented Interfaces:
FullPermissionRequestRepository<DePermissionRequest>,PermissionRequestRepository<DePermissionRequest>,StalePermissionRequestRepository<DePermissionRequest>,StatusPermissionRequestRepository<DePermissionRequest>,DePermissionRequestRepository
@Repository
public class DePermissionRequestRepositoryImpl
extends Object
implements DePermissionRequestRepository
JDBC-based implementation of DePermissionRequestRepository.
This repository reads from the aggregated view created by the event sourcing table.
-
Constructor Summary
ConstructorsConstructorDescriptionDePermissionRequestRepositoryImpl(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate) -
Method Summary
Modifier and TypeMethodDescriptionfindByPermissionId(String permissionId) Find a permission request by its permission ID.findByStatus(PermissionProcessStatus status) findStalePermissionRequests(int days) Finds all permission request that are older than thestalenessDurationand have either the statusVALIDATEDorSENT_TO_PERMISSION_ADMINISTRATOR.getByPermissionId(String permissionId) Gets a permission request by its permission id.voidsave(DePermissionRequest request) Save the permission request.
-
Constructor Details
-
DePermissionRequestRepositoryImpl
public DePermissionRequestRepositoryImpl(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
-
-
Method Details
-
findByPermissionId
Description copied from interface:DePermissionRequestRepositoryFind a permission request by its permission ID.- Specified by:
findByPermissionIdin interfaceDePermissionRequestRepository- Specified by:
findByPermissionIdin interfacePermissionRequestRepository<DePermissionRequest>- Parameters:
permissionId- the permission ID to search for- Returns:
- an Optional containing the permission request if found, empty otherwise
-
getByPermissionId
Description copied from interface:PermissionRequestRepositoryGets a permission request by its permission id. If it cannot be found throwsEntityNotFoundException. Should only be used when sure that the permission request exists- Specified by:
getByPermissionIdin interfacePermissionRequestRepository<DePermissionRequest>- Parameters:
permissionId- the id of the permission request.- Returns:
- the permission request
-
save
Description copied from interface:PermissionRequestRepositorySave the permission request. If a request with the same permission id already exists it will be overwritten.- Specified by:
savein interfacePermissionRequestRepository<DePermissionRequest>- Parameters:
request- the permission request to be saved.
-
findByStatus
- Specified by:
findByStatusin interfaceStatusPermissionRequestRepository<DePermissionRequest>
-
findStalePermissionRequests
Description copied from interface:StalePermissionRequestRepositoryFinds all permission request that are older than thestalenessDurationand have either the statusVALIDATEDorSENT_TO_PERMISSION_ADMINISTRATOR.- Specified by:
findStalePermissionRequestsin interfaceStalePermissionRequestRepository<DePermissionRequest>- Parameters:
days- the max amount of hours the permission request has to be created ago to not be considered stale.- Returns:
- all permission request created now -
stalenessDurationhours ago, with above specified status.
-