portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r331644 - in /portals/jetspeed-2/trunk: components/page-manager/src/java/org/apache/jetspeed/page/ components/page-manager/src/test/org/apache/jetspeed/page/ jetspeed-api/src/java/org/apache/jetspeed/page/
Date Mon, 07 Nov 2005 23:42:30 GMT
Author: taylor
Date: Mon Nov  7 15:42:27 2005
New Revision: 331644

URL: http://svn.apache.org/viewcvs?rev=331644&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-395

ongoing, continued work on importing, supporting import of security constraints, and all global
security constraints definitions
and refs (page.security)

Modified:
    portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
    portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestPageImporter.java
    portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java

Modified: portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java?rev=331644&r1=331643&r2=331644&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/java/org/apache/jetspeed/page/AbstractPageManager.java
Mon Nov  7 15:42:27 2005
@@ -544,13 +544,20 @@
         folder.setDefaultPage(source.getDefaultPage()); 
         folder.setShortTitle(source.getShortTitle());
         folder.setTitle(source.getTitle());
+        folder.setHidden(source.isHidden());
+        
+        // copy security constraints
+        SecurityConstraints srcSecurity = source.getSecurityConstraints();        
+        if (srcSecurity != null)
+        {
+            SecurityConstraints copiedSecurity = copySecurityConstraints(srcSecurity);
+            folder.setSecurityConstraints(copiedSecurity);
+        }    
         
         // TODO: document orders
 
         // TODO: menu definitions
-        
-        // TODO: security constraints
-        
+                
         return folder;
     }
     
@@ -564,6 +571,7 @@
         page.setDefaultDecorator(source.getDefaultDecorator(Fragment.LAYOUT), Fragment.LAYOUT);
         page.setDefaultDecorator(source.getDefaultDecorator(Fragment.PORTLET), Fragment.PORTLET);
         page.setDefaultSkin(source.getDefaultSkin());
+        page.setHidden(source.isHidden());
         
         // metadata
         copyMetadata(source, page);
@@ -726,4 +734,26 @@
         }
         return security;
     }
+    
+    public PageSecurity copyPageSecurity(PageSecurity source) 
+    throws JetspeedException
+    {
+        PageSecurity copy = this.newPageSecurity();
+        copy.setHidden(source.isHidden());
+        copy.setPath(source.getPath());
+//        copy.setShortTitle(source.getTitle());        
+//        copy.setTitle(source.getTitle());
+        
+        this.copySecurityConstraints(source.getSecurityConstraints());        
+        
+        Iterator globals = source.getGlobalSecurityConstraintsRefs().iterator();
+        while (globals.hasNext())
+        {
+            String global = (String)globals.next();
+            copy.getGlobalSecurityConstraintsRefs().add(global);
+        }
+        
+        return copy;
+    }
+    
 }

Modified: portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestPageImporter.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestPageImporter.java?rev=331644&r1=331643&r2=331644&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestPageImporter.java
(original)
+++ portals/jetspeed-2/trunk/components/page-manager/src/test/org/apache/jetspeed/page/TestPageImporter.java
Mon Nov  7 15:42:27 2005
@@ -17,18 +17,13 @@
 
 import java.util.Iterator;
 
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.sql.DataSource;
-
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import org.apache.jetspeed.components.rdbms.ojb.ConnectionRepositoryEntry;
 import org.apache.jetspeed.components.test.AbstractSpringTestCase;
 import org.apache.jetspeed.om.folder.Folder;
-import org.apache.jetspeed.om.folder.FolderNotFoundException;
 import org.apache.jetspeed.om.page.Page;
+import org.apache.jetspeed.om.page.PageSecurity;
 
 
 /**
@@ -125,9 +120,15 @@
         assertNotNull("db manager is null", dbManager);
         assertNotNull("castor manager is null", castorManager);
 
+        // create the root page security
+        PageSecurity rootSecurity = dbManager.copyPageSecurity(castorManager.getPageSecurity());
       
+        dbManager.updatePageSecurity(rootSecurity);
+        
         // create root folder
         Folder fsRoot = castorManager.getFolder("/");
-        Folder root = importFolder(fsRoot);                        
+        Folder root = importFolder(fsRoot);         
+        
+        
         
         // NOTE: this will delete EVERYTHING
         // dbManager.removeFolder(root);
@@ -148,19 +149,18 @@
         {
             if (isOverwriteFolders())
             {
-                System.out.println("overwriting folder " + srcFolder.getPath());        
                   
-                dbManager.removeFolder(dstFolder);                
-                dstFolder = dbManager.copyFolder(srcFolder, srcFolder.getPath());
+                System.out.println("overwriting folder " + srcFolder.getPath());
+                dbManager.removeFolder(dstFolder);
+                dstFolder = dbManager
+                        .copyFolder(srcFolder, srcFolder.getPath());
                 dbManager.updateFolder(dstFolder);
                 folderCount++;
-                
-            }
-            else            
-                System.out.println("skipping folder " + srcFolder.getPath());           

-        }
-        else
+
+            } else
+                System.out.println("skipping folder " + srcFolder.getPath());
+        } else
         {
-            System.out.println("importing new folder " + srcFolder.getPath());          
 
+            System.out.println("importing new folder " + srcFolder.getPath());
             dstFolder = dbManager.copyFolder(srcFolder, srcFolder.getPath());
             dbManager.updateFolder(dstFolder);
             folderCount++;

Modified: portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
URL: http://svn.apache.org/viewcvs/portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java?rev=331644&r1=331643&r2=331644&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
(original)
+++ portals/jetspeed-2/trunk/jetspeed-api/src/java/org/apache/jetspeed/page/PageManager.java
Mon Nov  7 15:42:27 2005
@@ -318,7 +318,7 @@
      * @return a new Page object copied from the source, with new fragment ids
      */
     public Page copyPage(Page source, String path) 
-        throws JetspeedException, PageNotUpdatedException;;
+        throws JetspeedException, PageNotUpdatedException;
 
     /** 
      * Copy the source folder creating and returning a new copy of the folder  
@@ -330,7 +330,7 @@
      * @return a new Folder object copied from the source, with new subobject ids
      */
     public Folder copyFolder(Folder source, String path) 
-        throws JetspeedException, PageNotUpdatedException;;
+        throws JetspeedException, PageNotUpdatedException;
 
     /** 
      * Copy the source fragment creating and returning a new copy of the fragment  
@@ -342,6 +342,17 @@
      * @return a new Fragment object copied from the source
      */
     public Fragment copyFragment(Fragment source, String name) 
-        throws JetspeedException, PageNotUpdatedException;;
+        throws JetspeedException, PageNotUpdatedException;
+
+    /**
+     * Copy the source page security (both global constraints and constraint references)
+     * creating and returning a new copy of the page security definition.
+     *  
+     * @param source The source PageSecurity definitions
+     * @return the new page security object
+     * @throws JetspeedException
+     */
+    public PageSecurity copyPageSecurity(PageSecurity source) 
+        throws JetspeedException;
         
 }



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