Package io.jmix.flowui.action.security
Class SubstituteUserAction
java.lang.Object
io.jmix.flowui.kit.action.AbstractAction
io.jmix.flowui.kit.action.BaseAction
io.jmix.flowui.action.security.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:
- Discard changes (close current view, cleanups background tasks, then performs
substitution and navigates to
MainView
) - Cancel (invokes all
cancelAction
s)
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected Dialogs
static final String
protected String
protected Messages
protected org.springframework.security.core.userdetails.UserDetails
protected org.springframework.security.core.userdetails.UserDetails
protected jakarta.servlet.ServletContext
protected UserSubstitutionManager
protected ViewRegistry
Fields inherited from class io.jmix.flowui.kit.action.BaseAction
enabledExplicitly, visibleExplicitly
Fields inherited from class io.jmix.flowui.kit.action.AbstractAction
description, enabled, eventBus, icon, id, shortcutCombination, text, variant, visible
Fields inherited from interface io.jmix.flowui.kit.action.Action
PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT_COMBINATION, PROP_TEXT, PROP_VARIANT, PROP_VISIBLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
actionPerform
(com.vaadin.flow.component.Component component) protected void
doCancel()
protected void
void
execute()
Executes theAction
protected String
protected void
openDiscardCurrentViewDialog
(View<?> view) protected void
prepareViewToClose
(View<?> view) void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setDialogs
(Dialogs dialogs) void
setMessages
(Messages messages) void
setServletContext
(jakarta.servlet.ServletContext servletContext) void
setUiProperties
(UiProperties uiProperties) void
setUserSubstitutionManager
(UserSubstitutionManager userSubstitutionManager) void
setViewRegistry
(ViewRegistry viewRegistry) withCancelHandler
(Consumer<org.springframework.security.core.userdetails.UserDetails> cancelHandler) withUsers
(org.springframework.security.core.userdetails.UserDetails prevSubstitutedUser, org.springframework.security.core.userdetails.UserDetails newSubstitutedUser) Methods inherited from class io.jmix.flowui.kit.action.BaseAction
addActionPerformedListener, isApplicable, refreshState, setEnabled, setEnabledInternal, setVisible, setVisibleInternal, withEnabled, withHandler, withIcon, withIcon, withShortcutCombination, withText, withTitle, withVariant, withVisible
Methods inherited from class io.jmix.flowui.kit.action.AbstractAction
addPropertyChangeListener, firePropertyChange, getDescription, getEventBus, getIcon, getId, getShortcutCombination, getText, getVariant, hasListener, isEnabled, isVisible, setDescription, setIcon, setShortcutCombination, setText, setVariant
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jmix.flowui.kit.action.Action
addPropertyChangeListener, getDescription, getIcon, getId, getText, getVariant, isEnabled, isVisible, refreshState, setDescription, setEnabled, setIcon, setText, setVariant, setVisible
Methods inherited from interface io.jmix.flowui.kit.component.HasShortcutCombination
getShortcutCombination, setShortcutCombination
-
Field Details
-
ID
- See Also:
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
servletContext
protected jakarta.servlet.ServletContext servletContext -
userSubstitutionManager
-
viewRegistry
-
dialogs
-
messages
-
mainViewId
-
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
-
-
Method Details
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
setServletContext
@Autowired public void setServletContext(jakarta.servlet.ServletContext servletContext) -
setUserSubstitutionManager
-
setViewRegistry
-
setDialogs
-
setMessages
-
setUiProperties
-
actionPerform
public void actionPerform(com.vaadin.flow.component.Component component) - Specified by:
actionPerform
in interfaceAction
- Overrides:
actionPerform
in classBaseAction
-
execute
public void execute()Description copied from interface:ExecutableAction
Executes theAction
- Specified by:
execute
in interfaceExecutableAction
-
prepareViewToClose
-
openDiscardCurrentViewDialog
-
findCurrentOpenedView
-
doSubstituteUser
protected void doSubstituteUser() -
doCancel
protected void doCancel() -
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)
-