portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r903982 - in /portals/jetspeed-2: applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/ applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/ portal/trunk/components/jetspeed-portal/src/main/java/org/apac...
Date Thu, 28 Jan 2010 07:35:08 GMT
Author: taylor
Date: Thu Jan 28 07:35:07 2010
New Revision: 903982

URL: http://svn.apache.org/viewvc?rev=903982&view=rev
Log:
Space Management UI: only store objects created by j2-admin context in the j2-admin session
Session management cleanup
Starting to refine algorithm to switch spaces and page menus (still in progress)
Fixed Add Space persistence issues

Added:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceBean.java
Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesList.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesManager.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/space-navigator.jsp
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-list.jsp
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-manager.jsp
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Spaces.java

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/PageNavigator.java
Thu Jan 28 07:35:07 2010
@@ -19,6 +19,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.LinkedList;
 import java.util.List;
 
 import javax.portlet.ActionRequest;
@@ -137,15 +138,19 @@
             request.getPortletSession().removeAttribute("links");
             request.getPortletSession().removeAttribute("space");
         }
-        List<Space> spaces = (List<Space>)request.getPortletSession().getAttribute("spaces");
+        List<SpaceBean> spaces = (List<SpaceBean>)request.getPortletSession().getAttribute("spaces");
         if (spaces == null)
         {
             // TODO: use environment
-            spaces = spacesService.listSpaces();
+            List<Space> sl = spacesService.listSpaces();
+            spaces = new LinkedList<SpaceBean>();
+            for (Space s : sl)
+            {
+            	spaces.add(new SpaceBean(s));
+            }
         }              
         request.getPortletSession().setAttribute("spaces", spaces);        
