[gatein-commits] gatein SVN: r2003 - portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Mar 5 08:19:57 EST 2010


Author: chris.laprun at jboss.com
Date: 2010-03-05 08:19:56 -0500 (Fri, 05 Mar 2010)
New Revision: 2003

Modified:
   portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
Log:
- GTNPORTAL-823: If a portlet is remote from a producer named foo, add it to a 'Foo Producer' category. Note that this will only work when WSRP is updated to CR01.

Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java	2010-03-05 13:02:54 UTC (rev 2002)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ApplicationRegistryServiceImpl.java	2010-03-05 13:19:56 UTC (rev 2003)
@@ -46,12 +46,17 @@
 import org.gatein.pc.api.info.PortletInfo;
 import org.picocontainer.Startable;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /**
- * The fundamental reason that motives to use tasks is because of the JMX access that does not
- * setup a context and therefore the task either reuse the existing context setup by the portal
- * or create a temporary context when accessed by JMX.
+ * The fundamental reason that motives to use tasks is because of the JMX access that does not setup a context and
+ * therefore the task either reuse the existing context setup by the portal or create a temporary context when accessed
+ * by JMX.
  *
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
  * @version $Revision$
@@ -81,6 +86,10 @@
    final POMSessionManager mopManager;
    private static final String REMOTE_DISPLAY_NAME_SUFFIX = " (remote)";
 
+   /** Should match WSRPPortletInfo.PRODUCER_NAME_META_INFO_KEY */
+   private static final String PRODUCER_NAME_META_INFO_KEY = "producer-name";
+   public static final String PRODUCER_CATEGORY_NAME_SUFFIX = " Producer";
+
    public ApplicationRegistryServiceImpl(ChromatticManager manager, POMSessionManager mopManager)
    {
       ApplicationRegistryChromatticLifeCycle lifeCycle = (ApplicationRegistryChromatticLifeCycle)manager.getLifeCycle("app");
@@ -417,7 +426,8 @@
          portletApplicationName = portletApplicationName.replace('/', '_');
          portletName = portletName.replace('/', '_');
 
-         LocalizedString keywordsLS = info.getMeta().getMetaValue(MetaInfo.KEYWORDS);
+         MetaInfo metaInfo = portlet.getInfo().getMeta();
+         LocalizedString keywordsLS = metaInfo.getMetaValue(MetaInfo.KEYWORDS);
 
          //
          Set<String> categoryNames = new HashSet<String>();
@@ -428,13 +438,17 @@
             String keywords = keywordsLS.getDefaultString();
             if (keywords != null && keywords.length() != 0)
             {
-               for (String categoryName : keywords.split(",")) {
+               for (String categoryName : keywords.split(","))
+               {
                   // Trim name
                   categoryName = categoryName.trim();
-                  if (INTERNAL_PORTLET_TAG.equalsIgnoreCase(categoryName)) {
+                  if (INTERNAL_PORTLET_TAG.equalsIgnoreCase(categoryName))
+                  {
                      log.debug("Skipping portlet (" + portletApplicationName + "," + portletName + ") + tagged as internal");
                      continue portlet;
-                  } else {
+                  }
+                  else
+                  {
                      categoryNames.add(categoryName);
                   }
                }
@@ -452,6 +466,13 @@
          if (remote)
          {
             categoryNames.add(REMOTE_CATEGORY_NAME);
+
+            // add producer name to categories for easier finding of portlets for GTNPORTAL-823
+            LocalizedString producerNameLS = metaInfo.getMetaValue(PRODUCER_NAME_META_INFO_KEY);
+            if (producerNameLS != null)
+            {
+               categoryNames.add(producerNameLS.getDefaultString() + PRODUCER_CATEGORY_NAME_SUFFIX);
+            }
          }
 
          //
@@ -473,9 +494,7 @@
             ContentDefinition app = category.getContentMap().get(portletName);
             if (app == null)
             {
-               MetaInfo metaInfo = portlet.getInfo().getMeta();
                LocalizedString descriptionLS = metaInfo.getMetaValue(MetaInfo.DESCRIPTION);
-
                LocalizedString displayNameLS = metaInfo.getMetaValue(MetaInfo.DISPLAY_NAME);
                String displayName = getLocalizedStringValue(displayNameLS, portletName);
 
@@ -616,7 +635,7 @@
          }
          else if (type == WSRP.CONTENT_TYPE)
          {
-        	 return "/eXoResources/skin/sharedImages/Icon80x80/DefaultPortlet.png";
+            return "/eXoResources/skin/sharedImages/Icon80x80/DefaultPortlet.png";
          }
          else if (type == org.exoplatform.portal.pom.spi.gadget.Gadget.CONTENT_TYPE)
          {



More information about the gatein-commits mailing list