com.dotmarketing.cms.factories
Class PublicUserFactory

java.lang.Object
  extended by com.liferay.portal.ejb.UserUtil
      extended by com.dotmarketing.cms.factories.PublicUserFactory

public class PublicUserFactory
extends com.liferay.portal.ejb.UserUtil

Version:
1.5
Author:
David Torres

Field Summary
 
Fields inherited from class com.liferay.portal.ejb.UserUtil
LISTENER, PERSISTENCE
 
Constructor Summary
PublicUserFactory()
           
 
Method Summary
static com.liferay.portal.model.User findUserByEmail(java.lang.String email)
          This method finds a User by email, if the user was not found it returns a null instance.
static com.liferay.portal.model.User findUserByUserId(java.lang.String userId)
          This method finds a User by userId, if the user was not found it returns a null instance.
static java.util.List<com.liferay.portal.model.User> getAllUsers()
          This metho return a list of all the existing users in the cms
static com.liferay.portal.model.User getAnonymousUser()
          This method return an anonymous user, created to manage the submitContent macro with no user logged in
static long getCountUsersByNameOrEmail(java.lang.String filter)
          This Method return the number of user that have a firstname, lastname or email like the filter string.
static com.liferay.portal.model.User getDefaultUser()
          This method return the default user of the system
static com.liferay.portal.model.User getInstance()
          Get a new empty instance of the user class
static com.liferay.portal.model.User getInstance(java.lang.String email)
           
static com.liferay.portal.model.User getInstanceByUserId(java.lang.String userId)
          Returns a fresh new user with a given userId.
static com.liferay.portal.model.User getSystemUser()
           
static com.liferay.portal.model.User getUserByEmail(java.lang.String email)
          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.
static com.liferay.portal.model.User getUserByUserId(java.lang.String userId)
          This method finds a User by userId, if the user was not found it returns a new user instance ready to be filled and stored.
static int getUserCountByName(java.lang.String filter)
          This method return number of uses whose names are like the filter passed in.
static java.lang.String getUserPictureURL(java.lang.String userId)
          this method returns the user portrait image file path when it's exists
static java.util.Map<java.lang.String,java.lang.Object> getUsersAnRolesByName(java.lang.String filter, int start, int limit)
          Deprecated.  
static java.util.List<com.liferay.portal.model.User> getUsersByName(java.lang.String filter, int start, int limit)
          This method return a list of users whose names are like the filter passed in.
static java.util.List<com.liferay.portal.model.User> getUsersByNameOrEmail(java.lang.String filter, int page, int pageSize)
          This metho return a a paginated list of user that have a firstname, lastname or email like the compare string passed
static java.util.List<java.lang.String> getUsersTitle()
          This method return all the posible title setted by the users.
static boolean isACMSAdmin(com.liferay.portal.model.User user)
          This method return true if the user parameter have CMS_ADMINISTRATOR_ROLE role associated
static boolean isACMSPowerUser(com.liferay.portal.model.User user)
          This method return true if the user parameter have CMS_ADMINISTRATOR_ROLE role associated
static void save(com.liferay.portal.model.User u)
          Save or update in db the user object
static void saveUserPicture(com.liferay.portal.model.User user, UserProxy userProxy, Host host, java.io.File uploadedFile)
          creates/updates the user portrait, saving the image file on dotCMS especific asset folder, associating the uploaded image file to liferay portrais as well
static java.util.HashMap<java.lang.String,java.lang.Object> searchUsersAndUsersProxy(java.lang.String firstName, java.lang.String lastName, java.lang.String title, java.util.List<com.liferay.portal.model.Group> groups, boolean showUserGroups, java.util.List<com.liferay.portal.model.Role> roles, boolean showUserRoles, java.lang.String orderBy, int page, int pageSize)
          This method return a paginated list of the info of user and user proxy that have a firstname, lastname, user proxy title, groups and roles.
static boolean userExists(java.lang.String email)
          Verify is exists a user with the specified email address
 
Methods inherited from class com.liferay.portal.ejb.UserUtil
addGroup, addGroup, addGroups, addGroups, addRole, addRole, addRoles, addRoles, clearGroups, clearRoles, containsGroup, containsGroup, containsRole, containsRole, countByC_EA, countByC_P, countByC_U, countByCompanyId, create, findAll, findByC_EA, findByC_P_First, findByC_P_Last, findByC_P_PrevAndNext, findByC_P, findByC_P, findByC_P, findByC_U, findByCompanyId_First, findByCompanyId_Last, findByCompanyId_PrevAndNext, findByCompanyId, findByCompanyId, findByCompanyId, findByPrimaryKey, getGroups, getGroups, getGroups, getGroupsSize, getRoles, getRoles, getRoles, getRolesSize, remove, removeByC_EA, removeByC_P, removeByC_U, removeByCompanyId, removeGroup, removeGroup, removeGroups, removeGroups, removeRole, removeRole, removeRoles, removeRoles, setGroups, setGroups, setRoles, setRoles, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PublicUserFactory

public PublicUserFactory()
Method Detail

getInstance

public static com.liferay.portal.model.User getInstance()
Get a new empty instance of the user class

Returns:
User
Since:
1.0

getInstance

public static com.liferay.portal.model.User getInstance(java.lang.String email)

getInstanceByUserId

public static com.liferay.portal.model.User getInstanceByUserId(java.lang.String userId)
                                                         throws com.liferay.portal.PortalException
Returns a fresh new user with a given userId. Does not check if this user exists before it returns it.

Parameters:
userId -
Returns:
User
Throws:
com.liferay.portal.PortalException

userExists

