Interface FacilitiesManagerImplApi
- All Known Implementing Classes:
FacilitiesManagerImpl
public interface FacilitiesManagerImplApi
Facility manager can create a new facility or find an existing facility.
You must get an instance of FacilityManager from PerunSession:
PerunSession perunSession = ...; FacilityManager gm = perunSession.getPerun().getFacilityManager();
- Author:
- Michal Prochazka, Slavek Licehammer
-
Method Summary
Modifier and TypeMethodDescriptionaddHost
(PerunSession perunSession, Host host, Facility facility) Adds host to the Facility.void
addOwner
(PerunSession perunSession, Facility facility, Owner owner) Add owner of the facilityvoid
assignSecurityTeam
(PerunSession sess, Facility facility, SecurityTeam securityTeam) Assign given security team to given facility (means the facility trusts the security team)boolean
banExists
(PerunSession sess, int banId) Get true if any band defined by id exists for any user and facility.boolean
banExists
(PerunSession sess, int userId, int facilityId) Get true if any ban for user and facility exists.void
checkFacilityExists
(PerunSession perunSession, Facility facility) Check if facility exists in underlaying data source.void
checkHostExists
(PerunSession sess, Host host) void
checkSecurityTeamAssigned
(PerunSession sess, Facility facility, SecurityTeam securityTeam) Check if security team is assigned to facility.void
checkSecurityTeamNotAssigned
(PerunSession sess, Facility facility, SecurityTeam securityTeam) Check if security team is not assigned to facility.createFacility
(PerunSession perunSession, Facility facility) Inserts facility into DB.void
deleteFacility
(PerunSession perunSession, Facility facility) Deletes facility by id.void
deleteFacilityOwners
(PerunSession perunSession, Facility facility) Deletes all facility owners.boolean
facilityExists
(PerunSession perunSession, Facility facility) Check if facility exists in underlaying data source.getAdminGroups
(PerunSession sess, Facility facility) Gets list of all group administrators of the Facility.getAdmins
(PerunSession sess, Facility facility) Gets list of all user administrators of the Facility.Get all expired bans on any facility to now dategetAllowedFacilities
(PerunSession sess, Member member) Return all allowed facilities of the member.getAllowedFacilities
(PerunSession sess, User user) Return all allowed facilities of the user.getAllowedMembers
(PerunSession sess, Facility facility) Return all members, which are "allowed" on facility through any resource disregarding their possible expired status in a group.getAllowedMembers
(PerunSession sess, Facility facility, Service service) Return all members, which are "allowed" on facility through any resource assigned to the given service.getAllowedUsers
(PerunSession sess, Facility facility) Return all users, which are "allowed" on facility through any member/resource.getAllowedVos
(PerunSession perunSession, Facility facility) Return all VO which can use this facility.getAssignedFacilities
(PerunSession sess, SecurityTeam securityTeam) Get facilities where security team is assigned.getAssignedResources
(PerunSession perunSession, Facility facility) Returns all resources assigned to the facility.getAssignedResources
(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService) Returns all resources assigned to the facility with optionally VO and Service specified.getAssignedRichResources
(PerunSession perunSession, Facility facility) Returns all rich resources assigned to the facility.getAssignedRichResources
(PerunSession perunSession, Facility facility, Service service) Returns all rich resources assigned to the facility and service.getAssignedSecurityTeams
(PerunSession sess, Facility facility) Return all security teams which specific facility trustsgetAssignedUsers
(PerunSession sess, Facility facility) Return all users assigned to Facility.getAssignedUsers
(PerunSession sess, Facility facility, Service service) Returns list of Users assigned with chosen Facility containing resources where service is assigned.getAssociatedMembers
(PerunSession sess, Facility facility, User user) Return all members, which are associated with the facility and belong to given user.getAssociatedUsers
(PerunSession sess, Facility facility) Return all users, which are associated with facility through any member/resource.getBan
(PerunSession sess, int userId, int faclityId) Get specific facility ban.getBanById
(PerunSession sess, int banId) Get Ban for user on facility by it's idgetBansForFacility
(PerunSession sess, int facilityId) Get all users bans for facilitygetBansForUser
(PerunSession sess, int userId) Get all facilities bans for user.getDirectAdmins
(PerunSession perunSession, Facility facility) Gets list of direct user administrators of the Facility.getFacilities
(PerunSession perunSession) List all facilities.getFacilitiesByAttribute
(PerunSession sess, Attribute attribute) Returns all facilities which have set the attribute with the value.getFacilitiesByAttributePartialMatch
(PerunSession sess, AttributeDefinition attrDef, String value) Partial search for facilities with the attribute 'attrDef' set to a similar value to 'value'getFacilitiesByDestination
(PerunSession perunSession, String destination) Searches for the Facilities by theirs destination.getFacilitiesByHostName
(PerunSession sess, String hostname) Return all facilities where exists host with the specific hostnamegetFacilitiesByIds
(PerunSession perunSession, List<Integer> ids) Gets facilities by their ids.int
getFacilitiesCount
(PerunSession perunSession) Get count of all facilities.getFacilitiesWhereUserIsAdmin
(PerunSession sess, User user) Get all facilities where the user is admin.getFacilityById
(PerunSession perunSession, int id) Searches for the Facility with specified id.getFacilityByName
(PerunSession perunSession, String name) Searches for the Facility by its name.getFacilityForHost
(PerunSession sess, Host host) Return facility which has the host.getHostById
(PerunSession sess, int id) Get the host by its ID.getHosts
(PerunSession perunSession, Facility facility) List hosts from facility.getHostsByHostname
(PerunSession sess, String hostname) Get all hosts with this hostname (from all facilities).int
getHostsCount
(PerunSession perunSession, Facility facility) Count hosts in the facility.getOwnerFacilities
(PerunSession perunSession, Owner owner) Returns list of all facilities owned by the owner.getOwners
(PerunSession perunSession, Facility facility) Returns owners of the facility.boolean
hostExists
(PerunSession sess, Host host) void
removeAllServiceDenials
(int facilityId) Remove all service denials on given facility.void
removeBan
(PerunSession sess, int banId) Remove ban by id from facilities bans.void
removeBan
(PerunSession sess, int userId, int facilityId) Remove ban by user_id and facility_id.void
removeHost
(PerunSession perunSession, Host host) Remove hosts from the Facility.void
removeOwner
(PerunSession perunSession, Facility facility, Owner owner) Remove owner of the facilityvoid
removeSecurityTeam
(PerunSession sess, Facility facility, SecurityTeam securityTeam) Remove (Unassign) given security team from given facilitysetBan
(PerunSession sess, BanOnFacility banOnFacility) Set ban for user on facilityvoid
setOwners
(PerunSession perunSession, Facility facility, List<Owner> owners) Updates owners of facilityupdateBan
(PerunSession sess, BanOnFacility banOnFacility) Update description and validity timestamp of specific ban.updateFacility
(PerunSession perunSession, Facility facility) Updates facility in DB.
-
Method Details
-
addHost
Adds host to the Facility.- Parameters:
perunSession
-host
-facility
- return host
-
addOwner
void addOwner(PerunSession perunSession, Facility facility, Owner owner) throws OwnerAlreadyAssignedException Add owner of the facility- Parameters:
perunSession
-facility
-owner
-- Throws:
InternalErrorException
OwnerAlreadyAssignedException
-
assignSecurityTeam
Assign given security team to given facility (means the facility trusts the security team)- Parameters:
sess
-facility
-securityTeam
-- Throws:
InternalErrorException
-
banExists
Get true if any ban for user and facility exists.- Parameters:
sess
-userId
- id of userfacilityId
- id of facility- Returns:
- true if ban exists
- Throws:
InternalErrorException
-
banExists
Get true if any band defined by id exists for any user and facility.- Parameters:
sess
-banId
- id of ban- Returns:
- true if ban exists
- Throws:
InternalErrorException
-
checkFacilityExists
void checkFacilityExists(PerunSession perunSession, Facility facility) throws FacilityNotExistsException Check if facility exists in underlaying data source.- Parameters:
perunSession
-facility
-- Throws:
InternalErrorException
FacilityNotExistsException
-
checkHostExists
- Throws:
HostNotExistsException
-
checkSecurityTeamAssigned
void checkSecurityTeamAssigned(PerunSession sess, Facility facility, SecurityTeam securityTeam) throws SecurityTeamNotAssignedException Check if security team is assigned to facility. Throw exception info not.- Parameters:
sess
-facility
-securityTeam
-- Throws:
InternalErrorException
SecurityTeamNotAssignedException
-
checkSecurityTeamNotAssigned
void checkSecurityTeamNotAssigned(PerunSession sess, Facility facility, SecurityTeam securityTeam) throws SecurityTeamAlreadyAssignedException Check if security team is not assigned to facility. Throw exception info is.- Parameters:
sess
-facility
-securityTeam
-- Throws:
InternalErrorException
SecurityTeamAlreadyAssignedException
-
createFacility
Inserts facility into DB.- Parameters:
perunSession
-facility
-- Throws:
InternalErrorException
-
deleteFacility
void deleteFacility(PerunSession perunSession, Facility facility) throws FacilityAlreadyRemovedException Deletes facility by id.- Parameters:
perunSession
-facility
-- Throws:
InternalErrorException
FacilityAlreadyRemovedException
- if there are 0 rows affected by delete from DB
-
deleteFacilityOwners
Deletes all facility owners.- Parameters:
perunSession
-facility
-- Throws:
InternalErrorException
-
facilityExists
Check if facility exists in underlaying data source.- Parameters:
perunSession
-facility
-- Returns:
- true if facility exists in underlaying data source, false otherwise
- Throws:
InternalErrorException
-
getAdminGroups
Gets list of all group administrators of the Facility.- Parameters:
sess
-facility
-- Returns:
- list of groups who are admins in the facility
- Throws:
InternalErrorException
-
getAdmins
Gets list of all user administrators of the Facility. If some group is administrator of the given group, all VALID members are included in the list.- Parameters:
sess
-facility
-- Returns:
- list of users who are admins in the facility
- Throws:
InternalErrorException
-
getAllExpiredBansOnFacilities
Get all expired bans on any facility to now date- Parameters:
sess
-- Returns:
- list of expired bans for any facility
- Throws:
InternalErrorException
-
getAllowedFacilities
Return all allowed facilities of the user. It means all facilities, where is assigned through some resource and member is allowed on such resource.- Parameters:
sess
-user
-- Returns:
- List of allowed facilities of the user.
-
getAllowedFacilities
Return all allowed facilities of the member. It means all facilities, where is assigned through some resource and member is allowed.- Parameters:
sess
-member
-- Returns:
- List of allowed facilities of the member.
-
getAllowedMembers
Return all members, which are "allowed" on facility through any resource disregarding their possible expired status in a group. All members include all group statuses, through which they can be filtered if necessary.- Parameters:
sess
-facility
-- Returns:
- list of allowed members
- Throws:
InternalErrorException
-
getAllowedMembers
Return all members, which are "allowed" on facility through any resource assigned to the given service. Service settings decide whether expired group and expired VO members are returned as well. Disabled and invalid VO members are always ignored.- Parameters:
sess
-facility
-service
-- Returns:
- list of allowed members
-
getAllowedUsers
Return all users, which are "allowed" on facility through any member/resource.- Parameters:
sess
-facility
-- Returns:
- list of allowed users
-
getAllowedVos
Return all VO which can use this facility. (VO must have the resource which belongs to this facility).- Parameters:
perunSession
-facility
-- Returns:
- list of Vos
- Throws:
InternalErrorException
-
getAssignedFacilities
Get facilities where security team is assigned.- Parameters:
sess
-securityTeam
-- Returns:
- Throws:
InternalErrorException
-
getAssignedResources
Returns all resources assigned to the facility.- Parameters:
perunSession
-facility
-- Returns:
- list of resources assigned to the facility
- Throws:
InternalErrorException
-
getAssignedResources
List<Resource> getAssignedResources(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService) Returns all resources assigned to the facility with optionally VO and Service specified.- Parameters:
perunSession
-facility
-specificVo
-specificService
-- Returns:
- list of resources assigned to the facility with optionally filter for VO and Service.
- Throws:
InternalErrorException
-
getAssignedRichResources
Returns all rich resources assigned to the facility.- Parameters:
perunSession
-facility
-- Returns:
- list of rich resources assigned to the facility
- Throws:
InternalErrorException
-
getAssignedRichResources
List<RichResource> getAssignedRichResources(PerunSession perunSession, Facility facility, Service service) Returns all rich resources assigned to the facility and service.- Parameters:
perunSession
-facility
-service
-- Returns:
- list of rich resources assigned to the facility and service
- Throws:
InternalErrorException
-
getAssignedSecurityTeams
Return all security teams which specific facility trusts- Parameters:
sess
-facility
- specific facility- Returns:
- list of assigned security teams
- Throws:
InternalErrorException
-
getAssignedUsers
Return all users assigned to Facility.- Parameters:
sess
-facility
-- Returns:
- list of user
- Throws:
InternalErrorException
-
getAssignedUsers
Returns list of Users assigned with chosen Facility containing resources where service is assigned.- Parameters:
sess
-facility
-service
-- Returns:
- list of Users
- Throws:
InternalErrorException
-
getAssociatedMembers
Return all members, which are associated with the facility and belong to given user. Does not require ACTIVE group-resource status or any specific member status.- Parameters:
sess
-facility
-user
-- Returns:
- list of associated members
- Throws:
InternalErrorException
-
getAssociatedUsers
Return all users, which are associated with facility through any member/resource. Does not require ACTIVE group-resource status.- Parameters:
sess
-facility
-- Returns:
- list of allowed users
-
getBan
Get specific facility ban.- Parameters:
sess
-userId
- the user idfaclityId
- the facility id- Returns:
- specific facility ban
- Throws:
InternalErrorException
BanNotExistsException
-
getBanById
Get Ban for user on facility by it's id- Parameters:
sess
-banId
- the ban id- Returns:
- facility ban by it's id
- Throws:
InternalErrorException
BanNotExistsException
-
getBansForFacility
Get all users bans for facility- Parameters:
sess
-facilityId
- the facility id- Returns:
- list of all users bans on facility
- Throws:
InternalErrorException
-
getBansForUser
Get all facilities bans for user.- Parameters:
sess
-userId
- the user id- Returns:
- list of bans for user on any facility
- Throws:
InternalErrorException
-
getDirectAdmins
Gets list of direct user administrators of the Facility. 'Direct' means, there aren't included users, who are members of group administrators, in the returned list.- Parameters:
perunSession
-facility
-- Throws:
InternalErrorException
-
getFacilities
List all facilities.- Parameters:
perunSession
-- Returns:
- List of all Facilities within the Perun
- Throws:
InternalErrorException
-
getFacilitiesByAttribute
Returns all facilities which have set the attribute with the value. Searching only def and opt attributes.- Parameters:
sess
-attribute
-- Returns:
- Throws:
InternalErrorException
-
getFacilitiesByAttributePartialMatch
List<Facility> getFacilitiesByAttributePartialMatch(PerunSession sess, AttributeDefinition attrDef, String value) Partial search for facilities with the attribute 'attrDef' set to a similar value to 'value'- Parameters:
sess
-attrDef
-- Returns:
- Throws:
InternalErrorException
-
getFacilitiesByDestination
List<Facility> getFacilitiesByDestination(PerunSession perunSession, String destination) throws FacilityNotExistsException Searches for the Facilities by theirs destination.- Parameters:
perunSession
-destination
-- Returns:
- Facility with specified name
- Throws:
FacilityNotExistsException
InternalErrorException
-
getFacilitiesByHostName
Return all facilities where exists host with the specific hostname- Parameters:
sess
-hostname
- specific hostname- Returns:
- Throws:
InternalErrorException
-
getFacilitiesByIds
Gets facilities by their ids. Silently skips non-existing facilities.- Parameters:
perunSession
-ids
-- Returns:
- list of facilities with specified ids
- Throws:
InternalErrorException
-
getFacilitiesCount
Get count of all facilities.- Parameters:
perunSession
-- Returns:
- count of all facilities
- Throws:
InternalErrorException
-
getFacilitiesWhereUserIsAdmin
Get all facilities where the user is admin. Including facilities, where the user is a VALID member of authorized group.- Parameters:
sess
-user
-- Returns:
- list of facilities
- Throws:
InternalErrorException
-
getFacilityById
Searches for the Facility with specified id.- Parameters:
perunSession
-id
-- Returns:
- Facility with specified id
- Throws:
FacilityNotExistsException
InternalErrorException
-
getFacilityByName
Facility getFacilityByName(PerunSession perunSession, String name) throws FacilityNotExistsException Searches for the Facility by its name.- Parameters:
perunSession
-name
-- Returns:
- Facility with specified name
- Throws:
FacilityNotExistsException
InternalErrorException
-
getFacilityForHost
Return facility which has the host.- Parameters:
sess
-host
-- Returns:
- facility
- Throws:
InternalErrorException
-
getHostById
Get the host by its ID.- Parameters:
sess
-id
-- Returns:
- host
- Throws:
HostNotExistsException
InternalErrorException
-
getHosts
List hosts from facility.- Parameters:
perunSession
-facility
-- Returns:
- hosts Hosts' id from the Cluster
- Throws:
InternalErrorException
-
getHostsByHostname
Get all hosts with this hostname (from all facilities).- Parameters:
sess
-hostname
-- Returns:
- list of hosts by hostname
- Throws:
InternalErrorException
-
getHostsCount
Count hosts in the facility.- Parameters:
perunSession
-facility
-- Returns:
- int The number of hosts present in the Cluster.
- Throws:
InternalErrorException
-
getOwnerFacilities
Returns list of all facilities owned by the owner.- Parameters:
perunSession
-owner
-- Returns:
- list of facilities owned by the owner
- Throws:
InternalErrorException
-
getOwners
Returns owners of the facility.- Parameters:
perunSession
-facility
-- Returns:
- owners of specified facility
- Throws:
InternalErrorException
-
hostExists
-
removeAllServiceDenials
void removeAllServiceDenials(int facilityId) Remove all service denials on given facility.WARNING: this method should be removed in the future if the tasks module is merged into core module.
- Parameters:
facilityId
- facility id- Throws:
InternalErrorException
- when db operation fails
-
removeBan
Remove ban by id from facilities bans.- Parameters:
sess
-banId
- id of specific ban- Throws:
InternalErrorException
BanNotExistsException
-
removeBan
Remove ban by user_id and facility_id.- Parameters:
sess
-userId
- the id of userfacilityId
- the id of facility- Throws:
InternalErrorException
BanNotExistsException
-
removeHost
Remove hosts from the Facility.- Parameters:
perunSession
-host
-- Throws:
InternalErrorException
HostAlreadyRemovedException
- if 0 rows affected by deleting from DB
-
removeOwner
void removeOwner(PerunSession perunSession, Facility facility, Owner owner) throws OwnerAlreadyRemovedException Remove owner of the facility- Parameters:
perunSession
-facility
-owner
-- Throws:
InternalErrorException
OwnerAlreadyRemovedException
-
removeSecurityTeam
Remove (Unassign) given security team from given facility- Parameters:
sess
-facility
-securityTeam
-- Throws:
InternalErrorException
-
setBan
Set ban for user on facility- Parameters:
sess
-banOnFacility
- the ban- Returns:
- ban on facility
- Throws:
InternalErrorException
-
setOwners
Updates owners of facility- Parameters:
perunSession
-facility
-owners
-- Throws:
InternalErrorException
-
updateBan
Update description and validity timestamp of specific ban.- Parameters:
sess
-banOnFacility
- ban to be updated- Returns:
- updated ban
- Throws:
InternalErrorException
-
updateFacility
Facility updateFacility(PerunSession perunSession, Facility facility) throws FacilityExistsException Updates facility in DB.- Parameters:
perunSession
-facility
-- Throws:
InternalErrorException
FacilityExistsException
- if the name of facility has been already used for different Facility
-