Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java Fri Nov 6 06:18:44 2015 @@ -57,41 +57,36 @@ import javax.xml.transform.stream.Stream import org.apache.commons.transaction.util.FileHelper; import org.apache.openmeetings.db.dao.basic.ChatDao; import org.apache.openmeetings.db.dao.basic.ConfigurationDao; -import org.apache.openmeetings.db.dao.calendar.AppointmentCategoryDao; import org.apache.openmeetings.db.dao.calendar.AppointmentDao; -import org.apache.openmeetings.db.dao.calendar.AppointmentReminderTypDao; import org.apache.openmeetings.db.dao.calendar.MeetingMemberDao; import org.apache.openmeetings.db.dao.file.FileExplorerItemDao; -import org.apache.openmeetings.db.dao.record.FlvRecordingDao; +import org.apache.openmeetings.db.dao.record.RecordingDao; import org.apache.openmeetings.db.dao.room.PollDao; import org.apache.openmeetings.db.dao.room.RoomDao; import org.apache.openmeetings.db.dao.room.RoomOrganisationDao; -import org.apache.openmeetings.db.dao.room.RoomTypeDao; import org.apache.openmeetings.db.dao.server.LdapConfigDao; import org.apache.openmeetings.db.dao.server.OAuth2Dao; import org.apache.openmeetings.db.dao.server.ServerDao; import org.apache.openmeetings.db.dao.user.OrganisationDao; +import org.apache.openmeetings.db.dao.user.PrivateMessageDao; import org.apache.openmeetings.db.dao.user.PrivateMessageFolderDao; -import org.apache.openmeetings.db.dao.user.PrivateMessagesDao; import org.apache.openmeetings.db.dao.user.StateDao; -import org.apache.openmeetings.db.dao.user.UserContactsDao; +import org.apache.openmeetings.db.dao.user.UserContactDao; import org.apache.openmeetings.db.dao.user.UserDao; import org.apache.openmeetings.db.entity.basic.ChatMessage; import org.apache.openmeetings.db.entity.basic.Configuration; import org.apache.openmeetings.db.entity.calendar.Appointment; -import org.apache.openmeetings.db.entity.calendar.AppointmentCategory; -import org.apache.openmeetings.db.entity.calendar.AppointmentReminderTyps; import org.apache.openmeetings.db.entity.calendar.MeetingMember; import org.apache.openmeetings.db.entity.file.FileExplorerItem; -import org.apache.openmeetings.db.entity.record.FlvRecording; -import org.apache.openmeetings.db.entity.record.FlvRecordingMetaData; +import org.apache.openmeetings.db.entity.file.FileItem; +import org.apache.openmeetings.db.entity.record.Recording; +import org.apache.openmeetings.db.entity.record.RecordingMetaData; import org.apache.openmeetings.db.entity.room.PollType; import org.apache.openmeetings.db.entity.room.Room; import org.apache.openmeetings.db.entity.room.RoomModerator; import org.apache.openmeetings.db.entity.room.RoomOrganisation; import org.apache.openmeetings.db.entity.room.RoomPoll; -import org.apache.openmeetings.db.entity.room.RoomPollAnswers; -import org.apache.openmeetings.db.entity.room.RoomType; +import org.apache.openmeetings.db.entity.room.RoomPollAnswer; import org.apache.openmeetings.db.entity.server.LdapConfig; import org.apache.openmeetings.db.entity.server.OAuthServer; import org.apache.openmeetings.db.entity.server.Server; @@ -102,7 +97,7 @@ import org.apache.openmeetings.db.entity import org.apache.openmeetings.db.entity.user.State; import org.apache.openmeetings.db.entity.user.User; import org.apache.openmeetings.db.entity.user.User.Right; -import org.apache.openmeetings.db.entity.user.User.Type; +import org.apache.openmeetings.db.entity.user.User.Salutation; import org.apache.openmeetings.db.entity.user.UserContact; import org.apache.openmeetings.db.util.TimezoneUtil; import org.apache.openmeetings.util.CalendarPatterns; @@ -137,17 +132,13 @@ public class BackupImport { @Autowired private RoomDao roomDao; @Autowired - private AppointmentCategoryDao appointmentCategoryDaoImpl; + private UserDao userDao; @Autowired - private AppointmentReminderTypDao appointmentReminderTypDaoImpl; - @Autowired - private UserDao usersDao; - @Autowired - private FlvRecordingDao flvRecordingDao; + private RecordingDao recordingDao; @Autowired private PrivateMessageFolderDao privateMessageFolderDao; @Autowired - private PrivateMessagesDao privateMessagesDao; + private PrivateMessageDao privateMessageDao; @Autowired private MeetingMemberDao meetingMemberDao; @Autowired @@ -155,7 +146,7 @@ public class BackupImport { @Autowired private FileExplorerItemDao fileExplorerItemDao; @Autowired - private UserContactsDao userContactsDao; + private UserContactDao userContactDao; @Autowired private PollDao pollManager; @Autowired @@ -169,10 +160,6 @@ public class BackupImport { @Autowired private OAuth2Dao auth2Dao; @Autowired - private OrganisationDao organisationDao; - @Autowired - private RoomTypeDao roomTypeDao; - @Autowired private RoomOrganisationDao roomOrganisationDao; private final Map<Long, Long> usersMap = new HashMap<Long, Long>(); @@ -240,7 +227,7 @@ public class BackupImport { matcher.bind(Long.class, LongTransform.class); registry.bind(Date.class, DateConverter.class); - registry.bind(User.class, new UserConverter(usersDao, usersMap)); + registry.bind(User.class, new UserConverter(userDao, usersMap)); List<Configuration> list = readList(serializer, f, "configs.xml", "configs", Configuration.class, true); for (Configuration c : list) { @@ -251,8 +238,8 @@ public class BackupImport { if (cfg != null && !cfg.isDeleted()) { log.warn("Non deleted configuration with same key is found! old value: {}, new value: {}", cfg.getConf_value(), c.getConf_value()); } - c.setConfiguration_id(cfg == null ? null : cfg.getConfiguration_id()); - if (c.getUser() != null && c.getUser().getUser_id() == null) { + c.setId(cfg == null ? null : cfg.getId()); + if (c.getUser() != null && c.getUser().getId() == null) { c.setUser(null); } if (CONFIG_CRYPT_KEY.equals(c.getConf_key())) { @@ -274,10 +261,10 @@ public class BackupImport { { List<Organisation> list = readList(simpleSerializer, f, "organizations.xml", "organisations", Organisation.class); for (Organisation o : list) { - long oldId = o.getOrganisation_id(); - o.setOrganisation_id(null); - o = organisationDao.update(o, null); - organisationsMap.put(oldId, o.getOrganisation_id()); + long oldId = o.getId(); + o.setId(null); + o = orgDao.update(o, null); + organisationsMap.put(oldId, o.getId()); } } @@ -293,7 +280,7 @@ public class BackupImport { if (u.getLogin() == null) { continue; } - if (u.getType() == Type.contact && u.getLogin().length() < minLoginLength) { + if (u.getType() == User.Type.contact && u.getLogin().length() < minLoginLength) { u.setLogin(UUID.randomUUID().toString()); } //FIXME: OPENMEETINGS-750 @@ -308,16 +295,16 @@ public class BackupImport { } u.setStarttime(new Date()); - long userId = u.getUser_id(); - u.setUser_id(null); + long userId = u.getId(); + u.setId(null); if (u.getSipUser() != null && u.getSipUser().getId() != 0) { u.getSipUser().setId(0); } - if (!Strings.isEmpty(u.getExternalUserType())) { - u.setType(Type.external); + if (!Strings.isEmpty(u.getExternalType())) { + u.setType(User.Type.external); } - usersDao.update(u, -1L); - usersMap.put(userId, u.getUser_id()); + userDao.update(u, -1L); + usersMap.put(userId, u.getId()); } } @@ -333,25 +320,25 @@ public class BackupImport { matcher.bind(Long.class, LongTransform.class); matcher.bind(Integer.class, IntegerTransform.class); - registry.bind(User.class, new UserConverter(usersDao, usersMap)); - registry.bind(RoomType.class, new RoomTypeConverter(roomTypeDao)); + registry.bind(User.class, new UserConverter(userDao, usersMap)); + registry.bind(Room.Type.class, new RoomTypeConverter()); List<Room> list = readList(serializer, f, "rooms.xml", "rooms", Room.class); for (Room r : list) { - Long roomId = r.getRooms_id(); + Long roomId = r.getId(); // We need to reset ids as openJPA reject to store them otherwise - r.setRooms_id(null); + r.setId(null); if (r.getModerators() != null) { for (Iterator<RoomModerator> i = r.getModerators().iterator(); i.hasNext();) { RoomModerator rm = i.next(); - if (rm.getUser().getUser_id() == null) { + if (rm.getUser().getId() == null) { i.remove(); } } } r = roomDao.update(r, null); - roomsMap.put(roomId, r.getRooms_id()); + roomsMap.put(roomId, r.getId()); } } @@ -369,9 +356,9 @@ public class BackupImport { List<RoomOrganisation> list = readList(serializer, f, "rooms_organisation.xml", "room_organisations", RoomOrganisation.class); for (RoomOrganisation ro : list) { - if (!ro.getDeleted() && ro.getRoom() != null && ro.getRoom().getRooms_id() != null && ro.getOrganisation() != null && ro.getOrganisation().getOrganisation_id() != null) { + if (!ro.isDeleted() && ro.getRoom() != null && ro.getRoom().getId() != null && ro.getOrganisation() != null && ro.getOrganisation().getId() != null) { // We need to reset this as openJPA reject to store them otherwise - ro.setRooms_organisation_id(null); + ro.setId(null); roomOrganisationDao.update(ro, null); } } @@ -386,7 +373,7 @@ public class BackupImport { Strategy strategy = new RegistryStrategy(registry); Serializer serializer = new Persister(strategy); - registry.bind(User.class, new UserConverter(usersDao, usersMap)); + registry.bind(User.class, new UserConverter(userDao, usersMap)); registry.bind(Room.class, new RoomConverter(roomDao, roomsMap)); registry.bind(Date.class, DateConverter.class); @@ -405,23 +392,21 @@ public class BackupImport { Strategy strategy = new RegistryStrategy(registry); Serializer serializer = new Persister(strategy); - registry.bind(AppointmentCategory.class, new AppointmentCategoryConverter(appointmentCategoryDaoImpl)); - registry.bind(User.class, new UserConverter(usersDao, usersMap)); - registry.bind(AppointmentReminderTyps.class, new AppointmentReminderTypeConverter(appointmentReminderTypDaoImpl)); + registry.bind(User.class, new UserConverter(userDao, usersMap)); + registry.bind(Appointment.Reminder.class, new AppointmentReminderTypeConverter()); registry.bind(Room.class, new RoomConverter(roomDao, roomsMap)); registry.bind(Date.class, DateConverter.class); List<Appointment> list = readList(serializer, f, "appointements.xml", "appointments", Appointment.class); - log.debug(list.size() + " Appointments found in backup"); for (Appointment a : list) { Long appId = a.getId(); // We need to reset this as openJPA reject to store them otherwise a.setId(null); - if (a.getOwner() != null && a.getOwner().getUser_id() == null) { + if (a.getOwner() != null && a.getOwner().getId() == null) { a.setOwner(null); } - if (a.getRoom() != null && a.getRoom().getRooms_id() == null) { + if (a.getRoom() != null && a.getRoom().getId() == null) { a.setRoom(null); } a = appointmentDao.update(a, null, false); @@ -482,35 +467,26 @@ public class BackupImport { * ##################### Import Recordings */ { - Registry registry = new Registry(); - Strategy strategy = new RegistryStrategy(registry); - RegistryMatcher matcher = new RegistryMatcher(); //TODO need to be removed in the later versions - Serializer serializer = new Persister(strategy, matcher); - - matcher.bind(Long.class, LongTransform.class); - matcher.bind(Integer.class, IntegerTransform.class); - registry.bind(Date.class, DateConverter.class); - - List<FlvRecording> list = readList(serializer, f, "flvRecordings.xml", "flvrecordings", FlvRecording.class, true); - for (FlvRecording fr : list) { - fr.setFlvRecordingId(0); - if (fr.getRoom_id() != null) { - fr.setRoom_id(roomsMap.get(fr.getRoom_id())); + List<Recording> list = readRecordingList(f, "flvRecordings.xml", "flvrecordings"); + for (Recording fr : list) { + fr.setId(null); + if (fr.getRoomId() != null) { + fr.setRoomId(roomsMap.get(fr.getRoomId())); } if (fr.getOwnerId() != null) { fr.setOwnerId(usersMap.get(fr.getOwnerId())); } - if (fr.getFlvRecordingMetaData() != null) { - for (FlvRecordingMetaData meta : fr.getFlvRecordingMetaData()) { - meta.setFlvRecordingMetaDataId(0); - meta.setFlvRecording(fr); + if (fr.getMetaData() != null) { + for (RecordingMetaData meta : fr.getMetaData()) { + meta.setId(null); + meta.setRecording(fr); } } - flvRecordingDao.update(fr); + recordingDao.update(fr); } } - log.info("FLVrecording import complete, starting private message folder import"); + log.info("Recording import complete, starting private message folder import"); /* * ##################### Import Private Message Folders */ @@ -518,10 +494,10 @@ public class BackupImport { List<PrivateMessageFolder> list = readList(simpleSerializer, f, "privateMessageFolder.xml" , "privatemessagefolders", PrivateMessageFolder.class, true); for (PrivateMessageFolder p : list) { - Long folderId = p.getPrivateMessageFolderId(); + Long folderId = p.getId(); PrivateMessageFolder storedFolder = privateMessageFolderDao.get(folderId); if (storedFolder == null) { - p.setPrivateMessageFolderId(0); + p.setId(null); Long newFolderId = privateMessageFolderDao.addPrivateMessageFolderObj(p); messageFoldersMap.put(folderId, newFolderId); } @@ -537,19 +513,19 @@ public class BackupImport { Strategy strategy = new RegistryStrategy(registry); Serializer serializer = new Persister(strategy); - registry.bind(User.class, new UserConverter(usersDao, usersMap)); + registry.bind(User.class, new UserConverter(userDao, usersMap)); List<UserContact> list = readList(serializer, f, "userContacts.xml", "usercontacts", UserContact.class, true); for (UserContact uc : list) { Long ucId = uc.getUserContactId(); - UserContact storedUC = userContactsDao.get(ucId); + UserContact storedUC = userContactDao.get(ucId); - if (storedUC == null && uc.getContact() != null && uc.getContact().getUser_id() != null) { + if (storedUC == null && uc.getContact() != null && uc.getContact().getId() != null) { uc.setUserContactId(0); - if (uc.getOwner() != null && uc.getOwner().getUser_id() == null) { + if (uc.getOwner() != null && uc.getOwner().getId() == null) { uc.setOwner(null); } - Long newId = userContactsDao.addUserContactObj(uc); + Long newId = userContactDao.addUserContactObj(uc); userContactsMap.put(ucId, newId); } } @@ -564,7 +540,7 @@ public class BackupImport { Strategy strategy = new RegistryStrategy(registry); Serializer serializer = new Persister(strategy); - registry.bind(User.class, new UserConverter(usersDao, usersMap)); + registry.bind(User.class, new UserConverter(userDao, usersMap)); registry.bind(Room.class, new RoomConverter(roomDao, roomsMap)); registry.bind(Date.class, DateConverter.class); @@ -578,28 +554,28 @@ public class BackupImport { } for (PrivateMessage p : list) { - p.setId(0); + p.setId(null); p.setFolderId(getNewId(p.getFolderId(), Maps.MESSAGEFOLDERS)); p.setUserContactId(getNewId(p.getUserContactId(), Maps.USERCONTACTS)); - if (p.getRoom() != null && p.getRoom().getRooms_id() == null) { + if (p.getRoom() != null && p.getRoom().getId() == null) { p.setRoom(null); } - if (p.getTo() != null && p.getTo().getUser_id() == null) { + if (p.getTo() != null && p.getTo().getId() == null) { p.setTo(null); } - if (p.getFrom() != null && p.getFrom().getUser_id() == null) { + if (p.getFrom() != null && p.getFrom().getId() == null) { p.setFrom(null); } - if (p.getOwner() != null && p.getOwner().getUser_id() == null) { + if (p.getOwner() != null && p.getOwner().getId() == null) { p.setOwner(null); } - if (oldBackup && p.getOwner() != null && p.getOwner().getUser_id() != null - && p.getFrom() != null && p.getFrom().getUser_id() != null - && p.getOwner().getUser_id() == p.getFrom().getUser_id()) + if (oldBackup && p.getOwner() != null && p.getOwner().getId() != null + && p.getFrom() != null && p.getFrom().getId() != null + && p.getOwner().getId() == p.getFrom().getId()) { p.setFolderId(SENT_FOLDER_ID); } - privateMessagesDao.update(p, null); + privateMessageDao.update(p, null); } } @@ -608,29 +584,23 @@ public class BackupImport { * ##################### Import File-Explorer Items */ { - Registry registry = new Registry(); - Strategy strategy = new RegistryStrategy(registry); - RegistryMatcher matcher = new RegistryMatcher(); //TODO need to be removed in the later versions - Serializer serializer = new Persister(strategy, matcher); - - matcher.bind(Long.class, LongTransform.class); - matcher.bind(Integer.class, IntegerTransform.class); - registry.bind(Date.class, DateConverter.class); - - List<FileExplorerItem> list = readList(serializer, f, "fileExplorerItems.xml", "fileExplorerItems", FileExplorerItem.class, true); + List<FileExplorerItem> list = readFileExplorerItemList(f, "fileExplorerItems.xml", "fileExplorerItems"); for (FileExplorerItem file : list) { // We need to reset this as openJPA reject to store them otherwise - file.setFileExplorerItemId(0); - Long roomId = file.getRoom_id(); - file.setRoom_id(roomsMap.containsKey(roomId) ? roomsMap.get(roomId) : null); + file.setId(null); + Long roomId = file.getRoomId(); + file.setRoomId(roomsMap.containsKey(roomId) ? roomsMap.get(roomId) : null); if (file.getOwnerId() != null) { file.setOwnerId(usersMap.get(file.getOwnerId())); } + if (file.getParentItemId() != null && file.getParentItemId() <= 0L) { + file.setParentItemId(null); + } fileExplorerItemDao.addFileExplorerItem(file); } } - log.info("File explorer item import complete, starting file poll import"); + log.info("File explorer item import complete, starting room poll import"); /* * ##################### Import Room Polls */ @@ -641,22 +611,22 @@ public class BackupImport { Serializer serializer = new Persister(strategy, matcher); matcher.bind(Integer.class, IntegerTransform.class); - registry.bind(User.class, new UserConverter(usersDao, usersMap)); + registry.bind(User.class, new UserConverter(userDao, usersMap)); registry.bind(Room.class, new RoomConverter(roomDao, roomsMap)); registry.bind(PollType.class, new PollTypeConverter(pollManager)); registry.bind(Date.class, DateConverter.class); List<RoomPoll> list = readList(serializer, f, "roompolls.xml", "roompolls", RoomPoll.class, true); for (RoomPoll rp : list) { - if (rp.getRoom() == null || rp.getRoom().getRooms_id() == null) { + if (rp.getRoom() == null || rp.getRoom().getId() == null) { //room was deleted continue; } - if (rp.getCreatedBy() == null || rp.getCreatedBy().getUser_id() == null) { + if (rp.getCreatedBy() == null || rp.getCreatedBy().getId() == null) { rp.setCreatedBy(null); } - for (RoomPollAnswers rpa : rp.getRoomPollAnswerList()) { - if (rpa.getVotedUser() == null || rpa.getVotedUser().getUser_id() == null) { + for (RoomPollAnswer rpa : rp.getRoomPollAnswerList()) { + if (rpa.getVotedUser() == null || rpa.getVotedUser().getId() == null) { rpa.setVotedUser(null); } } @@ -705,16 +675,140 @@ public class BackupImport { } private Node getNode(Node doc, String name) { - NodeList nl = doc.getChildNodes(); - for (int i = 0; i < nl.getLength(); ++i) { - Node node = nl.item(i); - if (node.getNodeType() == Node.ELEMENT_NODE && name.equals(node.getNodeName())) { - return node; + if (doc != null) { + NodeList nl = doc.getChildNodes(); + for (int i = 0; i < nl.getLength(); ++i) { + Node node = nl.item(i); + if (node.getNodeType() == Node.ELEMENT_NODE && name.equals(node.getNodeName())) { + return node; + } } } return null; } + public List<FileExplorerItem> readFileExplorerItemList(File baseDir, String fileName, String listNodeName) throws Exception { + List<FileExplorerItem> list = new ArrayList<FileExplorerItem>(); + File xml = new File(baseDir, fileName); + if (xml.exists()) { + Registry registry = new Registry(); + Strategy strategy = new RegistryStrategy(registry); + RegistryMatcher matcher = new RegistryMatcher(); //TODO need to be removed in the later versions + Serializer ser = new Persister(strategy, matcher); + + matcher.bind(Long.class, LongTransform.class); + matcher.bind(Integer.class, IntegerTransform.class); + registry.bind(Date.class, DateConverter.class); + + InputNode root = NodeBuilder.read(new FileInputStream(xml)); + InputNode root1 = NodeBuilder.read(new FileInputStream(xml)); //HACK to handle old isFolder, isImage, isVideo, isRecording, isPresentation, isStoredWmlFile, isChart + InputNode listNode = root.getNext(); + InputNode listNode1 = root1.getNext(); //HACK to handle old isFolder, isImage, isVideo, isRecording, isPresentation, isStoredWmlFile, isChart + if (listNodeName.equals(listNode.getName())) { + InputNode item = listNode.getNext(); + InputNode item1 = listNode1.getNext(); //HACK to handle old isFolder, isImage, isVideo, isRecording, isPresentation, isStoredWmlFile, isChart + while (item != null) { + FileExplorerItem f = ser.read(FileExplorerItem.class, item, false); + + boolean isFolder = false, isImage = false, isVideo = false, isPresentation = false, isStoredWmlFile = false, isChart = false; + //HACK to handle old isFolder, isImage, isVideo, isRecording, isPresentation, isStoredWmlFile, isChart + do { + if ("isChart".equals(item1.getName()) && "true".equals(item1.getValue())) { + isChart = true; + } + if ("isImage".equals(item1.getName()) && "true".equals(item1.getValue())) { + isImage = true; + } + if ("isVideo".equals(item1.getName()) && "true".equals(item1.getValue())) { + isVideo = true; + } + if ("isRecording".equals(item1.getName()) && "true".equals(item1.getValue())) { + log.warn("Recording is stored in FileExplorer Items"); + isVideo = true; + } + if ("isPresentation".equals(item1.getName()) && "true".equals(item1.getValue())) { + isPresentation = true; + } + if ("isStoredWmlFile".equals(item1.getName()) && "true".equals(item1.getValue())) { + isStoredWmlFile = true; + } + if ("isFolder".equals(item1.getName()) && "true".equals(item1.getValue())) { + isFolder = true; + } + item1 = listNode1.getNext(); //HACK to handle Address inside user + } while (item1 != null && !"fileExplorerItem".equals(item1.getName())); + + if (f.getType() == null) { + if (isChart) { + f.setType(FileItem.Type.PollChart); + } + if (isImage) { + f.setType(FileItem.Type.Image); + } + if (isVideo) { + f.setType(FileItem.Type.Video); + } + if (isPresentation) { + f.setType(FileItem.Type.Presentation); + } + if (isStoredWmlFile) { + f.setType(FileItem.Type.WmlFile); + } + if (isFolder) { + f.setType(FileItem.Type.Folder); + } + } + list.add(f); + item = listNode.getNext(); + } + } + } + return list; + } + + public List<Recording> readRecordingList(File baseDir, String fileName, String listNodeName) throws Exception { + List<Recording> list = new ArrayList<Recording>(); + File xml = new File(baseDir, fileName); + if (xml.exists()) { + Registry registry = new Registry(); + Strategy strategy = new RegistryStrategy(registry); + RegistryMatcher matcher = new RegistryMatcher(); //TODO need to be removed in the later versions + Serializer ser = new Persister(strategy, matcher); + + matcher.bind(Long.class, LongTransform.class); + matcher.bind(Integer.class, IntegerTransform.class); + registry.bind(Date.class, DateConverter.class); + + InputNode root = NodeBuilder.read(new FileInputStream(xml)); + InputNode root1 = NodeBuilder.read(new FileInputStream(xml)); //HACK to handle old isFolder + InputNode listNode = root.getNext(); + InputNode listNode1 = root1.getNext(); //HACK to handle old isFolder + if (listNodeName.equals(listNode.getName())) { + InputNode item = listNode.getNext(); + InputNode item1 = listNode1.getNext(); //HACK to handle old isFolder + while (item != null) { + Recording r = ser.read(Recording.class, item, false); + + boolean isFolder = false; + //HACK to handle old isFolder + do { + if ("isFolder".equals(item1.getName()) && "true".equals(item1.getValue())) { + isFolder = true; + } + item1 = listNode1.getNext(); //HACK to handle Address inside user + } while (item1 != null && !"flvrecording".equals(item1.getName())); + + if (r.getType() == null) { + r.setType(isFolder ? FileItem.Type.Folder : FileItem.Type.Recording); + } + list.add(r); + item = listNode.getNext(); + } + } + } + return list; + } + public List<User> readUserList(InputStream xml, String listNodeName) throws Exception { return readUserList(new InputSource(xml), listNodeName); } @@ -734,7 +828,7 @@ public class BackupImport { Strategy strategy = new RegistryStrategy(registry); Serializer ser = new Persister(strategy); - registry.bind(User.class, new UserConverter(usersDao, usersMap)); + registry.bind(User.class, new UserConverter(userDao, usersMap)); registry.bind(Appointment.class, new AppointmentConverter(appointmentDao, appointmentsMap)); File xml = new File(baseDir, filename); @@ -764,20 +858,20 @@ public class BackupImport { if (mm.getUser() == null) { mm.setUser(new User()); } - if (mm.getUser().getUser_id() == null) { + if (mm.getUser().getId() == null) { //HACK to handle external attendee's firstname, lastname, email boolean contactValid = false; do { - if (Type.contact == mm.getUser().getType() && "firstname".equals(item1.getName())) { + if (User.Type.contact == mm.getUser().getType() && "firstname".equals(item1.getName())) { mm.getUser().setFirstname(item1.getValue()); } - if (Type.contact == mm.getUser().getType() && "lastname".equals(item1.getName())) { + if (User.Type.contact == mm.getUser().getType() && "lastname".equals(item1.getName())) { mm.getUser().setLastname(item1.getValue()); } if ("email".equals(item1.getName())) { String email = item1.getValue(); if (mm.getAppointment() != null && mm.getAppointment().getOwner() != null) { - mm.setUser(usersDao.getContact(email, mm.getAppointment().getOwner())); + mm.setUser(userDao.getContact(email, mm.getAppointment().getOwner())); } contactValid = true; } @@ -803,7 +897,7 @@ public class BackupImport { return list; } - //FIXME (need to be removed in later versions) HACK to fix 2 deleted nodes in users.xml and inline Adresses and sipData + //FIXME (need to be removed in later versions) HACK to fix 2 deleted nodes in users.xml and inline Address and sipData private List<User> readUserList(InputSource xml, String listNodeName) throws Exception { Registry registry = new Registry(); Strategy strategy = new RegistryStrategy(registry); @@ -811,41 +905,45 @@ public class BackupImport { registry.bind(Organisation.class, new OrganisationConverter(orgDao, organisationsMap)); registry.bind(State.class, new StateConverter(statemanagement)); + registry.bind(Salutation.class, SalutationConverter.class); registry.bind(Date.class, DateConverter.class); DocumentBuilder dBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document doc = dBuilder.parse(xml); - NodeList nl = getNode(getNode(doc, "root"), listNodeName).getChildNodes(); userEmailMap.clear(); //add existence email from database - List<User> users = usersDao.getAllUsers(); + List<User> users = userDao.getAllUsers(); for (User u : users){ - if (u.getAdresses() == null || u.getAdresses().getEmail() == null || Type.user != u.getType()) { + if (u.getAddress() == null || u.getAddress().getEmail() == null || User.Type.user != u.getType()) { continue; } - userEmailMap.put(u.getAdresses().getEmail(), -1); + userEmailMap.put(u.getAddress().getEmail(), -1); } - // one of the old OM version created 2 nodes "deleted" this code block handles this - for (int i = 0; i < nl.getLength(); ++i) { - Node user = nl.item(i); - NodeList nl1 = user.getChildNodes(); - boolean deletedFound = false; - for (int j = 0; j < nl1.getLength(); ++j) { - Node node = nl1.item(j); - if (node.getNodeType() == Node.ELEMENT_NODE && "deleted".equals(node.getNodeName())) { - if (deletedFound) { - user.removeChild(node); - break; + Node nList = getNode(getNode(doc, "root"), listNodeName); + if (nList != null) { + NodeList nl = nList.getChildNodes(); + // one of the old OM version created 2 nodes "deleted" this code block handles this + for (int i = 0; i < nl.getLength(); ++i) { + Node user = nl.item(i); + NodeList nl1 = user.getChildNodes(); + boolean deletedFound = false; + for (int j = 0; j < nl1.getLength(); ++j) { + Node node = nl1.item(j); + if (node.getNodeType() == Node.ELEMENT_NODE && "deleted".equals(node.getNodeName())) { + if (deletedFound) { + user.removeChild(node); + break; + } + deletedFound = true; } - deletedFound = true; } } } StringWriter sw = new StringWriter(); Transformer xformer = TransformerFactory.newInstance().newTransformer(); - xformer.transform(new DOMSource(doc), new StreamResult(sw)); - + xformer.transform(new DOMSource(doc), new StreamResult(sw)); + List<User> list = new ArrayList<User>(); InputNode root = NodeBuilder.read(new StringReader(sw.toString())); InputNode root1 = NodeBuilder.read(new StringReader(sw.toString())); //HACK to handle Address inside user @@ -862,9 +960,9 @@ public class BackupImport { boolean needToSkip1 = true; //HACK to handle Address inside user - if (u.getAdresses() == null) { + if (u.getAddress() == null) { Address a = ser.read(Address.class, item1, false); - u.setAdresses(a); + u.setAddress(a); needToSkip1 = false; } if (needToSkip1) { @@ -872,14 +970,14 @@ public class BackupImport { item1 = listNode1.getNext(); //HACK to handle Address inside user } while (item1 != null && !"user".equals(item1.getName())); } - String level_id = null, status = null; + String levelId = null, status = null; do { if (u.getTimeZoneId() == null && "omTimeZone".equals(item2.getName())) { String jName = item2.getValue(); u.setTimeZoneId(jName == null ? null : tzUtil.getTimezoneByInternalJName(jName).getID()); } if ("level_id".equals(item2.getName())) { - level_id = item2.getValue(); + levelId = item2.getValue(); } if ("status".equals(item2.getName())) { status = item2.getValue(); @@ -892,22 +990,22 @@ public class BackupImport { u.getRights().add(Right.Dashboard); u.getRights().add(Right.Login); } - if ("3".equals(level_id)) { + if ("3".equals(levelId)) { u.getRights().add(Right.Admin); u.getRights().add(Right.Soap); } - if ("4".equals(level_id)) { + if ("4".equals(levelId)) { u.getRights().add(Right.Soap); } } // check that email is unique - if (u.getAdresses() != null && u.getAdresses().getEmail() != null && Type.user == u.getType()) { - if (userEmailMap.containsKey(u.getAdresses().getEmail())) { + if (u.getAddress() != null && u.getAddress().getEmail() != null && User.Type.user == u.getType()) { + if (userEmailMap.containsKey(u.getAddress().getEmail())) { log.warn("Email is duplicated for user " + u.toString()); - String updateEmail = "modified_by_import_<" + list.size() + ">" + u.getAdresses().getEmail(); - u.getAdresses().setEmail(updateEmail); + String updateEmail = "modified_by_import_<" + list.size() + ">" + u.getAddress().getEmail(); + u.getAddress().setEmail(updateEmail); } - userEmailMap.put(u.getAdresses().getEmail(), userEmailMap.size()); + userEmailMap.put(u.getAddress().getEmail(), userEmailMap.size()); } list.add(u); item = listNode.getNext();
Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/IntegerTransform.java Fri Nov 6 06:18:44 2015 @@ -22,7 +22,7 @@ import org.simpleframework.xml.transform public class IntegerTransform implements Transform<Integer>{ public Integer read(String value) throws Exception { - return OmConverter.getintValue(value, 0); + return OmConverter.getInt(value, 0); } public String write(Integer value) throws Exception { Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/LongTransform.java Fri Nov 6 06:18:44 2015 @@ -22,7 +22,7 @@ import org.simpleframework.xml.transform public class LongTransform implements Transform<Long>{ public Long read(String value) throws Exception { - return OmConverter.getlongValue(value); + return OmConverter.getLong(value); } public String write(Long value) throws Exception { Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmConverter.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmConverter.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmConverter.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OmConverter.java Fri Nov 6 06:18:44 2015 @@ -22,15 +22,15 @@ import org.simpleframework.xml.convert.C import org.simpleframework.xml.stream.InputNode; public abstract class OmConverter<T> implements Converter<T> { - static long getlongValue(InputNode node) throws Exception { - return getlongValue(node.getValue()); + static long getLong(InputNode node) throws Exception { + return getLong(node.getValue()); } - static long getlongValue(String value) { - return getlongValue(value, 0); + static long getLong(String value) { + return getLong(value, 0); } - static long getlongValue(String value, long def) { + static long getLong(String value, long def) { long result = def; try { result = Long.valueOf(value).longValue(); @@ -40,7 +40,11 @@ public abstract class OmConverter<T> imp return result; } - static int getintValue(String value, int def) { + static int getInt(InputNode node) throws Exception { + return getInt(node.getValue(), 0); + } + + static int getInt(String value, int def) { int result = def; try { result = Integer.valueOf(value).intValue(); Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OrganisationConverter.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OrganisationConverter.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OrganisationConverter.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/OrganisationConverter.java Fri Nov 6 06:18:44 2015 @@ -39,7 +39,7 @@ public class OrganisationConverter exten } public Organisation read(InputNode node) throws Exception { - long oldId = getlongValue(node); + long oldId = getLong(node); long newId = idMap.containsKey(oldId) ? idMap.get(oldId) : oldId; Organisation o = orgDao.get(newId); @@ -48,6 +48,6 @@ public class OrganisationConverter exten public void write(OutputNode node, Organisation value) throws Exception { node.setData(true); - node.setValue(value == null ? "0" : "" + value.getOrganisation_id()); + node.setValue(value == null ? "0" : "" + value.getId()); } } \ No newline at end of file Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/PollTypeConverter.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/PollTypeConverter.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/PollTypeConverter.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/PollTypeConverter.java Fri Nov 6 06:18:44 2015 @@ -35,7 +35,7 @@ public class PollTypeConverter extends O } public PollType read(InputNode node) throws Exception { - return pollManager.getPollType(getlongValue(node)); + return pollManager.getPollType(getLong(node)); } public void write(OutputNode node, PollType value) throws Exception { Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomConverter.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomConverter.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomConverter.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomConverter.java Fri Nov 6 06:18:44 2015 @@ -39,7 +39,7 @@ public class RoomConverter extends OmCon } public Room read(InputNode node) throws Exception { - long oldId = getlongValue(node); + long oldId = getLong(node); long newId = idMap.containsKey(oldId) ? idMap.get(oldId) : oldId; Room r = roomDao.get(newId); @@ -48,6 +48,6 @@ public class RoomConverter extends OmCon public void write(OutputNode node, Room value) throws Exception { node.setData(true); - node.setValue(value == null ? "0" : "" + value.getRooms_id()); + node.setValue(value == null ? "0" : "" + value.getId()); } } \ No newline at end of file Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomTypeConverter.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomTypeConverter.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomTypeConverter.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/RoomTypeConverter.java Fri Nov 6 06:18:44 2015 @@ -18,29 +18,19 @@ */ package org.apache.openmeetings.backup; -import org.apache.openmeetings.db.dao.room.RoomTypeDao; -import org.apache.openmeetings.db.entity.room.RoomType; +import org.apache.openmeetings.db.entity.room.Room.Type; import org.simpleframework.xml.stream.InputNode; import org.simpleframework.xml.stream.OutputNode; -public class RoomTypeConverter extends OmConverter<RoomType> { - private RoomTypeDao dao; +public class RoomTypeConverter extends OmConverter<Type> { + public RoomTypeConverter() {} - public RoomTypeConverter() { - //default constructor is for export - } - - public RoomTypeConverter(RoomTypeDao dao) { - this.dao = dao; - } - - public RoomType read(InputNode node) throws Exception { - RoomType rt = dao.get(getlongValue(node)); - return rt != null ? rt : dao.get(1); // conference type will be used in case of bad type + public Type read(InputNode node) throws Exception { + return Type.get(getInt(node)); } - public void write(OutputNode node, RoomType value) throws Exception { + public void write(OutputNode node, Type value) throws Exception { node.setData(true); - node.setValue(value == null ? "0" : "" + value.getRoomtypes_id()); + node.setValue(value == null ? "0" : "" + value.getId()); } } \ No newline at end of file Added: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/SalutationConverter.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/SalutationConverter.java?rev=1712911&view=auto ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/SalutationConverter.java (added) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/SalutationConverter.java Fri Nov 6 06:18:44 2015 @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License") + you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.openmeetings.backup; + +import org.apache.openmeetings.db.entity.user.User.Salutation; +import org.simpleframework.xml.stream.InputNode; +import org.simpleframework.xml.stream.OutputNode; + +public class SalutationConverter extends OmConverter<Salutation> { + public Salutation read(InputNode node) throws Exception { + return Salutation.get(getInt(node)); + } + + public void write(OutputNode node, Salutation value) throws Exception { + node.setData(true); + node.setValue(value == null ? "0" : "" + value.getId()); + } +} \ No newline at end of file Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/StateConverter.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/StateConverter.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/StateConverter.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/StateConverter.java Fri Nov 6 06:18:44 2015 @@ -24,22 +24,22 @@ import org.simpleframework.xml.stream.In import org.simpleframework.xml.stream.OutputNode; public class StateConverter extends OmConverter<State> { - private StateDao statemanagement; + private StateDao stateDao; public StateConverter() { //default constructor is for export } - public StateConverter(StateDao statemanagement) { - this.statemanagement = statemanagement; + public StateConverter(StateDao stateDao) { + this.stateDao = stateDao; } public State read(InputNode node) throws Exception { - return statemanagement.getStateById(getlongValue(node)); + return stateDao.get(getLong(node)); } public void write(OutputNode node, State value) throws Exception { node.setData(true); - node.setValue(value == null ? "0" : "" + value.getState_id()); + node.setValue(value == null ? "0" : "" + value.getId()); } } \ No newline at end of file Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/UserConverter.java Fri Nov 6 06:18:44 2015 @@ -39,7 +39,7 @@ public class UserConverter extends OmCon } public User read(InputNode node) throws Exception { - long oldId = getlongValue(node); + long oldId = getLong(node); long newId = idMap.containsKey(oldId) ? idMap.get(oldId) : oldId; User u = userDao.get(newId); @@ -48,6 +48,6 @@ public class UserConverter extends OmCon public void write(OutputNode node, User value) throws Exception { node.setData(true); - node.setValue(value == null ? "0" : "" + value.getUser_id()); + node.setValue(value == null ? "0" : "" + value.getId()); } } \ No newline at end of file Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/cli/Admin.java Fri Nov 6 06:18:44 2015 @@ -54,10 +54,10 @@ import org.apache.openmeetings.backup.Ba import org.apache.openmeetings.backup.ProgressHolder; import org.apache.openmeetings.db.dao.basic.ConfigurationDao; import org.apache.openmeetings.db.dao.file.FileExplorerItemDao; -import org.apache.openmeetings.db.dao.record.FlvRecordingDao; +import org.apache.openmeetings.db.dao.record.RecordingDao; import org.apache.openmeetings.db.dao.user.UserDao; import org.apache.openmeetings.db.entity.file.FileExplorerItem; -import org.apache.openmeetings.db.entity.record.FlvRecording; +import org.apache.openmeetings.db.entity.record.Recording; import org.apache.openmeetings.db.entity.user.User; import org.apache.openmeetings.installation.ImportInitvalues; import org.apache.openmeetings.installation.InstallationConfig; @@ -344,7 +344,7 @@ public class Admin { } long missing = 0; for (User u : udao.getAllBackupUsers()) { - if (!u.getDeleted() && u.getPictureuri() != null && !new File(OmFileHelper.getUploadProfilesUserDir(u.getUser_id()), u.getPictureuri()).exists()) { + if (!u.getDeleted() && u.getPictureuri() != null && !new File(OmFileHelper.getUploadProfilesUserDir(u.getId()), u.getPictureuri()).exists()) { missing++; } } @@ -376,7 +376,7 @@ public class Admin { } else { invalid += fSize; } - } else if (item.getDeleted()) { + } else if (item.isDeleted()) { if (cleanup) { FileHelper.removeRec(f); } else { @@ -386,7 +386,7 @@ public class Admin { } missing = 0; for (FileExplorerItem item : fileDao.getFileExplorerItems()) { - if (!item.getDeleted() && item.getFileHash() != null && !new File(files, item.getFileHash()).exists()) { + if (!item.isDeleted() && item.getFileHash() != null && !new File(files, item.getFileHash()).exists()) { missing++; } } @@ -411,17 +411,17 @@ public class Admin { report.append("Recordings allocates: ").append(OmFileHelper.getHumanSize(sectionSize)).append("\n"); long size = OmFileHelper.getSize(hibernateDir); long restSize = sectionSize - size; - FlvRecordingDao recordDao = getApplicationContext(ctxName).getBean(FlvRecordingDao.class); + RecordingDao recordDao = getApplicationContext(ctxName).getBean(RecordingDao.class); long[] params = {0, 0}; // [0] == deleted [1] == missing - for (FlvRecording rec : recordDao.getAllFlvRecordings()) { - checkRecordingFile(hibernateDir, rec.getFileHash(), rec.getDeleted(), params, cleanup); - checkRecordingFile(hibernateDir, rec.getAlternateDownload(), rec.getDeleted(), params, cleanup); - checkRecordingFile(hibernateDir, rec.getPreviewImage(), rec.getDeleted(), params, cleanup); + for (Recording rec : recordDao.get()) { + checkRecordingFile(hibernateDir, rec.getFileHash(), rec.isDeleted(), params, cleanup); + checkRecordingFile(hibernateDir, rec.getAlternateDownload(), rec.isDeleted(), params, cleanup); + checkRecordingFile(hibernateDir, rec.getPreviewImage(), rec.isDeleted(), params, cleanup); } long invalid = 0; for (File f : hibernateDir.listFiles()) { if (f.isFile() && f.getName().endsWith(".flv")) { - FlvRecording rec = recordDao.getRecordingByHash(f.getName()); + Recording rec = recordDao.getByHash(f.getName()); if (rec == null) { cleanUpFile(invalid, cleanup, f); String name = f.getName().substring(0, f.getName().length() - 5); Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java Fri Nov 6 06:18:44 2015 @@ -21,6 +21,7 @@ package org.apache.openmeetings.installa import static org.apache.openmeetings.db.dao.basic.ConfigurationDao.DEFAULT_APP_NAME; import static org.apache.openmeetings.db.dao.basic.ConfigurationDao.DEFAULT_MAX_UPLOAD_SIZE; import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_APPLICATION_BASE_URL; +import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_APPLICATION_NAME; import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_APPOINTMENT_REMINDER_MINUTES; import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_CALENDAR_FIRST_DAY; import static org.apache.openmeetings.util.OpenmeetingsVariables.CONFIG_CRYPT_KEY; @@ -55,18 +56,16 @@ import java.util.Iterator; import org.apache.openmeetings.db.dao.basic.ConfigurationDao; import org.apache.openmeetings.db.dao.basic.ErrorDao; import org.apache.openmeetings.db.dao.basic.NavigationDao; -import org.apache.openmeetings.db.dao.calendar.AppointmentCategoryDao; -import org.apache.openmeetings.db.dao.calendar.AppointmentReminderTypDao; import org.apache.openmeetings.db.dao.room.PollDao; import org.apache.openmeetings.db.dao.room.RoomDao; -import org.apache.openmeetings.db.dao.room.RoomTypeDao; import org.apache.openmeetings.db.dao.room.SipDao; import org.apache.openmeetings.db.dao.server.OAuth2Dao; import org.apache.openmeetings.db.dao.user.OrganisationDao; -import org.apache.openmeetings.db.dao.user.SalutationDao; import org.apache.openmeetings.db.dao.user.StateDao; import org.apache.openmeetings.db.dao.user.UserDao; +import org.apache.openmeetings.db.entity.basic.ErrorValue; import org.apache.openmeetings.db.entity.room.Room; +import org.apache.openmeetings.db.entity.room.Room.Type; import org.apache.openmeetings.db.entity.room.RoomOrganisation; import org.apache.openmeetings.db.entity.server.OAuthServer; import org.apache.openmeetings.db.entity.server.OAuthServer.RequestMethod; @@ -94,13 +93,7 @@ public class ImportInitvalues { @Autowired private NavigationDao navimanagement; @Autowired - private ErrorDao errorManagement; - @Autowired - private SalutationDao salutationmanagement; - @Autowired - private AppointmentCategoryDao appointmentCategoryDaoImpl; - @Autowired - private AppointmentReminderTypDao appointmentReminderTypDaoImpl; + private ErrorDao errorDao; @Autowired private PollDao pollManager; @Autowired @@ -108,9 +101,7 @@ public class ImportInitvalues { @Autowired private OAuth2Dao oauthDao; @Autowired - private RoomTypeDao roomTypeDao; - @Autowired - private OrganisationDao organisationDao; + private OrganisationDao groupDao; @Autowired private RoomDao roomDao; @@ -226,12 +217,6 @@ public class ImportInitvalues { log.debug("MainMenu ADDED"); } - public void loadErrorTypes() { - errorManagement.addErrorType(new Long(1), new Long(322)); - errorManagement.addErrorType(new Long(2), new Long(323)); - log.debug("Error types ADDED"); - } - public void loadErrorMappingsFromXML() throws Exception { SAXReader reader = new SAXReader(); Document document = reader.read(new File(OmFileHelper.getLanguagesDir(), OmFileHelper.nameOfErrorFile)); @@ -243,9 +228,9 @@ public class ImportInitvalues { Element row = it.next(); - Long errorvalues_id = null; - Long fieldvalues_id = null; - Long errortype_id = null; + Long errorvalueId = null; + Long labelId = null; + ErrorValue.Type type = null; for (@SuppressWarnings("unchecked") Iterator<Element> itSub = row.elementIterator("field"); itSub.hasNext();) { @@ -255,30 +240,21 @@ public class ImportInitvalues { String text = field.getText(); // System.out.println("NAME | TEXT "+name+" | "+text); if (name.equals("errorvalues_id")) { - errorvalues_id = Long.valueOf(text); + errorvalueId = Long.valueOf(text); } if (name.equals("fieldvalues_id")) { - fieldvalues_id = Long.valueOf(text); + labelId = Long.valueOf(text); } - if (name.equals("errortype_id")) { - errortype_id = Long.valueOf(text); + if (name.equals("type")) { + type = ErrorValue.Type.valueOf(text); } } - errorManagement.addErrorValues(errorvalues_id, errortype_id, fieldvalues_id); + errorDao.addErrorValues(errorvalueId, type, labelId); } log.debug("ErrorMappings ADDED"); } - public void loadSalutations() { - salutationmanagement.addUserSalutation("Mr", 261); - salutationmanagement.addUserSalutation("Ms", 262); - salutationmanagement.addUserSalutation("Mrs", 841); - salutationmanagement.addUserSalutation("Dr", 842); - salutationmanagement.addUserSalutation("Prof", 1464); - log.debug("Salutations ADDED"); - } - public void loadConfiguration(InstallationConfig cfg) { cfgDao.add(CONFIG_CRYPT_KEY, cfg.cryptClassName, null, "This Class is used for Authentification-Crypting. " @@ -312,7 +288,7 @@ public class ImportInitvalues { cfgDao.add("mail.smtp.timeout", "30000", null, "Socket I/O timeout value in milliseconds. Default is 30 seconds (30000)."); - cfgDao.add("application.name", DEFAULT_APP_NAME, null, "Name of the Browser Title window"); + cfgDao.add(CONFIG_APPLICATION_NAME, DEFAULT_APP_NAME, null, "Name of the Browser Title window"); // "1" == "EN" cfgDao.add(CONFIG_DEFAULT_LANG_KEY, cfg.defaultLangId, null, "Default System Language ID see languages.xml"); @@ -443,37 +419,16 @@ public class ImportInitvalues { log.debug("Configurations ADDED"); } - public void loadRoomTypes() { - long conference_Id = roomTypeDao.addRoomType( - "conference", 1541, false); - log.debug("conference_Id: " + conference_Id); - - // Audience room type is not in use anymore - roomTypeDao.addRoomType("audience", -1, true); - - long restricted_Id = roomTypeDao.addRoomType( - "restricted", 1542, false); - log.debug("restricted_Id: " + restricted_Id); - - long interview_Id = roomTypeDao.addRoomType( - "interview", 1543, false); - log.debug("interview_Id: " + interview_Id); - - // Custom room type is not in use anymore - roomTypeDao.addRoomType("custom", -2, true); - log.debug("RoomTypes ADDED"); - } - - private Room createRoom(String name, long typeId, long capacity, boolean isPublic, Long orgId) { + private Room createRoom(String name, Room.Type type, long capacity, boolean isPublic, Long groupId) { Room r = new Room(); r.setName(name); r.setComment(""); - r.setStarttime(new Date()); + r.setInserted(new Date()); r.setNumberOfPartizipants(capacity); - r.setRoomtype(roomTypeDao.get(typeId)); + r.setType(type); r.setIspublic(isPublic); r.setAllowUserQuestions(true); - r.setIsAudioOnly(false); + r.setAudioOnly(false); r.setAllowFontStyles(true); r.setAppointment(false); @@ -481,12 +436,12 @@ public class ImportInitvalues { r.setIsDemoRoom(false); r.setDemoTime(null); - r.setIsModeratedRoom(false); + r.setModerated(false); r.setHideTopBar(false); r.setDeleted(false); - r.setIsClosed(false); + r.setClosed(false); r.setRedirectURL(null); r.setOwnerId(null); @@ -494,44 +449,40 @@ public class ImportInitvalues { r.setWaitForRecording(false); r.setAllowRecording(true); - r.setHideChat(false); - r.setHideActivitiesAndActions(false); + r.setChatHidden(false); + r.setActivitiesHidden(false); r.setHideActionsMenu(false); r.setHideFilesExplorer(false); r.setHideScreenSharing(false); r.setHideWhiteboard(false); - if (orgId != null) { + if (groupId != null) { RoomOrganisation ro = new RoomOrganisation(); ro.setRoom(r); - ro.setOrganisation(organisationDao.get(orgId)); - ro.setStarttime(new Date()); + ro.setOrganisation(groupDao.get(groupId)); + ro.setInserted(new Date()); } r = roomDao.update(r, null); return r; } + public void loadDefaultRooms(boolean createRooms) { if (createRooms) { - // hardcoded IDs (they are not intended to be changed) - long conference_Id = 1; - long restricted_Id = 3; - long interview_Id = 4; - - createRoom("public Interview Room", interview_Id, 16L, true, null); - createRoom("public Conference Room", conference_Id, 32L, true, null); - Room r = createRoom("public Video Only Room", conference_Id, 32L, true, null); + createRoom("public Interview Room", Type.interview, 16L, true, null); + createRoom("public Conference Room", Type.conference, 32L, true, null); + Room r = createRoom("public Video Only Room", Type.conference, 32L, true, null); r.setHideWhiteboard(true); roomDao.update(r, null); - createRoom("public Video And Whiteboard Room", conference_Id, 32L, true, null); - createRoom("public Restricted Room", restricted_Id, 100L, true, null); - r = createRoom("restricted room with micro option set", restricted_Id, 100L, true, null); + createRoom("public Video And Whiteboard Room", Type.conference, 32L, true, null); + createRoom("public Restricted Room", Type.restricted, 100L, true, null); + r = createRoom("restricted room with micro option set", Type.restricted, 100L, true, null); r.setShowMicrophoneStatus(true); roomDao.update(r, null); - r = createRoom("conference room with micro option set", conference_Id, 32L, true, null); + r = createRoom("conference room with micro option set", Type.conference, 32L, true, null); r.setShowMicrophoneStatus(true); roomDao.update(r, null); - createRoom("private Conference Room", conference_Id, 32L, false, 1L); + createRoom("private Conference Room", Type.conference, 32L, false, 1L); } } @@ -542,7 +493,7 @@ public class ImportInitvalues { org.setInsertedby(1L); org.setDeleted(false); org.setStarttime(new Date()); - org = organisationDao.update(org, null); + org = groupDao.update(org, null); User u = userDao.getNewUserInstance(null); u.setType(User.Type.user); @@ -551,14 +502,14 @@ public class ImportInitvalues { u.setLogin(cfg.username); u.setFirstname("firstname"); u.setLastname("lastname"); - u.getAdresses().setEmail(cfg.email); + u.getAddress().setEmail(cfg.email); u.getOrganisation_users().add(new Organisation_Users(org)); u = userDao.update(u, cfg.password, -1); - log.debug("Installation - User Added user-Id " + u.getUser_id()); + log.debug("Installation - User Added user-Id " + u.getId()); - if (u.getUser_id() == null) { + if (u.getId() == null) { throw new Exception("Unable to add user"); } } @@ -581,37 +532,15 @@ public class ImportInitvalues { Iterator it = root.elementIterator("country"); it.hasNext();) { Element item = (Element) it.next(); - statemanagement.addState(item.attributeValue("name"), + statemanagement.add(item.attributeValue("name"), item.attributeValue("short"), Integer.parseInt(item.attributeValue("code"))); } log.debug("Countries ADDED"); } - /** - * @author o.becherer initial fillment of Appointmentcategories - */ - // ------------------------------------------------------------------------------ - public void loadInitAppointmentCategories() { - log.debug("ImportInitValues.loadInitAppointmentCategories"); - - appointmentCategoryDaoImpl.addAppointmentCategory(new Long(-1), "default", "default"); - } - // ------------------------------------------------------------------------------ - /** - * @author o.becherer initial fillment of AppointMentReminderTypes - */ - // ------------------------------------------------------------------------------ - public void loadInitAppointmentReminderTypes() { - log.debug("ImportInitValues.loadInitAppointmentReminderTypes"); - - appointmentReminderTypDaoImpl.addAppointmentReminderTyps(-1L, "do not send notification", 1568); - appointmentReminderTypDaoImpl.addAppointmentReminderTyps(-1L, "simple email", 1569); - appointmentReminderTypDaoImpl.addAppointmentReminderTyps(-1L, "iCal email", 1570); - } - public void loadInitialOAuthServers() throws Exception { // Yandex OAuthServer yandexServer = new OAuthServer(); @@ -688,33 +617,21 @@ public class ImportInitvalues { log.debug("System contains users, no need to install data one more time."); } sipDao.delete(); - progress = 8; + progress = 14; loadMainMenu(); - progress = 16; - loadErrorTypes(); - progress = 24; + progress = 28; loadErrorMappingsFromXML(); - progress = 32; + progress = 42; loadCountriesFiles(); - progress = 40; - loadSalutations(); - progress = 48; - // AppointMent Categories - loadInitAppointmentCategories(); progress = 56; - // Appointment Reminder types - loadInitAppointmentReminderTypes(); - progress = 64; // Appointment poll types loadPollTypes(); - progress = 72; - loadRoomTypes(); - progress = 80; + progress = 70; loadConfiguration(cfg); - progress = 88; + progress = 84; loadInitialOAuthServers(); - progress = 96; + progress = 99; } public void loadAll(InstallationConfig cfg, boolean force) throws Exception { Modified: openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationDocumentHandler.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationDocumentHandler.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationDocumentHandler.java (original) +++ openmeetings/branches/3.1.x/openmeetings-install/src/main/java/org/apache/openmeetings/installation/InstallationDocumentHandler.java Fri Nov 6 06:18:44 2015 @@ -30,31 +30,25 @@ import org.dom4j.io.XMLWriter; public class InstallationDocumentHandler { public static void createDocument(Integer stepNo) throws Exception { - Document document = DocumentHelper.createDocument(); - - Element root = document.addElement( "install" ); + + Element root = document.addElement("install"); Element step = root.addElement("step"); - + step.addElement("stepnumber").addText(stepNo.toString()); - step.addElement("stepname").addText("Step "+stepNo); - + step.addElement("stepname").addText("Step " + stepNo); + XMLWriter writer = new XMLWriter(new FileWriter(OmFileHelper.getInstallFile())); - writer.write( document ); - writer.close(); - + writer.write(document); + writer.close(); } - - public static int getCurrentStepNumber() throws Exception{ - - SAXReader reader = new SAXReader(); - Document document = reader.read(OmFileHelper.getInstallFile()); - - Node node = document.selectSingleNode( "//install/step/stepnumber" ); - - return Integer.valueOf(node.getText()).intValue(); - + + public static int getCurrentStepNumber() throws Exception { + SAXReader reader = new SAXReader(); + Document document = reader.read(OmFileHelper.getInstallFile()); + + Node node = document.selectSingleNode("//install/step/stepnumber"); + + return Integer.valueOf(node.getText()).intValue(); } - - } Added: openmeetings/branches/3.1.x/openmeetings-install/src/site/site.xml URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-install/src/site/site.xml?rev=1712911&view=auto ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-install/src/site/site.xml (added) +++ openmeetings/branches/3.1.x/openmeetings-install/src/site/site.xml Fri Nov 6 06:18:44 2015 @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + --> +<project xmlns="http://maven.apache.org/DECORATION/1.6.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/DECORATION/1.6.0 http://maven.apache.org/xsd/decoration-1.6.0.xsd" + name="Apache OpenMeetings Project"> + + <body> + <menu ref="parent"/> + <menu name="Project"> + <item name="About" href="/index.html" /> + <item name="Info" href="/project-info.html" /> + <item name="Summary" href="/project-summary.html" /> + <item name="License" href="/license.html" /> + <item name="Dependencies" href="/dependencies.html" /> + <item name="Dependency Convergence" href="/dependency-convergence.html" /> + <item name="RAT Report" href="/rat-report.html" /> + <item name="JavaDoc" href="/apidocs/index.html" target="_blank" /> + </menu> + </body> +</project> Modified: openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/AppointmentLogic.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/AppointmentLogic.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/AppointmentLogic.java (original) +++ openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/calendar/AppointmentLogic.java Fri Nov 6 06:18:44 2015 @@ -31,21 +31,20 @@ import java.util.List; import java.util.TimeZone; import org.apache.openmeetings.db.dao.basic.ConfigurationDao; -import org.apache.openmeetings.db.dao.calendar.AppointmentCategoryDao; import org.apache.openmeetings.db.dao.calendar.AppointmentDao; -import org.apache.openmeetings.db.dao.calendar.AppointmentReminderTypDao; import org.apache.openmeetings.db.dao.calendar.MeetingMemberDao; import org.apache.openmeetings.db.dao.label.LabelDao; import org.apache.openmeetings.db.dao.room.IInvitationManager; import org.apache.openmeetings.db.dao.room.InvitationDao; import org.apache.openmeetings.db.dao.room.RoomDao; -import org.apache.openmeetings.db.dao.room.RoomTypeDao; import org.apache.openmeetings.db.dao.user.UserDao; import org.apache.openmeetings.db.entity.calendar.Appointment; +import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder; import org.apache.openmeetings.db.entity.calendar.MeetingMember; import org.apache.openmeetings.db.entity.room.Invitation; import org.apache.openmeetings.db.entity.room.Invitation.MessageType; import org.apache.openmeetings.db.entity.room.Room; +import org.apache.openmeetings.db.entity.room.Room.Type; import org.apache.openmeetings.db.entity.user.User; import org.apache.openmeetings.db.util.TimezoneUtil; import org.apache.openmeetings.service.mail.template.AppointmentReminderTemplate; @@ -60,18 +59,12 @@ public class AppointmentLogic { @Autowired private AppointmentDao appointmentDao; @Autowired - private AppointmentCategoryDao appointmentCategoryDao; - @Autowired - private AppointmentReminderTypDao appointmentReminderTypDao; - @Autowired private ConfigurationDao configurationDao; @Autowired private LabelDao langDao; @Autowired private RoomDao roomDao; @Autowired - private RoomTypeDao roomTypeDao; - @Autowired private IInvitationManager invitationManager; @Autowired private TimezoneUtil timezoneUtil; @@ -96,13 +89,13 @@ public class AppointmentLogic { private void sendReminder(User u, Appointment a, Invitation inv) throws Exception { if (inv == null) { log.error(String.format("Error retrieving Invitation for member %s in Appointment %s" - , u.getAdresses().getEmail(), a.getTitle())); + , u.getAddress().getEmail(), a.getTitle())); return; } TimeZone tz = timezoneUtil.getTimeZone(u.getTimeZoneId()); - long langId = u.getLanguage_id(); + long langId = u.getLanguageId(); // Get the required labels one time for all meeting members. The // Language of the email will be the system default language @@ -111,7 +104,7 @@ public class AppointmentLogic { AppointmentReminderTemplate t = AppointmentReminderTemplate.get(langId, a, tz); invitationManager.sendInvitionLink(inv, MessageType.Create, t.getSubject(), t.getEmail(), false); - invitationManager.sendInvitationReminderSMS(u.getAdresses().getPhone(), smsSubject, langId); + invitationManager.sendInvitationReminderSMS(u.getAddress().getPhone(), smsSubject, langId); if (inv.getHash() != null) { inv.setUpdated(new Date()); invitationDao.update(inv); @@ -150,7 +143,7 @@ public class AppointmentLogic { end.setTimeInMillis(end.getTimeInMillis() + milliseconds); } - for (Appointment a : appointmentDao.getAppointmentsInRange(start, end)) { + for (Appointment a : appointmentDao.getInRange(start, end)) { // Prevent email from being send twice, even if the cycle takes // very long to send each if (a.isReminderEmailSend()) { @@ -179,7 +172,7 @@ public class AppointmentLogic { // Iterate through all MeetingMembers for (MeetingMember mm : members) { - log.debug("doScheduledMeetingReminder : Member " + mm.getUser().getAdresses().getEmail()); + log.debug("doScheduledMeetingReminder : Member " + mm.getUser().getAddress().getEmail()); Invitation inv = mm.getInvitation(); @@ -198,7 +191,7 @@ public class AppointmentLogic { String appointmentLocation, String appointmentDescription, Calendar appointmentstart, Calendar appointmentend, Boolean isDaily, Boolean isWeekly, Boolean isMonthly, - Boolean isYearly, Long categoryId, Long remind, String[] mmClient, + Boolean isYearly, Long categoryId, String remind, String[] mmClient, Long roomType, Long languageId, Boolean isPasswordProtected, String password, long roomId, Long users_id) { Appointment a = new Appointment(); @@ -211,15 +204,14 @@ public class AppointmentLogic { a.setIsWeekly(isWeekly); a.setIsMonthly(isMonthly); a.setIsYearly(isYearly); - a.setCategory(appointmentCategoryDao.get(categoryId)); - a.setRemind(appointmentReminderTypDao.get(remind)); + a.setReminder(Reminder.valueOf(remind)); if (roomId > 0) { a.setRoom(roomDao.get(roomId)); } else { a.setRoom(new Room()); a.getRoom().setComment(appointmentDescription); a.getRoom().setName(appointmentName); - a.getRoom().setRoomtype(roomTypeDao.get(roomType)); + a.getRoom().setType(Type.get(roomType)); } a.setOwner(userDao.get(users_id)); a.setPasswordProtected(isPasswordProtected); Modified: openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactConfirmTemplate.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactConfirmTemplate.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactConfirmTemplate.java (original) +++ openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactConfirmTemplate.java Fri Nov 6 06:18:44 2015 @@ -25,7 +25,7 @@ public class RequestContactConfirmTempla private static final long serialVersionUID = 1L; public RequestContactConfirmTemplate(UserContact contact) { - super(contact.getOwner().getLanguage_id()); + super(contact.getOwner().getLanguageId()); add(new Label("hi", getString(1192, langId))); add(new Label("firstName", contact.getOwner().getFirstname())); add(new Label("lastName", contact.getOwner().getLastname())); Modified: openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java (original) +++ openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/mail/template/RequestContactTemplate.java Fri Nov 6 06:18:44 2015 @@ -26,7 +26,7 @@ public class RequestContactTemplate exte private static final long serialVersionUID = 1L; public RequestContactTemplate(User userToAdd, User user) { - super(userToAdd.getLanguage_id()); + super(userToAdd.getLanguageId()); add(new Label("hi", getString(1192, langId))); add(new Label("addedFirstName", userToAdd.getFirstname())); add(new Label("addedLastName", userToAdd.getLastname())); Modified: openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/MeetingReminderJob.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/MeetingReminderJob.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/MeetingReminderJob.java (original) +++ openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/MeetingReminderJob.java Fri Nov 6 06:18:44 2015 @@ -20,6 +20,7 @@ package org.apache.openmeetings.service. import org.apache.openmeetings.service.calendar.AppointmentLogic; +import org.apache.openmeetings.util.InitializationContainer; import org.apache.openmeetings.util.OpenmeetingsVariables; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; @@ -32,6 +33,9 @@ public class MeetingReminderJob { public void doIt() { log.debug("MeetingReminderJob.execute"); + if (!InitializationContainer.initComplete) { + return; + } try { appointmentLogic.doScheduledMeetingReminder(); } catch (Exception err){ Modified: openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/SessionClearJob.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/SessionClearJob.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/SessionClearJob.java (original) +++ openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/SessionClearJob.java Fri Nov 6 06:18:44 2015 @@ -19,6 +19,7 @@ package org.apache.openmeetings.service.quartz.scheduler; import org.apache.openmeetings.db.dao.server.SessiondataDao; +import org.apache.openmeetings.util.InitializationContainer; import org.apache.openmeetings.util.OpenmeetingsVariables; import org.red5.logging.Red5LoggerFactory; import org.slf4j.Logger; @@ -28,14 +29,26 @@ public class SessionClearJob { private static Logger log = Red5LoggerFactory.getLogger(SessionClearJob.class, OpenmeetingsVariables.webAppRootKey); @Autowired private SessiondataDao sessiondataDao; + private long timeout = 1800000L; public void doIt() { log.trace("SessionClearJob.execute"); + if (!InitializationContainer.initComplete) { + return; + } try { // TODO Generate report - sessiondataDao.clearSessionTable(); + sessiondataDao.clearSessionTable(timeout); } catch (Exception err){ log.error("execute",err); } } + + public long getTimeout() { + return timeout; + } + + public void setTimeout(long timeout) { + this.timeout = timeout; + } } Modified: openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/TestSetupCleanupJob.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/TestSetupCleanupJob.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/TestSetupCleanupJob.java (original) +++ openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/quartz/scheduler/TestSetupCleanupJob.java Fri Nov 6 06:18:44 2015 @@ -21,6 +21,7 @@ package org.apache.openmeetings.service. import java.io.File; import java.io.FileFilter; +import org.apache.openmeetings.util.InitializationContainer; import org.apache.openmeetings.util.OmFileHelper; import org.apache.openmeetings.util.OpenmeetingsVariables; import org.red5.logging.Red5LoggerFactory; @@ -32,6 +33,9 @@ public class TestSetupCleanupJob { public void doIt() { log.debug("TestSetupClearJob.execute"); + if (!InitializationContainer.initComplete) { + return; + } try { //FIXME need to move all these staff to helper File[] folders = OmFileHelper.getStreamsDir().listFiles(); Modified: openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java URL: http://svn.apache.org/viewvc/openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java?rev=1712911&r1=1712910&r2=1712911&view=diff ============================================================================== --- openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java (original) +++ openmeetings/branches/3.1.x/openmeetings-service/src/main/java/org/apache/openmeetings/service/room/InvitationManager.java Fri Nov 6 06:18:44 2015 @@ -36,6 +36,7 @@ import org.apache.openmeetings.db.dao.ro import org.apache.openmeetings.db.dao.room.InvitationDao; import org.apache.openmeetings.db.entity.basic.MailMessage; import org.apache.openmeetings.db.entity.calendar.Appointment; +import org.apache.openmeetings.db.entity.calendar.Appointment.Reminder; import org.apache.openmeetings.db.entity.calendar.MeetingMember; import org.apache.openmeetings.db.entity.room.Invitation; import org.apache.openmeetings.db.entity.room.Invitation.MessageType; @@ -92,7 +93,7 @@ public class InvitationManager implement private void sendInvitionLink(Appointment a, MeetingMember mm, MessageType type, boolean ical) throws Exception { User owner = a.getOwner(); String invitorName = owner.getFirstname() + " " + owner.getLastname(); - Long langId = mm.getUser().getLanguage_id(); + Long langId = mm.getUser().getLanguageId(); TimeZone tz = timezoneUtil.getTimeZone(mm.getUser()); AbstractAppointmentTemplate t = null; switch (type) { @@ -116,13 +117,13 @@ public class InvitationManager implement User owner = i.getInvitedBy(); String invitorName = owner.getFirstname() + " " + owner.getLastname(); - String template = InvitationTemplate.getEmail(i.getInvitee().getLanguage_id(), invitorName, message, invitation_link); - String email = i.getInvitee().getAdresses().getEmail(); - String replyToEmail = owner.getAdresses().getEmail(); + String template = InvitationTemplate.getEmail(i.getInvitee().getLanguageId(), invitorName, message, invitation_link); + String email = i.getInvitee().getAddress().getEmail(); + String replyToEmail = owner.getAddress().getEmail(); if (ical) { String username = i.getInvitee().getLogin(); - boolean isOwner = owner.getUser_id().equals(i.getInvitee().getUser_id()); + boolean isOwner = owner.getId().equals(i.getInvitee().getId()); IcalHandler handler = new IcalHandler(MessageType.Cancel == type ? IcalHandler.ICAL_METHOD_CANCEL : IcalHandler.ICAL_METHOD_REQUEST); HashMap<String, String> attendeeList = handler.getAttendeeData(email, username, isOwner); @@ -283,32 +284,27 @@ public class InvitationManager implement } public void processInvitation(Appointment a, MeetingMember mm, MessageType type, boolean sendMail) { - if (a.getRemind() == null) { + Reminder reminder = a.getReminder(); + if (reminder == null) { log.error("Appointment doesn't have reminder set!"); return; } - long remindType = a.getRemind().getTypId(); - if (remindType < 2) { + if (Reminder.none == reminder) { log.error("MeetingMember should not have invitation!"); return; } - log.debug(":::: processInvitation ..... " + remindType); - - // appointment.getRemind().getTypId() == 1 will not receive emails - if (remindType > 1) { - log.debug("Invitation for Appointment : simple email"); - - try { - mm.setInvitation(getInvitation(mm.getInvitation() - , mm.getUser(), a.getRoom(), a.isPasswordProtected(), a.getPassword() - , Valid.Period, a.getOwner(), null, a.getStart(), a.getEnd(), a)); - if (sendMail) { - sendInvitionLink(a, mm, type, remindType > 2); - } - } catch (Exception e) { - log.error("Unexpected error while setting invitation", e); + log.debug(":::: processInvitation ..... " + reminder); + log.debug("Invitation for Appointment : simple email"); + try { + mm.setInvitation(getInvitation(mm.getInvitation() + , mm.getUser(), a.getRoom(), a.isPasswordProtected(), a.getPassword() + , Valid.Period, a.getOwner(), null, a.getStart(), a.getEnd(), a)); + if (sendMail) { + sendInvitionLink(a, mm, type, Reminder.ical == reminder); } + } catch (Exception e) { + log.error("Unexpected error while setting invitation", e); } } @@ -354,7 +350,7 @@ public class InvitationManager implement invitation.setInvitedBy(createdBy); invitation.setInvitee(inveetee); if (language_id != null && Type.contact == invitation.getInvitee().getType()) { - invitation.getInvitee().setLanguage_id(language_id); + invitation.getInvitee().setLanguageId(language_id); } invitation.setRoom(room); invitation.setInserted(new Date());
