Interface ConsentsManagerImplApi

All Known Implementing Classes:
ConsentsManagerImpl

public interface ConsentsManagerImplApi
Consents database logic.
Author:
Radoslav Čerhák invalid input: '<'r.cerhak@gmail.com>
  • Method Details

    • addFacility

      void addFacility(PerunSession sess, ConsentHub consentHub, Facility facility) throws FacilityAlreadyAssigned
      Adds facility to consent hub.
      Parameters:
      sess - session
      consentHub - consent hub
      facility - facility to be added
      Throws:
      FacilityAlreadyAssigned - if facility is already assigned to consent hub
    • changeConsentStatus

      void changeConsentStatus(PerunSession sess, Consent consent)
      Set consent status
      Parameters:
      sess - perun session
      consent - consent
    • checkConsentExists

      void checkConsentExists(PerunSession sess, Consent consent) throws ConsentNotExistsException
      Check if consent exists in underlying data source.
      Parameters:
      sess - PerunSession
      consent - Consent to check
      Throws:
      ConsentNotExistsException - if consent doesn't exist
    • checkConsentHubExists

      void checkConsentHubExists(PerunSession sess, ConsentHub consentHub) throws ConsentHubNotExistsException
      Throws exception if consent hub does not exist.
      Parameters:
      sess - session
      consentHub - consent hub
      Throws:
      ConsentHubNotExistsException - if consent hub does not exist
    • consentExists

      boolean consentExists(PerunSession sess, Consent consent)
      Check if consent exists in underlying data source.
      Parameters:
      sess - perun session
      consent - Consent to check
      Returns:
      true if consent exists in data source, false otherwise
    • consentHubExists

      boolean consentHubExists(PerunSession sess, ConsentHub consentHub)
      Returns true, if consent hub exists, false otherwise.
      Parameters:
      sess - session
      consentHub - consent hub
      Returns:
      whether consent hub exists
    • createConsent

      Consent createConsent(PerunSession perunSession, Consent consent) throws ConsentExistsException
      Save consent to database.
      Parameters:
      perunSession - PerunSession
      consent - Consent
      Returns:
      created consent
      Throws:
      ConsentExistsException - if consent already exists
    • createConsentHub

      ConsentHub createConsentHub(PerunSession perunSession, ConsentHub consentHub)
      Creates new consent hub.
      Parameters:
      perunSession - session
      consentHub - consent hub
      Returns:
      new consent hub
    • deleteConsent

      void deleteConsent(PerunSession perunSession, Consent consent) throws ConsentNotExistsException
      Delete consent from the database.
      Parameters:
      perunSession - PerunSession
      consent - Consent
      Throws:
      ConsentNotExistsException - if consent doesn't exist
    • deleteConsentHub

      void deleteConsentHub(PerunSession perunSession, ConsentHub consentHub) throws ConsentHubAlreadyRemovedException
      Deletes the consent hub.
      Parameters:
      perunSession - session
      consentHub - consent hub
      Throws:
      ConsentHubAlreadyRemovedException
    • getAllConsentHubs

      List<ConsentHub> getAllConsentHubs(PerunSession sess)
      Get list of all Consent Hubs
      Parameters:
      sess - perun session
      Returns:
      list of Consent Hubs
      Throws:
      InternalErrorException - if an exception occurred
    • getAllConsents

      List<Consent> getAllConsents(PerunSession sess)
      Gel all consents
      Parameters:
      sess - PerunSession
      Returns:
      all existing consents in the database
    • getConsentById

      Consent getConsentById(PerunSession sess, int id) throws ConsentNotExistsException
      Get consent object with specified id
      Parameters:
      sess - perun session
      id - id of desired consent object
      Returns:
      consent object with specified id
      Throws:
      ConsentNotExistsException - thrown if consent with the id doesn't exist
    • getConsentForUserAndConsentHub

      Consent getConsentForUserAndConsentHub(PerunSession sess, int userId, int consentHubId, ConsentStatus status) throws ConsentNotExistsException
      Get consent for chosen user in specified consent hub with specified status
      Parameters:
      sess - PerunSession
      userId - id of the user
      consentHubId - id of the consent hub
      status - chosen status
      Returns:
      consent for chosen user in specified consent hub with specified status
      Throws:
      ConsentNotExistsException - if consent doesn't exist
    • getConsentHubByFacility

      ConsentHub getConsentHubByFacility(PerunSession sess, int facilityId) throws ConsentHubNotExistsException
      Finds existing Consent Hub by facility.
      Parameters:
      sess - perun session
      facilityId - facility for which consent hub is searched
      Returns:
      found Consent Hub
      Throws:
      ConsentHubNotExistsException - if Consent Hub with the specified name doesn't exist
      InternalErrorException - if an exception occurred
    • getConsentHubById

      ConsentHub getConsentHubById(PerunSession sess, int id) throws ConsentHubNotExistsException
      Finds existing Consent Hub by id.
      Parameters:
      sess - perun session
      id - id of the Consent Hub you are looking for
      Returns:
      found Consent Hub
      Throws:
      ConsentHubNotExistsException - if Consent Hub with the specified id doesn't exist
      InternalErrorException - if an exception occurred
    • getConsentHubByName

      ConsentHub getConsentHubByName(PerunSession sess, String name) throws ConsentHubNotExistsException
      Finds existing Consent Hub by name.
      Parameters:
      sess - perun session
      name - name of the Consent Hub you are looking for
      Returns:
      found Consent Hub
      Throws:
      ConsentHubNotExistsException - if Consent Hub with the specified name doesn't exist
      InternalErrorException - if an exception occurred
    • getConsentHubsByService

      List<ConsentHub> getConsentHubsByService(PerunSession session, int serviceId)
      Finds all existing Consent Hubs by service (service is assigned to them)
      Parameters:
      session - perun session
      serviceId - service for which consent hubs are searched
      Returns:
      list of consent hubs that have given service assigned to them
    • getConsentsForConsentHub

      List<Consent> getConsentsForConsentHub(PerunSession sess, int id, ConsentStatus status)
      Get all consents for chosen ConsentHub with the specified status
      Parameters:
      sess - PerunSession
      id - id of the ConsentHub
      status - status of the consent
      Returns:
      consents for chosen ConsentHub with the specified status
    • getConsentsForConsentHub

      List<Consent> getConsentsForConsentHub(PerunSession sess, int id)
      Get all consents for chosen ConsentHub
      Parameters:
      sess - PerunSession
      id - id of the ConsentHub
      Returns:
      consents for chosen ConsentHub
    • getConsentsForUser

      List<Consent> getConsentsForUser(PerunSession sess, int id, ConsentStatus status)
      Get all consents for chosen User with the specified status
      Parameters:
      sess - PerunSession
      id - id of the User
      status - status of the consent
      Returns:
      consents for chosen User with the specified status
    • getConsentsForUser

      List<Consent> getConsentsForUser(PerunSession sess, int id)
      Get all consents for chosen User
      Parameters:
      sess - PerunSession
      id - id of the user
      Returns:
      consents for chosen User
    • getConsentsForUserAndConsentHub

      List<Consent> getConsentsForUserAndConsentHub(PerunSession sess, int userId, int consentHubId)
      Get list of consents for user and consent hub
      Parameters:
      sess - PerunSession
      userId - id of the user
      consentHubId - id of the consent hub
      Returns:
      list of consents for the user and consent hub
    • getFacilitiesForConsentHub

      List<Facility> getFacilitiesForConsentHub(ConsentHub consentHub)
      Get list of all facilities associated to the given Consent Hub
      Parameters:
      consentHub - Consent Hub
      Returns:
      list of facilities
    • removeFacility

      void removeFacility(PerunSession sess, ConsentHub consentHub, Facility facility) throws RelationNotExistsException
      Removes facility from consent hub.
      Parameters:
      sess - session
      consentHub - consent hub
      facility - facility to be removed
      Throws:
      RelationNotExistsException - if facility is not assigned to consent hub
    • updateConsentHub

      void updateConsentHub(PerunSession perunSession, ConsentHub consentHub) throws ConsentHubExistsException
      Updates the consent hub. Ignores related facilities.
      Parameters:
      perunSession - session
      consentHub - consent hub
      Throws:
      ConsentHubExistsException - if consent hub with the same name exists