-        Space space = (Space) request.getPortletSession().getAttribute("space");
-        
+        SpaceBean space = (SpaceBean) request.getPortletSession().getAttribute("space");
       
         if (space != null)
         {
             // check if this space matches the current portal page path.
@@ -169,7 +174,7 @@
             
             if (newSpace != null)
             {
-                for (Space sp : spaces)
+                for (SpaceBean sp : spaces)
                 {
                     if (sp.getName().equals(newSpace))
                     {
@@ -252,7 +257,7 @@
         }
     }
     
-    private List<MenuElement> getSpaceMenuElements(Space space, PortletRequest request)
+    private List<MenuElement> getSpaceMenuElements(SpaceBean space, PortletRequest
request)
     {
         ArrayList<MenuElement> spaceMenuElements = new ArrayList<MenuElement>();
         
@@ -336,7 +341,7 @@
         return spaceMenuElements;
     }
     
-    private List<MenuElement> getSpaceLinkMenuElements(Space space, PortletRequest
request)
+    private List<MenuElement> getSpaceLinkMenuElements(SpaceBean space, PortletRequest
request)
     {
         ArrayList<MenuElement> spaceLinkMenuElements = new ArrayList<MenuElement>();
         

Added: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceBean.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceBean.java?rev=903982&view=auto
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceBean.java
(added)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceBean.java
Thu Jan 28 07:35:07 2010
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jetspeed.portlets.spaces;
+
+import java.io.Serializable;
+
+import org.apache.jetspeed.spaces.Space;
+
+public class SpaceBean implements Serializable 
+{
+	private static final long serialVersionUID = 1L;
+
+	private String name;
+	private String path;
+	private String owner;
+	private String title;
+	private String description;
+	private String theme;
+	
+	public SpaceBean(Space s)
+	{
+		setName(s.getName());
+    	setPath(s.getPath());
+    	setOwner(s.getOwner());
+    	setTitle(s.getTitle());
+    	setDescription(s.getDescription());
+    	setTheme(s.getTheme());		
+	}
+	
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getPath() {
+		return path;
+	}
+	public void setPath(String path) {
+		this.path = path;
+	}
+	public String getOwner() {
+		return owner;
+	}
+	public void setOwner(String owner) {
+		this.owner = owner;
+	}
+	public String getTitle() {
+		return title;
+	}
+	public void setTitle(String title) {
+		this.title = title;
+	}
+	public String getDescription() {
+		return description;
+	}
+	public void setDescription(String description) {
+		this.description = description;
+	}
+	public String getTheme() {
+		return theme;
+	}
+	public void setTheme(String theme) {
+		this.theme = theme;
+	}
+}

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpaceNavigator.java
Thu Jan 28 07:35:07 2010
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.portlets.spaces;
 
 import java.io.IOException;
+import java.util.LinkedList;
 import java.util.List;
 
 import javax.portlet.ActionRequest;
@@ -73,66 +74,47 @@
             request.getPortletSession().removeAttribute("spaces");
             request.getPortletSession().removeAttribute("space");
         }
-        List<Space> spaces = (List<Space>)request.getPortletSession().getAttribute("spaces");
+        List<SpaceBean> spaces = (List<SpaceBean>)request.getPortletSession().getAttribute("spaces");
         if (spaces == null)
         {
             // TODO: use environment
-            spaces = spacesService.listSpaces();
-            request.setAttribute("spaces", spaces);        
-            request.getPortletSession().setAttribute("spaces", spaces);        
-        }
-        
-        request.setAttribute("spaces", spaces);
-        Space space = (Space)request.getPortletSession().getAttribute("space");
-        
-        if (space != null)
-        {
-            // check if this space matches the current portal page path.
-            RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
-            String portalPagePath = rc.getPortalURL().getPath();
-            
-            if (portalPagePath == null || "".equals(portalPagePath))
-            {
-                portalPagePath = "/";
-            }
-            
-            if (!portalPagePath.startsWith(space.getPath()))
+            List<Space> sl = spacesService.listSpaces();
+            spaces = new LinkedList<SpaceBean>();
+            for (Space s : sl)
             {
-                space = null;
+            	spaces.add(new SpaceBean(s));
             }
-        }
-        
+            request.getPortletSession().setAttribute("spaces", spaces);        
+        }        
+        boolean changed = false;
+        SpaceBean space = (SpaceBean)request.getPortletSession().getAttribute("space"); 
              
         if (space == null && spaceName != null)
         {
-            for (Space sp: spaces)
-            {
-                if (sp.getName().equals(spaceName))
-                {
-                    space = sp;
-                    request.getPortletSession().setAttribute("space", space);
-                    break;
-                }
-            }
+        	space = findSpace(spaces, spaceName);
+        	changed = true;
         }
-        
-        if (space== null)
+        // check if this space matches the current portal page path.
+        RequestContext rc = (RequestContext) request.getAttribute(RequestContext.REQUEST_PORTALENV);
+        String portalPagePath = rc.getPortalURL().getPath();
+        if (portalPagePath == null || "".equals(portalPagePath))
         {
-            space = spaces.get(0);
-            request.getPortletSession().setAttribute("space", space);
-            spaceName = space.getName();
+            portalPagePath = "/";
         }
-        
-        request.setAttribute("title", spaceName);        
-        request.setAttribute("space", space);
-        
-        try
+        if (space == null || !portalPagePath.startsWith(space.getPath()))
         {
-            super.doView(request, response);
-        }
-        catch (Throwable t)
+        	space = findSpaceByPath(spaces, portalPagePath);
+        	changed = true;        	
+        }        
+        if (space== null)
         {
-            t.printStackTrace();
+            space = spaces.get(0);
+        	changed = true;            
         }
+        if (changed)
+            request.getPortletSession().setAttribute("space", space);        	
+        request.setAttribute("space", space);        
+        request.setAttribute("spaces", spaces);
+        super.doView(request, response);
     }
     
     public void processAction(ActionRequest actionRequest, ActionResponse actionResponse)
throws PortletException,
@@ -145,7 +127,7 @@
             if (space != null)
             {
                 String path = admin.getPortalURL(actionRequest, actionResponse, space.getPath());
-                actionRequest.getPortletSession().setAttribute("space", space);     
+                actionRequest.getPortletSession().setAttribute("space", new SpaceBean(space));
    
                 PortletMessaging.publish(actionRequest, "PageNavigator", "spaceChange", spaceName);
                 actionResponse.sendRedirect(path);
             }
@@ -156,8 +138,7 @@
         {
             // TODO: make this link configurable. We need JetspeedLinks like in Jetspeed-1
             PortletMessaging.cancel(actionRequest, "SpaceList", "spaceChange");
-            String newSpacePath = actionRequest.getPreferences().getValue(NEW_SPACE_PATH_PREF,
NEW_SPACE_PATH_DEFAULT);               
-            
+            String newSpacePath = actionRequest.getPreferences().getValue(NEW_SPACE_PATH_PREF,
NEW_SPACE_PATH_DEFAULT);                           
             String path = admin.getPortalURL(actionRequest, actionResponse, newSpacePath);
             actionResponse.sendRedirect(path);
             return;
@@ -178,5 +159,28 @@
         }
         return space;
     }
