You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2010/06/29 21:42:43 UTC

svn commit: r959079 - /portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java

Author: rwatler
Date: Tue Jun 29 19:42:43 2010
New Revision: 959079

URL: http://svn.apache.org/viewvc?rev=959079&view=rev
Log:
Jetspeed Migration: filter orphan web application security roles from registry on migration

Modified:
    portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java

Modified: portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java?rev=959079&r1=959078&r2=959079&view=diff
==============================================================================
--- portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java (original)
+++ portals/jetspeed-2/portal/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/tools/migration/JetspeedRegistryMigration.java Tue Jun 29 19:42:43 2010
@@ -588,36 +588,38 @@ public class JetspeedRegistryMigration i
                     {
                         contextPath = webApplicationResultSet.getString(1);
                     }
-                    else
-                    {
-                        throw new SQLException("Unable to find web application for id: "+webApplicationId);
-                    }
                     webApplicationResultSet.close();
                     
                     int applicationId = 0;
-                    applicationQueryStatement.setString(1, contextPath);
-                    ResultSet applicationResultSet = applicationQueryStatement.executeQuery();
-                    if (applicationResultSet.next())
+                    if (contextPath != null)
                     {
-                        applicationId = applicationResultSet.getInt(1);
+                        applicationQueryStatement.setString(1, contextPath);
+                        ResultSet applicationResultSet = applicationQueryStatement.executeQuery();
+                        if (applicationResultSet.next())
+                        {
+                            applicationId = applicationResultSet.getInt(1);
+                        }
+                        applicationResultSet.close();
                     }
-                    else
+     
+                    if ((contextPath != null) && (applicationId != 0))
                     {
-                        throw new SQLException("Unable to find portlet application for context: "+contextPath);
-                    }
-                    applicationResultSet.close();
-                    
-                    securityRoleInsertStatement.setInt(1, securityRoleResultSet.getInt(1));
-                    securityRoleInsertStatement.setInt(2, applicationId);
-                    securityRoleInsertStatement.setString(3, securityRoleResultSet.getString(3));
-                    securityRoleInsertStatement.executeUpdate();
-                    rowsMigrated++;
+                        securityRoleInsertStatement.setInt(1, securityRoleResultSet.getInt(1));
+                        securityRoleInsertStatement.setInt(2, applicationId);
+                        securityRoleInsertStatement.setString(3, securityRoleResultSet.getString(3));
+                        securityRoleInsertStatement.executeUpdate();
+                        rowsMigrated++;
 
-                    int securityRoleId = securityRoleResultSet.getInt(1);
-                    String description = securityRoleResultSet.getString(4);
-                    if (description != null)
+                        int securityRoleId = securityRoleResultSet.getInt(1);
+                        String description = securityRoleResultSet.getString(4);
+                        if (description != null)
+                        {
+                            localizedDescriptions.add(new LocalizedDescription(securityRoleId, "org.apache.jetspeed.om.portlet.impl.SecurityRoleImpl", description));
+                        }
+                    }
+                    else
                     {
-                        localizedDescriptions.add(new LocalizedDescription(securityRoleId, "org.apache.jetspeed.om.portlet.impl.SecurityRoleImpl", description));
+                        rowsDropped++;
                     }
                 }
                 applicationQueryStatement.close();



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