Class AzureAdRestEntityMapper
java.lang.Object
com.atlassian.crowd.directory.rest.mapper.AzureAdRestEntityMapper
Maps REST entities returned from Microsoft Graph to Crowd entities and vice versa
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetUsername
(GraphUser user, String alternativeUsernameAttribute) Returns name of the user.mapDeltaQueryGroup
(GraphDeltaQueryGroup graphGroup, long directoryId) Maps a group obtained from the Microsoft Entra ID groups endpoint to a Crowd objectmapDeltaQueryGroups
(GraphDeltaQueryResult<GraphDeltaQueryGroup> graphGroups, long directoryId) Maps a delta query result for groups to a result suitable for incremental synchronisation.mapDeltaQueryUsers
(GraphDeltaQueryResult<GraphDeltaQueryUser> graphUsersList, long directoryId, String alternativeUsernameAttribute) Maps a delta query result for users to a result suitable for incremental synchronisation.<T> T
mapDirectoryObject
(DirectoryObject directoryObject, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps an AzureAD directory object to a Crowd object.<T> List<T>
mapDirectoryObjects
(GraphDirectoryObjectList directoryObjectList, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a directory objects response from Microsoft Entra ID.<T> List<T>
mapDirectoryObjects
(Collection<DirectoryObject> directoryObjects, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a collection of directory objects to Crowd objects.<T> T
mapGroup
(GraphGroup graphGroup, Class<T> returnType, long directoryId) Maps a group obtained from the Microsoft Entra ID groups endpoint to a Crowd object<T> List<T>
mapGroups
(GraphGroupList graphGroupList, Class<T> returnType, long directoryId) Maps a groups response from Microsoft Entra ID to Crowd groups.<T> List<T>
mapGroups
(Collection<GraphGroup> graphGroups, Class<T> returnType, long directoryId) Maps a collection of Microsoft Entra ID groups to Crowd groups.<T> T
mapUser
(GraphUser graphUser, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a user obtained from the Microsoft Entra ID users endpoint to a Crowd object<T> List<T>
mapUsers
(GraphUsersList graphUsersList, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a users response from Microsoft Entra ID to Crowd users.<T> List<T>
mapUsers
(Collection<GraphUser> graphUsersList, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a collection of Microsoft Entra ID users to Crowd users.
-
Constructor Details
-
AzureAdRestEntityMapper
public AzureAdRestEntityMapper()
-
-
Method Details
-
mapUsers
public <T> List<T> mapUsers(GraphUsersList graphUsersList, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a users response from Microsoft Entra ID to Crowd users.- Parameters:
graphUsersList
- the response from Microsoft Entra IDreturnType
- the desired return typedirectoryId
- the id of the Crowd directoryalternativeUsernameAttribute
- name of the attribute that should be mapped to user name- Returns:
- a list of mapped Crowd users
-
mapUsers
public <T> List<T> mapUsers(Collection<GraphUser> graphUsersList, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a collection of Microsoft Entra ID users to Crowd users.- Parameters:
graphUsersList
- the users to mapreturnType
- the desired return typedirectoryId
- the id of the Crowd directoryalternativeUsernameAttribute
- name of the attribute that should be mapped to user name- Returns:
- a list of mapped Crowd users
-
mapDeltaQueryUsers
public DeltaQueryResult<UserWithAttributes> mapDeltaQueryUsers(GraphDeltaQueryResult<GraphDeltaQueryUser> graphUsersList, long directoryId, String alternativeUsernameAttribute) Maps a delta query result for users to a result suitable for incremental synchronisation.- Parameters:
graphUsersList
- the users to mapdirectoryId
- the id of the Crowd directoryalternativeUsernameAttribute
- name of the attribute that should be mapped to user name- Returns:
- a list of mapped new users, ids of deleted users and a token suitable for change tracking
-
mapUser
public <T> T mapUser(GraphUser graphUser, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a user obtained from the Microsoft Entra ID users endpoint to a Crowd object- Parameters:
graphUser
- the user obtained from Microsoft Entra IDreturnType
- the desired return typedirectoryId
- the id of the Crowd directoryalternativeUsernameAttribute
- name of the attribute that should be mapped to user name- Returns:
- the mapped Crowd user
-
mapGroups
Maps a groups response from Microsoft Entra ID to Crowd groups.- Parameters:
graphGroupList
- the response from Microsoft Entra IDreturnType
- the desired return typedirectoryId
- the id of the Crowd directory- Returns:
- a list of mapped Crowd groups
-
mapGroups
public <T> List<T> mapGroups(Collection<GraphGroup> graphGroups, Class<T> returnType, long directoryId) Maps a collection of Microsoft Entra ID groups to Crowd groups.- Parameters:
graphGroups
- the groups to mapreturnType
- the desired return typedirectoryId
- the id of the Crowd directory- Returns:
- a list of mapped Crowd groups
-
mapDeltaQueryGroups
public DeltaQueryResult<GroupWithMembershipChanges> mapDeltaQueryGroups(GraphDeltaQueryResult<GraphDeltaQueryGroup> graphGroups, long directoryId) Maps a delta query result for groups to a result suitable for incremental synchronisation.- Parameters:
graphGroups
- the groups to mapdirectoryId
- the id of the Crowd directory- Returns:
- a list of mapped new groups, ids of deleted groups and a token suitable for change tracking
-
mapDirectoryObjects
public <T> List<T> mapDirectoryObjects(GraphDirectoryObjectList directoryObjectList, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a directory objects response from Microsoft Entra ID. The objects in the response should be of one type (groups or users)- Parameters:
directoryObjectList
- the directory objects response from Microsoft Entra IDreturnType
- the desired return typedirectoryId
- the id of the Crowd directoryalternativeUsernameAttribute
- name of the attribute that should be mapped to user name- Returns:
- a list of mapped Crowd objects
-
mapDirectoryObjects
public <T> List<T> mapDirectoryObjects(Collection<DirectoryObject> directoryObjects, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps a collection of directory objects to Crowd objects. The objects should be filtered by type (groups or users)- Parameters:
directoryObjects
- the directory objects to mapreturnType
- the desired return typedirectoryId
- the id of the Crowd directoryalternativeUsernameAttribute
- name of the attribute that should be mapped to user name- Returns:
- a list of mapped Crowd objects
-
mapGroup
Maps a group obtained from the Microsoft Entra ID groups endpoint to a Crowd object- Parameters:
graphGroup
- the group obtained from Microsoft Entra IDreturnType
- the desired return typedirectoryId
- the id of the Crowd directory- Returns:
- the mapped Crowd group
-
mapDeltaQueryGroup
public GroupWithMembershipChanges mapDeltaQueryGroup(GraphDeltaQueryGroup graphGroup, long directoryId) Maps a group obtained from the Microsoft Entra ID groups endpoint to a Crowd object- Parameters:
graphGroup
- the group obtained from Microsoft Entra IDdirectoryId
- the id of the Crowd directory- Returns:
- the mapped Crowd group
-
mapDirectoryObject
public <T> T mapDirectoryObject(DirectoryObject directoryObject, Class<T> returnType, long directoryId, String alternativeUsernameAttribute) Maps an AzureAD directory object to a Crowd object. The directory object must be of a concrete type- Parameters:
directoryObject
- the result from Microsoft Entra IDreturnType
- the desired return typedirectoryId
- the id of the Crowd directoryalternativeUsernameAttribute
- name of the attribute that should be mapped to user name- Returns:
- the mapped Crowd object
- Throws:
IllegalArgumentException
- when the directoryObject is a genericDirectoryObject
instance
-
getUsername
Returns name of the user.- Parameters:
user
-GraphUser
returned by AzurealternativeUsernameAttribute
- name of the attribute that should be mapped to user name
-