+ 
+    protected SpaceBean findSpace(List<SpaceBean> spaces, String spaceName)
+    {
+        for (SpaceBean s : spaces)
+        {
+        	if (s.getName().equals(spaceName))
+        	{
+        		return s;
+        	}
+        }            	
+        return null;
+    }
     
+    protected SpaceBean findSpaceByPath(List<SpaceBean> spaces, String spacePath)
+    {
+        for (SpaceBean s : spaces)
+        {
+        	if (s.getPath().equals(spacePath))
+        	{
+        		return s;
+        	}
+        }            	
+        return null;
+    }    
 }
\ No newline at end of file

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesList.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesList.java?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesList.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesList.java
Thu Jan 28 07:35:07 2010
@@ -17,6 +17,7 @@
 package org.apache.jetspeed.portlets.spaces;
 
 import java.io.IOException;
+import java.util.LinkedList;
 import java.util.List;
 
 import javax.portlet.ActionRequest;
@@ -59,10 +60,15 @@
     public void doView(RenderRequest request, RenderResponse response)
             throws PortletException, IOException
     {    
-        List<Space> spaces = (List<Space>)request.getPortletSession().getAttribute("spaces");
+        List<SpaceBean> spaces = (List<SpaceBean>)request.getPortletSession().getAttribute("spaces");
         if (spaces == null)
         {
-            spaces = spacesService.listSpaces();
+            List<Space> sl = spacesService.listSpaces();
+            spaces = new LinkedList<SpaceBean>();
+            for (Space s : sl)
+            {
+            	spaces.add(new SpaceBean(s));
+            }            
             request.getPortletSession().setAttribute("spaces", spaces);        
         }       
         request.setAttribute("spaces", spaces);

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesManager.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesManager.java?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesManager.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/spaces/SpacesManager.java
Thu Jan 28 07:35:07 2010
@@ -99,13 +99,6 @@
         {
         	space = this.spacesService.lookupSpace(current);
         }
-    	String tab = (String)request.getPortletSession().getAttribute("tab", PortletSession.PORTLET_SCOPE);
-        if (tab == null)
-        {
-            tab = "portlets";
-            request.getPortletSession().setAttribute("tab", tab, PortletSession.PORTLET_SCOPE);
-        }
-        request.setAttribute("tab", tab);
         request.setAttribute("themes", ThemeBean.retrieveThemes(request, decorationFactory));
         request.setAttribute("space", space);
         super.doView(request, response);        
@@ -130,17 +123,14 @@
                 }                
                 Folder templateFolder = pageManager.getFolder(templateFolderPath);
                 String owner = actionRequest.getUserPrincipal().getName();
-                Space space = spacesService.createSpace(spaceName, templateFolder, owner);
+                Space space = spacesService.newSpace(spaceName, owner);
                 space.setTheme(theme);
-                space.setTitle((title == null) ? name : title);
+                space.setTitle((title == null) ? name : title);                
                 space.setDescription((description == null) ? "" : description);
-                spacesService.storeSpace(space);
-                
-                // TODO: remove publish to JetspeedNavigator when replaced/removed for Space+PageNavigator
+                space = spacesService.storeSpaceFromTemplate(space, templateFolder);    
           
                 PortletMessaging.publish(actionRequest, "SpaceList", "spaceChange", name);
               
                 PortletMessaging.publish(actionRequest, "SpaceNavigator", "spaceChange",
name);
-                PortletMessaging.publish(actionRequest, "PageNavigator", "spaceChange", name);
-                
+                PortletMessaging.publish(actionRequest, "PageNavigator", "spaceChange", name);
              
                 // redirect
                 String path = admin.getPortalURL(actionRequest, actionResponse, space.getPath());
                 actionResponse.sendRedirect(path);                        

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/page-navigator.jsp
Thu Jan 28 07:35:07 2010
@@ -21,7 +21,7 @@
 <%@page import="java.text.NumberFormat"%>
 <%@page import="javax.portlet.RenderRequest"%>
 <%@page import="javax.portlet.RenderResponse"%>
-<%@page import="org.apache.jetspeed.spaces.Space"%>
+<%@page import="org.apache.jetspeed.portlets.spaces.SpaceBean"%>
 <%@page import="org.apache.jetspeed.om.page.Page"%>
 <%@page import="org.apache.jetspeed.om.page.Link"%>
 <%@page import="org.apache.jetspeed.portalsite.Menu"%>
