public class UserFactory extends HibernateFactory
| Modifier and Type | Field and Description |
|---|---|
static State |
DISABLED |
static State |
ENABLED |
static java.util.List<Role> |
IMPLIEDROLES
List of Role objects that are applied if you are an Org_admin
|
protected static org.apache.log4j.Logger |
LOG |
| Modifier | Constructor and Description |
|---|---|
protected |
UserFactory() |
| Modifier and Type | Method and Description |
|---|---|
protected User |
addNewUser(User usr,
Address addr,
java.lang.Long orgId)
Insert a new user.
|
static Address |
createAddress()
Create a new address instance.
|
static User |
createUser()
Create a new user from scratch
|
static void |
deleteUser(java.lang.Long userId) |
void |
disable(User userToDisable,
User disabledBy)
Disable a user
|
void |
enable(User userToEnable,
User enabledBy)
Enable a user
|
java.util.List<User> |
findAllOrgAdmins(Org inOrg)
Return a list of all User's who are org admins in the given org.
|
java.util.List<User> |
findAllUsers(Org inOrg)
Return a list of all User's who are in the given org.
|
static User |
findRandomOrgAdmin(Org orgIn)
Returns user (first org admin) of the org.
|
static User |
findResponsibleUser(java.lang.Long orgId,
Role r)
Returns the responsible user (first org admin) of the org.
|
static RhnTimeZone |
getDefaultTimeZone()
Gets the default time zone
|
static UserFactory |
getInstance() |
protected org.apache.log4j.Logger |
getLogger()
Get the Logger for the derived class so log messages
show up on the correct class
|
static RhnTimeZone |
getTimeZone(int id)
Get the timezone by ID
|
static RhnTimeZone |
getTimeZone(java.lang.String olsonName)
Get the timezone by olson name
|
static boolean |
isDisabled(User user)
Convenience method to determine whether a user is disabled
or not
|
static java.util.List |
lookupAllTimeZones()
Get all timezones in apropriate order
|
static java.util.List<User> |
lookupByEmail(java.lang.String email)
Return a list of all Users who has the given email.
|
static User |
lookupById(java.lang.Long id)
Lookup a user by their id
|
static User |
lookupById(User user,
java.lang.Long id)
Lookup a user by their id, assuming that they are in the same Org as
the user doing the search.
|
static java.util.List<User> |
lookupByIds(java.util.Collection<java.lang.Long> ids)
Get users by their ids.
|
static User |
lookupByLogin(java.lang.String login)
Lookup a user by their login
|
static User |
lookupByLogin(User user,
java.lang.String login)
Lookup a user by their login
|
UserServerPreference |
lookupServerPreferenceByUserServerAndName(User user,
Server server,
java.lang.String name)
Looks up the UserServerPreference corresponding to the given
user, server, and preference label
|
static boolean |
satelliteHasUsers()
Method to determine whether a satellite has any users.
|
static void |
save(User user)
Insert or Update a user
|
static void |
saveAddress(Address addr)
Save this instance of address
|
static User |
saveNewUser(User usr,
Address addr,
java.lang.Long orgId)
Insert a new user.
|
protected void |
saveUser(User user)
Insert or Update a user
|
void |
setUserServerPreferenceValue(User user,
Server server,
java.lang.String preferenceName,
boolean value)
Sets a UserServerPreference to true or false
|
void |
syncServerGroupPerms(User usr)
Syncs the user permissions with server group info..
|
protected void |
syncUserPerms(User usr)
Syncs the user permissions with server group info..
|
addConfigurator, blobToByteArray, byteArrayToBlob, closeSession, closeSessionFactory, commitTransaction, createSessionFactory, createSessionFactory, executeCallableMode, executeSelectMode, getBlobContents, getByteArrayContents, getObject, getSession, initialize, inTransaction, isClosed, isInitialized, listObjectsByNamedQuery, listObjectsByNamedQuery, listObjectsByNamedQuery, lockObject, lookupObjectByNamedQuery, lookupObjectByNamedQuery, reload, removeObject, rollbackTransaction, saveObject, saveObject, stringToByteArrayprotected static final org.apache.log4j.Logger LOG
public static final java.util.List<Role> IMPLIEDROLES
public static final State ENABLED
public static final State DISABLED
public static User findResponsibleUser(java.lang.Long orgId, Role r)
orgId - Org idr - Role to search for (ORG_ADMIN)public static User findRandomOrgAdmin(Org orgIn)
orgIn - Org idprotected org.apache.log4j.Logger getLogger()
getLogger in class HibernateFactorypublic static User createUser()
public static Address createAddress()
public static void saveAddress(Address addr)
addr - the address to save.public static User lookupById(java.lang.Long id)
id - the id to search forpublic static java.util.List<User> lookupByIds(java.util.Collection<java.lang.Long> ids)
ids - the ids to lookup forpublic static User lookupById(User user, java.lang.Long id)
user - the user doing the searchid - the id to search forpublic static User lookupByLogin(java.lang.String login)
login - the login to search bypublic static User lookupByLogin(User user, java.lang.String login)
user - the user doing the searchlogin - the login to search bypublic static User saveNewUser(User usr, Address addr, java.lang.Long orgId)
usr - The object we are commiting.addr - The address to add to the UserorgId - Org this new user is a member ofpublic static boolean isDisabled(User user)
user - to check on...protected User addNewUser(User usr, Address addr, java.lang.Long orgId)
usr - The object we are commiting.addr - The address to add to the UserorgId - Org this new user is a member ofpublic static void save(User user)
user - The object we are committing.protected void saveUser(User user)
user - The object we are committing.protected void syncUserPerms(User usr)
usr - the user to syncpublic void syncServerGroupPerms(User usr)
usr - User to be synchronized.public static RhnTimeZone getTimeZone(int id)
id - ID number for timezonepublic static RhnTimeZone getTimeZone(java.lang.String olsonName)
olsonName - olson name for timezonepublic static RhnTimeZone getDefaultTimeZone()
public static java.util.List lookupAllTimeZones()
public void disable(User userToDisable, User disabledBy)
userToDisable - The user to disabledisabledBy - The user committing the actpublic void enable(User userToEnable, User enabledBy)
userToEnable - The user to enableenabledBy - The user committing the actpublic static boolean satelliteHasUsers()
public static UserFactory getInstance()
public UserServerPreference lookupServerPreferenceByUserServerAndName(User user, Server server, java.lang.String name)
user - user who the preference corresponds toserver - server that preference corresponds toname - preference label we are looking forpublic void setUserServerPreferenceValue(User user, Server server, java.lang.String preferenceName, boolean value)
user - User whose preference will be setserver - Server we are setting the perference onpreferenceName - the name of the preferencevalue - true if the preference should be true, false otherwiseUserServerPreferenceIdpublic static java.util.List<User> lookupByEmail(java.lang.String email)
email - String to find users for.public java.util.List<User> findAllUsers(Org inOrg)
inOrg - Org to find users for.public java.util.List<User> findAllOrgAdmins(Org inOrg)
inOrg - Org to find administrators for.public static void deleteUser(java.lang.Long userId)
userId - the user id