Package de.xima.fc.dao.impl
Class UserProfileDao
- java.lang.Object
-
- de.xima.cmn.dao.AbstractDao<T,Long,IEntityContext>
-
- de.xima.fc.dao.impl.GenericDao<UserProfile>
-
- de.xima.fc.dao.impl.UserProfileDao
-
- All Implemented Interfaces:
de.xima.cmn.dao.interfaces.IAbstractDao<UserProfile,Long,IEntityContext>,IGenericDao<UserProfile>,IUserProfileDao
public class UserProfileDao extends GenericDao<UserProfile> implements IUserProfileDao
Implementation of theIUserProfileDaofor reading and writingUserProfileentities.- Since:
- 8.0.0
- Author:
- XIMA Media GmbH
-
-
Field Summary
Fields Modifier and Type Field Description static StringENTITY_CONTEXT_PARAM_REF_CLIENTS
-
Constructor Summary
Constructors Constructor Description UserProfileDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull UserProfileacceptDirectClientAuthorization(IEntityContext ec, UserProfile profile, DirectClientAuthorization authorization)Adds the given client authorization to the given profile and accepts it.@NotNull UserProfileaddDirectClientAuthorization(IEntityContext ec, UserProfile userProfile, DirectClientAuthorization authorization)Adds the given client authorizations to the user profile.booleancanBeDeleted(IEntityContext ec, UserProfile profile)Checks whether or not the user profile can be deleted.StringfindUniqueUserName(IEntityContext ec, String candidate, UserProfile exclude)Finds a unique user name for the given candidate.Set<UserProfile>getByEmailAddress(IEntityContext ec, String email)Finds the user profiles with the given email address.UserProfilegetByLoginId(IEntityContext ec, String loginId)Finds the user profile by the given login ID.UserProfilegetByUserName(IEntityContext ec, String userName)Finds the user profile with the given user nameUserProfilegetByUuid(IEntityContext ec, String uuid)Finds the user profile with the given UUID.UserProfilegetByUuid(IEntityContext ec, UUID uuid)Finds the user credentials with the given UUID.UserProfilegetByVerifiedEmailAddress(IEntityContext ec, String email)Finds the user profile with the given email address.UserProfilegetByVerifiedPrimaryEmailAddress(IEntityContext ec, String email)Finds the user profile with the given verified primary email address.protected IFCDaoActionHook<UserProfile>getPostActionHook()protected IFCDaoActionHook<UserProfile>getPreActionHook()Set<UserProfile>getProfilesExclusiveToClients(IEntityContext ec, Set<Mandant> clients)Finds all user profiles that are exclusive to the given clients, meaning they are only part of those clients and don't have any other special roles such essystem admin.booleanisUserNameExisiting(IEntityContext ec, String name)Checks if the given user name exists within the system.UserProfilemergeUserProfiles(IEntityContext ec, UserProfile main, UserProfile toBeMerged)Merges the a profile into another.UserProfilevalidateUserLogin(IEntityContext ec, String loginId, String password)Validates the given user credentials and returns the user profile if successfull.-
Methods inherited from class de.xima.fc.dao.impl.GenericDao
getEntityRefs, read
-
Methods inherited from class de.xima.cmn.dao.AbstractDao
all, bulkDelete, bulkUpdate, cb, checkLockingVersion, cq, create, create, delete, delete, deleteAll, executePagedDaoAction, getAttributes, getAttributes, getSingleAttributes, getSingleAttributes, getTransactionHandler, notifyListener, notifyListener, read, registerListener, registerListener, registerListener, resultTotalCount, setTransactionHandler, singleElement, unregisterListener, unregisterListener, unregisterListener, update, update
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.xima.cmn.dao.interfaces.IAbstractDao
all, bulkDelete, bulkUpdate, checkLockingVersion, create, create, delete, delete, deleteAll, executePagedDaoAction, getAttributes, getAttributes, getSingleAttributes, getSingleAttributes, getTransactionHandler, read, registerListener, registerListener, registerListener, resultTotalCount, setTransactionHandler, singleElement, unregisterListener, unregisterListener, unregisterListener, update, update
-
Methods inherited from interface de.xima.fc.dao.interfaces.IGenericDao
count, findAll, findSingle, getEntityRefs, read
-
-
-
-
Field Detail
-
ENTITY_CONTEXT_PARAM_REF_CLIENTS
public static final String ENTITY_CONTEXT_PARAM_REF_CLIENTS
- See Also:
- Constant Field Values
-
-
Method Detail
-
getByLoginId
public UserProfile getByLoginId(IEntityContext ec, String loginId)
Description copied from interface:IUserProfileDaoFinds the user profile by the given login ID. This ID may be the users primary email address or user name.- Specified by:
getByLoginIdin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the databaseloginId- primary email address (case irrelevant) or user name of the user profile- Returns:
- The user profile for the given login ID or
null.
-
getByEmailAddress
public Set<UserProfile> getByEmailAddress(IEntityContext ec, String email)
Description copied from interface:IUserProfileDaoFinds the user profiles with the given email address. There may be multiple user profiles with the given email address but there can only be one user profile with a given verified email address (seeIUserProfileDao.getByVerifiedEmailAddress(IEntityContext, String)).- Specified by:
getByEmailAddressin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the databaseemail- address of the user profile (case irrelevant)- Returns:
- A set of user profiles with the given email address.
-
getByVerifiedEmailAddress
public UserProfile getByVerifiedEmailAddress(IEntityContext ec, String email)
Description copied from interface:IUserProfileDaoFinds the user profile with the given email address. The user email needs to be verified.- Specified by:
getByVerifiedEmailAddressin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the databaseemail- address of the user profile (case irrelevant)- Returns:
- The user profile with the given verified email address or
null.
-
getByVerifiedPrimaryEmailAddress
public UserProfile getByVerifiedPrimaryEmailAddress(IEntityContext ec, String email)
Description copied from interface:IUserProfileDaoFinds the user profile with the given verified primary email address.- Specified by:
getByVerifiedPrimaryEmailAddressin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the databaseemail- address of the user profile (case irrelevant)- Returns:
- The user profile with the given verified primary email address or
null.
-
getByUserName
public UserProfile getByUserName(IEntityContext ec, String userName)
Description copied from interface:IUserProfileDaoFinds the user profile with the given user name- Specified by:
getByUserNamein interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the databaseuserName- of the user profile- Returns:
- The user profile with the given user name or
null.
-
getByUuid
public UserProfile getByUuid(IEntityContext ec, String uuid)
Description copied from interface:IUserProfileDaoFinds the user profile with the given UUID.- Specified by:
getByUuidin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the database.uuid- UUID of the user profile.- Returns:
- The user profile with the given UUID.
-
getByUuid
public UserProfile getByUuid(IEntityContext ec, UUID uuid)
Description copied from interface:IUserProfileDaoFinds the user credentials with the given UUID.- Specified by:
getByUuidin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the database.uuid- of the user profile.- Returns:
- The user profile with the given UUID.
-
getProfilesExclusiveToClients
public Set<UserProfile> getProfilesExclusiveToClients(IEntityContext ec, Set<Mandant> clients)
Description copied from interface:IUserProfileDaoFinds all user profiles that are exclusive to the given clients, meaning they are only part of those clients and don't have any other special roles such essystem admin.- Specified by:
getProfilesExclusiveToClientsin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the database.clients- the user profiles are exclusive to.- Returns:
- A set of user profiles that are exclusive to the given clients.
-
findUniqueUserName
public String findUniqueUserName(IEntityContext ec, String candidate, UserProfile exclude)
Description copied from interface:IUserProfileDaoFinds a unique user name for the given candidate. If the candidate is not unique a random number will be appended.- Specified by:
findUniqueUserNamein interfaceIUserProfileDao- Parameters:
ec- entity context for database transactions.candidate- desired user name.exclude- user profile to be excluded from search.- Returns:
- a unique user name.
-
isUserNameExisiting
public boolean isUserNameExisiting(IEntityContext ec, String name)
Description copied from interface:IUserProfileDaoChecks if the given user name exists within the system.- Specified by:
isUserNameExisitingin interfaceIUserProfileDao- Parameters:
ec- entity context for database transactions.name- user name to check.- Returns:
trueif the user name exists already andfalseotherwise.
-
validateUserLogin
public UserProfile validateUserLogin(IEntityContext ec, String loginId, String password)
Description copied from interface:IUserProfileDaoValidates the given user credentials and returns the user profile if successfull.- Specified by:
validateUserLoginin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the database.loginId- user name or primary email address of the userpassword- password for the user profile- Returns:
- user profile if validation was successful.
nullotherwise.
-
addDirectClientAuthorization
@NotNull public @NotNull UserProfile addDirectClientAuthorization(IEntityContext ec, UserProfile userProfile, DirectClientAuthorization authorization)
Description copied from interface:IUserProfileDaoAdds the given client authorizations to the user profile. If the user profile already has an authorization to client than the authorizations will be merged, meaning that allrolesanduser groupswill be added to the existing client authorization of the user profile.- Specified by:
addDirectClientAuthorizationin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the database.userProfile- to add the direct client authorization to.authorization- to add.- Returns:
- the updated user profile.
-
acceptDirectClientAuthorization
@NotNull public @NotNull UserProfile acceptDirectClientAuthorization(IEntityContext ec, UserProfile profile, DirectClientAuthorization authorization)
Description copied from interface:IUserProfileDaoAdds the given client authorization to the given profile and accepts it. If an authorization for the client already exists than the authorizations will be merged.- Specified by:
acceptDirectClientAuthorizationin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the database.profile- User profile to add the client authorization to.authorization- Client authorization to add & accept- Returns:
- The user profile with the added / accepted client authorization.
-
mergeUserProfiles
public UserProfile mergeUserProfiles(IEntityContext ec, UserProfile main, UserProfile toBeMerged)
Description copied from interface:IUserProfileDaoMerges the a profile into another. Emails, identities, authorizations, permissions, roles, credentials, files will be added / merged. The custom user properties won't be affected. The profile that will be merged into the other profile will be deleted when the merge has completed.- Specified by:
mergeUserProfilesin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the database.main- to be extended by merging another profile into it.toBeMerged- profile that will be merged into the main profile. This profile will be deleted when the merge has completed.- Returns:
- the extended user profile.
-
canBeDeleted
public boolean canBeDeleted(IEntityContext ec, UserProfile profile)
Description copied from interface:IUserProfileDaoChecks whether or not the user profile can be deleted. User profiles can't be deleted if they are the only admin of existing clients. If the user profile can't be deleted the given entity context will contain a set of clients for which the user profile is the only client admin.- Specified by:
canBeDeletedin interfaceIUserProfileDao- Parameters:
ec- entity context for accessing the database.profile- to check.- Returns:
trueid the user profile can be deleted (is not the single admin of any existing clients) andfalseotherwise.
-
getPreActionHook
protected IFCDaoActionHook<UserProfile> getPreActionHook()
- Overrides:
getPreActionHookin classGenericDao<UserProfile>
-
getPostActionHook
protected IFCDaoActionHook<UserProfile> getPostActionHook()
- Overrides:
getPostActionHookin classGenericDao<UserProfile>
-
-