use of org.apache.openmeetings.backup.converter.BaseFileItemConverter 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