portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r926722 - in /portals/jetspeed-2/portal/trunk: components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/ jetspeed-api/src/main/java/org/apache/jetspeed/spaces/
Date Tue, 23 Mar 2010 18:50:44 GMT
Author: woonsan
Date: Tue Mar 23 18:50:44 2010
New Revision: 926722

URL: http://svn.apache.org/viewvc?rev=926722&view=rev
Log:
JS2-1142: Fixing the problem that folder.metadata is not copied from the template folder.
Also, adding short title property for later use.

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/BaseSpaceImpl.java
    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/Space.java
    portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Spaces.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/BaseSpaceImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/BaseSpaceImpl.java?rev=926722&r1=926721&r2=926722&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/BaseSpaceImpl.java
(original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/spaces/BaseSpaceImpl.java
Tue Mar 23 18:50:44 2010
@@ -23,8 +23,11 @@ import org.apache.jetspeed.om.folder.Fol
 
 abstract public class BaseSpaceImpl implements Serializable
 {
+    private static final long serialVersionUID = 1L;
+    
     public static final String META_DESCRIPTION = "description";
     public static final String META_TITLE       = "title";
+    public static final String META_SHORT_TITLE       = "short-title";
 
     protected transient Folder backingFolder = null;
 
@@ -59,6 +62,16 @@ abstract public class BaseSpaceImpl impl
 	{
 	    backingFolder.setTitle(title);
 	}
+	
+    public String getShortTitle() 
+    {
+        return backingFolder.getShortTitle();
+    }
+    
+    public void setShortTitle(String shortTitle) 
+    {
+        backingFolder.setShortTitle(shortTitle);
+    }
 
     public String getTitle(Locale locale) 
     {
@@ -69,6 +82,16 @@ abstract public class BaseSpaceImpl impl
     {
         SpacesServiceImpl.updateField(backingFolder, locale, META_TITLE, title);
     }
+    
+    public String getShortTitle(Locale locale) 
+    {
+        return SpacesServiceImpl.retrieveField(backingFolder, locale, META_SHORT_TITLE);
+    }
+    
+    public void setShortTitle(String shortTitle, Locale locale)
+    {
+        SpacesServiceImpl.updateField(backingFolder, locale, META_SHORT_TITLE, shortTitle);
+    }
 	
     public String getDescription() 
     {

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=926722&r1=926721&r2=926722&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
Tue Mar 23 18:50:44 2010
@@ -213,56 +213,63 @@ public class SpacesServiceImpl implement
 		}        
         return result;
     }
-
-    public Space storeSpaceFromTemplate(Space space, Folder templateFolder) throws SpacesException
+    
+    public Space createSpace(String spaceName, String owner, Folder templateFolder, String
title, String shortTitle, String description, String theme, String constraint) throws SpacesException
     {
+        Space space = null;
+        String spacePath = makeSpacePath(spaceName);
         Folder spaceFolder = null;
-        boolean found = false;        
-        try
+        
+        if (pageManager.folderExists(spacePath))
         {
-            spaceFolder = this.pageManager.getFolder(space.getPath());
-            found = (spaceFolder != null);
+            throw new SpacesException("Space " + spaceName + " already exists");
         }
-        catch (Exception ignore)
-        {}        
+        
         try
         {
-            if (!found)
+            if (templateFolder != null)
             {
-                pageManager.deepCopyFolder(templateFolder, space.getPath(), space.getOwner());
+                pageManager.deepCopyFolder(templateFolder, spacePath, owner, false);
+                spaceFolder = pageManager.getFolder(spacePath);
             }
             else
             {
-                pageManager.deepMergeFolder(templateFolder, space.getPath(), space.getOwner());
-            }            
-            spaceFolder = pageManager.getFolder(space.getPath());
+                spaceFolder = pageManager.newFolder(spacePath);
+            }
+            
+            space = new SpaceImpl(spaceFolder);
+            space.setOwner(owner);
+            space.setTitle(title);
+            space.setShortTitle(shortTitle);
+            space.setDescription(description);
+            space.setTheme(theme);
+            
+            if (constraint != null && !"".equals(constraint.trim()))
+            {
+                space.setSecurityConstraint(constraint);
+            }
+            
             storeSpace(space);
-            return space;    	
+        }
+        catch (SpacesException e)
+        {
+            throw e;
         }
         catch (Exception e)
         {
-        	throw new SpacesException(e);
-        }        
+            throw new SpacesException(e);
+        }
+        
+        return space;
     }
     
-    public Space newSpace(String spaceName, String owner) throws SpacesException
-    {
-    	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
     {
     	try
     	{
 	    	if (space instanceof SpaceImpl)
 	    	{
-	    		pageManager.updateFolder(((SpaceImpl)space).getBackingFolder());
+	    		pageManager.updateFolder(((SpaceImpl)space).getBackingFolder(), true);
 	    	}
     	}
     	catch (Exception e)

Modified: portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Space.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Space.java?rev=926722&r1=926721&r2=926722&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Space.java
(original)
+++ portals/jetspeed-2/portal/trunk/jetspeed-api/src/main/java/org/apache/jetspeed/spaces/Space.java
Tue Mar 23 18:50:44 2010
@@ -53,6 +53,20 @@ public interface Space
     String getTitle();
     
     /**
+     * Retrieve the localized short title of the space for the requested locale
+     * 
+     * @return the localized title
+     */
+    String getShortTitle(Locale locale);
+
+    /**
+     * Retrieve the unlocalized short title of the space 
+     * 
+     * @return the unlocalized title
+     */
+    String getShortTitle();
+    
+    /**
      * Set the title of space for the given locale
      * 
      * @param locale
@@ -67,6 +81,21 @@ public interface Space
      */
     void setTitle(String title);
     
+    /**
+     * Set the short title of space for the given locale
+     * 
+     * @param locale
+     * @param title
+     */
+    void setShortTitle(String shortTitle, Locale locale);
+
+    /**
+     * Set the short title of space 
+     * 
+     * @param title
+     */
+    void setShortTitle(String shortTitle);
+    
 	/**
 	 * Retrieve the path of the space, which can be implementation specific
 	 * 

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=926722&r1=926721&r2=926722&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
Tue Mar 23 18:50:44 2010
@@ -88,25 +88,20 @@ public interface Spaces
      * @return a list of spaces for the given environment name
      */
     List<Space> listSpaces(String envName);
-
-    /**
-     * Setup and create a new space folder area cloning entire contents of template folder
-     * 
-     * @param space the space not yet persisted, should be created with newSpace
-     * @param templateFolder the template to use to create the space folder from
-     * @return a newly created space representing the space folder
-     * @throws a SpacesException in case the object could not be persisted
-     */
-    Space storeSpaceFromTemplate(Space space, Folder templateFolder) throws SpacesException;
-
+    
     /**
-     * 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 
+     * Creates a space persisted after copying from the template folder. 
+     * @param spaceName
+     * @param owner
+     * @param templateFolder
+     * @param title
+     * @param shortTitle
+     * @param description
+     * @param theme
+     * @return
+     * @throws SpacesException
      */
-    Space newSpace(String spaceName, String owner) throws SpacesException;
+    Space createSpace(String spaceName, String owner, Folder templateFolder, String title,
String shortTitle, String description, String theme, String constraint) 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