"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFileUploadResourceReference.java" between
apache-openmeetings-6.1.0-src.tar.gz and apache-openmeetings-6.2.0-src.tar.gz

About: OpenMeetings is a browser-based software that allows you to set up instantly a conference in the Web. You can use your microphone or webcam, share documents on a white board, share your screen or record meetings. Source code.

RoomFileUploadResourceReference.java  (apache-openmeetings-6.1.0-src):RoomFileUploadResourceReference.java  (apache-openmeetings-6.2.0-src)
skipping to change at line 74 skipping to change at line 74
import com.github.openjson.JSONObject; import com.github.openjson.JSONObject;
public class RoomFileUploadResourceReference extends ResourceReference { public class RoomFileUploadResourceReference extends ResourceReference {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Logger log = LoggerFactory.getLogger(RoomFileUploadR esourceReference.class); private static final Logger log = LoggerFactory.getLogger(RoomFileUploadR esourceReference.class);
private static final String PARAM_FILE_NAME = "room-upload-file"; private static final String PARAM_FILE_NAME = "room-upload-file";
private static final String PARAM_TO_WB_NAME = "room-upload-to-wb"; private static final String PARAM_TO_WB_NAME = "room-upload-to-wb";
private static final String PARAM_CLEAN_NAME = "room-upload-clean"; private static final String PARAM_CLEAN_NAME = "room-upload-clean";
private static final String PARAM_SID_NAME = "room-upload-sid"; private static final String PARAM_SID_NAME = "room-upload-sid";
private static final String PARAM_LAST_SELECTED_NAME = "room-upload-last- public static final String PARAM_LAST_SELECTED_ID = "room-upload-last-sel
selected"; ected-id";
public static final String PARAM_LAST_SELECTED_ROOM = "room-upload-last-s
elected-room";
public static final String PARAM_LAST_SELECTED_OWNER = "room-upload-last-
selected-pwner";
public static final String PARAM_LAST_SELECTED_GROUP = "room-upload-last-
selected-group";
private enum Status { private enum Status {
SUCCESS SUCCESS
, PROGRESS , PROGRESS
, ERROR , ERROR
} }
@SpringBean @SpringBean
private ClientManager cm; private ClientManager cm;
@SpringBean @SpringBean
private FileProcessor processor; private FileProcessor processor;
skipping to change at line 117 skipping to change at line 120
String sid = multiPartRequest.getPostPara meters().getParameterValue(PARAM_SID_NAME).toString(); String sid = multiPartRequest.getPostPara meters().getParameterValue(PARAM_SID_NAME).toString();
Client c = cm.getBySid(sid); Client c = cm.getBySid(sid);
final long langId = getLangId(c); final long langId = getLangId(c);
if (isUploadAllowed(c)) { if (isUploadAllowed(c)) {
Map<String, List<FileItem>> files = multiPartRequest.getFiles(); Map<String, List<FileItem>> files = multiPartRequest.getFiles();
final List<FileItem> fileItems = files.get(PARAM_FILE_NAME); final List<FileItem> fileItems = files.get(PARAM_FILE_NAME);
final boolean toWb = multiPartReq uest.getPostParameters().getParameterValue(PARAM_TO_WB_NAME).toBoolean(false); final boolean toWb = multiPartReq uest.getPostParameters().getParameterValue(PARAM_TO_WB_NAME).toBoolean(false);
final boolean clean = multiPartRe quest.getPostParameters().getParameterValue(PARAM_CLEAN_NAME).toBoolean(false); final boolean clean = multiPartRe quest.getPostParameters().getParameterValue(PARAM_CLEAN_NAME).toBoolean(false);
final long lastSelected = multiPa final long lastSelectedId = multi
rtRequest.getPostParameters().getParameterValue(PARAM_LAST_SELECTED_NAME).toLong PartRequest.getPostParameters().getParameterValue(PARAM_LAST_SELECTED_ID).toLong
(-1L); (-1L);
final long lastSelectedRoom = mul
tiPartRequest.getPostParameters().getParameterValue(PARAM_LAST_SELECTED_ROOM).to
Long(-1L);
final long lastSelectedOwner = mu
ltiPartRequest.getPostParameters().getParameterValue(PARAM_LAST_SELECTED_OWNER).
toLong(-1L);
final long lastSelectedGroup = mu
ltiPartRequest.getPostParameters().getParameterValue(PARAM_LAST_SELECTED_GROUP).
toLong(-1L);
final String uuid = randomUUID(). toString(); final String uuid = randomUUID(). toString();
startRunnable(() -> convertAll(c, fileItems, uuid, toWb, clean, lastSelected)); startRunnable(() -> convertAll(c, fileItems, uuid, toWb, clean, lastSelectedId, lastSelectedRoom, lastSelectedOwn er, lastSelectedGroup));
prepareResponse(response, Status. SUCCESS, uuid, Application.getString("54", langId)); prepareResponse(response, Status. SUCCESS, uuid, Application.getString("54", langId));
} else { } else {
prepareResponse(response, Status. ERROR, null, Application.getString("access.denied.header", langId)); prepareResponse(response, Status. ERROR, null, Application.getString("access.denied.header", langId));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("An error occurred while upload ing a file", e); log.error("An error occurred while upload ing a file", e);
prepareResponse(response, Status.ERROR, n ull, e.getMessage()); prepareResponse(response, Status.ERROR, n ull, e.getMessage());
} }
return response; return response;
skipping to change at line 160 skipping to change at line 166
} }
private static boolean isUploadAllowed(Client c) { private static boolean isUploadAllowed(Client c) {
if (c == null || c.getRoom() == null || Room.Type.INTERVIEW == c. getRoom().getType()) { if (c == null || c.getRoom() == null || Room.Type.INTERVIEW == c. getRoom().getType()) {
return false; return false;
} }
Room r = c.getRoom(); Room r = c.getRoom();
return !r.isHidden(RoomElement.FILES) && c.hasRight(Right.PRESENT ER); return !r.isHidden(RoomElement.FILES) && c.hasRight(Right.PRESENT ER);
} }
private void convertAll(Client c, List<FileItem> files, String uuid, bool private void convertAll(Client c, List<FileItem> files, String uuid, bool
ean toWb, boolean clean, long lastSelected) { ean toWb, boolean clean, long lastSelectedId, long lastSelectedRoom, long lastSe
final BaseFileItem parent = fileDao.get(lastSelected); lectedOwner, long lastSelectedGroup) {
final BaseFileItem parent = fileDao.get(lastSelectedId);
final long langId = getLangId(c); final long langId = getLangId(c);
final long totalSize = files.stream().mapToLong(FileItem::getSize ).sum(); final long totalSize = files.stream().mapToLong(FileItem::getSize ).sum();
final AtomicInteger progress = new AtomicInteger(0); final AtomicInteger progress = new AtomicInteger(0);
long currentSize = 0; long currentSize = 0;
for (FileItem curItem : files) { for (FileItem curItem : files) {
long size = curItem.getSize(); long size = curItem.getSize();
try { try {
org.apache.openmeetings.db.entity.file.FileItem f = new org.apache.openmeetings.db.entity.file.FileItem(); org.apache.openmeetings.db.entity.file.FileItem f = new org.apache.openmeetings.db.entity.file.FileItem();
f.setSize(size); f.setSize(size);
f.setName(curItem.getName()); f.setName(curItem.getName());
if (parent == null || BaseFileItem.Type.RECORDING == parent.getType()) { if (parent == null || BaseFileItem.Type.RECORDING == parent.getType()) {
f.setOwnerId(getUserId()); if (lastSelectedGroup > -1) {
f.setGroupId(lastSelectedGroup);
} else if (lastSelectedRoom > -1) {
f.setRoomId(lastSelectedRoom);
} else {
f.setOwnerId(lastSelectedOwner >
-1 ? lastSelectedOwner : getUserId());
}
} else { } else {
f.setRoomId(parent.getRoomId()); f.setRoomId(parent.getRoomId());
f.setOwnerId(parent.getOwnerId()); f.setOwnerId(parent.getOwnerId());
f.setGroupId(parent.getGroupId()); f.setGroupId(parent.getGroupId());
if (parent.getId() != null) { if (parent.getId() != null) {
f.setParentId(BaseFileItem.Type.F OLDER == parent.getType() ? parent.getId() : parent.getParentId()); f.setParentId(BaseFileItem.Type.F OLDER == parent.getType() ? parent.getId() : parent.getParentId());
} }
} }
f.setInsertedBy(getUserId()); f.setInsertedBy(getUserId());
 End of changes. 5 change blocks. 
10 lines changed or deleted 33 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)