Class PermissionRequestCreationAndValidationService
java.lang.Object
energy.eddie.regionconnector.at.eda.services.PermissionRequestCreationAndValidationService
-
Constructor Summary
ConstructorsConstructorDescriptionPermissionRequestCreationAndValidationService(Outbox outbox, DataNeedCalculationService<DataNeed> dataNeedCalculationService, ValidatedEventFactory validatedEventFactory) -
Method Summary
Modifier and TypeMethodDescriptioncreateAndValidatePermissionRequest(PermissionRequestForCreation permissionRequest) Creates and validates a number permission requests.
-
Constructor Details
-
Method Details
-
createAndValidatePermissionRequest
public CreatedPermissionRequest createAndValidatePermissionRequest(PermissionRequestForCreation permissionRequest) throws DataNeedNotFoundException, UnsupportedDataNeedException Creates and validates a number permission requests. This will emit aCreatedEvent, and aValidatedEventor aMalformedEventfor each created permission request. If only one data need ID is present, any exceptions that occur will be forwarded. That way callers, such as the controller, can react accordingly. If multiple data need IDs are present, the exceptions will be logged and only valid permission IDs are returned to the frontend.- Parameters:
permissionRequest- the DTO that is the base for the created and validated permission requests.- Returns:
- a DTO with the ids of the created and validated permission requests
- Throws:
DataNeedNotFoundException- If the data need ID is not found, will only be thrown if exactly one data need ID is presentUnsupportedDataNeedException- If the data need ID is not supported, will only be thrown if exactly one data need ID is present
-