Package cz.metacentrum.perun.core.entry
Class ConsentsManagerEntry
java.lang.Object
cz.metacentrum.perun.core.entry.ConsentsManagerEntry
- All Implemented Interfaces:
ConsentsManager
Consents entry logic.
- Author:
- Radoslav Čerhák invalid input: '<'r.cerhak@gmail.com>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchangeConsentStatus
(PerunSession sess, Consent consent, ConsentStatus status) Set consent statusvoid
evaluateConsents
(PerunSession sess, ConsentHub consentHub) Evaluates consents for given consent hub with enforced consents enabled.void
evaluateConsents
(PerunSession sess, Service service) Evaluates consents for given service for all consent hubs with given service with enforced consents enabled.void
evaluateConsents
(PerunSession sess, List<ConsentHub> consentHubs) Evaluates consents for given list of consent hubs with enforced consents enabled.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.getConsentHubByResource
(PerunSession sess, int resourceId) Finds existing Consent Hub for facility to which resource belongs.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 statusgetConsentsForConsentHubByResource
(PerunSession sess, int resourceId) Get consents for members assigned to the chosen resource.getConsentsForUser
(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 all consents for chosen User in specified consent hubvoid
setConsentsManagerBl
(ConsentsManagerBl consentsManagerBl) void
setPerunBl
(PerunBl perunBl) updateConsentHub
(PerunSession sess, ConsentHub consentHub) Updates the consent hub.
-
Constructor Details
-
ConsentsManagerEntry
-
ConsentsManagerEntry
public ConsentsManagerEntry()
-
-
Method Details
-
changeConsentStatus
public Consent changeConsentStatus(PerunSession sess, Consent consent, ConsentStatus status) throws ConsentNotExistsException, PrivilegeException, InvalidConsentStatusException, UserNotExistsException Description copied from interface:ConsentsManager
Set consent status- Specified by:
changeConsentStatus
in interfaceConsentsManager
- Parameters:
sess
- perun sessionconsent
- consentstatus
- status that should be set- Returns:
- consent
- Throws:
ConsentNotExistsException
- if consent hub does not existPrivilegeException
- if insufficient rightsInvalidConsentStatusException
- if passed status value can not be setUserNotExistsException
- if user does not exist
-
evaluateConsents
Description copied from interface:ConsentsManager
Evaluates consents for given consent hub with enforced consents enabled.Service defines whether only active users will be evaluated or expired ones as well.
- Specified by:
evaluateConsents
in interfaceConsentsManager
- Parameters:
sess
- sessionconsentHub
- consent hub- Throws:
PrivilegeException
-
evaluateConsents
public void evaluateConsents(PerunSession sess, List<ConsentHub> consentHubs) throws PrivilegeException Description copied from interface:ConsentsManager
Evaluates consents for given list of consent hubs with enforced consents enabled.Service defines whether only active users will be evaluated or expired ones as well.
- Specified by:
evaluateConsents
in interfaceConsentsManager
- Parameters:
sess
- sessionconsentHubs
- consent hubs- Throws:
PrivilegeException
-
evaluateConsents
Description copied from interface:ConsentsManager
Evaluates consents for given service for all consent hubs with given service with enforced consents enabled.Corresponding consent hubs (containing the service) will have consents evaluated ONLY for selected service. Service defines whether only active users will be evaluated or expired ones as well. If new consent is created, attributes from ALL services under given consent hub are gathered for it.
- Specified by:
evaluateConsents
in interfaceConsentsManager
- Parameters:
sess
- sessionservice
- service- Throws:
PrivilegeException
-
getAllConsentHubs
Description copied from interface:ConsentsManager
Get list of all Consent Hubs- Specified by:
getAllConsentHubs
in interfaceConsentsManager
- Parameters:
sess
- perun session- Returns:
- list of Consent Hubs
- Throws:
PrivilegeException
-
getAllConsents
Description copied from interface:ConsentsManager
Gel all consents- Specified by:
getAllConsents
in interfaceConsentsManager
- Parameters:
sess
-- Returns:
- all existing consents in the database
- Throws:
PrivilegeException
-
getConsentById
public Consent getConsentById(PerunSession sess, int id) throws ConsentNotExistsException, PrivilegeException Description copied from interface:ConsentsManager
Get consent object with specified id- Specified by:
getConsentById
in interfaceConsentsManager
- Parameters:
sess
-id
- id of desired consent object- Returns:
- consent object with specified id
- Throws:
ConsentNotExistsException
- thrown if consent with the id doesn't existPrivilegeException
-
getConsentForUserAndConsentHub
public Consent getConsentForUserAndConsentHub(PerunSession sess, int userId, int consentHubId, ConsentStatus status) throws PrivilegeException, UserNotExistsException, ConsentHubNotExistsException, ConsentNotExistsException Description copied from interface:ConsentsManager
Get consent for chosen user in specified consent hub with specified status- Specified by:
getConsentForUserAndConsentHub
in interfaceConsentsManager
- Parameters:
sess
-userId
- id of the userconsentHubId
- id of the consent hubstatus
- status of the consent- Returns:
- Throws:
PrivilegeException
UserNotExistsException
ConsentHubNotExistsException
ConsentNotExistsException
-
getConsentHubByFacility
public ConsentHub getConsentHubByFacility(PerunSession sess, int facilityId) throws ConsentHubNotExistsException, PrivilegeException, FacilityNotExistsException Description copied from interface:ConsentsManager
Finds existing Consent Hub by facility.- Specified by:
getConsentHubByFacility
in interfaceConsentsManager
- Parameters:
sess
- perun sessionfacilityId
- id of facility for which consent hub is searched- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
PrivilegeException
FacilityNotExistsException
-
getConsentHubById
public ConsentHub getConsentHubById(PerunSession sess, int id) throws ConsentHubNotExistsException, PrivilegeException Description copied from interface:ConsentsManager
Finds existing Consent Hub by id.- Specified by:
getConsentHubById
in interfaceConsentsManager
- Parameters:
sess
- perun sessionid
- id of the Consent Hub you are looking for- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
PrivilegeException
-
getConsentHubByName
public ConsentHub getConsentHubByName(PerunSession sess, String name) throws ConsentHubNotExistsException, PrivilegeException Description copied from interface:ConsentsManager
Finds existing Consent Hub by name.- Specified by:
getConsentHubByName
in interfaceConsentsManager
- Parameters:
sess
- perun sessionname
- name of the Consent Hub you are looking for- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
PrivilegeException
-
getConsentHubByResource
public ConsentHub getConsentHubByResource(PerunSession sess, int resourceId) throws ConsentHubNotExistsException, PrivilegeException, FacilityNotExistsException, ResourceNotExistsException Description copied from interface:ConsentsManager
Finds existing Consent Hub for facility to which resource belongs.- Specified by:
getConsentHubByResource
in interfaceConsentsManager
- Parameters:
sess
- perun sessionresourceId
- id of resource- Returns:
- found Consent Hub
- Throws:
ConsentHubNotExistsException
PrivilegeException
FacilityNotExistsException
ResourceNotExistsException
-
getConsentsForConsentHub
public List<Consent> getConsentsForConsentHub(PerunSession sess, int id, ConsentStatus status) throws PrivilegeException, ConsentHubNotExistsException Description copied from interface:ConsentsManager
Get all consents for chosen ConsentHub with the specified status- Specified by:
getConsentsForConsentHub
in interfaceConsentsManager
- Parameters:
sess
-id
- id of the ConsentHubstatus
- status of the consent- Returns:
- consents for chosen ConsentHub with the specified status
- Throws:
PrivilegeException
ConsentHubNotExistsException
-
getConsentsForConsentHub
public List<Consent> getConsentsForConsentHub(PerunSession sess, int id) throws PrivilegeException, ConsentHubNotExistsException Description copied from interface:ConsentsManager
Get all consents for chosen ConsentHub- Specified by:
getConsentsForConsentHub
in interfaceConsentsManager
- Parameters:
sess
-id
- id of the ConsentHub- Returns:
- consents for chosen ConsentHub
- Throws:
PrivilegeException
ConsentHubNotExistsException
-
getConsentsForConsentHubByResource
public List<Consent> getConsentsForConsentHubByResource(PerunSession sess, int resourceId) throws PrivilegeException, ConsentHubNotExistsException, FacilityNotExistsException, ResourceNotExistsException Description copied from interface:ConsentsManager
Get consents for members assigned to the chosen resource.- Specified by:
getConsentsForConsentHubByResource
in interfaceConsentsManager
- Parameters:
sess
- sessionresourceId
- id of resource- Returns:
- consents for corresponding ConsentHub
- Throws:
PrivilegeException
ConsentHubNotExistsException
FacilityNotExistsException
ResourceNotExistsException
-
getConsentsForUser
public List<Consent> getConsentsForUser(PerunSession sess, int id, ConsentStatus status) throws UserNotExistsException, PrivilegeException Description copied from interface:ConsentsManager
Get all consents for chosen User with the specified status- Specified by:
getConsentsForUser
in interfaceConsentsManager
- Parameters:
sess
-id
- id of the Userstatus
- status of the consent- Returns:
- consents for chosen User with the specified status
- Throws:
UserNotExistsException
PrivilegeException
-
getConsentsForUser
public List<Consent> getConsentsForUser(PerunSession sess, int id) throws UserNotExistsException, PrivilegeException Description copied from interface:ConsentsManager
Get all consents for chosen User- Specified by:
getConsentsForUser
in interfaceConsentsManager
- Parameters:
sess
-id
- id of the user- Returns:
- consents for chosen User
- Throws:
UserNotExistsException
PrivilegeException
-
getConsentsForUserAndConsentHub
public List<Consent> getConsentsForUserAndConsentHub(PerunSession sess, int userId, int consentHubId) throws PrivilegeException, UserNotExistsException, ConsentHubNotExistsException Description copied from interface:ConsentsManager
Get all consents for chosen User in specified consent hub- Specified by:
getConsentsForUserAndConsentHub
in interfaceConsentsManager
- Parameters:
sess
-userId
- id of the userconsentHubId
- id of the consent hub- Returns:
- Throws:
PrivilegeException
UserNotExistsException
ConsentHubNotExistsException
-
getConsentsManagerBl
-
getPerunBl
-
setConsentsManagerBl
-
setPerunBl
-
updateConsentHub
public ConsentHub updateConsentHub(PerunSession sess, ConsentHub consentHub) throws ConsentHubNotExistsException, PrivilegeException, ConsentHubExistsException Description copied from interface:ConsentsManager
Updates the consent hub. Ignores related facilities.- Specified by:
updateConsentHub
in interfaceConsentsManager
- Parameters:
sess
- sessionconsentHub
- consent hub- Returns:
- updated consent hub
- Throws:
ConsentHubNotExistsException
- if consent hub does not existPrivilegeException
- insufficient rightsConsentHubExistsException
- if consent hub with the same name already exists
-