[jboss-user] [JBoss Portal] - Re: Getting Access to assigned Portlet Instances => Portlet

vivek_saini07 do-not-reply at jboss.com
Fri Mar 27 13:12:22 EDT 2009


Hi 
To get information regarding all deployed portlets, Mbean is 



  | <service-name>InstanceContainer</service-name>
  |       <service-class>org.jboss.portal.core.model.instance.InstanceContainer</service-class>
  |       <service-ref>:container=Instance</service-ref>
  | 
  | 

Example of using it


  | Collection col=instanceContainer.getDefinitions();
  | 		for(Object o:col)
  | 		{
  | 			Instance inst =(Instance)o;
  | 			log.debug("portlet name is :"+inst.getId());
  | 			
  | 		}
  | 
  | 

And for getting all portlet from some particular page you can do something like




  | templatePortletFromSelectedObject = new HashMap();
  | 		if(currentTemplatePageObj!=null) {
  | 			PortalObjectId pageId = PortalObjectId.parse(currentTemplatePageObj, PortalObjectPath.CANONICAL_FORMAT);
  | 			Page selectedPage = (Page) portalObjectContainer.getObject(pageId);
  | 			Collection portletWindows = selectedPage.getChildren(PortalObject.WINDOW_MASK);
  | 			Iterator it= portletWindows.iterator();
  | 			while (it.hasNext()) {	
  | 				WindowImpl window = (WindowImpl) it.next();
  | 				if(window.getContentType()==ContentType.PORTLET)
  | 					templatePortletFromSelectedObject.put(window.getURI(), window.getName());
  | 				else if (window.getContentType()==ContentType.CMS)
  | 					templatePortletFromSelectedObject.put("CMSPortletInstance", window.getName());
  | 			}
  | 		}
  | 
  | 


To find out more on how to use portal api you can refer to /core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java and other files in same package.



View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4221634#4221634

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4221634



More information about the jboss-user mailing list