Search in sources :

Example 1 with PluginSubMenuContainer

use of com.agiletec.apsadmin.system.plugin.PluginSubMenuContainer in project entando-core by entando.

the class PluginsSubMenuTag method doStartTag.

@Override
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
    WebApplicationContext wac = ApsWebApplicationUtils.getWebApplicationContext(request);
    List<PluginSubMenuContainer> containters = new ArrayList<PluginSubMenuContainer>();
    ValueStack stack = this.getStack();
    try {
        String[] beanNames = wac.getBeanNamesForType(PluginSubMenuContainer.class);
        for (int i = 0; i < beanNames.length; i++) {
            PluginSubMenuContainer container = (PluginSubMenuContainer) wac.getBean(beanNames[i]);
            containters.add(container);
        }
        if (containters.size() > 0) {
            stack.getContext().put(this.getObjectName(), containters);
            stack.setValue("#attr['" + this.getObjectName() + "']", containters, false);
            return EVAL_BODY_INCLUDE;
        }
    } catch (Throwable t) {
        throw new JspException("Error creating the plugins menu list", t);
    }
    return super.doStartTag();
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) JspException(javax.servlet.jsp.JspException) ValueStack(com.opensymphony.xwork2.util.ValueStack) ArrayList(java.util.ArrayList) PluginSubMenuContainer(com.agiletec.apsadmin.system.plugin.PluginSubMenuContainer) WebApplicationContext(org.springframework.web.context.WebApplicationContext)

Aggregations

PluginSubMenuContainer (com.agiletec.apsadmin.system.plugin.PluginSubMenuContainer)1 ValueStack (com.opensymphony.xwork2.util.ValueStack)1 ArrayList (java.util.ArrayList)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 JspException (javax.servlet.jsp.JspException)1 WebApplicationContext (org.springframework.web.context.WebApplicationContext)1