You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2016/04/27 10:48:43 UTC

svn commit: r1741166 - in /openmeetings/application: branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/ branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/ trunk/openmeetings-install/src/main...

Author: solomax
Date: Wed Apr 27 08:48:43 2016
New Revision: 1741166

URL: http://svn.apache.org/viewvc?rev=1741166&view=rev
Log:
[OPENMEETINGS-1380] chat messages are imported as expected

Modified:
    openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
    openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
    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.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java?rev=1741166&r1=1741165&r2=1741166&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupExport.java Wed Apr 27 08:48:43 2016
@@ -348,13 +348,13 @@ public class BackupExport {
 		 * ##################### Chat
 		 */
 		{
+			List<ChatMessage> list = chatDao.get(0, Integer.MAX_VALUE);
 			Registry registry = new Registry();
+			registry.bind(User.class, UserConverter.class);
+			registry.bind(Room.class, RoomConverter.class);
 			Strategy strategy = new RegistryStrategy(registry);
 			Serializer serializer = new Persister(strategy);
 	
-			registry.bind(User.class, UserConverter.class);
-			registry.bind(Room.class, RoomConverter.class);
-			List<ChatMessage> list = chatDao.get(0, Integer.MAX_VALUE);
 			if (list != null && list.size() > 0) {
 				registry.bind(list.get(0).getSent().getClass(), DateConverter.class);
 			}

Modified: openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java?rev=1741166&r1=1741165&r2=1741166&view=diff
==============================================================================
--- openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java (original)
+++ openmeetings/application/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java Wed Apr 27 08:48:43 2016
@@ -288,6 +288,7 @@ public class BackupImport {
 			List<LdapConfig> list = readList(simpleSerializer, f, "ldapconfigs.xml", "ldapconfigs", LdapConfig.class, true);
 			for (LdapConfig c : list) {
 				if (!"local DB [internal]".equals(c.getName())) {
+					c.setId(null);
 					c = ldapConfigDao.update(c, null);
 					if (defaultLdapId == null) {
 						defaultLdapId = c.getId();
@@ -303,6 +304,7 @@ public class BackupImport {
 		{
 			List<OAuthServer> list = readList(simpleSerializer, f, "oauth2servers.xml", "oauth2servers", OAuthServer.class, true);
 			for (OAuthServer s : list) {
+				s.setId(null);
 				auth2Dao.update(s, null);
 			}
 		}
@@ -426,6 +428,10 @@ public class BackupImport {
 			
 			List<ChatMessage> list = readList(serializer, f, "chat_messages.xml", "chat_messages", ChatMessage.class, true);
 			for (ChatMessage m : list) {
+				m.setId(null);
+				if (m.getFromUser() == null || m.getFromUser().getId() == null) {
+					continue;
+				}
 				chatDao.update(m);
 			}
 		}
@@ -471,6 +477,7 @@ public class BackupImport {
 		{
 			List<MeetingMember> list = readMeetingMemberList(f, "meetingmembers.xml", "meetingmembers");
 			for (MeetingMember ma : list) {
+				ma.setId(null);
 				meetingMemberDao.update(ma);
 			}
 		}

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=1741166&r1=1741165&r2=1741166&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 Wed Apr 27 08:48:43 2016
@@ -348,13 +348,13 @@ public class BackupExport {
 		 * ##################### Chat
 		 */
 		{
+			List<ChatMessage> list = chatDao.get(0, Integer.MAX_VALUE);
 			Registry registry = new Registry();
+			registry.bind(User.class, UserConverter.class);
+			registry.bind(Room.class, RoomConverter.class);
 			Strategy strategy = new RegistryStrategy(registry);
 			Serializer serializer = new Persister(strategy);
 	
-			registry.bind(User.class, UserConverter.class);
-			registry.bind(Room.class, RoomConverter.class);
-			List<ChatMessage> list = chatDao.get(0, Integer.MAX_VALUE);
 			if (list != null && list.size() > 0) {
 				registry.bind(list.get(0).getSent().getClass(), DateConverter.class);
 			}

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=1741166&r1=1741165&r2=1741166&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 Wed Apr 27 08:48:43 2016
@@ -289,6 +289,7 @@ public class BackupImport {
 			List<LdapConfig> list = readList(simpleSerializer, f, "ldapconfigs.xml", "ldapconfigs", LdapConfig.class, true);
 			for (LdapConfig c : list) {
 				if (!"local DB [internal]".equals(c.getName())) {
+					c.setId(null);
 					c = ldapConfigDao.update(c, null);
 					if (defaultLdapId == null) {
 						defaultLdapId = c.getId();
@@ -304,6 +305,7 @@ public class BackupImport {
 		{
 			List<OAuthServer> list = readList(simpleSerializer, f, "oauth2servers.xml", "oauth2servers", OAuthServer.class, true);
 			for (OAuthServer s : list) {
+				s.setId(null);
 				auth2Dao.update(s, null);
 			}
 		}
@@ -417,6 +419,10 @@ public class BackupImport {
 			
 			List<ChatMessage> list = readList(serializer, f, "chat_messages.xml", "chat_messages", ChatMessage.class, true);
 			for (ChatMessage m : list) {
+				m.setId(null);
+				if (m.getFromUser() == null || m.getFromUser().getId() == null) {
+					continue;
+				}
 				chatDao.update(m);
 			}
 		}
@@ -462,6 +468,7 @@ public class BackupImport {
 		{
 			List<MeetingMember> list = readMeetingMemberList(f, "meetingmembers.xml", "meetingmembers");
 			for (MeetingMember ma : list) {
+				ma.setId(null);
 				meetingMemberDao.update(ma);
 			}
 		}

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=1741166&r1=1741165&r2=1741166&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 Wed Apr 27 08:48:43 2016
@@ -348,13 +348,13 @@ public class BackupExport {
 		 * ##################### Chat
 		 */
 		{
+			List<ChatMessage> list = chatDao.get(0, Integer.MAX_VALUE);
 			Registry registry = new Registry();
+			registry.bind(User.class, UserConverter.class);
+			registry.bind(Room.class, RoomConverter.class);
 			Strategy strategy = new RegistryStrategy(registry);
 			Serializer serializer = new Persister(strategy);
 	
-			registry.bind(User.class, UserConverter.class);
-			registry.bind(Room.class, RoomConverter.class);
-			List<ChatMessage> list = chatDao.get(0, Integer.MAX_VALUE);
 			if (list != null && list.size() > 0) {
 				registry.bind(list.get(0).getSent().getClass(), DateConverter.class);
 			}

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=1741166&r1=1741165&r2=1741166&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 Wed Apr 27 08:48:43 2016
@@ -289,6 +289,7 @@ public class BackupImport {
 			List<LdapConfig> list = readList(simpleSerializer, f, "ldapconfigs.xml", "ldapconfigs", LdapConfig.class, true);
 			for (LdapConfig c : list) {
 				if (!"local DB [internal]".equals(c.getName())) {
+					c.setId(null);
 					c = ldapConfigDao.update(c, null);
 					if (defaultLdapId == null) {
 						defaultLdapId = c.getId();
@@ -304,6 +305,7 @@ public class BackupImport {
 		{
 			List<OAuthServer> list = readList(simpleSerializer, f, "oauth2servers.xml", "oauth2servers", OAuthServer.class, true);
 			for (OAuthServer s : list) {
+				s.setId(null);
 				auth2Dao.update(s, null);
 			}
 		}
@@ -417,6 +419,10 @@ public class BackupImport {
 			
 			List<ChatMessage> list = readList(serializer, f, "chat_messages.xml", "chat_messages", ChatMessage.class, true);
 			for (ChatMessage m : list) {
+				m.setId(null);
+				if (m.getFromUser() == null || m.getFromUser().getId() == null) {
+					continue;
+				}
 				chatDao.update(m);
 			}
 		}
@@ -462,6 +468,7 @@ public class BackupImport {
 		{
 			List<MeetingMember> list = readMeetingMemberList(f, "meetingmembers.xml", "meetingmembers");
 			for (MeetingMember ma : list) {
+				ma.setId(null);
 				meetingMemberDao.update(ma);
 			}
 		}