nl.surfnet.coin.teams.service.impl
Class InMemoryMockTeamService

java.lang.Object
  extended by nl.surfnet.coin.teams.service.impl.InMemoryMockTeamService
All Implemented Interfaces:
GrouperDao, GrouperTeamService

public class InMemoryMockTeamService
extends Object
implements GrouperTeamService

Mock implementation of GrouperTeamService


Constructor Summary
InMemoryMockTeamService()
          Constructor
 
Method Summary
 void addMember(String teamId, nl.surfnet.coin.api.client.domain.Person person)
          Adds a person to the team
 boolean addMemberRole(String teamId, String memberId, Role role, String actAsUserId)
          Add Role to a Team
 String addTeam(String teamId, String displayName, String teamDescription, String stemName)
          Add a Team.
 void deleteMember(String teamId, String memberId)
          Delete a Member from a Team
 void deleteTeam(String teamId)
          Delete a Team
 boolean doesStemExists(String stemName)
          Does the Stem exists?
 Set<Member> findAdmins(Team team)
          Returns a Set of Member's that have the admin role for this team
 TeamResultWrapper findAllTeams(String personId, int offset, int pageSize)
          Return all teams using a specific stem, without the teams being private except if the personId is a member of the private team
 TeamResultWrapper findAllTeamsByMember(String personId, int offset, int pageSize)
          Return all teams using a specific stem where the personId is a member
 Member findMember(String teamId, String memberId)
          Tries to find a Member in a Team
 Stem findStem(String stemId)
          
 List<Stem> findStemsByMember(String personId)
          Return all stems for a person
 Team findTeamById(String teamId)
          Find Team by id
 TeamResultWrapper findTeams(String personId, String partOfGroupname, int offset, int pageSize)
          Return all teams using a specific stem with a name like, , without the teams being private except if the personId is a member of the private team
 TeamResultWrapper findTeamsByMember(String personId, String partOfGroupname, int offset, int pageSize)
          Return all teams using a specific stem with a name like where the personId is a member
 boolean removeMemberRole(String teamId, String memberId, Role role, String actAsUserId)
          Remove Role to a Team
 void setVisibilityGroup(String teamId, boolean viewable)
          Update the Team to be (not) visible
 void updateTeam(String teamId, String displayName, String teamDescription, String actAsSubject)
          Update a Team
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InMemoryMockTeamService

public InMemoryMockTeamService()
Constructor

Method Detail

findMember

public Member findMember(String teamId,
                         String memberId)
Description copied from interface: GrouperTeamService
Tries to find a Member in a Team

Specified by:
findMember in interface GrouperTeamService
Parameters:
teamId - the unique identifier of the Team
memberId - the unique identifier of a Member
Returns:
Member or null if the Team does not contain a Member by the memberId

addTeam

public String addTeam(String teamId,
                      String displayName,
                      String teamDescription,
                      String stemName)
               throws DuplicateTeamException
Add a Team. Note that the teamId is altered if not compliant to the rules for correct id's.

Specified by:
addTeam in interface GrouperTeamService
Parameters:
teamId - the teamId
displayName - the displayName
teamDescription - description of the team
stemName - name of the stem
Returns:
The id of the team
Throws:
DuplicateTeamException - when a team with with the given teamId already exists.

deleteMember

public void deleteMember(String teamId,
                         String memberId)
Delete a Member from a Team

Specified by:
deleteMember in interface GrouperTeamService
Parameters:
teamId - the unique identifier for a Team
memberId - the unique identifier for a Member

deleteTeam

public void deleteTeam(String teamId)
Delete a Team

Specified by:
deleteTeam in interface GrouperTeamService
Parameters:
teamId - the unique identifier

findAllTeams

public TeamResultWrapper findAllTeams(String personId,
                                      int offset,
                                      int pageSize)
Return all teams using a specific stem, without the teams being private except if the personId is a member of the private team

Specified by:
findAllTeams in interface GrouperDao
Parameters:
personId - the logged in person
offset - the row number of the start
pageSize - the maximum result size
Returns:
teams including the number of total records

findTeams

public TeamResultWrapper findTeams(String personId,
                                   String partOfGroupname,
                                   int offset,
                                   int pageSize)
