Class AuthenticatedUser
- All Implemented Interfaces:
- IAuthenticatedUser,- IBasicUserInfoDetailNames
- Author:
- Christopher Mindus
- Field SummaryFieldsModifier and TypeFieldDescription- static final StringThe file name for the undefined user profile image in huge format.- static final StringThe file name for the undefined user profile image in huge format.- static final StringThe base name of the file name for profile images of a certain size.- static final StringThe file name for the undefined user profile image in huge format.- final StringThe user name.- Fields inherited from interface com.iizix.user.IAuthenticatedUser- ADMIN_BACKUP_USER_NAME, ADMIN_USER_NAME, UNDEFINED_USER_NAME- Fields inherited from interface com.iizix.user.IBasicUserInfoDetailNames- DETAIL_AdditionalEmail, DETAIL_Address, DETAIL_Address_2, DETAIL_Address_3, DETAIL_City, DETAIL_CompanyDivision, DETAIL_CompanyName, DETAIL_Country, DETAIL_CroppedUploadedProfileImage, DETAIL_DBAdministrationUserName, DETAIL_DeveloperGroupID, DETAIL_DeveloperID, DETAIL_Email, DETAIL_EmailVerify, DETAIL_FirstName, DETAIL_FixedPassword, DETAIL_FullName, DETAIL_HomeFax, DETAIL_HomeMobile, DETAIL_HomePhone, DETAIL_JobTitle, DETAIL_LargeProfileImage, DETAIL_LastName, DETAIL_LocalizedFirstName, DETAIL_LocalizedFullName, DETAIL_LocalizedLastName, DETAIL_LocalizedMiddleName, DETAIL_LocalizedTitle, DETAIL_MiddleName, DETAIL_Phone, DETAIL_Phone_2, DETAIL_PinCode, DETAIL_RecoveryAnswer, DETAIL_RecoveryQuestion, DETAIL_StateProvince, DETAIL_ThumbnailProfileImage, DETAIL_Title, DETAIL_UploadedProfileImage, DETAIL_UploadedProfileImageCrop, DETAIL_WorkFax, DETAIL_WorkMobile, DETAIL_WorkPhone, DETAIL_ZipCode, detailsSet, profilePictureDetailsList
- Method SummaryModifier and TypeMethodDescription- booleanChecks for equality.Gets the basic user information that was last refreshed from the database.- longGets the last access time for the user.Gets the user's location history.- getProfileImage- (int width, int height, int quality, boolean createDefault) Gets the profile image for the user scaled to the requested size.- getProfileImage- (int width, int height, int quality, boolean createDefault, int rounded) Gets the profile image for the user scaled to the requested size.- getProfileImage- (IAppSessionGyro appGyro, int width, int height, int quality, boolean createDefault) Gets the profile image for the user scaled to the requested size.- getProfileImage- (IAppSessionGyro appGyro, int width, int height, int quality, boolean createDefault, int rounded) Gets the profile image for the user scaled to the requested size.- getProfileImage- (IClientSessionGyro clientGyro, int width, int height, int quality) Gets the profile image for the user scaled to the requested size.- getProfileImage- (IClientSessionGyro clientGyro, int width, int height, int quality, int rounded) Gets the profile image for the user scaled to the requested size.- getProfileImageName- (int width, int height, int quality) Gets the name of the profile image for this particular user.- getProfileImageName- (int width, int height, int quality, int rounded) Gets the name of the profile image for this particular user.Gets the File for the full profile picture, or any lower resolution(s) if the full profile picture is not found.- getProfilePictureFile- (String detail) Gets the File for the full profile picture, or any lower resolution(s) if the full profile picture is not found.- getProfilePictureFile- (String[] rcDetail) Gets the File for the full profile picture, or any lower resolution(s) if the full profile picture is not found.- static AuthenticatedUserGets the undefined "authenticated" user.- static FileGets the file for the undefined profile image that can be used to create the requested sizes.- static File- getUndefinedUserProfileImage- (File webServerRoot) Gets the file for the undefined profile image that can be used to create the requested sizes.Gets the user file provider for private user files such as images.Gets the user file provider for database backup up user files such as images.- int- hashCode()Gets the hash code of this instance.- booleanChecks if this user is the "undefined" user that is used for external login.Loads the directory of all user files that are currently present and reserves the names in the- WSFileProvider- voidMarks the user as accessed and updates the "last access" time.- boolean- removeAccount- (Connection conn) Removes the user from the database.- setProfileImage- (WSFileProviderEngine engine, Connection conn, String detail, File imageFile) Sets a new profile image for the user.- setProfileImage- (Connection conn, String detail, File imageFile) Sets a new profile image for the user.- toString()String representation of the class.
- Field Details- PROFILE_IMAGE_FILE_NAME_BASEThe base name of the file name for profile images of a certain size. The name is "profileImage-WWxHH[-quality].[png|jpg]" where HH is the height and WW the width. The quality only applies for JPG images.- See Also:
 
