Author: solomax
Date: Thu Aug 11 10:43:43 2016
New Revision: 1755932
URL: http://svn.apache.org/viewvc?rev=1755932&view=rev
Log:
[OPENMEETINGS-1030] broken room files are being displayed as expected
Added:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/chart_pie_error.png
(with props)
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/layout.png
(with props)
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/layout_error.png
(with props)
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/page.png
(with props)
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/page_error.png
(with props)
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/picture.png
(with props)
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/picture_error.png
(with props)
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/chart_pie_error.png
(with props)
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/layout.png
(with props)
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/layout_error.png
(with props)
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/page.png
(with props)
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/page_error.png
(with props)
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/picture.png
(with props)
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/picture_error.png
(with props)
Removed:
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileUtils.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/map.png
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/photo.png
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/report.png
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileUtils.java
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/map.png
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/photo.png
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/report.png
Modified:
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/Mp4RecordingResourceReference.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoInfo.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoPlayer.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/theme.css
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/Mp4RecordingResourceReference.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoInfo.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoPlayer.java
openmeetings/application/trunk/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/theme.css
openmeetings/application/trunk/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
Modified:
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
Thu Aug 11 10:43:43 2016
@@ -19,13 +19,12 @@
package org.apache.openmeetings.core.converter;
import static
org.apache.openmeetings.core.data.record.listener.async.BaseStreamWriter.TIME_TO_WAIT_FOR_FRAME;
+import static org.apache.openmeetings.util.OmFileHelper.FLV_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.OGG_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.FLV_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.getRecording;
import static org.apache.openmeetings.util.OmFileHelper.getRecordingMetaData;
import static org.apache.openmeetings.util.OmFileHelper.getStreamsSubDir;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.io.File;
@@ -340,7 +339,7 @@ public abstract class BaseConverter {
public void convertToMp4(Recording r, List<ConverterProcessResult>
returnLog) throws IOException {
//TODO add faststart, move filepaths to helpers
- if (!isRecordingExists(r.getHash())) {
+ if (!r.exists()) {
return;
}
File file = getRecording(r.getHash());
Modified:
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
Thu Aug 11 10:43:43 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.core.remote;
import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
+import static org.apache.openmeetings.util.OmFileHelper.WB_VIDEO_FILE_PREFIX;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.io.File;
@@ -208,10 +209,10 @@ public class ConferenceLibrary implement
/**
* @param sid
- * @param flvFileExplorerId
+ * @param fileId
* @return 1 in case of success, -1 otherwise
*/
- public Long copyFileToCurrentRoom(String sid, Long flvFileExplorerId) {
+ public Long copyFileToCurrentRoom(String sid, Long fileId) {
try {
Sessiondata sd = sessionDao.check(sid);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(sd.getUserId()))) {
@@ -221,14 +222,14 @@ public class ConferenceLibrary implement
Client currentClient =
sessionManager.getClientByStreamId(streamid, null);
- Long room_id = currentClient.getRoomId();
+ Long roomId = currentClient.getRoomId();
- if (room_id != null) {
- File outputFullFlvFile = new
File(OmFileHelper.getStreamsHibernateDir(), "UPLOADFLV_" + flvFileExplorerId +
MP4_EXTENSION);
+ if (roomId != null) {
+ File outputFullFlvFile = new
File(OmFileHelper.getStreamsHibernateDir(), WB_VIDEO_FILE_PREFIX + fileId +
MP4_EXTENSION);
- File targetFolder =
OmFileHelper.getStreamsSubDir(room_id);
+ File targetFolder =
OmFileHelper.getStreamsSubDir(roomId);
- File targetFullFlvFile = new
File(targetFolder, "UPLOADFLV_" + flvFileExplorerId + MP4_EXTENSION);
+ File targetFullFlvFile = new
File(targetFolder, WB_VIDEO_FILE_PREFIX + fileId + MP4_EXTENSION);
if (outputFullFlvFile.exists() &&
!targetFullFlvFile.exists()) {
FileHelper.copy(outputFullFlvFile, targetFullFlvFile);
}
Modified:
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
Thu Aug 11 10:43:43 2016
@@ -18,8 +18,11 @@
*/
package org.apache.openmeetings.db.dao.file;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
+import static org.apache.openmeetings.util.OmFileHelper.thumbImagePrefix;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@@ -31,6 +34,7 @@ import javax.persistence.TypedQuery;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
import org.apache.openmeetings.db.entity.file.FileItem.Type;
+import org.apache.openmeetings.util.OmFileHelper;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
import org.springframework.transaction.annotation.Transactional;
@@ -252,4 +256,58 @@ public class FileExplorerItemDao {
return update(f);
}
+ public long getOwnSize(Long userId) {
+ return getSize(getByOwner(userId));
+ }
+
+ public long getRoomSize(Long roomId) {
+ return getSize(getByRoom(roomId));
+ }
+
+ public long getSize(List<FileExplorerItem> list) {
+ long size = 0;
+ for (FileExplorerItem f : list) {
+ log.debug("FileExplorerItem fList " + f.getName());
+ size += getSize(f);
+ }
+ return size;
+ }
+
+ public long getSize(FileExplorerItem f) {
+ long size = 0;
+ try {
+ if (f.exists()) {
+ File base = OmFileHelper.getUploadFilesDir();
+ if (Type.Image == f.getType()) {
+ size += f.getFile().length();
+ File thumbFile = new File(base,
String.format("%s%s.%s", thumbImagePrefix, f.getHash(), EXTENSION_JPG));
+ if (thumbFile.exists()) {
+ size += thumbFile.length();
+ }
+ }
+ if (Type.Presentation == f.getType()) {
+ File tFolder = new File(base,
f.getHash());
+
+ if (tFolder.exists()) {
+ size +=
OmFileHelper.getSize(tFolder);
+ }
+ }
+ if (Type.Video == f.getType()) {
+ size += f.getFile().length();
+ File thumb = f.getFile(EXTENSION_JPG);
+ if (thumb.exists()) {
+ size += thumb.length();
+ }
+ }
+ }
+ if (Type.Folder == f.getType()) {
+ for (FileExplorerItem child :
getByParent(f.getId())) {
+ size += getSize(child);
+ }
+ }
+ } catch (Exception err) {
+ log.error("[getSize] ", err);
+ }
+ return size;
+ }
}
Modified:
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java
Thu Aug 11 10:43:43 2016
@@ -18,12 +18,11 @@
*/
package org.apache.openmeetings.db.dao.record;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.OGG_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.getMp4Recording;
-import static org.apache.openmeetings.util.OmFileHelper.getOggRecording;
-import static org.apache.openmeetings.util.OmFileHelper.getRecording;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_AVI;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_OGG;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.util.Date;
@@ -265,20 +264,20 @@ public class RecordingDao {
private long getSize(Recording r) {
long size = 0;
- if (isRecordingExists(r.getHash())) {
- size += getRecording(r.getHash()).length();
+ if (r.exists(EXTENSION_FLV)) {
+ size += r.getFile(EXTENSION_FLV).length();
}
- if (isRecordingExists(r.getAlternateDownload())) {
- size += getRecording(r.getAlternateDownload()).length();
+ if (r.exists(EXTENSION_AVI)) {
+ size += r.getFile(EXTENSION_AVI).length();
}
- if (isRecordingExists(r.getPreviewImage())) {
- size += getRecording(r.getPreviewImage()).length();
+ if (r.exists(EXTENSION_JPG)) {
+ size += r.getFile(EXTENSION_JPG).length();
}
- if (isRecordingExists(r.getHash() + MP4_EXTENSION)) {
- size += getMp4Recording(r.getHash()).length();
+ if (r.exists(EXTENSION_MP4)) {
+ size += r.getFile(EXTENSION_MP4).length();
}
- if (isRecordingExists(r.getHash() + OGG_EXTENSION)) {
- size += getOggRecording(r.getHash()).length();
+ if (r.exists(EXTENSION_OGG)) {
+ size += r.getFile(EXTENSION_OGG).length();
}
for (Recording rec : getByParent(r.getId())) {
size += getSize(rec);
Modified:
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java
Thu Aug 11 10:43:43 2016
@@ -18,15 +18,21 @@
*/
package org.apache.openmeetings.db.entity.file;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_SWF;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_WML;
+import static org.apache.openmeetings.util.OmFileHelper.WB_VIDEO_FILE_PREFIX;
+
+import java.io.File;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
+import org.apache.openmeetings.util.OmFileHelper;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
@@ -49,11 +55,6 @@ import org.simpleframework.xml.Root;
@Root
public class FileExplorerItem extends FileItem {
private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- @Element(data = true, name = "fileExplorerItemId")
- private Long id;
@Column(name = "filesize")
@Element(data = true, required = false)
@@ -65,16 +66,6 @@ public class FileExplorerItem extends Fi
@Column(name = "external_type")
private String externalType;
- @Override
- public Long getId() {
- return id;
- }
-
- @Override
- public void setId(Long id) {
- this.id = id;
- }
-
public Long getSize() {
return size;
}
@@ -98,4 +89,29 @@ public class FileExplorerItem extends Fi
public void setExternalType(String externalType) {
this.externalType = externalType;
}
+
+ @Override
+ protected File internalGetFile(String ext) {
+ File f = null;
+ switch (getType()) {
+ case WmlFile:
+ f = new File(OmFileHelper.getUploadWmlDir(),
String.format("%s.%s", getHash(), ext == null ? EXTENSION_WML : ext));
+ break;
+ case Image:
+ f = new File(OmFileHelper.getUploadFilesDir(),
String.format("%s.%s", getHash(), ext == null ? EXTENSION_JPG : ext));
+ break;
+ case Video:
+ f = new
File(OmFileHelper.getStreamsHibernateDir(), String.format("%s%s.%s",
WB_VIDEO_FILE_PREFIX, getId(), ext == null ? EXTENSION_MP4 : ext));
+ break;
+ case Presentation: {
+ File d = new
File(OmFileHelper.getUploadFilesDir(), getHash());
+ f = new File(d, String.format("%s.%s",
getHash(), ext == null ? EXTENSION_SWF : ext));
+ }
+ break;
+ case PollChart:
+ case Folder:
+ default:
+ }
+ return f;
+ }
}
Modified:
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
Thu Aug 11 10:43:43 2016
@@ -18,11 +18,15 @@
*/
package org.apache.openmeetings.db.entity.file;
+import java.io.File;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.xml.bind.annotation.XmlType;
@@ -39,6 +43,12 @@ public abstract class FileItem implement
Folder, Image, PollChart, Presentation, Recording, Video,
WmlFile
}
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id")
+ @Element(data = true, name = "flvRecordingId")
+ private Long id;
+
@Column(name = "name")
@Element(name = "fileName", data = true, required = false)
private String name;
@@ -94,6 +104,16 @@ public abstract class FileItem implement
@Enumerated(EnumType.STRING)
private Type type;
+ @Override
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(Long id) {
+ this.id = id;
+ }
+
public String getName() {
return name;
}
@@ -198,6 +218,28 @@ public abstract class FileItem implement
this.type = type;
}
+ public File getFile() {
+ return getFile(null);
+ }
+
+ protected abstract File internalGetFile(String ext);
+
+ public final File getFile(String ext) {
+ return internalGetFile(ext);
+ }
+
+ public final boolean exists() {
+ return exists(null);
+ }
+
+ public final boolean exists(String ext) {
+ if (id != null && !isDeleted()) {
+ File f = getFile(ext);
+ return f != null && f.exists() && f.isFile();
+ }
+ return false;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
Modified:
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java
Thu Aug 11 10:43:43 2016
@@ -18,6 +18,14 @@
*/
package org.apache.openmeetings.db.entity.record;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_AVI;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_OGG;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
+import static org.apache.openmeetings.util.OmFileHelper.getRecording;
+import static org.apache.openmeetings.util.OmFileHelper.recordingFileName;
+
+import java.io.File;
import java.util.Date;
import java.util.List;
@@ -27,9 +35,6 @@ import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
@@ -104,11 +109,6 @@ public class Recording extends FileItem
, PROCESSED
, ERROR
}
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- @Element(data = true, name = "flvRecordingId")
- private Long id;
@Column(name = "alternate_download")
@Element(data = true, required = false)
@@ -168,16 +168,6 @@ public class Recording extends FileItem
@Transient
private List<RecordingLog> log;
- @Override
- public Long getId() {
- return id;
- }
-
- @Override
- public void setId(Long id) {
- this.id = id;
- }
-
public String getComment() {
return comment;
}
@@ -289,4 +279,21 @@ public class Recording extends FileItem
public void setStatus(Status status) {
this.status = status;
}
+
+ @Override
+ public File internalGetFile(String ext) {
+ File f = null;
+ if (getId() != null && !isDeleted()) {
+ if (ext == null || EXTENSION_MP4.equals(ext)) {
+ f = getRecording(String.format("%s.%s.%s",
recordingFileName, EXTENSION_FLV, EXTENSION_AVI));
+ } else if (EXTENSION_FLV.equals(ext)) {
+ f = getRecording(String.format("%s.%s",
recordingFileName, EXTENSION_FLV));
+ } else if (EXTENSION_AVI.equals(ext)) {
+ f = getRecording(String.format("%s.%s",
recordingFileName, EXTENSION_AVI));
+ } else if (EXTENSION_OGG.equals(ext)) {
+ f = getRecording(String.format("%s.%s.%s",
recordingFileName, EXTENSION_FLV, EXTENSION_AVI));
+ }
+ }
+ return f;
+ }
}
Modified:
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
Thu Aug 11 10:43:43 2016
@@ -70,14 +70,21 @@ public class OmFileHelper {
public static final String profileImagePrefix = "_profile_";
public static final String thumbImagePrefix = "_thumb_";
public static final String dashboardFile = "dashboard.xml";
- public static final String WML_EXTENSION = ".wml";
- public static final String FLV_EXTENSION = ".flv";
- public static final String MP4_EXTENSION = ".mp4";
- public static final String OGG_EXTENSION = ".ogg";
- public static final String JPG_EXTENSION = ".jpg";
+ public static final String EXTENSION_WML = "wml";
+ public static final String EXTENSION_FLV = "flv";
+ public static final String EXTENSION_MP4 = "mp4";
+ public static final String EXTENSION_AVI = "avi";
+ public static final String EXTENSION_OGG = "ogg";
+ public static final String EXTENSION_JPG = "jpg";
+ public static final String EXTENSION_SWF = "swf";
+ public static final String WML_EXTENSION = "." + EXTENSION_WML;
+ public static final String FLV_EXTENSION = "." + EXTENSION_FLV;
+ public static final String MP4_EXTENSION = "." + EXTENSION_MP4;
+ public static final String OGG_EXTENSION = "." + EXTENSION_OGG;
+ public static final String JPG_EXTENSION = "." + EXTENSION_JPG;
public static final String WB_VIDEO_FILE_PREFIX = "UPLOADFLV_";
- public static final String FLV_MIME_TYPE = "video/flv";
- public static final String MP4_MIME_TYPE = "video/mp4";
+ public static final String FLV_MIME_TYPE = "video/" + EXTENSION_FLV;
+ public static final String MP4_MIME_TYPE = "video/" + EXTENSION_MP4;
public static final String JPG_MIME_TYPE = "image/jpeg";
public static void setOmHome(File omHome) {
@@ -189,16 +196,6 @@ public class OmFileHelper {
return new File(getDir(getStreamsDir(), HIBERNATE_DIR), name);
}
- public static boolean isRecordingExists(String name) {
- try {
- File f = new File(getDir(getStreamsDir(),
HIBERNATE_DIR), name);
- return f.exists() && f.isFile();
- } catch (Exception e) {
- //no-op
- }
- return false;
- }
-
public static File getMp4Recording(String name) {
return getRecording(name + MP4_EXTENSION);
}
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
Thu Aug 11 10:43:43 2016
@@ -18,8 +18,6 @@
*/
package org.apache.openmeetings.web.common.tree;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
import static org.apache.openmeetings.web.app.Application.getBean;
import java.util.ArrayList;
@@ -86,7 +84,7 @@ public class ConvertingErrorsDialog exte
if (f.getHash() == null) {
message.setVisible(true);
message.setDefaultModelObject(Application.getString(888));
- } else if (!isRecordingExists(f.getHash() + MP4_EXTENSION)) {
+ } else if (!f.exists()) {
message.setVisible(true);
message.setDefaultModelObject(Application.getString(1595));
} else {
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java
Thu Aug 11 10:43:43 2016
@@ -18,8 +18,6 @@
*/
package org.apache.openmeetings.web.common.tree;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
import static org.apache.openmeetings.web.app.Application.getBean;
import org.apache.openmeetings.db.dao.record.RecordingLogDao;
@@ -40,7 +38,7 @@ public class FileItemPanel extends Folde
if (model.getObject() instanceof Recording) {
Recording r = (Recording)model.getObject();
long errorCount =
getBean(RecordingLogDao.class).countErrors(r.getId());
- boolean visible = errorCount != 0 || (Status.RECORDING
!= r.getStatus() && Status.CONVERTING != r.getStatus() &&
!isRecordingExists(r.getHash() + MP4_EXTENSION));
+ boolean visible = errorCount != 0 || (Status.RECORDING
!= r.getStatus() && Status.CONVERTING != r.getStatus() && !r.exists());
errors.add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java
Thu Aug 11 10:43:43 2016
@@ -18,9 +18,6 @@
*/
package org.apache.openmeetings.web.common.tree;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
-
import org.apache.openmeetings.db.entity.file.FileItem;
import org.apache.openmeetings.db.entity.file.FileItem.Type;
import org.apache.openmeetings.db.entity.record.Recording;
@@ -85,39 +82,40 @@ public class FileItemTree extends Defaul
if (f.getId() == null) {
style = f.getHash().indexOf("my") > -1
? "my file om-icon" : "public file om-icon";
} else {
+ String _style, addStyle = f.exists() ?
"" : "broken";
switch(f.getType()) {
case Folder:
- style = def;
+ _style = def;
break;
case Image:
- style = "image file
om-icon";
+ _style = "image file
om-icon";
break;
case PollChart:
- style = "chart file
om-icon";
+ _style = "chart file
om-icon";
break;
case WmlFile:
- style = "wml file
om-icon";
+ _style = "wml file
om-icon";
break;
+ case Video:
case Recording:
{
- Recording r =
(Recording)f;
- if
(isRecordingExists(r.getHash() + MP4_EXTENSION)) {
- style =
"recording om-icon";
- } else if
(Status.RECORDING == r.getStatus() || Status.CONVERTING == r.getStatus()) {
- style =
"processing-recording om-icon";
- } else {
- style =
"broken-recording om-icon";
+ _style = "recording
om-icon";
+ if (f instanceof
Recording) {
+ Status st =
((Recording)f).getStatus();
+ if
(Status.RECORDING == st || Status.CONVERTING == st) {
+
addStyle = "processing";
+ }
}
}
break;
case Presentation:
- style = "doc file
om-icon";
+ _style = "doc file
om-icon";
break;
- case Video:
default:
- style = "recording
om-icon";
+ _style = "file om-icon";
break;
}
+ style = String.format("%s %s",
addStyle, _style);
}
return style;
}
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
Thu Aug 11 10:43:43 2016
@@ -18,11 +18,8 @@
*/
package org.apache.openmeetings.web.room;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_MIME_TYPE;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.JPG_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.JPG_MIME_TYPE;
-import static org.apache.openmeetings.util.OmFileHelper.WB_VIDEO_FILE_PREFIX;
+import static org.apache.openmeetings.util.OmFileHelper.MP4_MIME_TYPE;
import static org.apache.openmeetings.web.app.Application.getBean;
import static org.apache.openmeetings.web.app.Application.getOnlineClient;
@@ -30,7 +27,6 @@ import java.io.File;
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
-import org.apache.openmeetings.util.OmFileHelper;
import org.apache.openmeetings.web.app.WebSession;
import org.apache.openmeetings.web.util.FileItemResourceReference;
import org.apache.wicket.request.mapper.parameter.PageParameters;
@@ -95,29 +91,7 @@ public class RoomResourceReference exten
}
protected File getFile(FileExplorerItem r, String ext) {
- File result = null;
- switch (r.getType()) {
- case WmlFile: {
- result = new
File(OmFileHelper.getUploadWmlDir(), String.format("%s.%s", r.getHash(), ext ==
null ? "wml" : ext));
- }
- break;
- case Image: {
- result = new
File(OmFileHelper.getUploadFilesDir(), String.format("%s.%s", r.getHash(), ext
== null ? "jpg" : ext));
- }
- break;
- case Video: {
- result = new
File(OmFileHelper.getStreamsHibernateDir(), String.format("%s%s%s",
WB_VIDEO_FILE_PREFIX, r.getId(), preview ? JPG_EXTENSION : MP4_EXTENSION));
- break;
- }
- case Presentation: {
- File d = new
File(OmFileHelper.getUploadFilesDir(), r.getHash());
- result = new File(d, String.format("%s.%s",
r.getHash(), ext == null ? "swf" : ext));
- }
- break;
- default:
- throw new RuntimeException("Not supported");
- }
- return result;
+ return r.getFile(ext);
}
@Override
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java
Thu Aug 11 10:43:43 2016
@@ -22,7 +22,6 @@ import static org.apache.openmeetings.ut
import static org.apache.openmeetings.web.app.Application.getBean;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
-import org.apache.openmeetings.core.data.file.FileUtils;
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
import org.apache.openmeetings.db.dao.record.RecordingDao;
import org.apache.openmeetings.db.dto.record.RecordingContainerData;
@@ -45,10 +44,9 @@ public class RoomFilePanel extends FileT
@Override
public void updateSizes() {
FileExplorerItemDao dao = getBean(FileExplorerItemDao.class);
- FileUtils utils = getBean(FileUtils.class);
RecordingContainerData sizeData =
getBean(RecordingDao.class).getContainerData(getUserId());
- long userSize = utils.getSize(dao.getByOwner(getUserId()));
- long roomSize =
utils.getSize(dao.getByRoom(room.getRoom().getId()));
+ long userSize = dao.getOwnSize(getUserId());
+ long roomSize = dao.getRoomSize(room.getRoom().getId());
if (sizeData != null) {
userSize += sizeData.getUserHomeSize();
roomSize += sizeData.getPublicFileSize();
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/Mp4RecordingResourceReference.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/Mp4RecordingResourceReference.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/Mp4RecordingResourceReference.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/Mp4RecordingResourceReference.java
Thu Aug 11 10:43:43 2016
@@ -18,9 +18,7 @@
*/
package org.apache.openmeetings.web.user.record;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.MP4_MIME_TYPE;
-import static org.apache.openmeetings.util.OmFileHelper.getMp4Recording;
import java.io.File;
@@ -40,11 +38,11 @@ public class Mp4RecordingResourceReferen
@Override
protected String getFileName(Recording r) {
- return r.getHash() + MP4_EXTENSION;
+ return r.getFile().getName();
}
@Override
protected File getFile(Recording r) {
- return getMp4Recording(r.getHash());
+ return r.getFile();
}
}
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoInfo.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoInfo.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoInfo.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoInfo.java
Thu Aug 11 10:43:43 2016
@@ -18,18 +18,20 @@
*/
package org.apache.openmeetings.web.user.record;
-import static org.apache.openmeetings.util.OmFileHelper.getRecording;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_AVI;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
import static org.apache.openmeetings.util.OmFileHelper.getRecordingMetaData;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
import static org.apache.openmeetings.web.app.Application.getBean;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import org.apache.openmeetings.core.converter.IRecordingConverter;
import org.apache.openmeetings.core.converter.InterviewConverter;
import org.apache.openmeetings.core.converter.RecordingConverter;
-import org.apache.openmeetings.core.converter.IRecordingConverter;
import org.apache.openmeetings.db.dao.record.RecordingMetaDataDao;
import org.apache.openmeetings.db.dao.room.RoomDao;
import org.apache.openmeetings.db.entity.record.Recording;
@@ -126,7 +128,7 @@ public class VideoInfo extends Panel {
}
}
reConvert.setEnabled(reConvEnabled);
-
downloadBtn.setEnabled(isRecordingExists(r.getAlternateDownload()) ||
isRecordingExists(r.getHash()));
+ downloadBtn.setEnabled(r.exists() || r.exists(EXTENSION_AVI));
if (target != null) {
target.add(form);
}
@@ -150,6 +152,24 @@ public class VideoInfo extends Panel {
private List<IMenuItem> newDownloadMenuList() {
List<IMenuItem> list = new ArrayList<>();
+ //mp4
+ list.add(new MenuItem(EXTENSION_MP4,
JQueryIcon.ARROWTHICKSTOP_1_S) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public boolean isEnabled() {
+ Recording r = VideoInfo.this.rm.getObject();
+ return r != null && r.exists(EXTENSION_MP4);
+ }
+
+ @Override
+ public void onClick(AjaxRequestTarget target) {
+ File f = rm.getObject().getFile(EXTENSION_MP4);
+ download.setFileName(f.getName());
+ download.setResourceStream(new
FileResourceStream(f));
+ download.initiate(target);
+ }
+ });
//avi
list.add(new MenuItem(getString("884"),
JQueryIcon.ARROWTHICKSTOP_1_S) {
private static final long serialVersionUID = 1L;
@@ -157,13 +177,14 @@ public class VideoInfo extends Panel {
@Override
public boolean isEnabled() {
Recording r = VideoInfo.this.rm.getObject();
- return r != null &&
isRecordingExists(r.getAlternateDownload());
+ return r != null && r.exists(EXTENSION_AVI);
}
@Override
public void onClick(AjaxRequestTarget target) {
-
download.setFileName(rm.getObject().getAlternateDownload());
- download.setResourceStream(new
FileResourceStream(getRecording(rm.getObject().getAlternateDownload())));
+ File f = rm.getObject().getFile(EXTENSION_AVI);
+ download.setFileName(f.getName());
+ download.setResourceStream(new
FileResourceStream(f));
download.initiate(target);
}
});
@@ -174,13 +195,14 @@ public class VideoInfo extends Panel {
@Override
public boolean isEnabled() {
Recording r = VideoInfo.this.rm.getObject();
- return r != null &&
isRecordingExists(r.getAlternateDownload());
+ return r != null && r.exists(EXTENSION_FLV);
}
@Override
public void onClick(AjaxRequestTarget target) {
- download.setFileName(rm.getObject().getHash());
- download.setResourceStream(new
FileResourceStream(getRecording(rm.getObject().getHash())));
+ File f = rm.getObject().getFile(EXTENSION_FLV);
+ download.setFileName(f.getName());
+ download.setResourceStream(new
FileResourceStream(f));
download.initiate(target);
}
});
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoPlayer.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoPlayer.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoPlayer.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/VideoPlayer.java
Thu Aug 11 10:43:43 2016
@@ -19,7 +19,6 @@
package org.apache.openmeetings.web.user.record;
import static org.apache.openmeetings.util.OmFileHelper.MP4_MIME_TYPE;
-import static org.apache.openmeetings.util.OmFileHelper.getMp4Recording;
import org.apache.openmeetings.db.entity.record.Recording;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -59,7 +58,7 @@ public class VideoPlayer extends Panel {
}
public VideoPlayer update(AjaxRequestTarget target, Recording r) {
- boolean videoExists = r != null &&
getMp4Recording(r.getHash()).exists();
+ boolean videoExists = r != null && r.exists();
if (videoExists) {
PageParameters pp = new PageParameters().add("id",
r.getId());
mp4.setPageParameters(pp);
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/WEB-INF/classes/openmeetings-applicationContext.xml
Thu Aug 11 10:43:43 2016
@@ -242,7 +242,6 @@
<bean id="smsHandler"
class="org.apache.openmeetings.core.mail.SMSHandler" />
<bean id="importInitvalues"
class="org.apache.openmeetings.installation.ImportInitvalues" />
<bean id="generateSWF"
class="org.apache.openmeetings.core.converter.GenerateSWF" />
- <bean id="fileUtils"
class="org.apache.openmeetings.core.data.file.FileUtils" />
<bean id="ldapLoginManagement"
class="org.apache.openmeetings.core.ldap.LdapLoginManagement" />
<bean id="timezoneUtil"
class="org.apache.openmeetings.db.util.TimezoneUtil" />
<bean id="whiteboardManagement"
class="org.apache.openmeetings.core.data.whiteboard.WhiteboardManager" />
Added:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/chart_pie_error.png
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/chart_pie_error.png?rev=1755932&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/chart_pie_error.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/layout.png
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/layout.png?rev=1755932&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/layout.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/layout_error.png
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/layout_error.png?rev=1755932&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/layout_error.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/page.png
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/page.png?rev=1755932&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/page.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/page_error.png
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/page_error.png?rev=1755932&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/page_error.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/picture.png
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/picture.png?rev=1755932&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/picture.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/picture_error.png
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/picture_error.png?rev=1755932&view=auto
==============================================================================
Binary file - no diff available.
Propchange:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/images/picture_error.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Modified:
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/theme.css
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/theme.css?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/theme.css
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/webapp/css/theme.css
Thu Aug 11 10:43:43 2016
@@ -334,18 +334,15 @@ html, body {
background: url(images/folder_add.png);
}
.recording.om-icon {
- padding-left: 18px;
background-image: url(images/film.png);
}
-.broken-recording.om-icon {
- padding-left: 18px;
+.broken.recording.om-icon {
background-image: url(images/film_error.png);
}
-.processing-recording.om-icon {
- padding-left: 18px;
+.processing.recording.om-icon {
background-image: url(images/film_processing.png);
}
-.file.om-icon {
+.file.om-icon, .recording.om-icon {
padding-left: 18px;
}
.my.file.om-icon {
@@ -355,16 +352,28 @@ html, body {
background-image: url(images/world_link.png);
}
.image.file.om-icon {
- background-image: url(images/photo.png);
+ background-image: url(images/picture.png);
+}
+.broken.image.file.om-icon {
+ background-image: url(images/picture_error.png);
}
.chart.file.om-icon {
background-image: url(images/chart_pie.png);
}
+.broken.chart.file.om-icon {
+ background-image: url(images/chart_pie_error.png);
+}
.wml.file.om-icon {
- background-image: url(images/map.png);
+ background-image: url(images/layout.png);
+}
+.broken.wml.file.om-icon {
+ background-image: url(images/layout_error.png);
}
.doc.file.om-icon {
- background-image: url(images/report.png);
+ background-image: url(images/page.png);
+}
+.broken.doc.file.om-icon {
+ background-image: url(images/page_error.png);
}
.invite.om-icon {
background-image: url(images/connect.png);
Modified:
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
(original)
+++
openmeetings/application/branches/3.2.x/openmeetings-webservice/src/main/java/org/apache/openmeetings/webservice/FileWebService.java
Thu Aug 11 10:43:43 2016
@@ -43,7 +43,6 @@ import javax.ws.rs.core.MediaType;
import org.apache.cxf.feature.Features;
import org.apache.cxf.jaxrs.ext.multipart.Multipart;
import org.apache.openmeetings.core.data.file.FileProcessor;
-import org.apache.openmeetings.core.data.file.FileUtils;
import org.apache.openmeetings.core.documents.LoadLibraryPresentation;
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
import org.apache.openmeetings.db.dao.server.SessiondataDao;
@@ -86,8 +85,6 @@ public class FileWebService {
@Autowired
private FileExplorerItemDao fileDao;
@Autowired
- private FileUtils fileUtils;
- @Autowired
private FileProcessor fileProcessor;
/**
@@ -285,11 +282,11 @@ public class FileWebService {
// Home File List
List<FileExplorerItem> fList =
fileDao.getByOwner(userId);
- fileExplorerObject.setUser(fList,
fileUtils.getSize(fList));
+ fileExplorerObject.setUser(fList,
fileDao.getSize(fList));
// Public File List
List<FileExplorerItem> rList =
fileDao.getByRoom(roomId);
- fileExplorerObject.setRoom(rList,
fileUtils.getSize(rList));
+ fileExplorerObject.setRoom(rList,
fileDao.getSize(rList));
return fileExplorerObject;
} else {
Modified:
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
(original)
+++
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/converter/BaseConverter.java
Thu Aug 11 10:43:43 2016
@@ -19,13 +19,12 @@
package org.apache.openmeetings.core.converter;
import static
org.apache.openmeetings.core.data.record.listener.async.BaseStreamWriter.TIME_TO_WAIT_FOR_FRAME;
+import static org.apache.openmeetings.util.OmFileHelper.FLV_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.OGG_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.FLV_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.getRecording;
import static org.apache.openmeetings.util.OmFileHelper.getRecordingMetaData;
import static org.apache.openmeetings.util.OmFileHelper.getStreamsSubDir;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.io.File;
@@ -340,7 +339,7 @@ public abstract class BaseConverter {
public void convertToMp4(Recording r, List<ConverterProcessResult>
returnLog) throws IOException {
//TODO add faststart, move filepaths to helpers
- if (!isRecordingExists(r.getHash())) {
+ if (!r.exists()) {
return;
}
File file = getRecording(r.getHash());
Modified:
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
(original)
+++
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/ConferenceLibrary.java
Thu Aug 11 10:43:43 2016
@@ -19,6 +19,7 @@
package org.apache.openmeetings.core.remote;
import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
+import static org.apache.openmeetings.util.OmFileHelper.WB_VIDEO_FILE_PREFIX;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.io.File;
@@ -208,10 +209,10 @@ public class ConferenceLibrary implement
/**
* @param sid
- * @param flvFileExplorerId
+ * @param fileId
* @return 1 in case of success, -1 otherwise
*/
- public Long copyFileToCurrentRoom(String sid, Long flvFileExplorerId) {
+ public Long copyFileToCurrentRoom(String sid, Long fileId) {
try {
Sessiondata sd = sessionDao.check(sid);
if
(AuthLevelUtil.hasUserLevel(userDao.getRights(sd.getUserId()))) {
@@ -221,14 +222,14 @@ public class ConferenceLibrary implement
Client currentClient =
sessionManager.getClientByStreamId(streamid, null);
- Long room_id = currentClient.getRoomId();
+ Long roomId = currentClient.getRoomId();
- if (room_id != null) {
- File outputFullFlvFile = new
File(OmFileHelper.getStreamsHibernateDir(), "UPLOADFLV_" + flvFileExplorerId +
MP4_EXTENSION);
+ if (roomId != null) {
+ File outputFullFlvFile = new
File(OmFileHelper.getStreamsHibernateDir(), WB_VIDEO_FILE_PREFIX + fileId +
MP4_EXTENSION);
- File targetFolder =
OmFileHelper.getStreamsSubDir(room_id);
+ File targetFolder =
OmFileHelper.getStreamsSubDir(roomId);
- File targetFullFlvFile = new
File(targetFolder, "UPLOADFLV_" + flvFileExplorerId + MP4_EXTENSION);
+ File targetFullFlvFile = new
File(targetFolder, WB_VIDEO_FILE_PREFIX + fileId + MP4_EXTENSION);
if (outputFullFlvFile.exists() &&
!targetFullFlvFile.exists()) {
FileHelper.copy(outputFullFlvFile, targetFullFlvFile);
}
Modified:
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
(original)
+++
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/file/FileExplorerItemDao.java
Thu Aug 11 10:43:43 2016
@@ -18,8 +18,11 @@
*/
package org.apache.openmeetings.db.dao.file;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
+import static org.apache.openmeetings.util.OmFileHelper.thumbImagePrefix;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import java.io.File;
import java.util.Date;
import java.util.List;
import java.util.UUID;
@@ -31,6 +34,7 @@ import javax.persistence.TypedQuery;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
import org.apache.openmeetings.db.entity.file.FileItem.Type;
+import org.apache.openmeetings.util.OmFileHelper;
import org.red5.logging.Red5LoggerFactory;
import org.slf4j.Logger;
import org.springframework.transaction.annotation.Transactional;
@@ -252,4 +256,58 @@ public class FileExplorerItemDao {
return update(f);
}
+ public long getOwnSize(Long userId) {
+ return getSize(getByOwner(userId));
+ }
+
+ public long getRoomSize(Long roomId) {
+ return getSize(getByRoom(roomId));
+ }
+
+ public long getSize(List<FileExplorerItem> list) {
+ long size = 0;
+ for (FileExplorerItem f : list) {
+ log.debug("FileExplorerItem fList " + f.getName());
+ size += getSize(f);
+ }
+ return size;
+ }
+
+ public long getSize(FileExplorerItem f) {
+ long size = 0;
+ try {
+ if (f.exists()) {
+ File base = OmFileHelper.getUploadFilesDir();
+ if (Type.Image == f.getType()) {
+ size += f.getFile().length();
+ File thumbFile = new File(base,
String.format("%s%s.%s", thumbImagePrefix, f.getHash(), EXTENSION_JPG));
+ if (thumbFile.exists()) {
+ size += thumbFile.length();
+ }
+ }
+ if (Type.Presentation == f.getType()) {
+ File tFolder = new File(base,
f.getHash());
+
+ if (tFolder.exists()) {
+ size +=
OmFileHelper.getSize(tFolder);
+ }
+ }
+ if (Type.Video == f.getType()) {
+ size += f.getFile().length();
+ File thumb = f.getFile(EXTENSION_JPG);
+ if (thumb.exists()) {
+ size += thumb.length();
+ }
+ }
+ }
+ if (Type.Folder == f.getType()) {
+ for (FileExplorerItem child :
getByParent(f.getId())) {
+ size += getSize(child);
+ }
+ }
+ } catch (Exception err) {
+ log.error("[getSize] ", err);
+ }
+ return size;
+ }
}
Modified:
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java
(original)
+++
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/dao/record/RecordingDao.java
Thu Aug 11 10:43:43 2016
@@ -18,12 +18,11 @@
*/
package org.apache.openmeetings.db.dao.record;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.OGG_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.getMp4Recording;
-import static org.apache.openmeetings.util.OmFileHelper.getOggRecording;
-import static org.apache.openmeetings.util.OmFileHelper.getRecording;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_AVI;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_OGG;
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import java.util.Date;
@@ -265,20 +264,20 @@ public class RecordingDao {
private long getSize(Recording r) {
long size = 0;
- if (isRecordingExists(r.getHash())) {
- size += getRecording(r.getHash()).length();
+ if (r.exists(EXTENSION_FLV)) {
+ size += r.getFile(EXTENSION_FLV).length();
}
- if (isRecordingExists(r.getAlternateDownload())) {
- size += getRecording(r.getAlternateDownload()).length();
+ if (r.exists(EXTENSION_AVI)) {
+ size += r.getFile(EXTENSION_AVI).length();
}
- if (isRecordingExists(r.getPreviewImage())) {
- size += getRecording(r.getPreviewImage()).length();
+ if (r.exists(EXTENSION_JPG)) {
+ size += r.getFile(EXTENSION_JPG).length();
}
- if (isRecordingExists(r.getHash() + MP4_EXTENSION)) {
- size += getMp4Recording(r.getHash()).length();
+ if (r.exists(EXTENSION_MP4)) {
+ size += r.getFile(EXTENSION_MP4).length();
}
- if (isRecordingExists(r.getHash() + OGG_EXTENSION)) {
- size += getOggRecording(r.getHash()).length();
+ if (r.exists(EXTENSION_OGG)) {
+ size += r.getFile(EXTENSION_OGG).length();
}
for (Recording rec : getByParent(r.getId())) {
size += getSize(rec);
Modified:
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java
(original)
+++
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileExplorerItem.java
Thu Aug 11 10:43:43 2016
@@ -18,15 +18,21 @@
*/
package org.apache.openmeetings.db.entity.file;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_JPG;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_SWF;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_WML;
+import static org.apache.openmeetings.util.OmFileHelper.WB_VIDEO_FILE_PREFIX;
+
+import java.io.File;
+
import javax.persistence.Column;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
+import org.apache.openmeetings.util.OmFileHelper;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
@@ -49,11 +55,6 @@ import org.simpleframework.xml.Root;
@Root
public class FileExplorerItem extends FileItem {
private static final long serialVersionUID = 1L;
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- @Element(data = true, name = "fileExplorerItemId")
- private Long id;
@Column(name = "filesize")
@Element(data = true, required = false)
@@ -65,16 +66,6 @@ public class FileExplorerItem extends Fi
@Column(name = "external_type")
private String externalType;
- @Override
- public Long getId() {
- return id;
- }
-
- @Override
- public void setId(Long id) {
- this.id = id;
- }
-
public Long getSize() {
return size;
}
@@ -98,4 +89,29 @@ public class FileExplorerItem extends Fi
public void setExternalType(String externalType) {
this.externalType = externalType;
}
+
+ @Override
+ protected File internalGetFile(String ext) {
+ File f = null;
+ switch (getType()) {
+ case WmlFile:
+ f = new File(OmFileHelper.getUploadWmlDir(),
String.format("%s.%s", getHash(), ext == null ? EXTENSION_WML : ext));
+ break;
+ case Image:
+ f = new File(OmFileHelper.getUploadFilesDir(),
String.format("%s.%s", getHash(), ext == null ? EXTENSION_JPG : ext));
+ break;
+ case Video:
+ f = new
File(OmFileHelper.getStreamsHibernateDir(), String.format("%s%s.%s",
WB_VIDEO_FILE_PREFIX, getId(), ext == null ? EXTENSION_MP4 : ext));
+ break;
+ case Presentation: {
+ File d = new
File(OmFileHelper.getUploadFilesDir(), getHash());
+ f = new File(d, String.format("%s.%s",
getHash(), ext == null ? EXTENSION_SWF : ext));
+ }
+ break;
+ case PollChart:
+ case Folder:
+ default:
+ }
+ return f;
+ }
}
Modified:
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
(original)
+++
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
Thu Aug 11 10:43:43 2016
@@ -18,11 +18,15 @@
*/
package org.apache.openmeetings.db.entity.file;
+import java.io.File;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.xml.bind.annotation.XmlType;
@@ -39,6 +43,12 @@ public abstract class FileItem implement
Folder, Image, PollChart, Presentation, Recording, Video,
WmlFile
}
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "id")
+ @Element(data = true, name = "flvRecordingId")
+ private Long id;
+
@Column(name = "name")
@Element(name = "fileName", data = true, required = false)
private String name;
@@ -94,6 +104,16 @@ public abstract class FileItem implement
@Enumerated(EnumType.STRING)
private Type type;
+ @Override
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(Long id) {
+ this.id = id;
+ }
+
public String getName() {
return name;
}
@@ -198,6 +218,28 @@ public abstract class FileItem implement
this.type = type;
}
+ public File getFile() {
+ return getFile(null);
+ }
+
+ protected abstract File internalGetFile(String ext);
+
+ public final File getFile(String ext) {
+ return internalGetFile(ext);
+ }
+
+ public final boolean exists() {
+ return exists(null);
+ }
+
+ public final boolean exists(String ext) {
+ if (id != null && !isDeleted()) {
+ File f = getFile(ext);
+ return f != null && f.exists() && f.isFile();
+ }
+ return false;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
Modified:
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java
(original)
+++
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/record/Recording.java
Thu Aug 11 10:43:43 2016
@@ -18,6 +18,14 @@
*/
package org.apache.openmeetings.db.entity.record;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_AVI;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_FLV;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_OGG;
+import static org.apache.openmeetings.util.OmFileHelper.EXTENSION_MP4;
+import static org.apache.openmeetings.util.OmFileHelper.getRecording;
+import static org.apache.openmeetings.util.OmFileHelper.recordingFileName;
+
+import java.io.File;
import java.util.Date;
import java.util.List;
@@ -27,9 +35,6 @@ import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.GenerationType;
-import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
@@ -104,11 +109,6 @@ public class Recording extends FileItem
, PROCESSED
, ERROR
}
- @Id
- @GeneratedValue(strategy = GenerationType.IDENTITY)
- @Column(name = "id")
- @Element(data = true, name = "flvRecordingId")
- private Long id;
@Column(name = "alternate_download")
@Element(data = true, required = false)
@@ -168,16 +168,6 @@ public class Recording extends FileItem
@Transient
private List<RecordingLog> log;
- @Override
- public Long getId() {
- return id;
- }
-
- @Override
- public void setId(Long id) {
- this.id = id;
- }
-
public String getComment() {
return comment;
}
@@ -289,4 +279,21 @@ public class Recording extends FileItem
public void setStatus(Status status) {
this.status = status;
}
+
+ @Override
+ public File internalGetFile(String ext) {
+ File f = null;
+ if (getId() != null && !isDeleted()) {
+ if (ext == null || EXTENSION_MP4.equals(ext)) {
+ f = getRecording(String.format("%s.%s.%s",
recordingFileName, EXTENSION_FLV, EXTENSION_AVI));
+ } else if (EXTENSION_FLV.equals(ext)) {
+ f = getRecording(String.format("%s.%s",
recordingFileName, EXTENSION_FLV));
+ } else if (EXTENSION_AVI.equals(ext)) {
+ f = getRecording(String.format("%s.%s",
recordingFileName, EXTENSION_AVI));
+ } else if (EXTENSION_OGG.equals(ext)) {
+ f = getRecording(String.format("%s.%s.%s",
recordingFileName, EXTENSION_FLV, EXTENSION_AVI));
+ }
+ }
+ return f;
+ }
}
Modified:
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
(original)
+++
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/OmFileHelper.java
Thu Aug 11 10:43:43 2016
@@ -70,14 +70,21 @@ public class OmFileHelper {
public static final String profileImagePrefix = "_profile_";
public static final String thumbImagePrefix = "_thumb_";
public static final String dashboardFile = "dashboard.xml";
- public static final String WML_EXTENSION = ".wml";
- public static final String FLV_EXTENSION = ".flv";
- public static final String MP4_EXTENSION = ".mp4";
- public static final String OGG_EXTENSION = ".ogg";
- public static final String JPG_EXTENSION = ".jpg";
+ public static final String EXTENSION_WML = "wml";
+ public static final String EXTENSION_FLV = "flv";
+ public static final String EXTENSION_MP4 = "mp4";
+ public static final String EXTENSION_AVI = "avi";
+ public static final String EXTENSION_OGG = "ogg";
+ public static final String EXTENSION_JPG = "jpg";
+ public static final String EXTENSION_SWF = "swf";
+ public static final String WML_EXTENSION = "." + EXTENSION_WML;
+ public static final String FLV_EXTENSION = "." + EXTENSION_FLV;
+ public static final String MP4_EXTENSION = "." + EXTENSION_MP4;
+ public static final String OGG_EXTENSION = "." + EXTENSION_OGG;
+ public static final String JPG_EXTENSION = "." + EXTENSION_JPG;
public static final String WB_VIDEO_FILE_PREFIX = "UPLOADFLV_";
- public static final String FLV_MIME_TYPE = "video/flv";
- public static final String MP4_MIME_TYPE = "video/mp4";
+ public static final String FLV_MIME_TYPE = "video/" + EXTENSION_FLV;
+ public static final String MP4_MIME_TYPE = "video/" + EXTENSION_MP4;
public static final String JPG_MIME_TYPE = "image/jpeg";
public static void setOmHome(File omHome) {
@@ -189,16 +196,6 @@ public class OmFileHelper {
return new File(getDir(getStreamsDir(), HIBERNATE_DIR), name);
}
- public static boolean isRecordingExists(String name) {
- try {
- File f = new File(getDir(getStreamsDir(),
HIBERNATE_DIR), name);
- return f.exists() && f.isFile();
- } catch (Exception e) {
- //no-op
- }
- return false;
- }
-
public static File getMp4Recording(String name) {
return getRecording(name + MP4_EXTENSION);
}
Modified:
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
(original)
+++
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
Thu Aug 11 10:43:43 2016
@@ -18,8 +18,6 @@
*/
package org.apache.openmeetings.web.common.tree;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
import static org.apache.openmeetings.web.app.Application.getBean;
import java.util.ArrayList;
@@ -86,7 +84,7 @@ public class ConvertingErrorsDialog exte
if (f.getHash() == null) {
message.setVisible(true);
message.setDefaultModelObject(Application.getString(888));
- } else if (!isRecordingExists(f.getHash() + MP4_EXTENSION)) {
+ } else if (!f.exists()) {
message.setVisible(true);
message.setDefaultModelObject(Application.getString(1595));
} else {
Modified:
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java
(original)
+++
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemPanel.java
Thu Aug 11 10:43:43 2016
@@ -18,8 +18,6 @@
*/
package org.apache.openmeetings.web.common.tree;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
import static org.apache.openmeetings.web.app.Application.getBean;
import org.apache.openmeetings.db.dao.record.RecordingLogDao;
@@ -40,7 +38,7 @@ public class FileItemPanel extends Folde
if (model.getObject() instanceof Recording) {
Recording r = (Recording)model.getObject();
long errorCount =
getBean(RecordingLogDao.class).countErrors(r.getId());
- boolean visible = errorCount != 0 || (Status.RECORDING
!= r.getStatus() && Status.CONVERTING != r.getStatus() &&
!isRecordingExists(r.getHash() + MP4_EXTENSION));
+ boolean visible = errorCount != 0 || (Status.RECORDING
!= r.getStatus() && Status.CONVERTING != r.getStatus() && !r.exists());
errors.add(new AjaxEventBehavior("click") {
private static final long serialVersionUID = 1L;
Modified:
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java
(original)
+++
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileItemTree.java
Thu Aug 11 10:43:43 2016
@@ -18,9 +18,6 @@
*/
package org.apache.openmeetings.web.common.tree;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.isRecordingExists;
-
import org.apache.openmeetings.db.entity.file.FileItem;
import org.apache.openmeetings.db.entity.file.FileItem.Type;
import org.apache.openmeetings.db.entity.record.Recording;
@@ -85,39 +82,40 @@ public class FileItemTree extends Defaul
if (f.getId() == null) {
style = f.getHash().indexOf("my") > -1
? "my file om-icon" : "public file om-icon";
} else {
+ String _style, addStyle = f.exists() ?
"" : "broken";
switch(f.getType()) {
case Folder:
- style = def;
+ _style = def;
break;
case Image:
- style = "image file
om-icon";
+ _style = "image file
om-icon";
break;
case PollChart:
- style = "chart file
om-icon";
+ _style = "chart file
om-icon";
break;
case WmlFile:
- style = "wml file
om-icon";
+ _style = "wml file
om-icon";
break;
+ case Video:
case Recording:
{
- Recording r =
(Recording)f;
- if
(isRecordingExists(r.getHash() + MP4_EXTENSION)) {
- style =
"recording om-icon";
- } else if
(Status.RECORDING == r.getStatus() || Status.CONVERTING == r.getStatus()) {
- style =
"processing-recording om-icon";
- } else {
- style =
"broken-recording om-icon";
+ _style = "recording
om-icon";
+ if (f instanceof
Recording) {
+ Status st =
((Recording)f).getStatus();
+ if
(Status.RECORDING == st || Status.CONVERTING == st) {
+
addStyle = "processing";
+ }
}
}
break;
case Presentation:
- style = "doc file
om-icon";
+ _style = "doc file
om-icon";
break;
- case Video:
default:
- style = "recording
om-icon";
+ _style = "file om-icon";
break;
}
+ style = String.format("%s %s",
addStyle, _style);
}
return style;
}
Modified:
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
(original)
+++
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
Thu Aug 11 10:43:43 2016
@@ -18,11 +18,8 @@
*/
package org.apache.openmeetings.web.room;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_MIME_TYPE;
-import static org.apache.openmeetings.util.OmFileHelper.MP4_EXTENSION;
-import static org.apache.openmeetings.util.OmFileHelper.JPG_EXTENSION;
import static org.apache.openmeetings.util.OmFileHelper.JPG_MIME_TYPE;
-import static org.apache.openmeetings.util.OmFileHelper.WB_VIDEO_FILE_PREFIX;
+import static org.apache.openmeetings.util.OmFileHelper.MP4_MIME_TYPE;
import static org.apache.openmeetings.web.app.Application.getBean;
import static org.apache.openmeetings.web.app.Application.getOnlineClient;
@@ -30,7 +27,6 @@ import java.io.File;
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
import org.apache.openmeetings.db.entity.file.FileExplorerItem;
-import org.apache.openmeetings.util.OmFileHelper;
import org.apache.openmeetings.web.app.WebSession;
import org.apache.openmeetings.web.util.FileItemResourceReference;
import org.apache.wicket.request.mapper.parameter.PageParameters;
@@ -95,29 +91,7 @@ public class RoomResourceReference exten
}
protected File getFile(FileExplorerItem r, String ext) {
- File result = null;
- switch (r.getType()) {
- case WmlFile: {
- result = new
File(OmFileHelper.getUploadWmlDir(), String.format("%s.%s", r.getHash(), ext ==
null ? "wml" : ext));
- }
- break;
- case Image: {
- result = new
File(OmFileHelper.getUploadFilesDir(), String.format("%s.%s", r.getHash(), ext
== null ? "jpg" : ext));
- }
- break;
- case Video: {
- result = new
File(OmFileHelper.getStreamsHibernateDir(), String.format("%s%s%s",
WB_VIDEO_FILE_PREFIX, r.getId(), preview ? JPG_EXTENSION : MP4_EXTENSION));
- break;
- }
- case Presentation: {
- File d = new
File(OmFileHelper.getUploadFilesDir(), r.getHash());
- result = new File(d, String.format("%s.%s",
r.getHash(), ext == null ? "swf" : ext));
- }
- break;
- default:
- throw new RuntimeException("Not supported");
- }
- return result;
+ return r.getFile(ext);
}
@Override
Modified:
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java
URL:
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java?rev=1755932&r1=1755931&r2=1755932&view=diff
==============================================================================
---
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java
(original)
+++
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/RoomFilePanel.java
Thu Aug 11 10:43:43 2016
@@ -22,7 +22,6 @@ import static org.apache.openmeetings.ut
import static org.apache.openmeetings.web.app.Application.getBean;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
-import org.apache.openmeetings.core.data.file.FileUtils;
import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
import org.apache.openmeetings.db.dao.record.RecordingDao;
import org.apache.openmeetings.db.dto.record.RecordingContainerData;
@@ -45,10 +44,9 @@ public class RoomFilePanel extends FileT
@Override
public void updateSizes() {
FileExplorerItemDao dao = getBean(FileExplorerItemDao.class);
- FileUtils utils = getBean(FileUtils.class);
RecordingContainerData sizeData =
getBean(RecordingDao.class).getContainerData(getUserId());
- long userSize = utils.getSize(dao.getByOwner(getUserId()));
- long roomSize =
utils.getSize(dao.getByRoom(room.getRoom().getId()));
+ long userSize = dao.getOwnSize(getUserId());
+ long roomSize = dao.getRoomSize(room.getRoom().getId());
if (sizeData != null) {
userSize += sizeData.getUserHomeSize();
roomSize += sizeData.getPublicFileSize();