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 Details

    • ITEM_USER_ICON

      public static final String ITEM_USER_ICON
      See Also:
    • ITEM_SIGNATURE_IMAGE

      public static final String 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

      public static final String DEFAULT_LOCALE
      See Also:
    • profileService

      protected ProfileService profileService
    • userGroupService

      protected UserGroupService 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

      @Inject protected jakarta.enterprise.event.Event<ProfileEvent> profileEvents
  • Constructor Details

    • UserController

      public UserController()
  • Method Details

    • init

      @PostConstruct public void init() throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorException
      The 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.ProcessingErrorException
      org.imixs.workflow.exceptions.AccessDeniedException
    • getWorkitem

      public org.imixs.workflow.ItemCollection getWorkitem() throws org.imixs.workflow.exceptions.AccessDeniedException, org.imixs.workflow.exceptions.ProcessingErrorException
      This 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.ProcessingErrorException
      org.imixs.workflow.exceptions.AccessDeniedException
    • setWorkitem

      public void setWorkitem(org.imixs.workflow.ItemCollection aworkitem)
    • getLocale

      public Locale 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

      public void setLocale(Locale alocale)
    • getLanguage

      public String getLanguage()
      returns the user language
      Returns:
    • getProfile

      public org.imixs.workflow.ItemCollection getProfile(String aAccount)
      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

      public String getUserName(String aAccount)
      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

      public String getEmail(String aAccount)
      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

      public boolean isFavorite(String id)
      Returns true if the uniqueid is stored in the profile favorites
      Parameters:
      id -
      Returns:
    • getFavoriteIds

      public List<String> getFavoriteIds()
      Returns a list with all uniqueids stored in the profile favorites
      Returns:
    • addFavorite

      public void addFavorite(String id)
    • removeFavorite

      public void removeFavorite(String id)
    • isMobileUser

      public boolean isMobileUser()
      This method returns true if the user may be using a mobile device
      Returns: