Search in sources :

Example 6 with RoomFile

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);
    }
}
Also used : BaseFileItemConverter(org.apache.openmeetings.backup.converter.BaseFileItemConverter) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) RoomFile(org.apache.openmeetings.db.entity.room.RoomFile) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Strategy(org.simpleframework.xml.strategy.Strategy) Registry(org.simpleframework.xml.convert.Registry) Persister(org.simpleframework.xml.core.Persister) Room(org.apache.openmeetings.db.entity.room.Room) Serializer(org.simpleframework.xml.Serializer)

Example 7 with RoomFile

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);
}
Also used : RoomModerator(org.apache.openmeetings.db.entity.room.RoomModerator) RoomFile(org.apache.openmeetings.db.entity.room.RoomFile) Room(org.apache.openmeetings.db.entity.room.Room)

Aggregations

RoomFile (org.apache.openmeetings.db.entity.room.RoomFile)7 ArrayList (java.util.ArrayList)3 Room (org.apache.openmeetings.db.entity.room.Room)3 List (java.util.List)2 BaseFileItem (org.apache.openmeetings.db.entity.file.BaseFileItem)2 RoomModerator (org.apache.openmeetings.db.entity.room.RoomModerator)2 JSONObject (com.github.openjson.JSONObject)1 JQueryIcon (com.googlecode.wicket.jquery.ui.JQueryIcon)1 AjaxButton (com.googlecode.wicket.jquery.ui.form.button.AjaxButton)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Collectors (java.util.stream.Collectors)1 BaseFileItemConverter (org.apache.openmeetings.backup.converter.BaseFileItemConverter)1 FileItemDao (org.apache.openmeetings.db.dao.file.FileItemDao)1 RoomDao (org.apache.openmeetings.db.dao.room.RoomDao)1