Search in sources :

Example 1 with IActionLogManager

use of org.entando.entando.aps.system.services.actionlog.IActionLogManager in project entando-core by entando.

the class ActivityStreamLastUpdateTag method doEndTag.

@Override
public int doEndTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
    try {
        IActionLogManager loggerManager = (IActionLogManager) ApsWebApplicationUtils.getBean(SystemConstants.ACTION_LOGGER_MANAGER, this.pageContext);
        UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
        Date lastUpdate = loggerManager.lastUpdateDate(currentUser);
        if (null != this.getVar()) {
            ValueStack stack = this.getStack();
            stack.getContext().put(this.getVar(), lastUpdate);
            stack.setValue("#attr['" + this.getVar() + "']", lastUpdate, 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) IActionLogManager(org.entando.entando.aps.system.services.actionlog.IActionLogManager) Date(java.util.Date)

Example 2 with IActionLogManager

use of org.entando.entando.aps.system.services.actionlog.IActionLogManager in project entando-core by entando.

the class ActivityStreamTag method doEndTag.

@Override
public int doEndTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
    try {
        IActionLogManager loggerManager = (IActionLogManager) ApsWebApplicationUtils.getBean(SystemConstants.ACTION_LOGGER_MANAGER, this.pageContext);
        UserDetails currentUser = (UserDetails) request.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
        List<Integer> ids = loggerManager.getActivityStream(currentUser);
        if (null != this.getVar()) {
            ValueStack stack = this.getStack();
            stack.getContext().put(this.getVar(), ids);
            stack.setValue("#attr['" + this.getVar() + "']", ids, false);
        }
    } catch (Throwable t) {
        _logger.error("Error on doStartTag", t);
        // ApsSystemUtils.logThrowable(t, this, "doStartTag");
        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) IActionLogManager(org.entando.entando.aps.system.services.actionlog.IActionLogManager)

Aggregations

UserDetails (com.agiletec.aps.system.services.user.UserDetails)2 ValueStack (com.opensymphony.xwork2.util.ValueStack)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 JspException (javax.servlet.jsp.JspException)2 IActionLogManager (org.entando.entando.aps.system.services.actionlog.IActionLogManager)2 Date (java.util.Date)1