Class VosManagerBlImpl

java.lang.Object
cz.metacentrum.perun.core.blImpl.VosManagerBlImpl
All Implemented Interfaces:
VosManagerBl

public class VosManagerBlImpl extends Object implements VosManagerBl
VosManager business logic
Author:
Michal Prochazka michalp@ics.muni.cz, Slavek Licehammer glory@ics.muni.cz
  • Constructor Details

    • VosManagerBlImpl

      public VosManagerBlImpl(VosManagerImplApi vosManagerImpl)
      Constructor.
  • Method Details

    • getVos

      public List<Vo> getVos(PerunSession sess)
      Description copied from interface: VosManagerBl
      Get list of all Vos.
      Specified by:
      getVos in interface VosManagerBl
      Returns:
      List of VOs or empty ArrayList
    • deleteVo

      public void deleteVo(PerunSession sess, Vo vo, boolean forceDelete)
      Description copied from interface: VosManagerBl
      Delete VO.
      Specified by:
      deleteVo in interface VosManagerBl
      forceDelete - force the deletion of the VO, regardless there are any existing entities associated with the VO (they will be deleted)
    • deleteVo

      public void deleteVo(PerunSession sess, Vo vo)
      Description copied from interface: VosManagerBl
      Delete VO.
      Specified by:
      deleteVo in interface VosManagerBl
    • createVo

      public Vo createVo(PerunSession sess, Vo vo) throws VoExistsException
      Description copied from interface: VosManagerBl
      Create new VO.
      Specified by:
      createVo in interface VosManagerBl
      vo - vo object with prefilled voShortName and voName
      Returns:
      newly created VO
      Throws:
      VoExistsException
    • updateVo

      public Vo updateVo(PerunSession sess, Vo vo)
      Description copied from interface: VosManagerBl
      Updates VO.
      Specified by:
      updateVo in interface VosManagerBl
      Returns:
      returns updated VO
    • getVoByShortName

      public Vo getVoByShortName(PerunSession sess, String shortName) throws VoNotExistsException
      Description copied from interface: VosManagerBl
      Find existing VO by short name (short name is unique).
      Specified by:
      getVoByShortName in interface VosManagerBl
      shortName - short name of VO which you find (for example "KZCU")
      Returns:
      VO with requested shortName or throws if the VO with specified shortName doesn't exist
      Throws:
      VoNotExistsException
    • getVoById

      public Vo getVoById(PerunSession sess, int id) throws VoNotExistsException
      Description copied from interface: VosManagerBl
      Finds existing VO by id.
      Specified by:
      getVoById in interface VosManagerBl
      Returns:
      VO with requested id or throws if the VO with specified id doesn't exist
      Throws:
      VoNotExistsException
    • getVosByIds

      public List<Vo> getVosByIds(PerunSession sess, List<Integer> ids)
      Description copied from interface: VosManagerBl
      Finds existing VOs by ids.
      Specified by:
      getVosByIds in interface VosManagerBl
      Returns:
      VOs with requested ids
    • findCandidates

      public List<Candidate> findCandidates(PerunSession sess, Vo vo, String searchString, int maxNumOfResults)
      Description copied from interface: VosManagerBl
      Finds users, who can join the Vo.
      Specified by:
      findCandidates in interface VosManagerBl
      searchString - depends on the extSource of the VO, could by part of the name, email or something like that.
      maxNumOfResults - limit the maximum number of returned entries
      Returns:
      list of candidates who match the searchString
    • findCandidates

      public List<Candidate> findCandidates(PerunSession sess, Vo vo, String searchString, int maxNumOfResults, List<ExtSource> extSources, boolean filterExistingMembers)
    • findCandidates

      public List<Candidate> findCandidates(PerunSession sess, Vo vo, String searchString)
      Description copied from interface: VosManagerBl
      Finds users, who can join the Vo.
      Specified by:
      findCandidates in interface VosManagerBl
      vo - vo to be used
      searchString - depends on the extSource of the VO, could by part of the name, email or something like that.
      Returns:
      list of candidates who match the searchString
    • findCandidates

      public List<Candidate> findCandidates(PerunSession sess, Group group, String searchString)
      Description copied from interface: VosManagerBl
      Finds users, who can join the group in Vo.
      Specified by:
      findCandidates in interface VosManagerBl
      group - group to be used
      searchString - depends on the extSource of the Group, could by part of the name, email or something like that.
      Returns:
      list of candidates who match the searchString
    • findCandidates

      public List<Candidate> findCandidates(PerunSession sess, Group group, String searchString, List<ExtSource> extSources, boolean filterExistingMembers)
    • getCompleteCandidates

      public List<MemberCandidate> getCompleteCandidates(PerunSession sess, Vo vo, List<String> attrNames, String searchString)
      Description copied from interface: VosManagerBl
      Finds MemberCandidates who can join the Vo.
      Specified by:
      getCompleteCandidates in interface VosManagerBl
      Parameters:
      sess - session
      vo - vo to be used
      attrNames - name of attributes to be searched
      searchString - depends on the extSource of the Vo, could by part of the name, email or something like that.
      Returns:
      list of memberCandidates who match the searchString
    • getCompleteCandidates

      public List<MemberCandidate> getCompleteCandidates(PerunSession sess, Vo vo, Group group, List<String> attrNames, String searchString, List<ExtSource> extSources)
      Description copied from interface: VosManagerBl
      Finds MemberCandidates who can join the Group. If the given vo is not null, it searches only users who belong to this Vo or who have ues in any of given extSources.
      Specified by:
      getCompleteCandidates in interface VosManagerBl
      Parameters:
      sess - session
      vo - vo if vo is null, users are searched in whole perun, otherwise users are searched in members of given vo and in users with ues in any of given extSources
      group - group to be used
      attrNames - name of attributes to be searched
      searchString - depends on the extSource of the Vo, could by part of the name, email or something like that.
      extSources - extSources used to find candidates and possibly users
      Returns:
      list of memberCandidates who match the searchString
    • getAdmins

      public List<User> getAdmins(PerunSession perunSession, Vo vo, String role, boolean onlyDirectAdmins)
      Description copied from interface: VosManagerBl
      Get list of all user administrators for supported role and specific vo. If onlyDirectAdmins is true, return only direct users of the group for supported role. Supported roles: VOOBSERVER, TOPGROUPCREATOR, VOADMIN
      Specified by:
      getAdmins in interface VosManagerBl
      role - supported role
      onlyDirectAdmins - if true, get only direct user administrators (if false, get both direct and indirect)
      Returns:
      list of all user administrators of the given vo for supported role
    • getRichAdmins

      public List<RichUser> getRichAdmins(PerunSession perunSession, Vo vo, String role, List<String> specificAttributes, boolean allUserAttributes, boolean onlyDirectAdmins) throws UserNotExistsException
      Description copied from interface: VosManagerBl
      Get list of all richUser administrators for the vo and supported role with specific attributes. Supported roles: VOOBSERVER, TOPGROUPCREATOR, VOADMIN If "onlyDirectAdmins" is "true", return only direct users of the vo 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.
      Specified by:
      getRichAdmins in interface VosManagerBl
      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 vo and supported role with attributes
      Throws:
      UserNotExistsException
    • getAdminGroups

      public List<Group> getAdminGroups(PerunSession perunSession, Vo vo, String role)
      Description copied from interface: VosManagerBl
      Get list of group administrators of the given VO. Supported roles: VOOBSERVER, TOPGROUPCREATOR, VOADMIN
      Specified by:
      getAdminGroups in interface VosManagerBl
      Returns:
      List of groups, who are administrators of the Vo with supported role. Returns empty list if there is no VO group admin.
    • getAdmins

      @Deprecated public List<User> getAdmins(PerunSession sess, Vo vo)
      Deprecated.
      Description copied from interface: VosManagerBl
      Get list of Vo administrators. If some group is administrator of the VO, all members are included in the list.
      Specified by:
      getAdmins in interface VosManagerBl
      Returns:
      List of users, who are administrators of the Vo. Returns empty list if there is no VO admin.
    • getDirectAdmins

      @Deprecated public List<User> getDirectAdmins(PerunSession sess, Vo vo)
      Deprecated.
      Description copied from interface: VosManagerBl
      Gets list of direct user administrators of the VO. 'Direct' means, there aren't included users, who are members of group administrators, in the returned list.
      Specified by:
      getDirectAdmins in interface VosManagerBl
    • getDirectRichAdmins

      @Deprecated public List<RichUser> getDirectRichAdmins(PerunSession sess, Vo vo)
      Deprecated.
      Description copied from interface: VosManagerBl
      Get list of Vo administrators directly assigned to VO like RichUsers without attributes.
      Specified by:
      getDirectRichAdmins in interface VosManagerBl
      Returns:
      List of users, who are administrators of the Vo. Returns empty list if there is no VO admin.
    • getAdminGroups

      @Deprecated public List<Group> getAdminGroups(PerunSession sess, Vo vo)
      Deprecated.
      Description copied from interface: VosManagerBl
      Get list of group administrators of the given VO.
      Specified by:
      getAdminGroups in interface VosManagerBl
      Returns:
      List of groups, who are administrators of the Vo. Returns empty list if there is no VO group admin.
    • getRichAdmins

      @Deprecated public List<RichUser> getRichAdmins(PerunSession perunSession, Vo vo)
      Deprecated.
      Description copied from interface: VosManagerBl
      Get list of Vo administrators like RichUsers without attributes.
      Specified by:
      getRichAdmins in interface VosManagerBl
      Returns:
      List of users, who are administrators of the Vo. Returns empty list if there is no VO admin.
    • getRichAdminsWithAttributes

      @Deprecated public List<RichUser> getRichAdminsWithAttributes(PerunSession perunSession, Vo vo) throws UserNotExistsException
      Deprecated.
      Description copied from interface: VosManagerBl
      Get list of Vo administrators like RichUsers with attributes.
      Specified by:
      getRichAdminsWithAttributes in interface VosManagerBl
      Returns:
      List of users, who are administrators of the Vo. Returns empty list if there is no VO admin.
      Throws:
      UserNotExistsException
    • getRichAdminsWithSpecificAttributes

      @Deprecated public List<RichUser> getRichAdminsWithSpecificAttributes(PerunSession perunSession, Vo vo, List<String> specificAttributes)
      Deprecated.
      Description copied from interface: VosManagerBl
      Get list of Vo administrators with specific attributes. From list of specificAttributes get all Users Attributes and find those for every RichAdmin (only, other attributes are not searched)
      Specified by:
      getRichAdminsWithSpecificAttributes in interface VosManagerBl
      Returns:
      list of RichUsers with specific attributes.
    • getDirectRichAdminsWithSpecificAttributes

      @Deprecated public List<RichUser> getDirectRichAdminsWithSpecificAttributes(PerunSession perunSession, Vo vo, List<String> specificAttributes)
      Deprecated.
      Description copied from interface: VosManagerBl
      Get list of Vo administrators, which are directly assigned (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)
      Specified by:
      getDirectRichAdminsWithSpecificAttributes in interface VosManagerBl
      Returns:
      list of RichUsers with specific attributes.
    • checkVoExists

      public void checkVoExists(PerunSession sess, Vo vo) throws VoNotExistsException
      Specified by:
      checkVoExists in interface VosManagerBl
      Throws:
      VoNotExistsException
    • getVosByPerunBean

      public List<Vo> getVosByPerunBean(PerunSession sess, Group group) throws VoNotExistsException
      Description copied from interface: VosManagerBl
      Returns list of vos connected with a group
      Specified by:
      getVosByPerunBean in interface VosManagerBl
      Returns:
      list of vos connected with group
      Throws:
      VoNotExistsException
    • getVosByPerunBean

      public List<Vo> getVosByPerunBean(PerunSession sess, Member member)
      Description copied from interface: VosManagerBl
      Returns list of vos connected with a member
      Specified by:
      getVosByPerunBean in interface VosManagerBl
      Returns:
      list of vos connected with member
    • getVosByPerunBean

      public List<Vo> getVosByPerunBean(PerunSession sess, Resource resource) throws VoNotExistsException
      Description copied from interface: VosManagerBl
      Returns list of vos connected with a resource
      Specified by:
      getVosByPerunBean in interface VosManagerBl
      Returns:
      list of vos connected with resource
      Throws:
      VoNotExistsException
    • getVosByPerunBean

      public List<Vo> getVosByPerunBean(PerunSession sess, User user)
      Description copied from interface: VosManagerBl
      Returns list of vos connected with a user
      Specified by:
      getVosByPerunBean in interface VosManagerBl
      Returns:
      list of vos connected with user
    • getVosByPerunBean

      public List<Vo> getVosByPerunBean(PerunSession sess, Host host)
      Description copied from interface: VosManagerBl
      Returns list of vos connected with a host
      Specified by:
      getVosByPerunBean in interface VosManagerBl
      Returns:
      list of vos connected with host
    • getVosByPerunBean

      public List<Vo> getVosByPerunBean(PerunSession sess, Facility facility)
      Description copied from interface: VosManagerBl
      Returns list of vos connected with a facility
      Specified by:
      getVosByPerunBean in interface VosManagerBl
      Returns:
      list of vos connected with facility
    • getVosCount

      public int getVosCount(PerunSession sess)
      Description copied from interface: VosManagerBl
      Get count of all vos.
      Specified by:
      getVosCount in interface VosManagerBl
      Returns:
      count of all vos
    • getVoMembersCountsByStatus

      public Map<Status,Integer> getVoMembersCountsByStatus(PerunSession sess, Vo vo)
      Description copied from interface: VosManagerBl
      Returns number of vo members by their status.
      Specified by:
      getVoMembersCountsByStatus in interface VosManagerBl
      Parameters:
      sess - perun session
      vo - vo of members
      Returns:
      map of status in vo to number of vo members with the status
    • isUserInRoleForVo

      public boolean isUserInRoleForVo(PerunSession session, User user, String role, Vo vo, boolean checkGroups)
      Description copied from interface: VosManagerBl
      Check whether a user is in a role for a given VO, possibly checking also user's groups.
      Specified by:
      isUserInRoleForVo in interface VosManagerBl
      Parameters:
      session - session
      user - user
      role - role
      vo - virtual organization
      checkGroups - check also groups of the user whether they have the role
      Returns:
      true if user is directly in role for the vo, or if "checkGroups" flag is set and at least one of the groups is in the role
    • handleUserLostVoRole

      public void handleUserLostVoRole(PerunSession sess, User user, Vo vo, String role)
      Description copied from interface: VosManagerBl
      Handles a user that lost a role.
      Specified by:
      handleUserLostVoRole in interface VosManagerBl
      Parameters:
      sess - perun session
      user - user
      vo - virtual organization
      role - role of user in VO
    • handleGroupLostVoRole

      public void handleGroupLostVoRole(PerunSession sess, Group group, Vo vo, String role)
      Description copied from interface: VosManagerBl
      Handles a group that lost a role.
      Specified by:
      handleGroupLostVoRole in interface VosManagerBl
      Parameters:
      sess - perun session
      group - group
      vo - virtual organization
      role - role of group in VO
    • setBan

      public BanOnVo setBan(PerunSession sess, BanOnVo banOnVo) throws MemberNotExistsException
      Description copied from interface: VosManagerBl
      Set given ban.
      Specified by:
      setBan in interface VosManagerBl
      Parameters:
      sess - session
      banOnVo - ban information, memberId, voId, validity and description are needed
      Returns:
      created ban object
      Throws:
      MemberNotExistsException
    • getBanById

      public BanOnVo getBanById(PerunSession sess, int banId) throws BanNotExistsException
      Description copied from interface: VosManagerBl
      Get ban by its id.
      Specified by:
      getBanById in interface VosManagerBl
      Parameters:
      sess - session
      banId - ban id
      Returns:
      ban object
      Throws:
      BanNotExistsException - if ban with given id is not found
    • getBanForMember

      public Optional<BanOnVo> getBanForMember(PerunSession sess, int memberId)
      Description copied from interface: VosManagerBl
      Get ban for given member, if it exists.
      Specified by:
      getBanForMember in interface VosManagerBl
      Parameters:
      sess - session
      memberId - member id
      Returns:
      ban object, or null if there is no ban for given member
    • getBansForVo

      public List<BanOnVo> getBansForVo(PerunSession sess, int voId)
      Description copied from interface: VosManagerBl
      Get list of all bans for vo with given id.
      Specified by:
      getBansForVo in interface VosManagerBl
      Parameters:
      sess - session
      voId - vo id
      Returns:
      list of bans for given vo
    • updateBan

      public BanOnVo updateBan(PerunSession sess, BanOnVo banOnVo)
      Description copied from interface: VosManagerBl
      Update ban information. Only description and validity are updated.
      Specified by:
      updateBan in interface VosManagerBl
      Parameters:
      sess - session
      banOnVo - updated ban
      Returns:
      updated ban object
    • removeBan

      public void removeBan(PerunSession sess, int banId) throws BanNotExistsException
      Description copied from interface: VosManagerBl
      Removes ban with given id.
      Specified by:
      removeBan in interface VosManagerBl
      Parameters:
      sess - session
      banId - ban id
      Throws:
      BanNotExistsException - if there is no ban with given id
    • removeBanForMember

      public void removeBanForMember(PerunSession sess, int memberId) throws BanNotExistsException
      Description copied from interface: VosManagerBl
      Removes ban for member with given id.
      Specified by:
      removeBanForMember in interface VosManagerBl
      Parameters:
      sess - session
      memberId - member id
      Throws:
      BanNotExistsException - if there is no ban for member with given id
    • isMemberBanned

      public boolean isMemberBanned(PerunSession sess, int memberId)
      Description copied from interface: VosManagerBl
      Information if there is a ban for member with given id.
      Specified by:
      isMemberBanned in interface VosManagerBl
      Parameters:
      sess - session
      memberId - member id
      Returns:
      true, if member with given id is banned, false otherwise
    • convertSponsoredUsers

      public void convertSponsoredUsers(PerunSession sess, Vo vo)
      Description copied from interface: VosManagerBl
      For the given vo, creates sponsored members for each sponsored user who is a member of the given vo. Original sponsors of the users will be set to the sponsored members.
      Specified by:
      convertSponsoredUsers in interface VosManagerBl
      Parameters:
      sess - session
      vo - vo where members will be converted
    • convertSponsoredUsersWithNewSponsor

      public void convertSponsoredUsersWithNewSponsor(PerunSession sess, Vo vo, User newSponsor)
      Description copied from interface: VosManagerBl
      For the given vo, creates sponsored members for each sponsored user who is a member of the given vo. The sponsored members will be sponsored by the given user, not by its original sponsors.
      Specified by:
      convertSponsoredUsersWithNewSponsor in interface VosManagerBl
      Parameters:
      sess - session
      vo - vo where members will be converted
      newSponsor - user, who will be set as a sponsor to the sponsored members
    • usesEmbeddedGroupRegistrations

      public boolean usesEmbeddedGroupRegistrations(PerunSession sess, Vo vo)
      Description copied from interface: VosManagerBl
      Returns true, if the given vo uses EMBEDDED_GROUP_APPLICATION item in its form.
      Specified by:
      usesEmbeddedGroupRegistrations in interface VosManagerBl
      Parameters:
      sess - session
      vo - vo
      Returns:
      true, if the given vo uses EMBEDDED_GROUP_APPLICATION item in its form, false otherwise.
    • createMemberCandidates

      public List<MemberCandidate> createMemberCandidates(PerunSession sess, List<RichUser> users, Vo vo, Group group, List<Candidate> candidates, List<String> attrNames)
      Creates MemberCandidates for given RichUsers, vo, group and candidates. If the given group is not null then to all members who are in this group is assigned the sourceGroupId of the given group. The given group can be null.
      Parameters:
      sess - session
      users - users
      group - group
      candidates - candidates
      attrNames - names of attributes that will be returned
      Returns:
      list of MemberCandidates for given RichUsers, group and candidates
      Throws:
      InternalErrorException - internal error
    • setPerunBl

      public void setPerunBl(PerunBl perunBl)
      Sets the perunBl for this instance.
      Parameters:
      perunBl - The perunBl.
    • getPerunBl

      public PerunBl getPerunBl()
      Gets the perunBl.
      Returns:
      The perunBl.