Search in sources :

Example 1 with INavigatorParser

use of com.agiletec.aps.system.services.page.widget.INavigatorParser in project entando-core by entando.

the class NavigatorTag method doStartTag.

@Override
public int doStartTag() throws JspException {
    ServletRequest request = this.pageContext.getRequest();
    try {
        this._reqCtx = (RequestContext) request.getAttribute(RequestContext.REQCTX);
        INavigatorParser navigatorParser = (INavigatorParser) ApsWebApplicationUtils.getBean(SystemConstants.NAVIGATOR_PARSER, this.pageContext);
        IPage currPage = (IPage) this._reqCtx.getExtraParam(SystemConstants.EXTRAPAR_CURRENT_PAGE);
        UserDetails currentUser = (UserDetails) this.pageContext.getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
        if (this._spec == null) {
            Widget currShowlet = (Widget) _reqCtx.getExtraParam((SystemConstants.EXTRAPAR_CURRENT_WIDGET));
            ApsProperties showletConfig = currShowlet.getConfig();
            String spec = (null != showletConfig) ? showletConfig.getProperty(CONFIG_PARAM_SPEC) : null;
            this._targets = navigatorParser.parseSpec(spec, currPage, currentUser);
        } else {
            this._targets = navigatorParser.parseSpec(this._spec, currPage, currentUser);
        }
        if (this._targets == null || this._targets.isEmpty()) {
            return SKIP_BODY;
        }
        this._index = 0;
        NavigatorTarget currentTarget = this.getCurrentTarget();
        this.pageContext.setAttribute(this.getVar(), currentTarget);
        return EVAL_BODY_INCLUDE;
    } catch (Throwable t) {
        _logger.error("Error during tag initialization", t);
        // ApsSystemUtils.logThrowable(t, this, "doStartTag");
        throw new JspException("Error during tag initialization ", t);
    }
}
Also used : ServletRequest(javax.servlet.ServletRequest) JspException(javax.servlet.jsp.JspException) IPage(com.agiletec.aps.system.services.page.IPage) UserDetails(com.agiletec.aps.system.services.user.UserDetails) NavigatorTarget(com.agiletec.aps.system.services.page.widget.NavigatorTarget) Widget(com.agiletec.aps.system.services.page.Widget) INavigatorParser(com.agiletec.aps.system.services.page.widget.INavigatorParser) ApsProperties(com.agiletec.aps.util.ApsProperties)

Aggregations

IPage (com.agiletec.aps.system.services.page.IPage)1 Widget (com.agiletec.aps.system.services.page.Widget)1 INavigatorParser (com.agiletec.aps.system.services.page.widget.INavigatorParser)1 NavigatorTarget (com.agiletec.aps.system.services.page.widget.NavigatorTarget)1 UserDetails (com.agiletec.aps.system.services.user.UserDetails)1 ApsProperties (com.agiletec.aps.util.ApsProperties)1 ServletRequest (javax.servlet.ServletRequest)1 JspException (javax.servlet.jsp.JspException)1