Package org.gbif.api.model.common
Class AbstractGbifUser
- java.lang.Object
-
- org.gbif.api.model.common.AbstractGbifUser
-
- Direct Known Subclasses:
GbifUser
public abstract class AbstractGbifUser extends Object
An abstract GBIF user account. The main purpose of this abstraction is to let subclasses handle key and password information only if required. By doing so, it is possible to have classes working for user information without having to carry those information around.
-
-
Constructor Summary
Constructors Constructor Description AbstractGbifUser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRole(UserRole role)
boolean
equals(Object o)
Date
getDeleted()
@NotNull @ValidEmail String
getEmail()
String
getFirstName()
String
getLastName()
Locale
getLocale()
String
getName()
@NotNull Set<UserRole>
getRoles()
@NotNull Map<String,String>
getSettings()
Gets the settings which may be empty but never null.@NotNull Map<String,String>
getSystemSettings()
Gets the settings which may be empty but never null.@NotNull @Pattern(regexp="^[a-z0-9_.-]+$") @Size(min=3,max=64) String
getUserName()
The unique, immutable drupal user account name.int
hashCode()
boolean
hasRole(UserRole role)
Checks if the user has the given user role.void
setDeleted(Date deleted)
void
setEmail(String email)
void
setFirstName(String firstName)
void
setLastName(String lastName)
void
setRoles(Set<UserRole> roles)
void
setSettings(Map<String,String> settings)
Sets the settings object, setting an empty map if null is provided.void
setSystemSettings(Map<String,String> systemSettings)
Sets the settings object, setting an empty map if null is provided.void
setUserName(String userName)
String
toString()
-
-
-
Constructor Detail
-
AbstractGbifUser
public AbstractGbifUser()
-
-
Method Detail
-
getEmail
@NotNull @ValidEmail public @NotNull @ValidEmail String getEmail()
-
getUserName
@NotNull @Pattern(regexp="^[a-z0-9_.-]+$") @Size(min=3, max=64) public @NotNull @Pattern(regexp="^[a-z0-9_.-]+$") @Size(min=3,max=64) String getUserName()
The unique, immutable drupal user account name. This name should be used for referring to a user. The account name is made of ASCII lower case alphanumerics, underscore, dash or dots and is in particular void of whitespace.
-
setUserName
public void setUserName(String userName)
-
getFirstName
public String getFirstName()
- Returns:
- the first name of a person
-
setFirstName
public void setFirstName(String firstName)
-
getLastName
public String getLastName()
- Returns:
- the last name of the user
-
setLastName
public void setLastName(String lastName)
-
getName
public String getName()
- Returns:
- the first and last name of the user concatenated with a space
-
hasRole
public boolean hasRole(UserRole role)
Checks if the user has the given user role.- Parameters:
role
- user role- Returns:
- true if the user has the requested role
-
setSettings
public void setSettings(Map<String,String> settings)
Sets the settings object, setting an empty map if null is provided.
-
getSettings
@NotNull public @NotNull Map<String,String> getSettings()
Gets the settings which may be empty but never null.
-
setSystemSettings
public void setSystemSettings(Map<String,String> systemSettings)
Sets the settings object, setting an empty map if null is provided.
-
getSystemSettings
@NotNull public @NotNull Map<String,String> getSystemSettings()
Gets the settings which may be empty but never null.
-
getDeleted
public Date getDeleted()
-
setDeleted
public void setDeleted(Date deleted)
-
-