- UNDEFINED_USER_PROFILE_IMAGEThe file name for the undefined user profile image in huge format.- See Also:
 
- ADMIN_PROFILE_IMAGEThe file name for the undefined user profile image in huge format.- See Also:
 
- ADMIN_BACKUP_PROFILE_IMAGEThe file name for the undefined user profile image in huge format.- See Also:
 
- userNameThe user name.
 
- Method Details- getUndefinedUserProfileImageGets the file for the undefined profile image that can be used to create the requested sizes.- Returns:
- The file, null if not found.
- Throws:
- FileNotFoundException
 
- getUndefinedUserProfileImageGets the file for the undefined profile image that can be used to create the requested sizes.- Parameters:
- webServerRoot- The root of the web server.
- Returns:
- The file, null if not found.
- Throws:
- FileNotFoundException
 
- getUndefinedUserGets the undefined "authenticated" user.- Returns:
- The instance of the undefined "authenticated" user with its file provider.
 
- markAccessedpublic void markAccessed()Marks the user as accessed and updates the "last access" time.
- getLastAccessedTimepublic long getLastAccessedTime()Gets the last access time for the user.- Specified by:
- getLastAccessedTimein interface- IAuthenticatedUser
- Returns:
- Time in millis since the epoch.
 
- hashCodepublic int hashCode()Gets the hash code of this instance.
- equalsChecks for equality.
- toStringString representation of the class.
- isUndefinedpublic boolean isUndefined()Checks if this user is the "undefined" user that is used for external login. Once the user is authenticated by the external framework, a real user is assigned for the session.- Specified by:
- isUndefinedin interface- IAuthenticatedUser
- Returns:
- true if user is "undefined" and false for normal users.
 
- getBasicUserInfoGets the basic user information that was last refreshed from the database.- Specified by:
- getBasicUserInfoin interface- IAuthenticatedUser
- Returns:
- The basic user information, or null if user is the "undefined" user.
 
- removeAccountRemoves the user from the database. The "iiziAdmin" and "iiziAdmin Backup" users cannot be removed.- Parameters:
- conn- The connection.
- Returns:
- true for success, false if not found.
- Throws:
- SQLException- For SQL errors.
- IllegalStateException- If the basic user information is not present or if it's one of the admin users.
 
- getLocationHistoryGets the user's location history. The history is fed with locations from the background location service.- Specified by:
- getLocationHistoryin interface- IAuthenticatedUser
- Returns:
- An instance of the users locations history.
- Throws:
- IllegalStateException- If this call is done when the information of the user is undefined.
 
- getUserFileProviderGets the user file provider for private user files such as images. The directory is created if required. Files placed in this directory can be published to the web for use in a user-local context by means of uniquely generated names to be used as URL's.- Returns:
- The WSFileProvider with files in a directory.
- Throws:
- IOException- If the user private directory failed to be created.
- IllegalStateException- If the WSFileProvider is disposed (server has been stopped).
 
- getUserFileProviderGets the user file provider for database backup up user files such as images. The cache directory is created if required. Files placed in this directory can be published to the web for use in a user-local context by means of uniquely generated names to be used as URL's.- Parameters:
- engine- The file provider engine (when Designer creates a profile image).
- Returns:
- The WSFileProvider with files in a directory.
- Throws:
- IOException- If the user private directory failed to be created.
- IllegalStateException- If the WSFileProvider is disposed (server has been stopped).
 
- loadAllUserFilesLoads the directory of all user files that are currently present and reserves the names in the- WSFileProvider- The key is the file name and the value is the IWSFile with a reserved name ready for publishing, but not yet published. - Returns:
- A map of the user files, where the key string is the file name without path and the value is the IWSFile
- Throws:
- IOException- If the user private directory failed to be created or the directory failed to list its files.
 
- setProfileImagepublic IWSFile setProfileImage- (Connection conn, String detail, File imageFile) throws IOException, SQLException Sets a new profile image for the user. A previous image file is upon success deleted and unpublished. The new image file is not published.- Parameters:
- conn- The connection.
- detail- The image detail:- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImage- IBasicUserInfoDetailNames.DETAIL_ThumbnailProfileImage- IBasicUserInfoDetailNames.DETAIL_LargeProfileImage
- imageFile- The new profile image located inside the files provider.
- Returns:
- The IWSFile created.
- Throws:
- IOException- For I/O errors.
- SQLException- For SQL errors.
- NotFoundException- If the file doesn't exist.
- IllegalArgumentException- If the file parent is not this providers root directory.
- IllegalArgumentException- If the detail is not valid.
- IllegalStateException- If the WSFileProvider is disposed (server has been stopped), or if the user is undefined.
 