@@ -44,7 +44,7 @@
                            RenderRequest renderRequest, 
                            RenderResponse renderResponse,
                            RequestContext rc,
-                           Space space,
+                           SpaceBean space,
                            PageNavigator pageNavigator) throws java.io.IOException
 {
     String type = element.getElementType();
@@ -107,7 +107,7 @@
 if (portalPagePath == null || "".equals(portalPagePath)) {
     portalPagePath = "/";
 }
-Space space = (Space) renderRequest.getAttribute("space");
+SpaceBean space = (SpaceBean) renderRequest.getAttribute("space");
 Locale locale = renderRequest.getLocale();
 PageNavigator pageNavigator = (PageNavigator) renderRequest.getAttribute("pageNavigator");
 List<MenuElement> menuElements = (List<MenuElement>) renderRequest.getAttribute("spaceMenuElements");

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/space-navigator.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/space-navigator.jsp?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/space-navigator.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/space-navigator.jsp
Thu Jan 28 07:35:07 2010
@@ -18,7 +18,7 @@
 <%@page import="java.util.List"%>
 <%@page import="java.text.DecimalFormat"%>
 <%@page import="java.text.NumberFormat"%>
-<%@page import="org.apache.jetspeed.spaces.Space"%>
+<%@page import="org.apache.jetspeed.portlets.spaces.SpaceBean"%>
 <%@page import="org.apache.jetspeed.om.page.Page"%>
 <%@page import="org.apache.jetspeed.CommonPortletServices"%>
 <%@ page contentType="text/html" %>
@@ -27,16 +27,16 @@
 
 <portlet:defineObjects/>
 <%
-	Space current = ((Space)renderRequest.getAttribute("space"));
+	SpaceBean current = ((SpaceBean)renderRequest.getAttribute("space"));
 %>
 		<ul id="nav-top">
 			<li><a href="<portlet:actionURL><portlet:param name='space' value='<%=current.getName()%>'/></portlet:actionURL>"
title="<%=current.getTitle() %>"><%=current.getTitle() %></a>
 				<ul id="spaceList">
 <%
   int count = 0;
-  List<Space> spaces = (List<Space>)renderRequest.getAttribute("spaces");
+  List<SpaceBean> spaces = (List<SpaceBean>)renderRequest.getAttribute("spaces");
   
-  for (Space space : spaces) 
+  for (SpaceBean space : spaces) 
   {
       String style = null;
       String extStyle = null;

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-list.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-list.jsp?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-list.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-list.jsp
Thu Jan 28 07:35:07 2010
@@ -17,14 +17,14 @@
 --%>
 <%@page contentType="text/html" %>
 <%@page import="java.util.List"%>
-<%@page import="org.apache.jetspeed.spaces.Space"%>
+<%@page import="org.apache.jetspeed.portlets.spaces.SpaceBean"%>
 <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
 <%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
 <portlet:defineObjects/>
 <fmt:setBundle basename="org.apache.jetspeed.portlets.spaces.resources.SpacesResources"
/>
 <%
 	String current = ((String)renderRequest.getAttribute("space"));
-	List<Space> spaces = (List<Space>)renderRequest.getAttribute("spaces");
+	List<SpaceBean> spaces = (List<SpaceBean>)renderRequest.getAttribute("spaces");
 %>
 <table width='100%'>
      <tr>
@@ -33,7 +33,7 @@
 	  <th class="portlet-section-subheader" colspan="4"></th>
      </tr>
 <%
-for (Space space : spaces)
+for (SpaceBean space : spaces)
 {
     String style = (current != null && current.equals(space.getName())) ? "portlet-section-alternate"
: "portlet-section-body";           
 %>     	

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-manager.jsp
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-manager.jsp?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-manager.jsp
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/webapp/WEB-INF/view/spaces/spaces-manager.jsp
Thu Jan 28 07:35:07 2010
@@ -15,7 +15,7 @@
 limitations under the License.
 
 --%>
-<%@page import="org.apache.jetspeed.spaces.Space"%>
+<%@page import="org.apache.jetspeed.portlets.spaces.SpaceBean"%>
 <%@page import="org.apache.jetspeed.request.RequestContext"%>
 
 <%@ page contentType="text/html" %>
@@ -31,10 +31,6 @@
   <c:set var="portalContextPath" value="/"/>
 </c:if>
 
- 	<%
- 	// List<PortletInfo> portlets = (List<PortletInfo>)renderRequest.getAttribute("portlets");
- 	//String tab = (String)renderRequest.getAttribute("tab"); 	
- 	%>
 <form id='jsSpacesManagement' method="POST" action='<portlet:actionURL/>'>
 <table width="100%">
 	<tr>

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/SpacesServiceImpl.java
Thu Jan 28 07:35:07 2010
@@ -204,14 +204,13 @@
         return result;
     }
 
-    public Space createSpace(String spaceName, Folder templateFolder, String owner) throws
SpacesException
+    public Space storeSpaceFromTemplate(Space space, Folder templateFolder) throws SpacesException
     {
-    	String spacePath = makeSpacePath(spaceName);
         Folder spaceFolder = null;
         boolean found = false;        
         try
         {
-            spaceFolder = this.pageManager.getFolder(spacePath);
+            spaceFolder = this.pageManager.getFolder(space.getPath());
             found = (spaceFolder != null);
         }
         catch (Exception ignore)
@@ -220,16 +219,13 @@
         {
             if (!found)
             {
-                pageManager.deepCopyFolder(templateFolder, spacePath, owner);
+                pageManager.deepCopyFolder(templateFolder, space.getPath(), space.getOwner());
             }
             else
             {
-                pageManager.deepMergeFolder(templateFolder, spacePath, owner);
-            }
-            
-            spaceFolder = pageManager.getFolder(spacePath);
-            Space space = loadSpace(spaceFolder);
-            space.setOwner(owner);
+                pageManager.deepMergeFolder(templateFolder, space.getPath(), space.getOwner());
+            }            
+            spaceFolder = pageManager.getFolder(space.getPath());
             storeSpace(space);
             return space;    	
         }
@@ -239,20 +235,15 @@
         }        
     }
     
