Search in sources :

Example 1 with UserConfigBean

use of org.entando.entando.apsadmin.system.services.shortcut.model.UserConfigBean in project entando-core by entando.

the class MyShortcutConfigAction method setUserConfig.

protected void setUserConfig(String[] config) {
    UserConfigBean userConfig = new UserConfigBean(this.getCurrentUser().getUsername(), config);
    this.setUserConfigBean(userConfig);
}
Also used : UserConfigBean(org.entando.entando.apsadmin.system.services.shortcut.model.UserConfigBean)

Example 2 with UserConfigBean

use of org.entando.entando.apsadmin.system.services.shortcut.model.UserConfigBean in project entando-core by entando.

the class MyShortcutConfigAction method getUserConfigBean.

public UserConfigBean getUserConfigBean() {
    UserConfigBean config = null;
    try {
        config = (UserConfigBean) this.getRequest().getSession().getAttribute(SESSION_PARAM_MY_SHORTCUTS);
        if (null == config || !this.getCurrentUser().getUsername().equals(config.getUsername())) {
            config = this.getShortcutManager().getUserConfigBean(this.getCurrentUser());
            this.setUserConfigBean(config);
        }
    } catch (Throwable t) {
        _logger.error("Error extracting user config bean by user {}", this.getCurrentUser(), t);
        throw new RuntimeException("Error extracting user config bean by user " + this.getCurrentUser(), t);
    }
    return config;
}
Also used : UserConfigBean(org.entando.entando.apsadmin.system.services.shortcut.model.UserConfigBean)

Example 3 with UserConfigBean

use of org.entando.entando.apsadmin.system.services.shortcut.model.UserConfigBean in project entando-core by entando.

the class UserShortcutsConfigTag method doEndTag.

@Override
public int doEndTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
    try {
        UserConfigBean config = (UserConfigBean) request.getSession().getAttribute(MyShortcutConfigAction.SESSION_PARAM_MY_SHORTCUTS);
        UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
        if (null == config || !currentUser.getUsername().equals(config.getUsername())) {
            request.getSession().removeAttribute(MyShortcutConfigAction.SESSION_PARAM_MY_SHORTCUTS);
            IShortcutManager shortcutManager = (IShortcutManager) ApsWebApplicationUtils.getBean(ApsAdminSystemConstants.SHORTCUT_MANAGER, this.pageContext);
            config = shortcutManager.getUserConfigBean(currentUser);
        }
        if (null != this.getVar()) {
            ValueStack stack = this.getStack();
            stack.getContext().put(this.getVar(), config);
            stack.setValue("#attr['" + this.getVar() + "']", config, false);
        }
    } catch (Throwable t) {
        _logger.error("Error on doStartTag", t);
        throw new JspException("Error on doStartTag", t);
    }
    return super.doEndTag();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) UserDetails(com.agiletec.aps.system.services.user.UserDetails) ValueStack(com.opensymphony.xwork2.util.ValueStack) IShortcutManager(org.entando.entando.apsadmin.system.services.shortcut.IShortcutManager) UserConfigBean(org.entando.entando.apsadmin.system.services.shortcut.model.UserConfigBean)

Aggregations

UserConfigBean (org.entando.entando.apsadmin.system.services.shortcut.model.UserConfigBean)3 UserDetails (com.agiletec.aps.system.services.user.UserDetails)1 ValueStack (com.opensymphony.xwork2.util.ValueStack)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 JspException (javax.servlet.jsp.JspException)1 IShortcutManager (org.entando.entando.apsadmin.system.services.shortcut.IShortcutManager)1