Package de.dlr.proseo.usermgr.rest
Klasse GroupManager
java.lang.Object
de.dlr.proseo.usermgr.rest.GroupManager
Service methods required to manage user group groups.
- Autor:
- Dr. Thomas Bassler
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic class
Exception to indicate unmodified data to caller -
Feldübersicht
FelderModifizierer und TypFeldBeschreibung(Package privat) GroupMemberRepository
Repository for group members(Package privat) GroupRepository
Repository for User group objects(Package privat) UserRepository
Repository for User objects -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungaddGroupMember
(Long id, String username) Add a member to the given user groupcountGroups
(String mission) Count the groups matching the specified missioncreateGroup
(RestGroup restGroup) Create a user group (optionally with direct authorities)void
deleteGroupById
(Long id) Delete a user group by IDgetGroupById
(Long id) Get a user group by IDgetGroupMembers
(Long id) Get all members of the given user groupGet user groups by mission and optionally by group namemodifyGroup
(Long id, RestGroup restGroup) Update a user group by user group IDvoid
removeGroupMember
(Long id, String username) Delete a member from the given user group(Package privat) static Group
toModelGroup
(RestGroup restGroup) Convert a user group from REST format to the prosEO data model format (including authorities)(Package privat) static RestGroup
toRestGroup
(Group modelGroup) Convert a user group from prosEO data model format to REST format (including authorities)
-
Felddetails
-
groupRepository
Repository for User group objects -
userRepository
Repository for User objects -
groupMemberRepository
Repository for group members
-
-
Konstruktordetails
-
GroupManager
public GroupManager()
-
-
Methodendetails
-
toModelGroup
Convert a user group from REST format to the prosEO data model format (including authorities)- Parameter:
restGroup
- the REST user group to convert- Gibt zurück:
- the converted model user group
- Löst aus:
IllegalArgumentException
- if an invalid authority value was given
-
toRestGroup
Convert a user group from prosEO data model format to REST format (including authorities)- Parameter:
modelGroup
- the model user group to convert- Gibt zurück:
- the converted REST user
-
createGroup
Create a user group (optionally with direct authorities)- Parameter:
restGroup
- a Json representation of the new user group- Gibt zurück:
- a Json representation of the user group after creation
- Löst aus:
IllegalArgumentException
- if any of the input data was invalid
-
getGroups
public List<RestGroup> getGroups(String mission, String groupName, Integer recordFrom, Integer recordTo) throws javax.persistence.NoResultException, org.springframework.web.client.HttpClientErrorException Get user groups by mission and optionally by group name- Parameter:
mission
- the mission codegroupName
- the group name (optional)recordFrom
- first record of filtered and ordered result to returnrecordTo
- last record of filtered and ordered result to return- Gibt zurück:
- a list of Json objects representing the user groups authorized for the given mission
- Löst aus:
org.springframework.web.client.HttpClientErrorException
- if the result list exceeds a configured maximumjavax.persistence.NoResultException
- if no groups matching the search criteria can be found
-
getGroupById
public RestGroup getGroupById(Long id) throws IllegalArgumentException, javax.persistence.NoResultException Get a user group by ID- Parameter:
id
- the user group ID- Gibt zurück:
- a Json object corresponding to the user group found
- Löst aus:
IllegalArgumentException
- if no user group ID was givenjavax.persistence.NoResultException
- if no user group with the given ID exists
-
deleteGroupById
public void deleteGroupById(Long id) throws javax.persistence.EntityNotFoundException, RuntimeException Delete a user group by ID- Parameter:
id
- the ID of the user group to delete- Löst aus:
javax.persistence.EntityNotFoundException
- if the user group to delete does not exist in the databaseRuntimeException
- if the deletion was not performed as expected
-
modifyGroup
public RestGroup modifyGroup(Long id, RestGroup restGroup) throws javax.persistence.EntityNotFoundException, IllegalArgumentException, GroupManager.NotModifiedException Update a user group by user group ID- Parameter:
id
- the ID of the user group to updaterestGroup
- a Json object containing the modified (and unmodified) attributes- Gibt zurück:
- a response containing a Json object corresponding to the user group after modification
- Löst aus:
javax.persistence.EntityNotFoundException
- if no user group with the given user group ID existsIllegalArgumentException
- if any of the input data was invalidGroupManager.NotModifiedException
- if the group data was not modified (input data same as database data)
-
getGroupMembers
Get all members of the given user group- Parameter:
id
- the ID of the user group- Gibt zurück:
- a list of Json objects representing the users, which are members of the given group
- Löst aus:
javax.persistence.NoResultException
- if the group has no members
-
addGroupMember
public List<RestUser> addGroupMember(Long id, String username) throws javax.persistence.EntityNotFoundException, IllegalArgumentException, GroupManager.NotModifiedException Add a member to the given user group- Parameter:
id
- the ID of the group to updateusername
- the name of the user to add- Gibt zurück:
- a Json object corresponding to the list of users after addition
- Löst aus:
javax.persistence.EntityNotFoundException
- if no user group with the given ID or no user with the given name existsIllegalArgumentException
- if any of the input data was invalidGroupManager.NotModifiedException
- if the user is already a member of the group
-
removeGroupMember
public void removeGroupMember(Long id, String username) throws javax.persistence.EntityNotFoundException, RuntimeException, GroupManager.NotModifiedException Delete a member from the given user group- Parameter:
id
- the group IDusername
- the name of the user to remove- Löst aus:
javax.persistence.EntityNotFoundException
- if the group did not existRuntimeException
- if the deletion was unsuccessfulGroupManager.NotModifiedException
- if the user is not a member of the group
-
countGroups
Count the groups matching the specified mission- Parameter:
mission
- the mission code- Gibt zurück:
- the number of groups found as string
-