- setProfileImagepublic IWSFile setProfileImage- (WSFileProviderEngine engine, Connection conn, String detail, File imageFile) throws IOException, SQLException Sets a new profile image for the user. A previous image file is upon success deleted and unpublished. The new image file is not published. If you set the- detailto- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImage, the two others- IBasicUserInfoDetailNames.DETAIL_LargeProfileImageand- IBasicUserInfoDetailNames.DETAIL_ThumbnailProfileImagewill be removed.- Parameters:
- conn- The connection.
- detail- The image detail:- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImage- IBasicUserInfoDetailNames.DETAIL_ThumbnailProfileImage- IBasicUserInfoDetailNames.DETAIL_LargeProfileImage
- imageFile- The new profile image located inside the files provider.
- Returns:
- The IWSFile created.
- Throws:
- IOException- For I/O errors.
- SQLException- For SQL errors.
- NotFoundException- If the file doesn't exist.
- IllegalArgumentException- If the file parent is not this providers root directory.
- IllegalArgumentException- If the detail is not valid.
- IllegalStateException- If the WSFileProvider is disposed (server has been stopped), or if the user is undefined.
 
- getProfileImageNameGets the name of the profile image for this particular user. This name is typically used in the AppSessionGyro instance to hold images for multiple users.- Parameters:
- width- The width requested (minimum 16, maximum 400).
- height- The height requested (minimum 16, maximum 400).
- quality- JPG quality 0-100, if zero a PNG is used. 100 means loss-less and 1 means really bad quality.
- Returns:
- The image name.
 
- getProfileImageNameGets the name of the profile image for this particular user. This name is typically used in the AppSessionGyro instance to hold images for multiple users.- Parameters:
- width- The width requested (minimum 16, maximum 400).
- height- The height requested (minimum 16, maximum 400).
- quality- JPG quality 0-100, if zero a PNG is used. 100 means loss-less and 1 means really bad quality.
- rounded- Rounded corners pixel value: if- -1half the- widthand- heightis used as rounding values, otherwise- zeromeans no rounded corners (keep rectangular corners), or a pixel value if- greater than zero.
- Returns:
- The image name.
 
- getProfileImagepublic RuntimeImageDefinition getProfileImage- (IClientSessionGyro clientGyro, int width, int height, int quality) throws IOException Gets the profile image for the user scaled to the requested size. The image is created and cached in the requested size if not available. The Device Pixel Ratio is taken from the client session gyro.- Parameters:
- clientGyro- The client session gyro.
- width- The width requested (minimum 16, maximum 400).
- height- The height requested (minimum 16, maximum 400).
- quality- JPG quality 0-100, if zero a PNG is used. 100 means loss-less and 1 means really bad quality.
- Returns:
- The image definition, or nullif a profile image is not available.
- Throws:
- IOException- For file I/O errors.
- IllegalArgumentException- If the width, height or quality is invalid, or if DPR=1 is not present.
 
- getProfileImagepublic RuntimeImageDefinition getProfileImage- (IClientSessionGyro clientGyro, int width, int height, int quality, int rounded) throws IOException Gets the profile image for the user scaled to the requested size. The image is created and cached in the requested size if not available. The Device Pixel Ratio is taken from the client session gyro.- Parameters:
- clientGyro- The client session gyro.
- width- The width requested (minimum 16, maximum 400).
- height- The height requested (minimum 16, maximum 400).
- quality- JPG quality 0-100, if zero a PNG is used. 100 means loss-less and 1 means really bad quality.
- rounded- Value for rounded corners in pixels. If- zero, rectangular corners are used. The special value- -1will round the corners to half the- widthand- height. if- roundedis greater than zero, it will be the rounding value in pixels of the corners. If a rounding value is used, it is multiplied with the DPR used for the created image.
- Returns:
- The image definition, or nullif a profile image is not available.
- Throws:
- IOException- For file I/O errors.
- IllegalArgumentException- If the width, height or quality is invalid, or if DPR=1 is not present.
 
- getProfileImagepublic RuntimeImageDefinition getProfileImage- (IAppSessionGyro appGyro, int width, int height, int quality, boolean createDefault) throws IOException Gets the profile image for the user scaled to the requested size. The image is created and cached in the requested size if not available.- This method will create images for the most common DPR's: 1, 1.5, 2, 3, and 4. - Profile images runtime definition is cached in the instance of the app session gyro. - Parameters:
- appGyro- The application session gyro.
- width- The width requested (minimum 16, maximum 400).
- height- The height requested (minimum 16, maximum 400).
- quality- JPG quality 0-100, if zero a PNG is used. 100 means loss-less and 1 means really bad quality.
- createDefault- Flag indicating the image will be created from the undefined profile image if no image is present.
- Returns:
- The image definition, or nullif a profile image is not available.
- Throws:
- IOException- For file I/O errors.
- IllegalArgumentException- If the width, height or quality is invalid, or if DPR=1 is not present.
 
