Package org.opencustomer.webapp.util.menu

Examples of org.opencustomer.webapp.util.menu.Menu


                request.getSession().setAttribute(Globals.AUTHENTICATOR_KEY, new Authenticator(user));
                request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY, user.getLocale());
                request.getSession().setAttribute(Globals.CONFIGURATION_KEY, new UserConfiguration(user));
               
                MenuFactory menuFactory = (MenuFactory)request.getSession().getServletContext().getAttribute(Globals.MENU_FACTORY_KEY);
                Menu menu = menuFactory.getCustomizedMenu(AuthenticatorUtility.getAuthenticator(request));
                request.getSession().setAttribute(Globals.MENU_KEY, menu);

                forward = LOGIN_OK;
            }
        }

        if (!errors.isEmpty())
            saveErrors(request, errors);

        if (forward == LOGIN_OK) {
            Menu menu     = (Menu) request.getSession().getAttribute(Globals.MENU_KEY);
           
            if(form.getDeeplink() != null) {
                MenuItem item = null;
               
                if(log.isDebugEnabled())
                    log.debug("execute deeplink");

                if("EVENT".equals(form.getDeeplink())) {
                    if(log.isDebugEnabled()) {
                        log.debug("prepare deeplink to event with id: "+form.getId());
                    }
                    item   = menu.findItem("/calendar/showMainCalendar");
                } else if("JOB".equals(form.getDeeplink())) {
                    if(log.isDebugEnabled()) {
                        log.debug("prepare deeplink to job with id: "+form.getId());
                    }
                    item   = menu.findItem("/home/jobs");
                }

                if(item != null) {
                    if(log.isDebugEnabled())
                        log.debug("active menu item with id: "+item.getId());
                       
                    menu.activate(item.getId());
                }
            }

            return new ActionForward(getActionURL(request, menu.getActiveItem().getAction()));
        else {
            return mapping.getInputForward();
        }
    }
View Full Code Here


    private final static Logger log = Logger.getLogger(MenuAction.class);
   
    @Override
    public ActionForward execute(ActionMapping mapping, MenuForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
    {
        Menu menu = (Menu)request.getSession().getAttribute(Globals.MENU_KEY);
       
        MenuItem menuItem = null;
       
        if(menu == null)
        {
            if(log.isDebugEnabled())
                log.debug("no menu found in session");
           
            // not protected by rights -> write error and go to login manually
            ActionMessages errors = new ActionMessages();
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("module.common.error.notLoggedIn"));
            saveErrors(request, errors);
        }
        else
        {
            menuItem = menu.activate(form.getMenuId());

            if(menuItem == null)
            {
                menuItem = menu.getActiveItem();
                if(log.isDebugEnabled())
                    log.debug("could not activate menu item / use active item: "+menuItem);
            }
            else if(log.isDebugEnabled())
                log.debug("activate item: "+menuItem);
View Full Code Here

           
            postOperations(form, errors, request);
        }
        else
        {
            Menu menu = (Menu)request.getSession().getAttribute(Globals.MENU_KEY);
            forward = Panel.getForward(menu.getActiveItem().getAction(), request);
           
            errors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage("default.error.backbutton"));
        }
       
        if(!errors.isEmpty())
View Full Code Here

TOP

Related Classes of org.opencustomer.webapp.util.menu.Menu

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.