portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r592508 - in /portals/jetspeed-2/branches/JETSPEED-2.1.3: applications/j2-admin/src/java/org/apache/jetspeed/portlets/admin/ applications/j2-admin/src/webapp/WEB-INF/view/admin/ components/portal/src/java/org/apache/jetspeed/layout/impl/
Date Tue, 06 Nov 2007 18:10:49 GMT
Author: taylor
Date: Tue Nov  6 10:10:48 2007
New Revision: 592508

URL: http://svn.apache.org/viewvc?rev=592508&view=rev
Log:
http://issues.apache.org/jira/browse/JS2-716
- Secondary import and export of preferences and entities, error handling 

Modified:
    portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/java/org/apache/jetspeed/portlets/admin/JetspeedDataImporter.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/webapp/WEB-INF/view/admin/importer-view.vm
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/java/org/apache/jetspeed/portlets/admin/JetspeedDataImporter.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/java/org/apache/jetspeed/portlets/admin/JetspeedDataImporter.java?rev=592508&r1=592507&r2=592508&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/java/org/apache/jetspeed/portlets/admin/JetspeedDataImporter.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/java/org/apache/jetspeed/portlets/admin/JetspeedDataImporter.java
Tue Nov  6 10:10:48 2007
@@ -153,6 +153,7 @@
     {
         super.doView(request, response);
         request.getPortletSession().removeAttribute("status");
+        request.getPortletSession().removeAttribute("msg");
     }
 
     public void processAction(ActionRequest request,
@@ -201,24 +202,19 @@
             if (success)
             {
                 request.getPortletSession().setAttribute("status", fileName);
-            } else
+                request.getPortletSession().setAttribute("msg", "File imported succesfully");
+            } 
+            else
             {
                 request.getPortletSession().setAttribute("status", "false");
+                request.getPortletSession().setAttribute("msg", "Failed to import file. Please
check XML file for correctness.");                
             }
         } catch (Exception e)
         {
             request.getPortletSession().setAttribute("status", "false");
+            request.getPortletSession().setAttribute("msg", e.getMessage());            
               
             // throw new PortletException("Error occured in file uplodad");
         }
-
-        try
-        {
-
-        } catch (Exception e)
-        {
-            // TODO: handle exception
-        }
-        // serializer.exportData(name, exportFileName, settings)
     }
 
     private boolean importJetspeedData(String filePath)
@@ -237,10 +233,18 @@
             settings.put(JetspeedSerializer.KEY_BACKUP_BEFORE_PROCESS,
                     Boolean.FALSE);
             JetspeedSerializer serializer = serializerFactory.create(JetspeedSerializerFactory.PRIMARY);
-            serializer.importData(filePath, settings);
-            // TODO: secondarySerializer            
+            try
+            {
+                serializer.importData(filePath, settings);
+            }
+            catch (Exception e)
+            {
+                serializer = serializerFactory.create(JetspeedSerializerFactory.SECONDARY);
+                serializer.importData(filePath, settings);                
+            }
             return true;
-        } catch (Exception e)
+        } 
+        catch (Exception e)
         {
             return false;
         }

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/webapp/WEB-INF/view/admin/importer-view.vm
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/webapp/WEB-INF/view/admin/importer-view.vm?rev=592508&r1=592507&r2=592508&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/webapp/WEB-INF/view/admin/importer-view.vm
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/applications/j2-admin/src/webapp/WEB-INF/view/admin/importer-view.vm
Tue Nov  6 10:10:48 2007
@@ -22,6 +22,7 @@
 #set($renderURL = $renderResponse.createRenderURL())
 #set($actionURL = $renderResponse.createActionURL())
 #set($status = $renderRequest.getPortletSession().getAttribute("status"))
