use of org.apache.openmeetings.db.entity.room.RoomFile 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);
}
}
use of org.apache.openmeetings.db.entity.room.RoomFile in project openmeetings by apache.
the class RoomForm method onSaveSubmit.
@Override
protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
Room r = getModelObject();
boolean newRoom = r.getId() == null;
r = roomDao.update(r, getUserId());
if (newRoom) {
for (RoomModerator rm : r.getModerators()) {
rm.setRoomId(r.getId());
}
for (RoomFile rf : r.getFiles()) {
rf.setRoomId(r.getId());
}
roomDao.update(getModelObject(), getUserId());
}
hideNewRecord();
updateView(target);
}
Aggregations