Class SubstituteUserAction

All Implemented Interfaces:
ExecutableAction, Action, HasShortcutCombination, org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware

@ActionType("substituteUser") public class SubstituteUserAction extends BaseAction implements ExecutableAction, org.springframework.context.ApplicationContextAware
Makes UI-specific preparations to user substitution and performs it using UserSubstitutionManager Checks if there are unsaved changes on the current view and shows dialog with options:
  1. Discard changes (close current view, cleanups background tasks, then performs substitution and navigates to MainView)
  2. Cancel (invokes all cancelActions)
  • Field Details

    • ID

      public static final String ID
      See Also:
    • applicationContext

      protected org.springframework.context.ApplicationContext applicationContext
    • servletContext

      protected jakarta.servlet.ServletContext servletContext
    • userSubstitutionManager

      protected UserSubstitutionManager userSubstitutionManager
    • viewRegistry

      protected ViewRegistry viewRegistry
    • dialogs

      protected Dialogs dialogs
    • messages

      protected Messages messages
    • mainViewId

      protected String mainViewId
    • cancelHandlers

      protected List<Consumer<org.springframework.security.core.userdetails.UserDetails>> cancelHandlers
    • newSubstitutedUser

      protected org.springframework.security.core.userdetails.UserDetails newSubstitutedUser
    • prevSubstitutedUser

      protected org.springframework.security.core.userdetails.UserDetails prevSubstitutedUser
  • Constructor Details

    • SubstituteUserAction

      public SubstituteUserAction()
    • SubstituteUserAction

      public SubstituteUserAction(String id)
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • setServletContext

      @Autowired public void setServletContext(jakarta.servlet.ServletContext servletContext)
    • setUserSubstitutionManager

      @Autowired public void setUserSubstitutionManager(UserSubstitutionManager userSubstitutionManager)
    • setViewRegistry

      @Autowired public void setViewRegistry(ViewRegistry viewRegistry)
    • setDialogs

      @Autowired public void setDialogs(Dialogs dialogs)
    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setUiProperties

      @Autowired public void setUiProperties(UiProperties uiProperties)
    • actionPerform

      public void actionPerform(com.vaadin.flow.component.Component component)
      Specified by:
      actionPerform in interface Action
      Overrides:
      actionPerform in class BaseAction
    • execute

      public void execute()
      Description copied from interface: ExecutableAction
      Executes the Action
      Specified by:
      execute in interface ExecutableAction
    • prepareViewToClose

      protected void prepareViewToClose(View<?> view)
    • openDiscardCurrentViewDialog

      protected void openDiscardCurrentViewDialog(View<?> view)
    • findCurrentOpenedView

      protected Optional<View<?>> findCurrentOpenedView()
    • doSubstituteUser

      protected void doSubstituteUser()
    • doCancel

      protected void doCancel()
    • getMainViewLocation

      protected String getMainViewLocation()
    • withUsers

      public SubstituteUserAction withUsers(org.springframework.security.core.userdetails.UserDetails prevSubstitutedUser, org.springframework.security.core.userdetails.UserDetails newSubstitutedUser)
    • withCancelHandler

      public SubstituteUserAction withCancelHandler(Consumer<org.springframework.security.core.userdetails.UserDetails> cancelHandler)