Description copied from interface: GrouperDao
Return all teams using a specific stem with a name like, , without the teams being private except if the personId is a member of the private team

Specified by:
findTeams in interface GrouperDao
Parameters:
personId - the logged in person
partOfGroupname - part of group name
offset - the row number of the start
pageSize - the maximum result size
Returns:
teams including the number of total records

findAllTeamsByMember

public TeamResultWrapper findAllTeamsByMember(String personId,
                                              int offset,
                                              int pageSize)
Description copied from interface: GrouperDao
Return all teams using a specific stem where the personId is a member

Specified by:
findAllTeamsByMember in interface GrouperDao
Parameters:
personId - the logged in person
offset - the row number of the start
pageSize - the maximum result size
Returns:
teams including the number of total records

findTeamsByMember

public TeamResultWrapper findTeamsByMember(String personId,
                                           String partOfGroupname,
                                           int offset,
                                           int pageSize)
Description copied from interface: GrouperDao
Return all teams using a specific stem with a name like where the personId is a member

Specified by:
findTeamsByMember in interface GrouperDao
Parameters:
personId - the logged in person
partOfGroupname - part of group name
offset - the row number of the start
pageSize - the maximum result size
Returns:
teams including the number of total records

findStemsByMember

public List<Stem> findStemsByMember(String personId)
Return all stems for a person

Specified by:
findStemsByMember in interface GrouperDao
Parameters:
personId - String the identifier of the logged in person
Returns:
List the list with stems that this user is a member of.

findTeamById

public Team findTeamById(String teamId)
Find Team by id

Specified by:
findTeamById in interface GrouperTeamService
Parameters:
teamId - unique identifier for a Team
Returns:
Team with all members

setVisibilityGroup

public void setVisibilityGroup(String teamId,
                               boolean viewable)
Update the Team to be (not) visible

Specified by:
setVisibilityGroup in interface GrouperTeamService
Parameters:
teamId - unique identifier for a Team
viewable - boolean

addMemberRole

public boolean addMemberRole(String teamId,
                             String memberId,
                             Role role,
                             String actAsUserId)
Add Role to a Team

Specified by:
addMemberRole in interface GrouperTeamService
Parameters:
teamId - the unique identifier of a Team
memberId - the unique identifier of a Member
role - the Role to be added
actAsUserId - the unique identifier that performs the request in Grouper. Can be the power user or the memberId
Returns:
boolean true if the Role has been successfully added false if the Role has not been added

removeMemberRole

public boolean removeMemberRole(String teamId,
                                String memberId,
                                Role role,
                                String actAsUserId)
Remove Role to a Team

Specified by:
removeMemberRole in interface GrouperTeamService
Parameters:
teamId - the unique identifier of a Team
memberId - the unique identifier of a Member
role - the Role to be removed
actAsUserId - the unique identifier that performs the request in Grouper. Can be the power user of the memberId
Returns:
boolean true if the Role has been successfully added false if the Role has not been added

addMember

public void addMember(String teamId,
                      nl.surfnet.coin.api.client.domain.Person person)
Adds a person to the team

Specified by:
addMember in interface GrouperTeamService
Parameters:
teamId - the unique identifier of the Team
person - Person to add as Member to the Team

updateTeam

public void updateTeam(String teamId,
                       String displayName,
                       String teamDescription,
                       String actAsSubject)
Update a Team

Specified by:
updateTeam in interface GrouperTeamService
Parameters:
teamId - the id of a Team
displayName - the new displayName
teamDescription - the new description of the Team
actAsSubject - the unique identifier that performs the request in Grouper. Can be the power user or the memberId

findAdmins

public Set<Member> findAdmins(Team team)
Returns a Set of Member's that have the admin role for this team

Specified by:
findAdmins in interface GrouperTeamService
Parameters:
team - Team
Returns:
Set of Member's with admin role, can be empty

doesStemExists

public boolean doesStemExists(String stemName)
Description copied from interface: GrouperTeamService
Does the Stem exists?

Specified by:
doesStemExists in interface GrouperTeamService
Parameters:
stemName - the exact name of the stem
Returns:
true if the Stem is an existing Stem

findStem

public Stem findStem(String stemId)

Specified by:
findStem in interface GrouperTeamService


Copyright © 2009-2013 SURFnet bv, The Netherlands. All Rights Reserved.