Foros de discusión

Want to Create portlet Similar to Add Application

saumil nitin baxi, modificado hace 15 años.

Want to Create portlet Similar to Add Application

Junior Member Mensajes: 31 Fecha de incorporación: 7/04/08 Mensajes recientes
Hi,
I Want to create a Portlet in which I will get a List of Portlet in a particular Category like Sample or CMS . Can anyone tell me how to go ahead with it.

Thanks,
Saumil
saumil nitin baxi, modificado hace 15 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

Junior Member Mensajes: 31 Fecha de incorporación: 7/04/08 Mensajes recientes
Guys Please Help me Out!!!
thumbnail
Victor Zorin, modificado hace 15 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

Liferay Legend Mensajes: 1228 Fecha de incorporación: 14/04/08 Mensajes recientes
This is an extract from our code:
package com.myoffice.content.search.portlet.view.action;
/* MyOffice24x7.com - ERMS - Portlet - Search */
public class ViewAction
    extends com.myoffice.liferay.common.BasePortletAction {
  private static final Log logger = LogFactory.getLog(ViewAction.class);
  
  private void listCategoryDetails(long companyId, PortletCategory portletCategory)
  {
      java.util.Collection<portletcategory> subcategories = portletCategory.getCategories();
      logger.info("Category : " + portletCategory.getName());
      Set<string> portletIds = portletCategory.getPortletIds();
      logger.info("portlets = " + portletIds.size());
      java.util.Iterator<string> itp = portletIds.iterator();
      while(itp.hasNext())
      {
        try {
          Portlet portlet = PortletLocalServiceUtil.getPortletById(companyId,
              itp.next());
          logger.info(" Portlet : " + portlet.getDisplayName());
        } catch(Exception e) { 
          logger.error("Portlet details not available");
        }
      }
      
      logger.info("subcategories = " + subcategories.size());
      java.util.Iterator<portletcategory> it = subcategories.iterator();
      while(it.hasNext())
      {
        PortletCategory subcategory = it.next();
        listCategoryDetails(companyId, subcategory);
      }
  }

  public ActionForward render(ActionMapping mapping, ActionForm form,
                              PortletConfig config, RenderRequest req,
                              RenderResponse res) throws Exception {
    // start from top-level category
    long compId = com.liferay.portal.util.PortalUtil.getCompanyId(req);
     PortletCategory portletCategory = (PortletCategory)
         com.liferay.portal.util.WebAppPool.get(
           String.valueOf(compId), 
           com.liferay.portal.util.WebKeys.PORTLET_CATEGORY);
    listCategoryDetails(compId, portletCategory);
    // etc etc
   ...
 }
}
</portletcategory></string></string></portletcategory>
Jason Walker, modificado hace 15 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

New Member Mensajes: 2 Fecha de incorporación: 25/02/09 Mensajes recientes
I'm trying to do the same thing (making a new version of the Add Application portlet) and I'm having the same trouble with Categories. I tried the above approach but I'm getting a null object when I try to pull the PortletCategory from the WebAppPool. I think the problem is because I'm using the Plugin SDK (for 5.2) instead of the ext environment, so my portlet is trying to use a separate instance of the WebAppPool with no values loaded into it.

Is there any other way to find the category that a portlet belongs to, or get values into the WebAppPool? Or is my only hope going to be moving the project into the ext development environment?
thumbnail
Victor Zorin, modificado hace 15 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

Liferay Legend Mensajes: 1228 Fecha de incorporación: 14/04/08 Mensajes recientes
It is hard to say remotely what is happenning at the backend of your installation. Did you try to have a look how AddApplication gets the data in your version of liferay?

It should be in \html\portlet\layout_configuration\view.jsp
Jason Walker, modificado hace 15 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

New Member Mensajes: 2 Fecha de incorporación: 25/02/09 Mensajes recientes
Yes that was the first place I looked (even before I found this post), and it's doing it the same way, by instantiating the PortletCategory from the WebAppPool. The standard Add Applicatin portlet is working properly, so that's why I think that my custom portlet is creating its own instance of the WebAppPool.
thumbnail
Victor Zorin, modificado hace 15 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

Liferay Legend Mensajes: 1228 Fecha de incorporación: 14/04/08 Mensajes recientes
Have not used SDK, is it running on separate JVM?
If it is the same, your WebAppPool shall be populated, it is a single instance object, isn't it?

In the meantime, I'll check which other services can provide such info.
thumbnail
Victor Zorin, modificado hace 15 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

Liferay Legend Mensajes: 1228 Fecha de incorporación: 14/04/08 Mensajes recientes
Yes, it looks like you must be in the same JVM to enjoy the benefits of WebAppPool. It is populated with root PortletCategory when liferay starts. Always sits in a memory, no other access apart from WebAppPool. Same for the rest of the tree.
thumbnail
Nagendra Kumar Busam, modificado hace 13 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

Liferay Master Mensajes: 678 Fecha de incorporación: 7/07/09 Mensajes recientes
Hi Victor,

I am looking for similar kind of functionality. I am using Plugins SDK for my portlet implementation. Even i am getting "null" for PortletCategory where as default Add Application is working fine. Please let me know how can i get actual categories from WebAppPoll from Plugins SDK env.

I want to get clarifications regarding following
1. Whether its possible to get that using Plugins SDK
2. Do i need to develop this in Ext Env


BTW,I am using LR 5.2.3. Thanks in advance

Regards,
- Nagendra Kumar
Gavin Headen, modificado hace 13 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

New Member Mensajes: 18 Fecha de incorporación: 1/06/10 Mensajes recientes
I am also having this same issue.

Are there other ways to get the PortletCategory(s)?
Gavin Headen, modificado hace 11 años.

RE: Want to Create portlet Similar to Add ApplicationGuys

New Member Mensajes: 18 Fecha de incorporación: 1/06/10 Mensajes recientes
Here I am 2 years later and coming back around to this...
Funny how I found this thread through google and I didn't even realized I'd commented on it until I got to the bottom.

Anyway, does anyone know how to do this?