Author: solomax
Date: Mon Sep 19 02:20:01 2016
New Revision: 1761382

URL: http://svn.apache.org/viewvc?rev=1761382&view=rev
Log:
no jira: import/export is improved

Modified:
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
    
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java?rev=1761382&r1=1761381&r2=1761382&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
 Mon Sep 19 02:20:01 2016
@@ -179,14 +179,22 @@ public class BackupExport {
                        Registry registry = new Registry();
                        Strategy strategy = new RegistryStrategy(registry);
                        Serializer serializer = new Persister(strategy);
-       
+
                        registry.bind(User.class, UserConverter.class);
                        registry.bind(Appointment.Reminder.class, 
AppointmentReminderTypeConverter.class);
                        registry.bind(Room.class, RoomConverter.class);
                        if (list != null && !list.isEmpty()) {
-                               
registry.bind(list.get(0).getStart().getClass(), DateConverter.class);
+                               for (Appointment a : list) {
+                                       if (a.getStart() != null) {
+                                               
registry.bind(a.getStart().getClass(), DateConverter.class);
+                                               break;
+                                       } else if (a.getInserted() != null) {
+                                               
registry.bind(a.getInserted().getClass(), DateConverter.class);
+                                               break;
+                                       }
+                               }
                        }
-                       
+
                        writeList(serializer, backup_dir, "appointements.xml", 
"appointments", list);
                        progressHolder.setProgress(25);
                }

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java?rev=1761382&r1=1761381&r2=1761382&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 Mon Sep 19 02:20:01 2016
@@ -454,6 +454,10 @@ public class BackupImport {
                                        log.warn("Appointment without room was 
found, skipping: {}", a);
                                        continue;
                                }
+                               if (a.getStart() == null || a.getEnd() == null) 
{
+                                       log.warn("Appointment without start/end 
time was found, skipping: {}", a);
+                                       continue;
+                               }
                                a = appointmentDao.update(a, null, false);
                                appointmentsMap.put(appId, a.getId());
                        }

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java?rev=1761382&r1=1761381&r2=1761382&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
 Mon Sep 19 02:20:01 2016
@@ -179,14 +179,22 @@ public class BackupExport {
                        Registry registry = new Registry();
                        Strategy strategy = new RegistryStrategy(registry);
                        Serializer serializer = new Persister(strategy);
-       
+
                        registry.bind(User.class, UserConverter.class);
                        registry.bind(Appointment.Reminder.class, 
AppointmentReminderTypeConverter.class);
                        registry.bind(Room.class, RoomConverter.class);
                        if (list != null && !list.isEmpty()) {
-                               
registry.bind(list.get(0).getStart().getClass(), DateConverter.class);
+                               for (Appointment a : list) {
+                                       if (a.getStart() != null) {
+                                               
registry.bind(a.getStart().getClass(), DateConverter.class);
+                                               break;
+                                       } else if (a.getInserted() != null) {
+                                               
registry.bind(a.getInserted().getClass(), DateConverter.class);
+                                               break;
+                                       }
+                               }
                        }
-                       
+
                        writeList(serializer, backup_dir, "appointements.xml", 
"appointments", list);
                        progressHolder.setProgress(25);
                }

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java?rev=1761382&r1=1761381&r2=1761382&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 Mon Sep 19 02:20:01 2016
@@ -454,6 +454,10 @@ public class BackupImport {
                                        log.warn("Appointment without room was 
found, skipping: {}", a);
                                        continue;
                                }
+                               if (a.getStart() == null || a.getEnd() == null) 
{
+                                       log.warn("Appointment without start/end 
time was found, skipping: {}", a);
+                                       continue;
+                               }
                                a = appointmentDao.update(a, null, false);
                                appointmentsMap.put(appId, a.getId());
                        }


Reply via email to