Class GitLabUser
- java.lang.Object
-
- com.mooltiverse.oss.nyx.services.gitlab.GitLabUser
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
geFullName()
Returns the full name of this user.Map<String,Object>
getAttributes()
Returns a read-only map with all the raw properties for the user.static GitLabUser
getAuthenticatedUser(GitLabSession session)
Retrieves the authenticated user for the given session.String
getID()
Returns the ID of this user.GitLab
getService()
Returns the service associated with this entity.GitLabSession
getSession()
Returns the session associated with this entity.String
getUserName()
Returns the user name of this user.protected static Map<String,Object>
toAttributeMap(com.fasterxml.jackson.databind.JsonNode node)
Reads all the attributes of the given object and puts them in the resulting map.void
update()
Updates the user data and attributes.
-
-
-
Method Detail
-
getAttributes
public Map<String,Object> getAttributes()
Returns a read-only map with all the raw properties for the user.- Specified by:
getAttributes
in interfaceGitUser
- Returns:
- a read-only map with all the raw properties for the user.
-
getID
public String getID()
Returns the ID of this user.
-
getUserName
public String getUserName()
Returns the user name of this user.- Specified by:
getUserName
in interfaceGitUser
- Returns:
- the user name of this user.
-
geFullName
public String geFullName()
Returns the full name of this user.- Specified by:
geFullName
in interfaceGitUser
- Returns:
- the full name of this user. If not vailable then
null
is returned.
-
update
public void update() throws GitTransportException, GitAuthenticationException
Updates the user data and attributes. This method might be useful when the remote data has changed and you need to update the local status.- Specified by:
update
in interfaceGitUser
- Throws:
GitTransportException
- if a transport related error occurs while communicating with the serverGitAuthenticationException
- if authentication fails
-
getAuthenticatedUser
public static GitLabUser getAuthenticatedUser(GitLabSession session) throws GitTransportException, GitAuthenticationException
Retrieves the authenticated user for the given session.- Parameters:
session
- the session to fetch the authenticated user for- Returns:
- the authenticated user for the given session
- Throws:
GitTransportException
- if a transport related error occurs while communicating with the serverGitAuthenticationException
- if authentication failsNullPointerException
- if the given session isnull
-
getService
public GitLab getService()
Returns the service associated with this entity.- Returns:
- the service associated with this entity.
-
getSession
public GitLabSession getSession()
Returns the session associated with this entity.- Returns:
- the session associated with this entity.
-
toAttributeMap
protected static Map<String,Object> toAttributeMap(com.fasterxml.jackson.databind.JsonNode node)
Reads all the attributes of the given object and puts them in the resulting map.- Parameters:
node
- the node to read the attributes from- Returns:
- the map with all the attributes from the given node
- Throws:
NullPointerException
- if the given node isnull
-
-