use of org.apache.openmeetings.backup.converter.UserConverter in project openmeetings by apache.
the class BackupImport method importCalendars.
/*
* ##################### Import Calendars
*/
private void importCalendars(File f) throws Exception {
log.info("Chat messages import complete, starting calendar import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, new UserConverter(userDao, userMap));
List<OmCalendar> list = readList(serializer, f, "calendars.xml", "calendars", OmCalendar.class, true);
for (OmCalendar c : list) {
Long id = c.getId();
c.setId(null);
c = calendarDao.update(c);
calendarMap.put(id, c.getId());
}
}
use of org.apache.openmeetings.backup.converter.UserConverter in project openmeetings by apache.
the class BackupImport method importPolls.
/*
* ##################### Import Room Polls
*/
private void importPolls(File f) throws Exception {
log.info("File explorer item import complete, starting room poll import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
RegistryMatcher matcher = new RegistryMatcher();
Serializer serializer = new Persister(strategy, matcher);
matcher.bind(Integer.class, IntegerTransform.class);
registry.bind(User.class, new UserConverter(userDao, userMap));
registry.bind(Room.class, new RoomConverter(roomDao, roomMap));
registry.bind(RoomPoll.Type.class, PollTypeConverter.class);
registry.bind(Date.class, DateConverter.class);
List<RoomPoll> list = readList(serializer, f, "roompolls.xml", "roompolls", RoomPoll.class);
for (RoomPoll rp : list) {
rp.setId(null);
if (rp.getRoom() == null || rp.getRoom().getId() == null) {
// room was deleted
continue;
}
if (rp.getCreator() == null || rp.getCreator().getId() == null) {
rp.setCreator(null);
}
for (RoomPollAnswer rpa : rp.getAnswers()) {
if (rpa.getVotedUser() == null || rpa.getVotedUser().getId() == null) {
rpa.setVotedUser(null);
}
}
pollDao.update(rp);
}
}
use of org.apache.openmeetings.backup.converter.UserConverter in project openmeetings by apache.
the class BackupImport method importMeetingMembers.
/*
* ##################### Import MeetingMembers
*
* Reminder Invitations will be NOT send!
*/
private void importMeetingMembers(File f) throws Exception {
log.info("Appointement import complete, starting meeting members import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer ser = new Persister(strategy);
registry.bind(User.class, new UserConverter(userDao, userMap));
registry.bind(Appointment.class, new AppointmentConverter(appointmentDao, appointmentMap));
List<MeetingMember> list = readList(ser, f, "meetingmembers.xml", "meetingmembers", MeetingMember.class);
for (MeetingMember ma : list) {
ma.setId(null);
meetingMemberDao.update(ma);
}
}
use of org.apache.openmeetings.backup.converter.UserConverter in project openmeetings by apache.
the class BackupImport method importContacts.
/*
* ##################### Import User Contacts
*/
private void importContacts(File f) throws Exception {
log.info("Private message folder import complete, starting user contacts import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, new UserConverter(userDao, userMap));
List<UserContact> list = readList(serializer, f, "userContacts.xml", "usercontacts", UserContact.class);
for (UserContact uc : list) {
Long ucId = uc.getId();
UserContact storedUC = userContactDao.get(ucId);
if (storedUC == null && uc.getContact() != null && uc.getContact().getId() != null) {
uc.setId(null);
if (uc.getOwner() != null && uc.getOwner().getId() == null) {
uc.setOwner(null);
}
uc = userContactDao.update(uc);
userContactMap.put(ucId, uc.getId());
}
}
}
Aggregations