use of org.simpleframework.xml.strategy.Strategy 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.simpleframework.xml.strategy.Strategy 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());
}
}
}
use of org.simpleframework.xml.strategy.Strategy in project openmeetings by apache.
the class BackupImport method importRoomGroups.
/*
* ##################### Import Room Groups
*/
private void importRoomGroups(File f) throws Exception {
log.info("Room import complete, starting room groups import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(Group.class, new GroupConverter(groupDao, groupMap));
registry.bind(Room.class, new RoomConverter(roomDao, roomMap));
List<RoomGroup> list = readList(serializer, f, "rooms_organisation.xml", "room_organisations", RoomGroup.class);
for (RoomGroup ro : list) {
Room r = roomDao.get(ro.getRoom().getId());
if (r == null || ro.getGroup() == null || ro.getGroup().getId() == null) {
continue;
}
if (r.getGroups() == null) {
r.setGroups(new ArrayList<>());
}
ro.setId(null);
ro.setRoom(r);
r.getGroups().add(ro);
roomDao.update(r, null);
}
}
use of org.simpleframework.xml.strategy.Strategy in project openmeetings by apache.
the class BackupImport method importRoomFiles.
/*
* ##################### Import Room Files
*/
private void importRoomFiles(File f) throws Exception {
log.info("Poll import complete, starting room files import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(BaseFileItem.class, new BaseFileItemConverter(fileItemDao, fileItemMap));
List<RoomFile> list = readList(serializer, f, "roomFiles.xml", "RoomFiles", RoomFile.class, true);
for (RoomFile rf : list) {
Room r = roomDao.get(roomMap.get(rf.getRoomId()));
if (r == null || rf.getFile() == null || rf.getFile().getId() == null) {
continue;
}
if (r.getFiles() == null) {
r.setFiles(new ArrayList<>());
}
rf.setId(null);
rf.setRoomId(r.getId());
r.getFiles().add(rf);
roomDao.update(r, null);
}
}
Aggregations