-    public Space createSpace(String spaceName, String owner) throws SpacesException
+    public Space newSpace(String spaceName, String owner) throws SpacesException
     {
-    	Folder folder = pageManager.newFolder(makeSpacePath(spaceName));
-    	// TODO: store owner in security constraints
-    	updateField(folder, Locale.ENGLISH, Space.META_SPACE_OWNER, owner);
-    	try
-    	{
-    		pageManager.updateFolder(folder);
-    	}
-    	catch (Exception e)
-    	{
-    		throw new SpacesException(e);
-    	}
-    	return new SpaceImpl(folder);    	
+    	String spacePath = makeSpacePath(spaceName);
+    	if (pageManager.folderExists(spacePath))
+    		throw new SpacesException("Space " + spaceName + " already exists");
+    	Folder folder = pageManager.newFolder(spacePath);
+    	Space space = new SpaceImpl(folder);
+    	space.setOwner(owner);
+    	return space;
     }
 
     public void storeSpace(Space space) throws SpacesException
@@ -440,8 +431,11 @@
             LocalizedField field = it.next();
             if (locale == null || field.getLocale().equals(locale))
             {
-                field.setValue(value);
-                return true;
+            	if (field.getName().equals(name))
+            	{
+            		field.setValue(value);
+            		return true;
+            	}
             }
         }       
         return false;

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Spaces.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Spaces.java?rev=903982&r1=903981&r2=903982&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Spaces.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Spaces.java
Thu Jan 28 07:35:07 2010
@@ -91,25 +91,23 @@
     List<Space> listSpaces(String envName);
 
     /**
-     * Setup and create a new space folder area
+     * Setup and create a new space folder area cloning entire contents of template folder
      * 
-     * @param spaceName the name of the space to create (not the path to the space)
+     * @param space the space not yet persisted, should be created with newSpace
      * @param templateFolder the template to use to create the space folder from
-     * @param owner the owner (user) of the space
      * @return a newly created space representing the space folder
      * @throws a SpacesException in case the object could not be persisted
      */
-    Space createSpace(String spaceName, Folder templateFolder, String owner) throws SpacesException;
+    Space storeSpaceFromTemplate(Space space, Folder templateFolder) throws SpacesException;
 
     /**
-     * Creates a space without a template
+     * Creates a space in memory object, not persisted 
      * 
      * @param spaceName the name of the space to create (not the path to the space)
      * @param owner the owner (user) of the space
-     * @return a newly created space representing the space folder
-     * @throws a SpacesException in case the object could not be persisted
+     * @return a newly created space 
      */
-    Space createSpace(String spaceName, String owner)  throws SpacesException;
+    Space newSpace(String spaceName, String owner) throws SpacesException;
     
     /**
      * Stores a space to the portal



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