Interface FacilitiesManagerBl

All Known Implementing Classes:
FacilitiesManagerBlImpl

public interface FacilitiesManagerBl
Facility manager can create a new facility or find an existing facility.
Author:
Michal Prochazka, Slavek Licehammer
  • Method Details

    • addHost

      Host addHost(PerunSession perunSession, Host host, Facility facility)
      Adds host to the Facility.
      Parameters:
      perunSession -
      host -
      facility - return host
    • addHosts

      List<Host> addHosts(PerunSession sess, List<Host> hosts, Facility facility) throws HostExistsException
      Create hosts in Perun and add them to the Facility Note: If you wish to add more hosts, it is recommended to prepare a List of them so as there can be only one database call.
      Parameters:
      sess -
      hosts - ID of any host doesn't need to be filled. Hosts will be created.
      facility -
      Returns:
      Hosts with ID's set.
      Throws:
      HostExistsException
    • addHosts

      List<Host> addHosts(PerunSession sess, Facility facility, List<String> hosts) throws HostExistsException, WrongPatternException
      Create hosts in Perun and add them to the Facility. Names of the hosts can be generative. The pattern is string with square brackets, e.g. "local[1-3]domain". Then the content of the brackets is distributed, so the list is [local1domain, local2domain, local3domain]. Multibrackets are aslo allowed. For example "a[00-01]b[90-91]c" generates [a00b90c, a00b91c, a01b90c, a01b91c].
      Parameters:
      sess -
      facility -
      hosts - list of strings with names of hosts, the name can by generative
      Returns:
      Hosts with ID's set.
      Throws:
      HostExistsException
      WrongPatternException - when syntax of any of the hostnames is wrong
    • addOwner

      @Deprecated void addOwner(PerunSession perunSession, Facility facility, Owner owner) throws OwnerAlreadyAssignedException
      Deprecated.
      Add owner of the facility
      Parameters:
      perunSession -
      facility -
      owner -
      Throws:
      InternalErrorException
      OwnerAlreadyAssignedException
    • banExists

      boolean banExists(PerunSession sess, int userId, int facilityId)
      Get true if any ban for user and facility exists.
      Parameters:
      sess -
      userId - id of user
      facilityId - id of facility
      Returns:
      true if ban exists
      Throws:
      InternalErrorException
    • banExists

      boolean banExists(PerunSession sess, int banId)
      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
    • checkBanExists

      void checkBanExists(PerunSession sess, int userId, int facilityId) throws BanNotExistsException
      Check if ban already exists.

      Throw exception if no.

      Parameters:
      sess -
      userId - user id
      facilityId - facility id
      Throws:
      InternalErrorException
      BanNotExistsException
    • checkBanExists

      void checkBanExists(PerunSession sess, int banId) throws BanNotExistsException
      Check if ban already exists.

      Throw exception if no.

      Parameters:
      sess -
      banId - ban id
      Throws:
      InternalErrorException
      BanNotExistsException
    • checkFacilityExists

      void checkFacilityExists(PerunSession sess, Facility facility) throws FacilityNotExistsException
      Throws:
      FacilityNotExistsException
    • checkHostExists

      void checkHostExists(PerunSession sess, Host host) throws HostNotExistsException
      Throws:
      HostNotExistsException
    • copyAttributes

      Copy all attributes of the source facility to the destination facility. The attributes, that are in the destination facility and aren't in the source facility, are retained. The common attributes are replaced with attributes from source facility.
      Parameters:
      sess -
      sourceFacility -
      destinationFacility -
      Throws:
      InternalErrorException
      WrongAttributeAssignmentException - if there is no facility attribute
      WrongAttributeValueException - if the attribute value is illegal
      WrongReferenceAttributeValueException - if the attribute value is illegal
    • copyManagers

      void copyManagers(PerunSession sess, Facility sourceFacility, Facility destinationFacility)
      Copy all managers(admins) of the source facility to the destination facility. The admins, that are in the destination facility and aren't in the source facility, are retained. The common admins are also retained in destination facility.
      Parameters:
      sess -
      sourceFacility -
      destinationFacility -
      Throws:
      InternalErrorException
    • copyOwners

      @Deprecated void copyOwners(PerunSession sess, Facility sourceFacility, Facility destinationFacility)
      Deprecated.
      Copy all owners of the source facility to the destination facility. The owners, that are in the destination facility and aren't in the source facility, are retained. The common owners are replaced with owners from source facility.
      Parameters:
      sourceFacility -
      destinationFacility -
      Throws:
      InternalErrorException
    • createFacility

      Facility createFacility(PerunSession perunSession, Facility facility) throws FacilityExistsException, ConsentHubExistsException
      Store the facility.
      Parameters:
      perunSession -
      facility -
      Returns:
      Throws:
      InternalErrorException
      FacilityExistsException
      ConsentHubExistsException
    • deleteFacility

      Delete the facility by id.
      Parameters:
      perunSession -
      facility -
      force -
      Throws:
      InternalErrorException
      RelationExistsException - there are still some resources assigned to this facility
      FacilityAlreadyRemovedException - there are 0 rows affected by delete from DB
      HostAlreadyRemovedException - if there is at least 1 host who was not affected by deleting from DB
      ResourceAlreadyRemovedException - if there are at least 1 resource not affected by deleting from DB
      GroupAlreadyRemovedFromResourceException - there are at least 1 group on resource not affected by deleting from DB
    • getAdminGroups

      List<Group> getAdminGroups(PerunSession sess, Facility facility)
      Gets list of all group administrators of the Facility.
      Parameters:
      sess -
      facility -
      Returns:
      list of Groups that are admins in the facility
      Throws:
      InternalErrorException
    • getAdmins

      List<User> getAdmins(PerunSession perunSession, Facility facility, boolean onlyDirectAdmins)
      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.

      If onlyDirectAdmins is true, return only direct users of the group for supported role.

      Supported roles: FacilityAdmin

      Parameters:
      perunSession -
      facility -
      onlyDirectAdmins - if true, get only direct user administrators (if false, get both direct and indirect)
      Returns:
      list of all user administrators of the given facility for supported role
      Throws:
      InternalErrorException
    • getAdmins

      @Deprecated List<User> getAdmins(PerunSession sess, Facility facility)
      Deprecated.
      Gets list of all user administrators of the Facility. If some group is administrator of the given group, all members are included in the list.
      Parameters:
      sess -
      facility -
      Returns:
      list of Users who are admins in the facility
      Throws:
      InternalErrorException
    • getAllExpiredBansOnFacilities

      List<BanOnFacility> getAllExpiredBansOnFacilities(PerunSession sess)
      Get all expired bans on any facility to now date
      Parameters:
      sess -
      Returns:
      list of expired bans for any facility
      Throws:
      InternalErrorException
    • getAllowedFacilities

      List<Facility> getAllowedFacilities(PerunSession sess, User user)
      Get all facilities where the user is allowed. The user has a membership in a group with an active assignment to a resource on the facility and their VO membership status is not INVALID or DISABLED.
      Parameters:
      sess -
      user -
      Returns:
      List of allowed facilities of the user.
    • getAllowedFacilities

      List<Facility> getAllowedFacilities(PerunSession sess, Member member)
      Get all facilities where the member is allowed. The member belongs to a group with an active assignment to a resource on the facility and their VO membership status is not INVALID or DISABLED.
      Parameters:
      sess -
      member -
      Returns:
      List of allowed facilities of the member.
    • getAllowedGroups

      List<Group> getAllowedGroups(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService)
      Get all allowed groups on the facility. Allowed groups have an active assignment to a resource on this facility.

      Results can optionally be filtered by specificVo, specificService, or both. If null, no filtering is applied.

      Parameters:
      perunSession -
      facility - searching for this facility
      specificVo - filter to only groups in this VO (null means all VOs)
      specificService - filter to only groups on resources with this service assigned (null means all services)
      Returns:
      list of allowed groups
      Throws:
      InternalErrorException
    • getAllowedMembers

      List<Member> getAllowedMembers(PerunSession sess, Facility facility)
      Return all allowed members on the facility. Allowed members belong to a group with an active assignment to a resource on this facility and their VO membership status is not INVALID or DISABLED.
      Parameters:
      sess -
      facility -
      Returns:
      list of allowed members
      Throws:
      InternalErrorException
    • getAllowedMembers

      List<Member> getAllowedMembers(PerunSession sess, Facility facility, Service service)
      Return all allowed members on the facility through any resource assigned to the given service. Allowed members belong to a group with an active assignment to a resource with this service and their VO membership status is not INVALID or DISABLED. Users banned on the facility are filtered out as well.

      The result is further narrowed by the service's flags: useExpiredVoMembers=false excludes EXPIRED VO members (only VALID are kept), and useExpiredMembers=false excludes members whose group membership is expired.

      Parameters:
      sess -
      facility -
      service -
      Returns:
      list of allowed members
    • getAllowedRichGroupsWithAttributes

      List<RichGroup> getAllowedRichGroupsWithAttributes(PerunSession perunSession, Facility facility, Vo specificVo, Service specificService, List<String> attrNames)
      Get all allowed RichGroups on the facility. Allowed groups have an active assignment to a resource on this facility. Each returned RichGroup includes attributes specified by attrNames.

      Results can optionally be filtered by specificVo, specificService, or both. If null, no filtering is applied.

      Parameters:
      facility - searching for this facility
      specificVo - filter to only groups in this VO (null means all VOs)
      specificService - filter to only groups on resources with this service assigned (null means all services)
      attrNames - with each returned RichGroup we get also attributes specified by this list
      Returns:
      list of allowed groups
      Throws:
      InternalErrorException - when implementation fails
    • getAllowedUsers

      List<User> getAllowedUsers(PerunSession sess, Facility facility)
      Return all allowed users on the facility. Allowed users are members of a group with an active assignment to a resource on this facility and whose VO membership status is not INVALID or DISABLED.
      Parameters:
      sess -
      facility -
      Returns:
      list of allowed users
    • getAllowedUsers

      List<User> getAllowedUsers(PerunSession sess, Facility facility, Vo specificVo, Service specificService)
      Return all allowed users on the facility. Allowed users are members of a group with an active assignment to a resource on this facility and whose VO membership status is not INVALID or DISABLED.

      Results can optionally be filtered by specificVo, specificService, or both. If null, no filtering is applied.

      Parameters:
      sess -
      facility -
      specificVo - filter to only users in this VO (null means all VOs)
      specificService - filter to only users on resources with this service assigned (null means all services)
      Returns:
      list of allowed users
      Throws:
      InternalErrorException
    • getAllowedUsersNotExpiredInGroups

      List<User> getAllowedUsersNotExpiredInGroups(PerunSession sess, Facility facility, Vo specificVo, Service specificService)
      Return all allowed users on the facility who are not expired in groups.

      Allowed users are members of a group with an active assignment to a resource on this facility and whose VO membership status is not INVALID or DISABLED. On top of that, only users with a VALID group membership status in at least one group assigned to a resource on this facility are included.

      Results can optionally be filtered by specificVo, specificService, or both. If null, no filtering is applied.

      Parameters:
      sess -
      facility -
      specificVo - filter to only users in this VO (null means all VOs)
      specificService - filter to only users on resources with this service assigned (null means all services)
      Returns:
      list of allowed users not expired in groups
      Throws:
      InternalErrorException
    • getAllowedVos

      List<Vo> getAllowedVos(PerunSession perunSession, Facility facility)
      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

      List<Facility> getAssignedFacilities(PerunSession sess, Group group)
      Get facilities which are assigned to Group (via resource).
      Parameters:
      sess -
      group -
      Returns:
      Throws:
      InternalErrorException
    • getAssignedFacilities

      List<Facility> getAssignedFacilities(PerunSession sess, Member member)
      Get facilities where the member is assigned. A facility is returned if the member belongs to a group with an active assignment to at least one resource on that facility. No filter is applied on their VO membership status.
      Parameters:
      sess -
      member -
      Returns:
      list of facilities where the member is assigned
      Throws:
      InternalErrorException
    • getAssignedFacilities

      List<Facility> getAssignedFacilities(PerunSession sess, User user)
      Get facilities where the user is assigned. A facility is returned if the user has a membership in a group with an active assignment to at least one resource on that facility. No filter is applied on VO membership status.
      Parameters:
      sess -
      user -
      Returns:
      list of facilities where the user is assigned
      Throws:
      InternalErrorException
    • getAssignedFacilities

      List<Facility> getAssignedFacilities(PerunSession sess, Service service)
      Get facilities where the services is defined.
      Parameters:
      sess -
      service -
      Returns:
      Throws:
      InternalErrorException
    • getAssignedResources

      List<Resource> getAssignedResources(PerunSession perunSession, Facility facility)
      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
      Throws:
      InternalErrorException
    • getAssignedRichResources

      List<RichResource> getAssignedRichResources(PerunSession perunSession, Facility facility)
      Returns all rich resources assigned to the facility with VO property filled
      Parameters:
      perunSession -
      facility -
      Returns:
      list of 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 with VO property filled
      Parameters:
      perunSession -
      facility -
      service -
      Returns:
      list of resources assigned to the facility and service
      Throws:
      InternalErrorException
    • getAssignedUsers

      List<User> getAssignedUsers(PerunSession sess, Facility facility)
      Returns all assigned users on the facility. Assigned users are members of a group with an active assignment to a resource on this facility. No filter is applied on their VO membership status.
      Parameters:
      sess -
      facility -
      Returns:
      list of assigned users on the facility
      Throws:
      InternalErrorException
    • getAssignedUsers

      List<User> getAssignedUsers(PerunSession sess, Facility facility, Service service)
      Returns all assigned users on the facility. Assigned users are members of a group with an active assignment to a resource on this facility. On top of that, results are restricted to resources that have the given service assigned. No filter is applied on their VO membership status.
      Parameters:
      sess -
      facility -
      service -
      Returns:
      list of assigned users on the facility for resources with the given service
      Throws:
      InternalErrorException
    • getAssociatedMembers

      List<Member> getAssociatedMembers(PerunSession sess, Facility facility, User user)
      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

      List<User> getAssociatedUsers(PerunSession sess, Facility facility)
      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 associated users
    • getBan

      BanOnFacility getBan(PerunSession sess, int userId, int faclityId) throws BanNotExistsException
      Get specific facility ban.
      Parameters:
      sess -
      userId - the user id
      faclityId - the facility id
      Returns:
      specific facility ban
      Throws:
      InternalErrorException
      BanNotExistsException
    • getBanById

      BanOnFacility getBanById(PerunSession sess, int banId) throws BanNotExistsException
      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

      List<BanOnFacility> getBansForFacility(PerunSession sess, int facilityId)
      Get all users bans for facility
      Parameters:
      sess -
      facilityId - the facility id
      Returns:
      list of all users bans on facility
      Throws:
      InternalErrorException
    • getBansForUser

      List<BanOnFacility> getBansForUser(PerunSession sess, int userId)
      Get all facilities bans for user.
      Parameters:
      sess -
      userId - the user id
      Returns:
      list of bans for user on any facility
      Throws:
      InternalErrorException
    • getDirectAdmins

      @Deprecated List<User> getDirectAdmins(PerunSession perunSession, Facility facility)
      Deprecated.
      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
    • getDirectRichAdmins

      @Deprecated List<RichUser> getDirectRichAdmins(PerunSession sess, Facility facility)
      Deprecated.
      Get all Facility admins, which are assigned directly (not by group membership) without attributes.
      Parameters:
      sess -
      facility -
      Returns:
      return list of RichUsers without attributes.
      Throws:
      InternalErrorException
    • getDirectRichAdminsWithSpecificAttributes

      @Deprecated List<RichUser> getDirectRichAdminsWithSpecificAttributes(PerunSession perunSession, Facility facility, List<String> specificAttributes)
      Deprecated.
      Get list of Facility administrators. which are assigned directly (not by group membership) with specific attributes. From list of specificAttributes get all Users Attributes and find those for every RichAdmin (only, other attributes are not searched)
      Parameters:
      perunSession -
      facility -
      specificAttributes -
      Returns:
      list of RichUsers with specific attributes.
      Throws:
      InternalErrorException
    • getEnrichedBansForFacility

      List<EnrichedBanOnFacility> getEnrichedBansForFacility(PerunSession sess, Facility facility, List<String> attrNames) throws AttributeNotExistsException
      Get all enriched bans for members on the resource with user and member attributes
      Parameters:
      sess -
      facility - facility
      attrNames - names of attributes
      Returns:
      list of all enriched bans on facility
      Throws:
      AttributeNotExistsException
    • getEnrichedBansForUser

      List<EnrichedBanOnFacility> getEnrichedBansForUser(PerunSession sess, User user, List<String> attrNames) throws AttributeNotExistsException
      Get enriched bans for user on all resources where user is assigned with user and member attributes
      Parameters:
      sess -
      user - user
      attrNames - names of attributes
      Returns:
      list of all user's bans on facility
      Throws:
      AttributeNotExistsException
    • getEnrichedFacilities

      List<EnrichedFacility> getEnrichedFacilities(PerunSession perunSession)
      Gets all enriched facilities.
      Parameters:
      perunSession -
      Returns:
      List of all EnrichedFacilities
      Throws:
      InternalErrorException
    • getFacilities

      List<Facility> getFacilities(PerunSession perunSession)
      List all facilities.
      Parameters:
      perunSession -
      Returns:
      List of all Facilities within the Perun
      Throws:
      InternalErrorException
    • getFacilitiesByAttribute

      List<Facility> getFacilitiesByAttribute(PerunSession sess, String attributeName, String attributeValue) throws WrongAttributeAssignmentException
      Returns all facilities that have set the attribute 'attributeName' with the value 'attributeValue'. Searching only def and opt attributes. Large attributes are not supported.
      Parameters:
      sess - perun session
      attributeName - attribute name to be searched by
      attributeValue - attribute value to be searched by
      Returns:
      Throws:
      InternalErrorException
      WrongAttributeAssignmentException
    • getFacilitiesByAttributeWithAttributes

      List<FacilityWithAttributes> getFacilitiesByAttributeWithAttributes(PerunSession sess, String searchAttributeName, String searchAttributeValue, List<String> attrNames) throws AttributeNotExistsException
      Searches (partially!) for facilities with the attribute 'searchAttributeName' and its value 'searchAttributeValue'. Found Facilities are returned along with attributes listed in 'attrNames'.
      Parameters:
      sess -
      searchAttributeName - name of the attribute to search by
      searchAttributeValue - value to search for
      attrNames - names of attributes to return with facilities
      Returns:
      list of facilities with attributes
      Throws:
      AttributeNotExistsException - when the attribute to search by does not exist
    • 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

      List<Facility> getFacilitiesByHostName(PerunSession sess, String hostname)
      Return all facilities where exists host with the specific hostname
      Parameters:
      sess -
      hostname - specific hostname
      Returns:
      Throws:
      InternalErrorException
    • getFacilitiesByIds

      List<Facility> getFacilitiesByIds(PerunSession perunSession, List<Integer> ids)
      Searches for the Facilities with specified ids.
      Parameters:
      perunSession -
      ids -
      Returns:
      list of Facilities with specified ids
      Throws:
      InternalErrorException
    • getFacilitiesByPerunBean

      List<Facility> getFacilitiesByPerunBean(PerunSession sess, Group group)
      Returns list of facilities connected with a group
      Parameters:
      sess -
      group -
      Returns:
      list of facilities connected with group
      Throws:
      InternalErrorException
    • getFacilitiesByPerunBean

      List<Facility> getFacilitiesByPerunBean(PerunSession sess, Member member)
      Returns list of facilities connected with a member
      Parameters:
      sess -
      member -
      Returns:
      list of facilities connected with member
      Throws:
      InternalErrorException
    • getFacilitiesByPerunBean

      List<Facility> getFacilitiesByPerunBean(PerunSession sess, Resource resource)
      Returns list of facilities connected with a resource
      Parameters:
      sess -
      resource -
      Returns:
      list of facilities connected with resource
      Throws:
      InternalErrorException
    • getFacilitiesByPerunBean

      List<Facility> getFacilitiesByPerunBean(PerunSession sess, User user)
      Returns list of facilities connected with a user
      Parameters:
      sess -
      user -
      Returns:
      list of facilities connected with user
      Throws:
      InternalErrorException
    • getFacilitiesByPerunBean

      List<Facility> getFacilitiesByPerunBean(PerunSession sess, Host host)
      Returns list of facilities connected with a host
      Parameters:
      sess -
      host -
      Returns:
      list of facilities connected with host
      Throws:
      InternalErrorException
    • getFacilitiesByPerunBean

      List<Facility> getFacilitiesByPerunBean(PerunSession sess, Vo vo)
      Returns list of facilities connected with a vo
      Parameters:
      sess -
      vo -
      Returns:
      list of facilities connected with vo
      Throws:
      InternalErrorException
    • getFacilitiesCount

      int getFacilitiesCount(PerunSession perunSession)
      Get count of all facilities.
      Parameters:
      perunSession -
      Returns:
      count of all facilities
      Throws:
      InternalErrorException
    • getFacilitiesWhereUserIsAdmin

      List<Facility> getFacilitiesWhereUserIsAdmin(PerunSession sess, User user)
      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, where the user is an admin.
      Throws:
      InternalErrorException
    • getFacilityById

      Facility getFacilityById(PerunSession perunSession, int id) throws FacilityNotExistsException
      Searches for the Facility with specified id.
      Parameters:
      perunSession -
      id -
      Returns:
      Facility with specified id
      Throws:
      InternalErrorException
      FacilityNotExistsException
    • 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:
      InternalErrorException
      FacilityNotExistsException
    • getFacilityForHost

      Facility getFacilityForHost(PerunSession sess, Host host)
      Return facility which has the host.
      Parameters:
      sess -
      host -
      Returns:
      facility
      Throws:
      InternalErrorException
    • getHostById

      Host getHostById(PerunSession sess, int id) throws HostNotExistsException
      Get the host by its ID.
      Parameters:
      sess -
      id -
      Returns:
      host
      Throws:
      HostNotExistsException
      InternalErrorException
    • getHosts

      List<Host> getHosts(PerunSession sess, Facility facility)
      List hosts of Facility.
      Parameters:
      sess -
      facility -
      Returns:
      hosts
      Throws:
      InternalErrorException
    • getHostsByHostname

      List<Host> getHostsByHostname(PerunSession sess, String hostname)
      Get all hosts with this hostname (from all facilities).
      Parameters:
      sess -
      hostname -
      Returns:
      list of hosts by hostname
      Throws:
      InternalErrorException
    • getHostsCount

      int getHostsCount(PerunSession sess, Facility facility)
      Count hosts in the facility.
      Parameters:
      sess -
      facility -
      Returns:
      the number of hosts present in the Cluster.
      Throws:
      InternalErrorException
    • getOwnerFacilities

      List<Facility> getOwnerFacilities(PerunSession perunSession, Owner owner)
      Returns list of all facilities owned by the owner.
      Parameters:
      perunSession -
      owner -
      Returns:
      list of facilities owned by the owner
      Throws:
      InternalErrorException
    • getOwners

      @Deprecated List<Owner> getOwners(PerunSession perunSession, Facility facility)
      Deprecated.
      Returns owners of the facility.
      Parameters:
      perunSession -
      facility -
      Returns:
      owners of specified facility
      Throws:
      InternalErrorException
    • getRichAdmins

      List<RichUser> getRichAdmins(PerunSession perunSession, Facility facility, List<String> specificAttributes, boolean allUserAttributes, boolean onlyDirectAdmins) throws UserNotExistsException
      Gets list of all richUser administrators of the Facility. If some group is administrator of the given group, all VALID members are included in the list.

      Supported roles: FacilityAdmin

      If "onlyDirectAdmins" is "true", return only direct users of the group for supported role with specific attributes. If "allUserAttributes" is "true", do not specify attributes through list and return them all in objects richUser . Ignoring list of specific attributes.

      Parameters:
      perunSession -
      facility -
      specificAttributes - list of specified attributes which are needed in object richUser
      allUserAttributes - if true, get all possible user attributes and ignore list of specificAttributes (if false, get only specific attributes)
      onlyDirectAdmins - if true, get only direct user administrators (if false, get both direct and indirect)
      Returns:
      list of RichUser administrators for the facility and supported role with attributes
      Throws:
      InternalErrorException
      UserNotExistsException
    • getRichAdmins

      @Deprecated List<RichUser> getRichAdmins(PerunSession sess, Facility facility)
      Deprecated.
      Get all Facility admins without attributes.
      Parameters:
      sess -
      facility -
      Returns:
      return list of RichUsers without attributes.
      Throws:
      InternalErrorException
    • getRichAdminsWithAttributes

      @Deprecated List<RichUser> getRichAdminsWithAttributes(PerunSession sess, Facility facility) throws UserNotExistsException
      Deprecated.
      Get all Facility admins with attributes.
      Parameters:
      sess -
      facility -
      Returns:
      list of Rich Users who are admins in the facility WITH ATTRIBUTES
      Throws:
      InternalErrorException
      UserNotExistsException
    • getRichAdminsWithSpecificAttributes

      @Deprecated List<RichUser> getRichAdminsWithSpecificAttributes(PerunSession perunSession, Facility facility, List<String> specificAttributes)
      Deprecated.
      Get list of Facility administrators with specific attributes. From list of specificAttributes get all Users Attributes and find those for every RichAdmin (only, other attributes are not searched)
      Parameters:
      perunSession -
      facility -
      specificAttributes -
      Returns:
      list of RichUsers with specific attributes.
      Throws:
      InternalErrorException
    • getRichFacilities

      List<RichFacility> getRichFacilities(PerunSession perunSession)
      Get all rich Facilities with all their owners.
      Parameters:
      perunSession -
      Returns:
      list of RichFacilities with owners
      Throws:
      InternalErrorException
    • getRichFacilities

      List<RichFacility> getRichFacilities(PerunSession perunSession, List<Facility> facilities)
      Get all RichFacilities with all their owners from list of Facilities.
      Parameters:
      perunSession -
      facilities - list of facilities
      Returns:
      list of RichFacilities with owners
      Throws:
      InternalErrorException
    • removeAllExpiredBansOnFacilities

      void removeAllExpiredBansOnFacilities(PerunSession sess)
      Remove all expired bans on facilities to now date.

      Get all expired bans and remove them one by one with auditing process. This method is for purpose of removing expired bans using some cron tool.

      Parameters:
      sess -
      Throws:
      InternalErrorException
    • removeBan

      void removeBan(PerunSession sess, int banId) throws BanNotExistsException
      Remove ban by id from facilities bans.
      Parameters:
      sess -
      banId - id of specific ban
      Throws:
      InternalErrorException
      BanNotExistsException
    • removeBan

      void removeBan(PerunSession sess, int userId, int facilityId) throws BanNotExistsException
      Remove ban by user_id and facility_id.
      Parameters:
      sess -
      userId - the id of user
      facilityId - the id of facility
      Throws:
      InternalErrorException
      BanNotExistsException
    • removeHost

      void removeHost(PerunSession perunSession, Host host, Facility facility) throws HostAlreadyRemovedException
      Remove hosts from the Facility.
      Parameters:
      perunSession -
      host -
      facility -
      Throws:
      InternalErrorException
      HostAlreadyRemovedException - if 0 rows was affected by deleting from DB
    • removeHosts

      void removeHosts(PerunSession sess, List<Host> hosts, Facility facility) throws HostAlreadyRemovedException
      Remove hosts from the Facility.
      Parameters:
      sess -
      hosts -
      facility -
      Throws:
      InternalErrorException
      HostAlreadyRemovedException - if there is at least 1 not removed host (not affected by removing from DB)
    • removeOwner

      @Deprecated void removeOwner(PerunSession perunSession, Facility facility, Owner owner) throws OwnerAlreadyRemovedException
      Deprecated.
      Remove owner of the facility
      Parameters:
      perunSession -
      facility -
      owner -
      Throws:
      InternalErrorException
      OwnerAlreadyRemovedException
    • searchForFacilities

      List<Facility> searchForFacilities(PerunSession sess, String searchString, boolean includeIDs)
      Similarity substring search in all facilities based on name, description and optionally ID
      Parameters:
      sess - session
      searchString - string to search for
      includeIDs - whether to search in IDs as well, used for PERUNADMINs
      Returns:
      list of matched facilities
    • searchForFacilities

      List<Facility> searchForFacilities(PerunSession sess, String searchString, Set<Integer> facilityIds, boolean includeIDs)
      Similarity substring search in provided facilities based on name, description and optionally ID
      Parameters:
      sess - session
      searchString - string to search for
      facilityIds - IDs of facilities to perform the search in
      includeIDs - whether to search in IDs as well, used for PERUNADMINs
      Returns:
      list of matched facilities
    • setBan

      Set ban for user on facility
      Parameters:
      sess -
      banOnFacility - the ban
      Returns:
      ban on facility
      Throws:
      InternalErrorException
      BanAlreadyExistsException
    • setOwners

      @Deprecated void setOwners(PerunSession perunSession, Facility facility, List<Owner> owners)
      Deprecated.
      Use addOwner and removeOwner instead
      Updates owners of facility
      Parameters:
      perunSession -
      facility -
      owners -
      Throws:
      InternalErrorException
    • updateBan

      BanOnFacility updateBan(PerunSession sess, BanOnFacility banOnFacility)
      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, ConsentHubExistsException
      Updates facility.
      Parameters:
      perunSession -
      facility - to update
      Returns:
      updated facility
      Throws:
      InternalErrorException
      FacilityExistsException
      ConsentHubExistsException