+#set($msg = $renderRequest.getPortletSession().getAttribute("msg"))
 <script>
 	function buildExportquery(){
 		var users = document.getElementById('users');     
@@ -175,6 +176,19 @@
 		  <td id='exportAns'></td>
       </tr>
     </table>
+	<table width="97%" border="1">
+      <tr>
+        <td colspan="2"><div align="left"><b>Export Preferences</b></div></td>
+      </tr>
+      <tr>
+        <td colspan="2"><input type="checkbox" name="prefs" id="prefs" value="n">
+          Preferences</td>
+      </tr>
+	  <tr>
+		  <td><input type="button" value="Export Prefs" onClick="javascript:buildPrefsquery();"></td>
+		  <td id='exportPrefsAns'></td>
+      </tr>
+    </table>    
 	</td>
     </form>
     <td width="60%">
@@ -183,12 +197,14 @@
       <tr>
         <td><div><b>Import</b></div></td>
       </tr>
-#if($status != '')
-	#if($status == 'true')
-      <tr>
-        <td>File imported succesfully</td>
-      </tr>	  
-	 #end 
+#if("$!status" != "")
+<tr>
+#if($status == 'false')
+  <td class="portlet-msg-error">$!msg</td>
+#else
+  <td class="portlet-msg-info">$!msg</td>
+#end
+</tr>	       
 #end
       <tr>
         <td>Choose file to import 
@@ -205,4 +221,4 @@
       </tr>
     </table></form></td>
   </tr>
-</table>
\ No newline at end of file
+</table>

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java?rev=592508&r1=592507&r2=592508&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/layout/impl/ExportJetspeedSchema.java
Tue Nov  6 10:10:48 2007
@@ -56,6 +56,7 @@
     private static final String PERMISSIONS = "permissions";
     private static final String PROFILES = "profiles";
     private static final String CAPABILITIES = "capabilities";
+    private static final String PREFS = "prefs";
 
     String pathSeprator = System.getProperty("file.separator");
 
@@ -87,14 +88,22 @@
                 resultMap.put(REASON, "Insufficient access to get portlets");
                 return success;
             }
-            settings.put(JetspeedSerializer.KEY_PROCESS_USERS, 
-                    getNonNullActionParameter(requestContext, USERS).equalsIgnoreCase("y")
? Boolean.TRUE : Boolean.FALSE);
-            settings.put(JetspeedSerializer.KEY_PROCESS_PERMISSIONS, 
-                    getNonNullActionParameter(requestContext, PERMISSIONS).equalsIgnoreCase("y")
? Boolean.TRUE : Boolean.FALSE);
-            settings.put(JetspeedSerializer.KEY_PROCESS_PROFILER, 
-                    getNonNullActionParameter(requestContext, PROFILES).equalsIgnoreCase("y")
? Boolean.TRUE : Boolean.FALSE);
-            settings.put(JetspeedSerializer.KEY_PROCESS_CAPABILITIES, 
-                    getNonNullActionParameter(requestContext, CAPABILITIES).equalsIgnoreCase("y")
? Boolean.TRUE : Boolean.FALSE);
+            boolean processPrefs = getNonNullActionParameter(requestContext, PREFS).equalsIgnoreCase("y")
? true : false;
+            if (!processPrefs)
+            {
+                settings.put(JetspeedSerializer.KEY_PROCESS_USERS, 
+                        getNonNullActionParameter(requestContext, USERS).equalsIgnoreCase("y")
? Boolean.TRUE : Boolean.FALSE);
+                settings.put(JetspeedSerializer.KEY_PROCESS_PERMISSIONS, 
+                        getNonNullActionParameter(requestContext, PERMISSIONS).equalsIgnoreCase("y")
? Boolean.TRUE : Boolean.FALSE);
+                settings.put(JetspeedSerializer.KEY_PROCESS_PROFILER, 
+                        getNonNullActionParameter(requestContext, PROFILES).equalsIgnoreCase("y")
? Boolean.TRUE : Boolean.FALSE);
+                settings.put(JetspeedSerializer.KEY_PROCESS_CAPABILITIES, 
+                        getNonNullActionParameter(requestContext, CAPABILITIES).equalsIgnoreCase("y")
? Boolean.TRUE : Boolean.FALSE);
+            }
+            else
+            {
+                settings.put(JetspeedSerializer.KEY_PROCESS_PREFERENCES, Boolean.TRUE);
+            }
             if (!cleanUserFolder(userName)) 
             {
                 resultMap.put(STATUS, "failure");
@@ -106,7 +115,11 @@
                     Boolean.TRUE);
             settings.put(JetspeedSerializer.KEY_BACKUP_BEFORE_PROCESS,
                     Boolean.FALSE);
-            JetspeedSerializer serializer = serializerFactory.create(JetspeedSerializerFactory.PRIMARY);
               
+            JetspeedSerializer serializer = null;
+            if (processPrefs)
+                serializer = serializerFactory.create(JetspeedSerializerFactory.SECONDARY);
+            else
+                serializer = serializerFactory.create(JetspeedSerializerFactory.PRIMARY);
             serializer.exportData("jetspeedadmin_export_process", exportFileName, settings);
             requestContext.getRequest().getSession().setAttribute("file", userName + "_ldapExport.xml");
             resultMap.put("link", getDownloadLink(requestContext, "tmpExport.xml", userName));



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