- getProfileImagepublic RuntimeImageDefinition getProfileImage- (IAppSessionGyro appGyro, int width, int height, int quality, boolean createDefault, int rounded) throws IOException Gets the profile image for the user scaled to the requested size. The image is created and cached in the requested size if not available.- This method will create images for the most common DPR's: 1, 1.5, 2, 3, and 4. - Profile images runtime definition is cached in the instance of the app session gyro. - Parameters:
- appGyro- The application session gyro.
- width- The width requested (minimum 16, maximum 400).
- height- The height requested (minimum 16, maximum 400).
- quality- JPG quality 0-100, if zero a PNG is used. 100 means loss-less and 1 means really bad quality.
- createDefault- Flag indicating the image will be created from the undefined profile image if no image is present.
- rounded- Value for rounded corners in pixels. If- zero, rectangular corners are used. The special value- -1will round the corners to half the- widthand- height. if- roundedis greater than zero, it will be the rounding value in pixels of the corners. If a rounding value is used, it is multiplied with the DPR used for the created image.
- Returns:
- The image definition, or nullif a profile image is not available.
- Throws:
- IOException- For file I/O errors.
- IllegalArgumentException- If the width, height or quality is invalid, or if DPR=1 is not present.
 
- getProfileImagepublic RuntimeImageDefinition getProfileImage- (int width, int height, int quality, boolean createDefault) throws IOException Gets the profile image for the user scaled to the requested size. The image is created and cached in the requested size if not available.- This method will create images for the most common DPR's: 1, 1.5, 2, 3, and 4. - Profile images runtime definition is cached in this instance of the authenticated user. - Parameters:
- width- The width requested (minimum 16, maximum 400).
- height- The height requested (minimum 16, maximum 400).
- quality- JPG quality 0-100, if zero a PNG is used. 100 means loss-less and 1 means really bad quality.
- createDefault- Flag indicating the image will be created from the undefined profile image if no image is present.
- Returns:
- The image definition, or nullif a profile image is not available.
- Throws:
- IOException- For file I/O errors.
- IllegalArgumentException- If the width, height or quality is invalid, or if DPR=1 is not present.
 
- getProfileImagepublic RuntimeImageDefinition getProfileImage- (int width, int height, int quality, boolean createDefault, int rounded) throws IOException Gets the profile image for the user scaled to the requested size. The image is created and cached in the requested size if not available.- This method will create images for the most common DPR's: 1, 1.5, 2, 3, and 4. - Profile images runtime definition is cached in this instance of the authenticated user. - Parameters:
- width- The width requested (minimum 16, maximum 400).
- height- The height requested (minimum 16, maximum 400).
- quality- JPG quality 0-100, if zero a PNG is used. 100 means loss-less and 1 means really bad quality.
- createDefault- Flag indicating the image will be created from the undefined profile image if no image is present.
- rounded- Value for rounded corners in pixels. If- zero, rectangular corners are used. The special value- -1will round the corners to half the- widthand- height. if- roundedis greater than zero, it will be the rounding value in pixels of the corners. If a rounding value is used, it is multiplied with the DPR used for the created image.
- Returns:
- The image definition, or nullif a profile image is not available.
- Throws:
- IOException- For file I/O errors.
- IllegalArgumentException- If the width, height or quality is invalid, or if DPR=1 is not present.
 
- getProfilePictureFileGets the File for the full profile picture, or any lower resolution(s) if the full profile picture is not found.- Returns:
- File The file for the profile picture, or null if it doesn't exist.
- Throws:
- IOException- If the file provider for the user or its root directory fails retrieving.
 
- getProfilePictureFileGets the File for the full profile picture, or any lower resolution(s) if the full profile picture is not found.- Parameters:
- rcDetail- The detail of the file, must be an array of length 1, or null. Upon return and a file is found, the rcDetail[0] contains the value- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImage,- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImageor- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImage. If a file is not found, it is set to null (if array is not null).
- Returns:
- File The file for the profile picture, or null if it doesn't exist.
- Throws:
- IOException- If the file provider for the user or its root directory fails retrieving.
 
- getProfilePictureFileGets the File for the full profile picture, or any lower resolution(s) if the full profile picture is not found.- Parameters:
- detail- The detail of the file, and be- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImage,- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImageor- IBasicUserInfoDetailNames.DETAIL_UploadedProfileImage.
- Returns:
- File The file for the profile picture, or null if it doesn't exist.
- Throws:
- IOException- If the file provider for the user or its root directory fails retrieving.