public static boolean userExists(java.lang.String email)
Verify is exists a user with the specified email address

Parameters:
email - user email
Returns:
boolean
Since:
1.0

getUserByEmail

public static com.liferay.portal.model.User getUserByEmail(java.lang.String email)
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.

Parameters:
email -
Returns:
User
Since:
1.0

getUserByUserId

public static com.liferay.portal.model.User getUserByUserId(java.lang.String userId)
This method finds a User by userId, 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.

Parameters:
email -
Returns:
User
Since:
1.0

findUserByUserId

public static com.liferay.portal.model.User findUserByUserId(java.lang.String userId)
This method finds a User by userId, if the user was not found it returns a null instance.

Parameters:
email -
Returns:
User
Since:
1.0

findUserByEmail

public static com.liferay.portal.model.User findUserByEmail(java.lang.String email)
This method finds a User by email, if the user was not found it returns a null instance.

Parameters:
email -
Returns:
User
Since:
1.0

save

public static void save(com.liferay.portal.model.User u)
Save or update in db the user object

Parameters:
u - teh user object
Since:
1.0

getDefaultUser

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

Returns:
User
Since:
1.0

getSystemUser

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

getAllUsers

public static java.util.List<com.liferay.portal.model.User> getAllUsers()
This metho return a list of all the existing users in the cms

Returns:
List
Since:
1.0

isACMSAdmin

public static boolean isACMSAdmin(com.liferay.portal.model.User user)
This method return true if the user parameter have CMS_ADMINISTRATOR_ROLE role associated

Parameters:
user -
Returns:
boolean
Since:
1.0

isACMSPowerUser

public static boolean isACMSPowerUser(com.liferay.portal.model.User user)
This method return true if the user parameter have CMS_ADMINISTRATOR_ROLE role associated

Parameters:
user -
Returns:
boolean
Since:
1.7

getCountUsersByNameOrEmail

public static long getCountUsersByNameOrEmail(java.lang.String filter)
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"

Parameters:
filter - Compare string
Returns:
long
Since:
1.0

getUsersByNameOrEmail

public static java.util.List<com.liferay.portal.model.User> getUsersByNameOrEmail(java.lang.String filter,
                                                                                  int page,
                                                                                  int pageSize)
This metho return a a paginated list of user that have a firstname, lastname or email like the compare string passed

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

getUsersAnRolesByName

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

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

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

getUsersByName

public static java.util.List<com.liferay.portal.model.User> getUsersByName(java.lang.String filter,
                                                                           int start,
                                                                           int limit)
                                                                    throws DotRuntimeException
This method return a list of users whose names are like the filter passed in.

Parameters:
filter - compare string.
start - is the first element to display.
limit - is the maximum number of elements to get.
Returns:
List of user entities
Throws:
DotRuntimeException
Since:
1.0

getUserCountByName

public static int getUserCountByName(java.lang.String filter)
                              throws DotRuntimeException
This method return number of uses whose names are like the filter passed in.

Parameters:
filter - compare string.
Returns:
Number of user that matches filter.
Throws:
DotRuntimeException
Since:
1.6

saveUserPicture

public static void saveUserPicture(com.liferay.portal.model.User user,
                                   UserProxy userProxy,
                                   Host host,
                                   java.io.File uploadedFile)
                            throws java.lang.Exception
creates/updates the user portrait, saving the image file on dotCMS especific asset folder, associating the uploaded image file to liferay portrais as well

Parameters:
user - user to create/update portrait
userProxy - user proxy object of the user parameter
host - host where resides the dotCMS asset folder
uploadedFile - image file
Throws:
java.lang.Exception

getUserPictureURL

public static java.lang.String getUserPictureURL(java.lang.String userId)
this method returns the user portrait image file path when it's exists

Parameters:
userId - user id of the user
Returns:
path of the user portrait image file file

searchUsersAndUsersProxy

public static java.util.HashMap<java.lang.String,java.lang.Object> searchUsersAndUsersProxy(java.lang.String firstName,
                                                                                            java.lang.String lastName,
                                                                                            java.lang.String title,
                                                                                            java.util.List<com.liferay.portal.model.Group> groups,
                                                                                            boolean showUserGroups,
                                                                                            java.util.List<com.liferay.portal.model.Role> roles,
                                                                                            boolean showUserRoles,
                                                                                            java.lang.String orderBy,
                                                                                            int page,
                                                                                            int pageSize)
This method return a paginated list of the info of user and user proxy that have a firstname, lastname, user proxy title, groups and roles.

Parameters:
firstName - compare string
lastName - compare string
title - compare string
groups - list of groups
showUserGroups - boolean. If true then a list of group names will returned in the result. This value will be automatically set to true if the parameter group list is greater than 0 or the order by parameter is ordered by group name.
roles - list of roles
showUserRoles - boolean. If true then a list of role names will returned in the result. This value will be automatically set to true if the parameter role list is greater than 0 or the order by parameter is ordered by role name.
orderBy - how will be ordered the result
page - page to display
pageSize - number of element to show in the page
Returns:
HashMap: The list of users found will be associated to the key 'users'. The list of users proxy found will be associated to the key 'usersProxy'. The total number of items returned is associated to the key 'total'. A list of group names can be found and associated to the key 'groupNames' if a group list is passed in. A list of role names can be found and associated to the key 'roleNames' if a role list is passed in.

getUsersTitle

public static java.util.List<java.lang.String> getUsersTitle()
This method return all the posible title setted by the users.

Returns:
List of titles.

getAnonymousUser

public static 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


Copyright © 2009 Dotmarketing, Inc. All Rights Reserved.