5 Replies Latest reply on Apr 18, 2009 10:07 AM by Dirk vanWestrienen

    Access to User's Dashboard from a Servlet

    Dirk vanWestrienen Newbie

      Greetings,

      Using portal 2.6.2.

      We are trying to access portal functionality from a servlet. I'm able to get access to the PortalObjectContainer and from there I can get to various portals, but I don't see a way to get to the user's dashboard. Can someone provide directions or hints?

      thanks.

        • 1. Re: Access to User's Dashboard from a Servlet
          Dirk vanWestrienen Newbie

          OK, I found it... looked in jboss-service.xml and then the stuff below works if you wrap in a transaction.

          MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();

          customManager = (CustomizationManager)MBeanProxy.get(CustomizationManager.class,
          new ObjectName("portal:service=CustomizationManager"), mbeanServer);

          userModule = (UserModule)MBeanProxy.get(UserModule.class,
          new ObjectName("portal:service=Module,type=User"), mbeanServer);

          User user = userModule.findUserByUserName(request.getRemoteUser());
          Portal portal = customManager.getDashboard(user);

          • 2. Re: Access to User's Dashboard from a Servlet
            Viet Master

            What are you trying to achieve ?

            • 3. Re: Access to User's Dashboard from a Servlet
              Dirk vanWestrienen Newbie

              We are trying to replace the edit dashboard screen with a simple drop-down panel that would allow one to add a portlet to a dashboard page.

              We've also added a delete button to the window decoration for dashboard portlets to allow folks to easily remove a portlet.

              • 4. Re: Access to User's Dashboard from a Servlet
                Viet Master

                Ajax extension, wow cool, if you do it, please give us your stuff, we could integrate them with portal.

                We wanted to implement the second option but never did it really... (we even have the icon already in the set of icons). We also wanted to make the first one at the beginning but we don't have the time/knowledge to do it from a javascript point of view...

                You should use core commands to achieve the different effects as the WindowMoveCommand do. That way you would have a WindowDestroyCommand and probably a WindowAddCommand.

                • 5. Re: Access to User's Dashboard from a Servlet
                  Dirk vanWestrienen Newbie

                  While the example I referenced before was for dashboards, I'd hope that something like this would work with non-dashboard pages. I've not tried this however, as we define static portal pages via the portal-object.xml. This example assumes you want to implement via a servlet, rather than a portlet.


                  MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
                  portalObjectContainer = (PortalObjectContainer)MBeanProxy.get(PortalObjectContainer.class,
                   new ObjectName("portal:container=PortalObject"), mbeanServer);
                  
                  Portal portal = portalObjectContainer.getContext().getPortal(portalName);
                  Page page = portal.getPage(pageName);
                  
                  Window win = page.createWindow(winName, ContentType.PORTLET, instanceID);
                  win.setDeclaredProperty("theme.region", "left");
                  win.setDeclaredProperty("theme.order", "0");