Class UserProfileDao


  • public class UserProfileDao
    extends AbstractDao
    Provides a DAO for the UserProfile entity.
    See Also:
    UserProfile
    • Constructor Detail

      • UserProfileDao

        public UserProfileDao()
    • 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 to
        profileName - 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