Class PermissionRequestCreationAndValidationService

java.lang.Object
energy.eddie.regionconnector.at.eda.services.PermissionRequestCreationAndValidationService

@Component public class PermissionRequestCreationAndValidationService extends Object
  • Constructor Details

  • Method Details

    • createAndValidatePermissionRequest

      public CreatedPermissionRequest createAndValidatePermissionRequest(PermissionRequestForCreation permissionRequest) throws DataNeedNotFoundException, UnsupportedDataNeedException
      Creates and validates a number permission requests. This will emit a CreatedEvent, and a ValidatedEvent or a MalformedEvent for 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 present
      UnsupportedDataNeedException - If the data need ID is not supported, will only be thrown if exactly one data need ID is present