portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r366679 - in /portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src: java/org/apache/jetspeed/portlets/layout/ webapp/WEB-INF/
Date Sat, 07 Jan 2006 05:46:26 GMT
Author: taylor
Date: Fri Jan  6 21:46:24 2006
New Revision: 366679

URL: http://svn.apache.org/viewcvs?rev=366679&view=rev
Log:
bug fix: changing layouts from customizer now working 

Modified:
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/LayoutPortlet.java
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java
    portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/webapp/WEB-INF/jetspeed-portlet.xml

Modified: portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/LayoutPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/LayoutPortlet.java?rev=366679&r1=366678&r2=366679&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/LayoutPortlet.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/LayoutPortlet.java
Fri Jan  6 21:46:24 2006
@@ -96,7 +96,13 @@
         if (null == jptFactory)
         {
             throw new PortletException("Failed to find the JPT Factory on portlet initialization");
-        }        
+        }
+        
+        entityAccess = (PortletEntityAccessComponent) getPortletContext().getAttribute(CommonPortletServices.CPS_ENTITY_ACCESS_COMPONENT);
+        if (null == entityAccess)
+        {
+            throw new PortletException("Failed to find the Entity Access on portlet initialization");
+        }                
         
         templateLocator = (TemplateLocator) getPortletContext().getAttribute("TemplateLocator");
         decorationLocator = (TemplateLocator) getPortletContext().getAttribute("DecorationLocator");

Modified: portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java?rev=366679&r1=366678&r2=366679&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/java/org/apache/jetspeed/portlets/layout/MultiColumnPortlet.java
Fri Jan  6 21:46:24 2006
@@ -34,9 +34,12 @@
 import org.apache.jetspeed.CommonPortletServices;
 import org.apache.jetspeed.decoration.DecorationFactory;
 import org.apache.jetspeed.om.folder.Folder;
+import org.apache.jetspeed.om.page.ContentFragment;
+import org.apache.jetspeed.om.page.ContentPage;
 import org.apache.jetspeed.om.page.Fragment;
 import org.apache.jetspeed.om.page.Page;
 import org.apache.jetspeed.request.RequestContext;
+import org.apache.pluto.om.entity.PortletEntity;
 import org.apache.pluto.om.window.PortletWindow;
 
 /**
@@ -322,10 +325,10 @@
                  layoutChange != null &&
                  editingPage != null)                
         {
-            Page page;
+            ContentPage page;
             try
             {
-                page = pageManager.getPage(editingPage);
+                page = pageManager.getContentPage(editingPage);
             }
             catch (Exception e)
             {
@@ -333,11 +336,21 @@
             }
             
             page.setDefaultDecorator(themeChange, Fragment.LAYOUT);
-            page.getRootFragment().setName(layoutChange);
             
             try
             {
-                pageManager.updatePage(page);
+                PortletEntity oldEntity = this.entityAccess.getPortletEntity(page.getRootFragment().getId());
+                if (oldEntity != null)
+                {
+                    PortletEntity newEntity = 
+                        this.entityAccess.generateEntityFromFragment((ContentFragment)page.getRootFragment(),
null);
+                    this.entityAccess.removePortletEntity(oldEntity);
+                    Fragment newFragment = pageManager.copyFragment(page.getRootFragment(),
layoutChange);
+                    page.setRootFragment(newFragment);
+                    
+                    this.entityAccess.storePortletEntity(newEntity);
+                    pageManager.updatePage(page);
+                }                
             }
             catch (Exception e)
             {

Modified: portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/webapp/WEB-INF/jetspeed-portlet.xml
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/webapp/WEB-INF/jetspeed-portlet.xml?rev=366679&r1=366678&r2=366679&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/webapp/WEB-INF/jetspeed-portlet.xml
(original)
+++ portals/jetspeed-2/branches/JETSPEED-BRANCH-2.0.1/layout-portlets/src/webapp/WEB-INF/jetspeed-portlet.xml
Fri Jan  6 21:46:24 2006
@@ -32,6 +32,7 @@
 		<js:service name='DecorationLocator'/>
 		<js:service name='Powertools'/>    
 		<js:service name='DecorationFactory'/>		    
+		<js:service name='EntityAccessor'/>				
 	</js:services>
 	
 </portlet-app>



---------------------------------------------------------------------
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