Package org.imixs.marty.profile
Class UserController
java.lang.Object
org.imixs.marty.profile.UserController
- All Implemented Interfaces:
Serializable
@Named("userController")
@SessionScoped
public class UserController
extends Object
implements Serializable
This backing beans handles the Profile entity for the current user and
provides a application scoped access to all other profiles through the
ProfileService EJB.
A new user profile will be created automatically if no profile yet exists!
The user is identified by its principal user name. This name is mapped to the
attribute txtname.
The UserController provides the user 'locale' and 'language' which is used in
JSF Pages to display pages using the current user settings.
With the methods mark() and unmark() workitems can be added into the users
profile favorite list.
The controller allows to store up to 50 favorite workitem IDs in the profile.
- Author:
- rsoika
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected org.imixs.workflow.faces.util.LoginControllerstatic final intprotected jakarta.enterprise.event.Event<ProfileEvent>protected ProfileServicestatic final intprotected UserGroupServiceprotected org.imixs.workflow.faces.data.WorkflowControllerprotected org.imixs.workflow.engine.WorkflowService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFavorite(String id) This method returns the email for a useraccountReturns a list with all uniqueids stored in the profile favoritesreturns the user languageThis method returns the current user locale.org.imixs.workflow.ItemCollectiongetProfile(String aAccount) This method returns a cached cloned version of a user profile for a given useraccount.getUserName(String aAccount) This method returns the username (displayname) for a useraccount.org.imixs.workflow.ItemCollectionThis method returns the current users userprofile entity.voidinit()The init method is used to load a user profile or automatically create a new one if no profile for the user is available.booleanisFavorite(String id) Returns true if the uniqueid is stored in the profile favoritesbooleanThis method returns true if the user may be using a mobile devicevoidonWorkflowEvent(org.imixs.workflow.faces.data.WorkflowEvent workflowEvent) WorkflowEvent listener listens to WORKITEM events to reset the current username workitem if processed.voidremoveFavorite(String id) voidremoves the current user signaturevoidremoves the current user iconvoidvoidsetWorkitem(org.imixs.workflow.ItemCollection aworkitem)
-
Field Details
-
LINK_PROPERTY
- See Also:
-
LINK_PROPERTY_DEPRECATED
- See Also:
-
ITEM_USER_ICON
- See Also:
-
ITEM_SIGNATURE_IMAGE
- See Also:
-
MAX_FAVORITE_ENTRIES
public static final int MAX_FAVORITE_ENTRIES- See Also:
-
UPDATE_PROJECT_ACTIVITY_ID
public static final int UPDATE_PROJECT_ACTIVITY_ID- See Also:
-
DEFAULT_LOCALE
- See Also:
-
COOKIE_LOCALE
- See Also:
-
profileService
-
userGroupService
-
workflowService
protected org.imixs.workflow.engine.WorkflowService workflowService -
loginController
@Inject protected org.imixs.workflow.faces.util.LoginController loginController -
workflowController
@Inject protected org.imixs.workflow.faces.data.WorkflowController workflowController -
profileEvents
-
-
Constructor Details
-
UserController
public UserController()
-
-
Method Details
-
init
@PostConstruct public void init() throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorExceptionThe init method is used to load a user profile or automatically create a new one if no profile for the user is available. A new Profile will be filled with default values. This method did not use the internal cache of the ProfileService to lookup the user profile, to make sure that the entity is uptodate when a user logs in.- Throws:
org.imixs.workflow.exceptions.ProcessingErrorExceptionorg.imixs.workflow.exceptions.AccessDeniedException
-
getWorkitem
public org.imixs.workflow.ItemCollection getWorkitem() throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorExceptionThis method returns the current users userprofile entity. The method verifies if the profile was yet loaded. if not the method tries to initiate the profile - see method init();- Returns:
- Throws:
org.imixs.workflow.exceptions.ProcessingErrorExceptionorg.imixs.workflow.exceptions.AccessDeniedException
-
setWorkitem
public void setWorkitem(org.imixs.workflow.ItemCollection aworkitem) -
getLocale
This method returns the current user locale. If the user is not logged in the method try to get the locale out from the cookie. If no cockie is set the method defaults to "de_DE"- Returns:
- - ISO Locale format
-
setLocale
-
getLanguage
returns the user language- Returns:
-
getProfile
This method returns a cached cloned version of a user profile for a given useraccount. The profile is cached in the current user session- Parameters:
aName-- Returns:
-
getUserName
This method returns the username (displayname) for a useraccount. If no Username is set in the profile then we return the useraccount.- Parameters:
aName-- Returns:
-
getEmail
This method returns the email for a useraccount- Parameters:
aName-- Returns:
-
removeUserIcon
public void removeUserIcon()removes the current user icon -
removeSignature
public void removeSignature()removes the current user signature -
onWorkflowEvent
public void onWorkflowEvent(@Observes org.imixs.workflow.faces.data.WorkflowEvent workflowEvent) WorkflowEvent listener listens to WORKITEM events to reset the current username workitem if processed.The method also updates the user Locale
In case a new image is uplaoded the method set the item user.icon. The deprecated item name 'txtusericon' is still supported..
Optional Signature images can be uploaded if the file name starts with 'signatrue.'. If a signature image exists the item 'signature.image' is set
A profile can hole one user.icon and one signature.image. Deprecated images will be removed by this method automatically.
- Parameters:
workflowEvent-
-
isFavorite
Returns true if the uniqueid is stored in the profile favorites- Parameters:
id-- Returns:
-
getFavoriteIds
Returns a list with all uniqueids stored in the profile favorites- Returns:
-
addFavorite
-
removeFavorite
-
isMobileUser
public boolean isMobileUser()This method returns true if the user may be using a mobile device- Returns:
-