Package com.avoka.fc.core.dao
Class UserProfileDao
- java.lang.Object
-
- com.avoka.core.dao.BaseDao
-
- com.avoka.fc.core.dao.AbstractDao
-
- com.avoka.fc.core.dao.UserProfileDao
-
public class UserProfileDao extends AbstractDao
Provides a DAO for the UserProfile entity.- See Also:
UserProfile
-
-
Field Summary
-
Fields inherited from class com.avoka.core.dao.BaseDao
FETCH_LIMIT, STATEMENT_MAX_NO_PARAMETERS
-
-
Constructor Summary
Constructors Constructor Description UserProfileDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUserPropertyToProfiles(PropertyType propertyType)
Ensure all user profiles contain a user property for the given property type (normally a newly created property type).UserProfile
deleteProfile(UserProfile userProfile)
Delete the given user profile, and return the next user profile.UserProfile
getProfile(UserAccount userAccount, String profileName)
Return the user profile with a given name for a given user accountUserProfile
getProfileForPK(Object id)
Return the user profile with the specified OIDList<UserProfile>
getProfilesForUser(UserAccount user)
Return the user profiles for the given user account, ordered by profile namevoid
makeCurrentProfile(UserProfile userProfile)
Mark a new user profile as the current one for the user.void
unsetCurrentProfile(UserProfile oldCurrentProfile)
Unset the current flag on a given user profile.void
updateActiveUserProfile(UserAccount userAccount, Map<String,String> newPropertyMap)
Update user account's active profile with the given profile values map.-
Methods inherited from class com.avoka.fc.core.dao.AbstractDao
andFilterClientExcludeNull, andFilterClientIncludeNull, andFilterClientOnly, isClientAccessAllowed, performQueryConfigCached
-
Methods inherited from class com.avoka.core.dao.BaseDao
addOrdering, addOrderingCaseInsensitive, addOrderingCaseSensitive, andQueryBetween, andQueryInExp, andQueryInExp, andQueryLikeIgnoreCaseExp, andQueryMatchDbExp, andQueryMatchExp, andQueryMatchIsNotNull, andQueryMatchIsNull, andQueryNoMatchExp, andQueryNotTrue, deleteObject, deleteObjects, findObject, getDataContext, getFetchLimit, getLogger, getObjectForPK, newObject, orQueryLikeIgnoreCaseExp, orQueryMatchExp, performNamedQuery, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, performQuery, registerNewObject, setCacheStrategy, setFetchLimit, setLocalCacheStrategy, setLocalCacheStrategy, setSharedCacheStrategy, toMap, toMap
-
-
-
-
Method Detail
-
getProfileForPK
public UserProfile getProfileForPK(Object id)
Return the user profile with the specified OID- Parameters:
id
- the OID- Returns:
- the matching user proile, or null if not found
-
getProfilesForUser
public List<UserProfile> getProfilesForUser(UserAccount user)
Return the user profiles for the given user account, ordered by profile name- Parameters:
user
- the non-null user account- Returns:
- the list of matching user profiles
-
getProfile
public UserProfile getProfile(UserAccount userAccount, String profileName)
Return the user profile with a given name for a given user account- Parameters:
userAccount
- the non-null user the profile must belong toprofileName
- the non-empty profile name to look for- Returns:
- the matching user profile, if one exists
-
makeCurrentProfile
public void makeCurrentProfile(UserProfile userProfile)
Mark a new user profile as the current one for the user. After this method has completed, only one user profile will be marked as current for the user.- Parameters:
userProfile
- the non-null user profile to be marked as current
-
unsetCurrentProfile
public void unsetCurrentProfile(UserProfile oldCurrentProfile)
Unset the current flag on a given user profile. This method will promote another profile to be the current one, and will execute a db commit.- Parameters:
oldCurrentProfile
- the current profile for a SmartForm Manager user
-
deleteProfile
public UserProfile deleteProfile(UserProfile userProfile)
Delete the given user profile, and return the next user profile. If the profile is the last profile for the user a new default user profile will be created.- Parameters:
userProfile
- the non-null user profile to delete- Returns:
- the next profile for the same user
-
addUserPropertyToProfiles
public void addUserPropertyToProfiles(PropertyType propertyType)
Ensure all user profiles contain a user property for the given property type (normally a newly created property type). The caller will need to commit the changes. Iterates through all user profiles and adds a property if the user profile does not currently have a property value with the same name.- Parameters:
propertyType
- the property type (required, must be of scope 'User' and have a name set)
-
updateActiveUserProfile
public void updateActiveUserProfile(UserAccount userAccount, Map<String,String> newPropertyMap)
Update user account's active profile with the given profile values map. If the user does not have an active profile one will be created. This method will also create user scope PropertyTypes if required. When this method has completed, a profile property will exist for each user property type.- Parameters:
userAccount
- the user account (required)newPropertyMap
- the value to populate the active user profile with (required)- Since:
- 3.6.0
-
-