Class UserProfileDao

    • Constructor Detail

      • UserProfileDao

        public UserProfileDao()
    • Method Detail

      • getByLoginId

        public UserProfile getByLoginId​(IEntityContext ec,
                                        String loginId)
        Description copied from interface: IUserProfileDao
        Finds the user profile by the given login ID. This ID may be the users primary email address or user name.
        Specified by:
        getByLoginId in interface IUserProfileDao
        Parameters:
        ec - entity context for accessing the database
        loginId - primary email address (case irrelevant) or user name of the user profile
        Returns:
        The user profile for the given login ID or null.
      • getByVerifiedEmailAddress

        public UserProfile getByVerifiedEmailAddress​(IEntityContext ec,
                                                     String email)
        Description copied from interface: IUserProfileDao
        Finds the user profile with the given email address. The user email needs to be verified.
        Specified by:
        getByVerifiedEmailAddress in interface IUserProfileDao
        Parameters:
        ec - entity context for accessing the database
        email - 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: IUserProfileDao
        Finds the user profile with the given verified primary email address.
        Specified by:
        getByVerifiedPrimaryEmailAddress in interface IUserProfileDao
        Parameters:
        ec - entity context for accessing the database
        email - 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: IUserProfileDao
        Finds the user profile with the given user name
        Specified by:
        getByUserName in interface IUserProfileDao
        Parameters:
        ec - entity context for accessing the database
        userName - 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: IUserProfileDao
        Finds the user profile with the given UUID.
        Specified by:
        getByUuid in interface IUserProfileDao
        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: IUserProfileDao
        Finds the user credentials with the given UUID.
        Specified by:
        getByUuid in interface IUserProfileDao
        Parameters:
        ec - entity context for accessing the database.
        uuid - of the user profile.
        Returns:
        The user profile with the given UUID.
      • findUniqueUserName

        public String findUniqueUserName​(IEntityContext ec,
                                         String candidate,
                                         UserProfile exclude)
        Description copied from interface: IUserProfileDao
        Finds a unique user name for the given candidate. If the candidate is not unique a random number will be appended.
        Specified by:
        findUniqueUserName in interface IUserProfileDao
        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: IUserProfileDao
        Checks if the given user name exists within the system.
        Specified by:
        isUserNameExisiting in interface IUserProfileDao
        Parameters:
        ec - entity context for database transactions.
        name - user name to check.
        Returns:
        true if the user name exists already and false otherwise.
      • validateUserLogin

        public UserProfile validateUserLogin​(IEntityContext ec,
                                             String loginId,
                                             String password)
        Description copied from interface: IUserProfileDao
        Validates the given user credentials and returns the user profile if successfull.
        Specified by:
        validateUserLogin in interface IUserProfileDao
        Parameters:
        ec - entity context for accessing the database.
        loginId - user name or primary email address of the user
        password - password for the user profile
        Returns:
        user profile if validation was successful. null otherwise.
      • addDirectClientAuthorization

        @NotNull
        public @NotNull UserProfile addDirectClientAuthorization​(IEntityContext ec,
                                                                 UserProfile userProfile,
                                                                 DirectClientAuthorization authorization)
        Description copied from interface: IUserProfileDao
        Adds 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 all roles and user groups will be added to the existing client authorization of the user profile.
        Specified by:
        addDirectClientAuthorization in interface IUserProfileDao
        Parameters:
        ec - entity context for accessing the database.
        userProfile - to add the direct client authorization to.
        authorization - to add.
        Returns:
        the updated user profile.
      • mergeUserProfiles

        public UserProfile mergeUserProfiles​(IEntityContext ec,
                                             UserProfile main,
                                             UserProfile toBeMerged)
        Description copied from interface: IUserProfileDao
        Merges 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:
        mergeUserProfiles in interface IUserProfileDao
        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: IUserProfileDao
        Checks 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:
        canBeDeleted in interface IUserProfileDao
        Parameters:
        ec - entity context for accessing the database.
        profile - to check.
        Returns:
        true id the user profile can be deleted (is not the single admin of any existing clients) and false otherwise.