com.dotmarketing.business
Interface UserAPI

All Known Subinterfaces:
UserWebAPI
All Known Implementing Classes:
UserAPIImpl, UserWebAPIImpl

public interface UserAPI

UserAPI is an API intended to be a helper class for class to get User entities. Classes within the dotCMS should use this API for user management. The UserAPI does not do cache management. It delegates this responsibilities to underlying classes.

Since:
1.6
Version:
1.9
Author:
Jason Tesser

Method Summary
 com.liferay.portal.model.User createUser(java.lang.String userId, java.lang.String email)
          Creates an instance of a user
 void delete(com.liferay.portal.model.User userToDelete, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
           
 void deleteAddress(com.liferay.portal.model.Address ad, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
          Removes from the system the given address
 java.lang.String encryptUserId(java.lang.String userId)
          Used to encrypt a User's userid
 java.util.List<com.liferay.portal.model.User> findAllUsers()
          This method return a list of all the existing users in the cms.
 java.util.List<com.liferay.portal.model.User> findAllUsers(int begin, int end)
          This method return a list of all the existing users in the cms.
 com.liferay.portal.model.User getAnonymousUser()
          This method return an anonymous user, created to manage the submitContent macro with no user logged in
 long getCountUsersByNameOrEmail(java.lang.String filter)
          This Method return the number of user that have a firstname, lastname or email like the filter string.
 long getCountUsersByNameOrEmailOrUserID(java.lang.String filter)
          This Method return the number of user that have a firstname, lastname or email like the filter string.
 com.liferay.portal.model.User getDefaultUser()
          This method return the default user of the system
 com.liferay.portal.model.User getSystemUser()
           
 java.util.Map<java.lang.String,java.lang.Object> getUsersAnRolesByName(java.lang.String filter, int start, int limit)
          Deprecated.  
 java.util.List<com.liferay.portal.model.User> getUsersByName(java.lang.String filter, int start, int limit, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
          This method returns a list of users whose names are like the string passed in.
 java.util.List<com.liferay.portal.model.User> getUsersByNameOrEmail(java.lang.String filter, int page, int pageSize)
          This method return a a paginated list of user that have a firstname, lastname or email like the compare string passed This method will ALWAYS hit DB
 java.util.List<com.liferay.portal.model.User> getUsersByNameOrEmailOrUserID(java.lang.String filter, int page, int pageSize)
          This method return a a paginated list of user that have a firstname, lastname or email like the compare string passed This method will ALWAYS hit DB
 boolean isCMSAdmin(com.liferay.portal.model.User user)
          Returns true if the user is a cms admin
 com.liferay.portal.model.Address loadAddressById(java.lang.String addressId, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
          Load address by id
 com.liferay.portal.model.User loadByUserByEmail(java.lang.String email, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
          This method finds a User by email, if the user was not found it returns a new user instance ready to be filled and stored.
 java.util.List<com.liferay.portal.model.Address> loadUserAddresses(com.liferay.portal.model.User userToGetAddresses, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
          Retrieves all addresses associated to a user
 com.liferay.portal.model.User loadUserById(java.lang.String userId)
           
 com.liferay.portal.model.User loadUserById(java.lang.String userId, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
           
 void save(com.liferay.portal.model.User userToSave, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
          Save or update in db the user object
 void saveAddress(com.liferay.portal.model.User userToSaveNewAddress, com.liferay.portal.model.Address ad, com.liferay.portal.model.User user, boolean respectFrontEndRoles)
          Method that saves a new address and tie it to the user
 boolean userExistsWithEmail(java.lang.String email)
          Verify is exists a user with the specified email address
 

Method Detail

encryptUserId

java.lang.String encryptUserId(java.lang.String userId)
                               throws DotStateException
Used to encrypt a User's userid

Parameters:
userId -
Returns:
Throws:
DotStateException - if userid doesn't exist

loadUserById

com.liferay.portal.model.User loadUserById(java.lang.String userId,
                                           com.liferay.portal.model.User user,
                                           boolean respectFrontEndRoles)
                                           throws DotDataException,
                                                  DotSecurityException,
                                                  NoSuchUserException
Parameters:
userId - - UserID being searched for
user - - The user who is requesting the user to be returned
respectFrontEndRoles -
Returns:
Throws:
DotDataException
DotSecurityException
NoSuchUserException

loadUserById

com.liferay.portal.model.User loadUserById(java.lang.String userId)
                                           throws DotDataException,
                                                  DotSecurityException,
                                                  NoSuchUserException
Parameters:
userId - - UserID being searched for
Returns:
Throws:
DotDataException
DotSecurityException
NoSuchUserException

loadByUserByEmail

com.liferay.portal.model.User loadByUserByEmail(java.lang.String email,
                                                com.liferay.portal.model.User user,
                                                boolean respectFrontEndRoles)
                                                throws DotDataException,
                                                       DotSecurityException,
                                                       NoSuchUserException
This method finds a User by email, if the user was not found it returns a new user instance ready to be filled and stored. This methods pulls a new userid from liferay counters. If the user is not found it will return a new user.

Parameters:
email -
user - - The user who is requesting the user to be returned
respectFrontEndRoles -
Returns:
User
Throws:
DotDataException
DotSecurityException
NoSuchUserException
Since:
1.9

findAllUsers

java.util.List<com.liferay.portal.model.User> findAllUsers(int begin,
                                                           int end)
                                                           throws DotDataException
This method return a list of all the existing users in the cms. It will ALWAYS hit the database

Parameters:
begin -
end -
Returns:
Throws:
DotDataException

findAllUsers

java.util.List<com.liferay.portal.model.User> findAllUsers()
                                                           throws DotDataException
This method return a list of all the existing users in the cms. It will ALWAYS hit the database

Returns:
Throws:
DotDataException

getUsersByName

java.util.List<com.liferay.portal.model.User> getUsersByName(java.lang.String filter,
                                                             int start,
                                                             int limit,
                                                             com.liferay.portal.model.User user,
                                                             boolean respectFrontEndRoles)
                                                             throws DotDataException
This method returns a list of users whose names are like the string passed in. This method WILL hit the DB EVERY time

Parameters:
filter - compare string
start - First element to display. For a negative value, zero is assumed.
limit - Max number of elements to show. For a negative value, zero is assumed.
user -
respectFrontEndRoles -
Returns:
Throws:
DotDataException

createUser

com.liferay.portal.model.User createUser(java.lang.String userId,
                                         java.lang.String email)
                                         throws DotDataException,
                                                DuplicateUserException
Creates an instance of a user

Parameters:
userId - Can be null
email - Can be null
Returns:
Throws:
DotDataException
DuplicateUserException

getDefaultUser

com.liferay.portal.model.User getDefaultUser()
                                             throws DotDataException
This method return the default user of the system

Returns:
User
Throws:
DotDataException
Since:
1.9

getSystemUser

com.liferay.portal.model.User getSystemUser()
                                            throws DotDataException
Throws:
DotDataException

getAnonymousUser

com.liferay.portal.model.User getAnonymousUser()
                                               throws DotDataException
This method return an anonymous user, created to manage the submitContent macro with no user logged in

Returns:
User
Throws:
DotDataException

userExistsWithEmail

boolean userExistsWithEmail(java.lang.String email)
                            throws DotDataException,
                                   NoSuchUserException
Verify is exists a user with the specified email address

Parameters:
email - user email
Returns:
boolean
Throws:
DotDataException
NoSuchUserException
Since:
1.9

getCountUsersByNameOrEmail

long getCountUsersByNameOrEmail(java.lang.String filter)
                                throws DotDataException
This Method return the number of user that have a firstname, lastname or email like the filter string. For example all amount of user with lastName "Andrews" This method will ALWAYS hit DB

Parameters:
filter - Compare string
Returns:
long
Throws:
DotDataException

getCountUsersByNameOrEmailOrUserID

long getCountUsersByNameOrEmailOrUserID(java.lang.String filter)
                                        throws DotDataException
This Method return the number of user that have a firstname, lastname or email like the filter string. For example all amount of user with lastName "Andrews" This method will ALWAYS hit DB

Parameters:
filter - Compare string
Returns:
long
Throws:
DotDataException

getUsersByNameOrEmail

java.util.List<com.liferay.portal.model.User> getUsersByNameOrEmail(java.lang.String filter,
                                                                    int page,
                                                                    int pageSize)
                                                                    throws DotDataException
This method return a a paginated list of user that have a firstname, lastname or email like the compare string passed This method will ALWAYS hit DB

Parameters:
filter - compare string
page - page to display
pageSize - number of element to show in the page
Returns:
List
Throws:
DotDataException

getUsersByNameOrEmailOrUserID

java.util.List<com.liferay.portal.model.User> getUsersByNameOrEmailOrUserID(java.lang.String filter,
                                                                            int page,
                                                                            int pageSize)
                                                                            throws DotDataException
This method return a a paginated list of user that have a firstname, lastname or email like the compare string passed This method will ALWAYS hit DB

Parameters:
filter - compare string
page - page to display
pageSize - number of element to show in the page
Returns:
List
Throws:
DotDataException

getUsersAnRolesByName

java.util.Map<java.lang.String,java.lang.Object> getUsersAnRolesByName(java.lang.String filter,
                                                                       int start,
                                                                       int limit)
                                                                       throws DotDataException
Deprecated. 

This method return a list of users and roles which name are like the compared string passed This method will ALWAYS hit DB

Parameters:
filter - compare string
start - first element to display
limit - max number of elements to show
Returns:
Map
Throws:
DotRuntimeException
DotDataException
Since:
1.0

save

void save(com.liferay.portal.model.User userToSave,
          com.liferay.portal.model.User user,
          boolean respectFrontEndRoles)
          throws DotDataException,
                 DotSecurityException,
                 DuplicateUserException
Save or update in db the user object

Parameters:
user - - User to save
user - - User to check permissions to save
respectFrontEndRoles -
Throws:
DotDataException
DotSecurityException
DuplicateUserException

delete

void delete(com.liferay.portal.model.User userToDelete,
            com.liferay.portal.model.User user,
            boolean respectFrontEndRoles)
            throws DotDataException,
                   DotSecurityException
Parameters:
userToDelete -
user -
respectFrontEndRoles -
Throws:
DotDataException
DotSecurityException

saveAddress

void saveAddress(com.liferay.portal.model.User userToSaveNewAddress,
                 com.liferay.portal.model.Address ad,
                 com.liferay.portal.model.User user,
                 boolean respectFrontEndRoles)
                 throws DotDataException,
                        DotRuntimeException,
                        DotSecurityException
Method that saves a new address and tie it to the user

Parameters:
user -
ad -
Throws:
DotDataException
DotSecurityException
DotRuntimeException

loadAddressById

com.liferay.portal.model.Address loadAddressById(java.lang.String addressId,
                                                 com.liferay.portal.model.User user,
                                                 boolean respectFrontEndRoles)
                                                 throws DotDataException,
                                                        DotSecurityException
Load address by id

Throws:
DotSecurityException
DotDataException

deleteAddress

void deleteAddress(com.liferay.portal.model.Address ad,
                   com.liferay.portal.model.User user,
                   boolean respectFrontEndRoles)
                   throws DotDataException,
                          DotRuntimeException,
                          DotSecurityException
Removes from the system the given address

Parameters:
ad -
Throws:
DotDataException
DotSecurityException
DotRuntimeException

loadUserAddresses

java.util.List<com.liferay.portal.model.Address> loadUserAddresses(com.liferay.portal.model.User userToGetAddresses,
                                                                   com.liferay.portal.model.User user,
                                                                   boolean respectFrontEndRoles)
                                                                   throws DotDataException,
                                                                          DotRuntimeException,
                                                                          DotSecurityException
Retrieves all addresses associated to a user

Parameters:
user -
Returns:
Throws:
DotDataException
DotSecurityException
DotRuntimeException

isCMSAdmin

boolean isCMSAdmin(com.liferay.portal.model.User user)
                   throws DotDataException
Returns true if the user is a cms admin

Parameters:
user -
Returns:
Throws:
DotDataException
DotRuntimeException
DotSecurityException


Copyright © 2013 dotCMS Inc. All Rights Reserved.