Package cz.metacentrum.perun.core.impl
Class ConsentsManagerImpl
java.lang.Object
cz.metacentrum.perun.core.impl.ConsentsManagerImpl
- All Implemented Interfaces:
ConsentsManagerImplApi
Consents database logic.
- Author:
- Radoslav Čerhák invalid input: '<'r.cerhak@gmail.com>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final RowMapper<ConsentHub> protected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFacility(PerunSession sess, ConsentHub consentHub, Facility facility) Adds facility to consent hub.voidchangeConsentStatus(PerunSession sess, Consent consent) Set consent statusvoidcheckConsentExists(PerunSession sess, Consent consent) Check if consent exists in underlying data source.voidcheckConsentHubExists(PerunSession sess, ConsentHub consentHub) Throws exception if consent hub does not exist.booleanconsentExists(PerunSession sess, Consent consent) Check if consent exists in underlying data source.booleanconsentHubExists(PerunSession sess, ConsentHub consentHub) Returns true, if consent hub exists, false otherwise.createConsent(PerunSession perunSession, Consent consent) Save consent to database.createConsentHub(PerunSession sess, ConsentHub consentHub) Creates new consent hub.voiddeleteConsent(PerunSession perunSession, Consent consent) Delete consent from the database.voiddeleteConsentHub(PerunSession perunSession, ConsentHub consentHub) Deletes the consent hub.Get list of all Consent HubsgetAllConsents(PerunSession sess) Gel all consentsgetConsentById(PerunSession sess, int id) Get consent object with specified idgetConsentForUserAndConsentHub(PerunSession sess, int userId, int consentHubId, ConsentStatus status) Get consent for chosen user in specified consent hub with specified statusgetConsentHubByFacility(PerunSession sess, int facilityId) Finds existing Consent Hub by facility.getConsentHubById(PerunSession sess, int id) Finds existing Consent Hub by id.getConsentHubByName(PerunSession sess, String name) Finds existing Consent Hub by name.getConsentHubsByService(PerunSession session, int serviceId) Finds all existing Consent Hubs by service (service is assigned to them)getConsentsForConsentHub(PerunSession sess, int id) Get all consents for chosen ConsentHubgetConsentsForConsentHub(PerunSession sess, int id, ConsentStatus status) Get all consents for chosen ConsentHub with the specified statusgetConsentsForUser(PerunSession sess, int id) Get all consents for chosen UsergetConsentsForUser(PerunSession sess, int id, ConsentStatus status) Get all consents for chosen User with the specified statusgetConsentsForUserAndConsentHub(PerunSession sess, int userId, int consentHubId) Get list of consents for user and consent hubgetFacilitiesForConsentHub(ConsentHub consentHub) Get list of all facilities associated to the given Consent HubvoidremoveFacility(PerunSession sess, ConsentHub consentHub, Facility facility) Removes facility from consent hub.voidupdateConsentHub(PerunSession sess, ConsentHub consentHub) Updates the consent hub.
-
Field Details
-
CONSENT_HUB_MAPPING_SELECT_QUERY
- See Also:
-
CONSENT_HUB_MAPPER
-
-
Constructor Details
-
ConsentsManagerImpl
-
-
Method Details
-
addFacility
public void addFacility(PerunSession sess, ConsentHub consentHub, Facility facility) throws FacilityAlreadyAssigned Description copied from interface:ConsentsManagerImplApiAdds facility to consent hub.- Specified by:
addFacilityin interfaceConsentsManagerImplApi- Parameters:
sess- sessionconsentHub- consent hubfacility- facility to be added- Throws:
FacilityAlreadyAssigned- if facility is already assigned to consent hub
-
changeConsentStatus
Description copied from interface:ConsentsManagerImplApiSet consent status- Specified by:
changeConsentStatusin interfaceConsentsManagerImplApi- Parameters:
sess- perun sessionconsent- consent
-
checkConsentExists
Description copied from interface:ConsentsManagerImplApiCheck if consent exists in underlying data source.- Specified by:
checkConsentExistsin interfaceConsentsManagerImplApi- Parameters:
sess- PerunSessionconsent- Consent to check- Throws:
ConsentNotExistsException- if consent doesn't exist
-
checkConsentHubExists
public void checkConsentHubExists(PerunSession sess, ConsentHub consentHub) throws ConsentHubNotExistsException Description copied from interface:ConsentsManagerImplApiThrows exception if consent hub does not exist.- Specified by:
checkConsentHubExistsin interfaceConsentsManagerImplApi- Parameters:
sess- sessionconsentHub- consent hub- Throws:
ConsentHubNotExistsException- if consent hub does not exist
-
consentExists
Description copied from interface:ConsentsManagerImplApiCheck if consent exists in underlying data source.- Specified by:
consentExistsin interfaceConsentsManagerImplApi- Parameters:
sess- perun sessionconsent- Consent to check- Returns:
- true if consent exists in data source, false otherwise
-
consentHubExists
Description copied from interface:ConsentsManagerImplApiReturns true, if consent hub exists, false otherwise.- Specified by:
consentHubExistsin interfaceConsentsManagerImplApi- Parameters:
sess- sessionconsentHub- consent hub- Returns:
- whether consent hub exists
-
createConsent
public Consent createConsent(PerunSession perunSession, Consent consent) throws ConsentExistsException Description copied from interface:ConsentsManagerImplApiSave consent to database.- Specified by:
createConsentin interfaceConsentsManagerImplApi- Parameters:
perunSession- PerunSessionconsent- Consent- Returns:
- created consent
- Throws:
ConsentExistsException- if consent already exists
-
createConsentHub
Description copied from interface:ConsentsManagerImplApiCreates new consent hub.- Specified by:
createConsentHubin interfaceConsentsManagerImplApi- Parameters:
sess- sessionconsentHub- consent hub- Returns:
- new consent hub
-
deleteConsent
public void deleteConsent(PerunSession perunSession, Consent consent) throws ConsentNotExistsException Description copied from interface:ConsentsManagerImplApiDelete consent from the database.- Specified by:
deleteConsentin interfaceConsentsManagerImplApi- Parameters:
perunSession- PerunSessionconsent- Consent- Throws:
ConsentNotExistsException- if consent doesn't exist
-
deleteConsentHub
public void deleteConsentHub(PerunSession perunSession, ConsentHub consentHub) throws ConsentHubAlreadyRemovedException Description copied from interface:ConsentsManagerImplApiDeletes the consent hub.- Specified by:
deleteConsentHubin interfaceConsentsManagerImplApi- Parameters:
perunSession- sessionconsentHub- consent hub- Throws:
ConsentHubAlreadyRemovedException
-
getAllConsentHubs
Description copied from interface:ConsentsManagerImplApiGet list of all Consent Hubs- Specified by:
getAllConsentHubsin interfaceConsentsManagerImplApi- Parameters:
sess- perun session- Returns:
- list of Consent Hubs
-
getAllConsents
Description copied from interface:ConsentsManagerImplApiGel all consents- Specified by:
getAllConsentsin interfaceConsentsManagerImplApi- Parameters:
sess- PerunSession- Returns:
- all existing consents in the database
-
getConsentById
Description copied from interface:ConsentsManagerImplApiGet consent object with specified id- Specified by:
getConsentByIdin interfaceConsentsManagerImplApi- Parameters:
sess- perun sessionid- id of desired consent object- Returns:
- consent object with specified id
- Throws:
ConsentNotExistsException- thrown if consent with the id doesn't exist
-
getConsentForUserAndConsentHub
public Consent getConsentForUserAndConsentHub(PerunSession sess, int userId, int consentHubId, ConsentStatus status) throws ConsentNotExistsException Description copied from interface:ConsentsManagerImplApiGet consent for chosen user in specified consent hub with specified status- Specified by:
getConsentForUserAndConsentHubin interfaceConsentsManagerImplApi- Parameters:
sess- PerunSessionuserId- id of the userconsentHubId- id of the consent hubstatus- chosen status- Returns:
- consent for chosen user in specified consent hub with specified status
- Throws:
ConsentNotExistsException- if consent doesn't exist
-
getConsentHubByFacility
public ConsentHub getConsentHubByFacility(PerunSession sess, int facilityId) throws ConsentHubNotExistsException Description copied from interface:ConsentsManagerImplApiFinds existing Consent Hub by facility.- Specified by:
getConsentHubByFacilityin interfaceConsentsManagerImplApi- Parameters:
sess- perun sessionfacilityId- facility for which consent hub is searched- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException- if Consent Hub with the specified name doesn't exist
-
getConsentHubById
Description copied from interface:ConsentsManagerImplApiFinds existing Consent Hub by id.- Specified by:
getConsentHubByIdin interfaceConsentsManagerImplApi- Parameters:
sess- perun sessionid- 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
-
getConsentHubByName
public ConsentHub getConsentHubByName(PerunSession sess, String name) throws ConsentHubNotExistsException Description copied from interface:ConsentsManagerImplApiFinds existing Consent Hub by name.- Specified by:
getConsentHubByNamein interfaceConsentsManagerImplApi- Parameters:
sess- perun sessionname- 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
-
getConsentHubsByService
Description copied from interface:ConsentsManagerImplApiFinds all existing Consent Hubs by service (service is assigned to them)- Specified by:
getConsentHubsByServicein interfaceConsentsManagerImplApi- Parameters:
session- perun sessionserviceId- service for which consent hubs are searched- Returns:
- list of consent hubs that have given service assigned to them
-
getConsentsForConsentHub
Description copied from interface:ConsentsManagerImplApiGet all consents for chosen ConsentHub with the specified status- Specified by:
getConsentsForConsentHubin interfaceConsentsManagerImplApi- Parameters:
sess- PerunSessionid- id of the ConsentHubstatus- status of the consent- Returns:
- consents for chosen ConsentHub with the specified status
-
getConsentsForConsentHub
Description copied from interface:ConsentsManagerImplApiGet all consents for chosen ConsentHub- Specified by:
getConsentsForConsentHubin interfaceConsentsManagerImplApi- Parameters:
sess- PerunSessionid- id of the ConsentHub- Returns:
- consents for chosen ConsentHub
-
getConsentsForUser
Description copied from interface:ConsentsManagerImplApiGet all consents for chosen User with the specified status- Specified by:
getConsentsForUserin interfaceConsentsManagerImplApi- Parameters:
sess- PerunSessionid- id of the Userstatus- status of the consent- Returns:
- consents for chosen User with the specified status
-
getConsentsForUser
Description copied from interface:ConsentsManagerImplApiGet all consents for chosen User- Specified by:
getConsentsForUserin interfaceConsentsManagerImplApi- Parameters:
sess- PerunSessionid- id of the user- Returns:
- consents for chosen User
-
getConsentsForUserAndConsentHub
public List<Consent> getConsentsForUserAndConsentHub(PerunSession sess, int userId, int consentHubId) Description copied from interface:ConsentsManagerImplApiGet list of consents for user and consent hub- Specified by:
getConsentsForUserAndConsentHubin interfaceConsentsManagerImplApi- Parameters:
sess- PerunSessionuserId- id of the userconsentHubId- id of the consent hub- Returns:
- list of consents for the user and consent hub
-
getFacilitiesForConsentHub
Description copied from interface:ConsentsManagerImplApiGet list of all facilities associated to the given Consent Hub- Specified by:
getFacilitiesForConsentHubin interfaceConsentsManagerImplApi- Parameters:
consentHub- Consent Hub- Returns:
- list of facilities
-
removeFacility
public void removeFacility(PerunSession sess, ConsentHub consentHub, Facility facility) throws RelationNotExistsException Description copied from interface:ConsentsManagerImplApiRemoves facility from consent hub.- Specified by:
removeFacilityin interfaceConsentsManagerImplApi- Parameters:
sess- sessionconsentHub- consent hubfacility- facility to be removed- Throws:
RelationNotExistsException- if facility is not assigned to consent hub
-
updateConsentHub
public void updateConsentHub(PerunSession sess, ConsentHub consentHub) throws ConsentHubExistsException Description copied from interface:ConsentsManagerImplApiUpdates the consent hub. Ignores related facilities.- Specified by:
updateConsentHubin interfaceConsentsManagerImplApi- Parameters:
sess- sessionconsentHub- consent hub- Throws:
ConsentHubExistsException- if consent hub with the same name exists
-