portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r409054 - in /portals/jetspeed-2/trunk: components/page-manager/src/java/org/apache/jetspeed/om/page/ components/registry/src/java/org/apache/jetspeed/components/portletentity/ components/registry/src/test/org/apache/jetspeed/components/por...
Date Wed, 24 May 2006 03:21:34 GMT
Author: ate
Date: Tue May 23 20:21:33 2006
New Revision: 409054

URL: http://svn.apache.org/viewvc?rev=409054&view=rev
Log:
Fixing the awful "Title Error: Cannot pass a null PortletDefinition to a PortletEntity." error
message when a PortletDefinition cannot be found.
Now, a more 'friendly'  "Portlet "+<portlet name>+" not found" message will be displayed
*inside* the portlet, instead of on the window title.
Furthermore, to reduce the number of error messages to the log, I've extended the ContentFragment
to allow access to the overriddenContent
so we can check if the same error message has been raised already...


Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
    portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
    portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/ContentFragment.java

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java?rev=409054&r1=409053&r2=409054&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/om/page/ContentFragmentImpl.java
Tue May 23 20:21:33 2006
@@ -53,6 +53,14 @@
     {
         return getContentFragments();
     }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.ContentFragment#getOverriddenContent()
+     */
+    public String getOverriddenContent()
+    {
+        return overridenContent != null ? overridenContent.toString() : null;
+    }
 
     /* (non-Javadoc)
      * @see org.apache.jetspeed.om.page.ContentFragment#getRenderedContent()

Modified: portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java?rev=409054&r1=409053&r2=409054&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/java/org/apache/jetspeed/components/portletentity/PersistenceBrokerPortletEntityAccess.java
Tue May 23 20:21:33 2006
@@ -238,19 +238,22 @@
                 // unique name has changed and access the portlet definition
                 // using that unique name.
                 parentPortletDef = registry.getPortletDefinitionByUniqueName(fragment.getName());
-                ((PortletEntityCtrl)portletEntity).setPortletDefinition(parentPortletDef);
-                storePortletEntity(portletEntity);
+                if ( parentPortletDef != null)
+                {
+                    ((PortletEntityCtrl)portletEntity).setPortletDefinition(parentPortletDef);
+                    storePortletEntity(portletEntity);
+                }
             }
             
-            
-            
             if(parentPortletDef == null)
             {
-                final String msg = "No parent portlet definition could be located using unique
name: "+portletUniqueName+
-                            ".  Unless you plan on redploying this portlet definition, it
is highly recommended "+
-                            "that you delete the orphaned portlet entity with the id: "+portletEntity.getId();
-                fragment.overrideRenderedContent(msg);
-                logger.warn(msg);                
+                final String msg = "Portlet "+portletUniqueName+" not found";
+                String content = fragment.getOverriddenContent();
+                if (content == null || !content.equals(msg))
+                {
+                    fragment.overrideRenderedContent(msg);
+                    logger.error(msg);
+                }
             }           
             
             return (MutablePortletEntity) portletEntity;                

Modified: portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java?rev=409054&r1=409053&r2=409054&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/registry/src/test/org/apache/jetspeed/components/portletentity/ContentFragmentTestImpl.java
Tue May 23 20:21:33 2006
@@ -320,6 +320,14 @@
     public void overrideRenderedContent(String contnent)
     {
     }
+    
+    /* (non-Javadoc)
+     * @see org.apache.jetspeed.om.page.ContentFragment#getOverriddenContent()
+     */
+    public String getOverriddenContent()
+    {
+        return null;
+    }
 
     /** 
      * @see org.apache.jetspeed.om.page.ContentFragment#setPortletContent(org.apache.jetspeed.aggregator.PortletContent)

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/ContentFragment.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/ContentFragment.java?rev=409054&r1=409053&r2=409054&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/ContentFragment.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/om/page/ContentFragment.java
Tue May 23 20:21:33 2006
@@ -66,6 +66,10 @@
     public void overrideRenderedContent(String contnent);
 
     /**
+     * @return the overridden content set by overrideRenderedContent
+     */
+    public String getOverriddenContent();
+    /**
      * 
      * <p>
      * setPortletContent



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message