0 Replies Latest reply on Dec 9, 2008 10:45 AM by John Gerevich

    get corresponding PortalObject of a PortalNode

    John Gerevich Newbie

      JBoss Portal 2.7.0-cr1

      I have a PortalNode via JBossRenderRequest.getPortalNode();
      I want to create a Page programmaticly under this node, to do that I need a PortalObject (Page) instance.

      Is there any easy way to do that, for example a PortalObject getPortalObjectFor(PortalNode node) function?:

      PortalNode currentNode = request.getPortalNode();
      PortalNode pageNode = currentNode .getParent();
      Page pageObj = (Page)getPortalObjectFor(pageNode);
      Page newPage = pageObj.createPage(...);
      



      Or do I have to do it the hard way?:

      PortalNode currentNode = request.getPortalNode();
      PortalNode pageNode = currentNode.getParent();
      
      // get name of pageNode's parents
      ...
      
       MBeanServer mbeanServer = MBeanServerLocator.locateJBoss();
       container = (PortalObjectContainer) MBeanProxy.get(PortalObjectContainer.class, new ObjectName("portal:container=PortalObject"), mbeanServer);
       Context ctx = container.getContext();
      
      //using the names of pageNode's parents - get the PortalObject from the Context's children's children.
      ...
      


      Thanks, John