Author: solomax
Date: Fri Sep 16 16:55:32 2016
New Revision: 1761062

URL: http://svn.apache.org/viewvc?rev=1761062&view=rev
Log:
[OPENMEETINGS-1457] more work, get file is unified, conversion errors are 
displayed for files

Modified:
    
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-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/room/RoomResourceReference.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-web/src/main/java/org/apache/openmeetings/web/common/tree/ConvertingErrorsDialog.java
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java

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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -18,14 +18,6 @@
  */
 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;
@@ -35,7 +27,6 @@ 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;
 
@@ -108,28 +99,4 @@ public class FileExplorerItem extends Fi
        public void setExternalType(String externalType) {
                this.externalType = externalType;
        }
-
-       @Override
-       protected File internalGetFile(String ext) {
-               File f = null;
-               File d = new File(OmFileHelper.getUploadFilesDir(), getHash());
-               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(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_JPG : ext));
-                               break;
-                       case Video:
-                               f = new File(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_MP4 : ext));
-                               break;
-                       case Presentation:
-                               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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -18,6 +18,11 @@
  */
 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 java.io.File;
 import java.util.Date;
 import java.util.List;
@@ -30,6 +35,7 @@ import javax.persistence.Transient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.apache.openmeetings.db.entity.IDataProviderEntity;
+import org.apache.openmeetings.util.OmFileHelper;
 import org.simpleframework.xml.Element;
 
 @MappedSuperclass
@@ -201,14 +207,38 @@ public abstract class FileItem implement
                this.log = log;
        }
 
+       public String getFileName(String ext) {
+               return ext == null ? name : String.format("%s.%s", name, ext);
+       }
+
        public File getFile() {
                return getFile(null);
        }
 
-       protected abstract File internalGetFile(String ext);
-       
        public final File getFile(String ext) {
-               return internalGetFile(ext);
+               File f = null;
+               if (getHash() != null) {
+                       File d = new File(OmFileHelper.getUploadFilesDir(), 
getHash());
+                       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(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_JPG : ext));
+                                       break;
+                               case Recording:
+                               case Video:
+                                       f = new File(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_MP4 : ext));
+                                       break;
+                               case Presentation:
+                                       f = new File(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_SWF : ext));
+                                       break;
+                               case PollChart:
+                               case Folder:
+                               default:
+                       }
+               }
+               return f;
        }
 
        public final boolean exists() {

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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -19,10 +19,8 @@
 package org.apache.openmeetings.db.entity.record;
 
 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;
 
@@ -272,11 +270,7 @@ public class Recording extends FileItem
        }
 
        @Override
-       public File internalGetFile(String ext) {
-               File f = null;
-               if (getId() != null && !isDeleted()) {
-                       f = getRecording(String.format("%s%s.%s", 
recordingFileName, id, ext == null ? EXTENSION_MP4 : ext));
-               }
-               return f;
+       public String getFileName(String ext) {
+               return String.format("%s%s.%s", recordingFileName, id, ext == 
null ? EXTENSION_MP4 : ext);
        }
 }

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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -49,8 +49,8 @@ public class ConvertingErrorsDialog exte
                @Override
                protected void populateItem(ListItem<FileItemLog> item) {
                        FileItemLog l = item.getModelObject();
-                       item.add(new Label("exitCode"));
-                       item.add(new Label("message"));
+                       item.add(new Label("exitCode", l.getExitCode()));
+                       item.add(new Label("message", l.getMessage()));
                        if (!l.isOk()) {
                                item.add(AttributeModifier.replace("class", 
"alert"));
                        }

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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -91,17 +91,17 @@ public class RoomResourceReference exten
                return null;
        }
 
-       protected File getFile(FileExplorerItem r, String ext) {
-               return r.getFile(ext);
+       protected File getFile(FileExplorerItem f, String ext) {
+               return f.getFile(ext);
        }
 
        @Override
-       protected File getFile(FileExplorerItem r) {
-               return getFile(r, null);
+       protected File getFile(FileExplorerItem f) {
+               return getFile(f, null);
        }
        
        @Override
-       protected String getFileName(FileExplorerItem r) {
-               return preview ? String.format("%s.%s", r.getName(), 
EXTENSION_JPG) : r.getName();
+       protected String getFileName(FileExplorerItem f) {
+               return f.getFileName(preview ? EXTENSION_JPG : null);
        }
 }

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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -18,14 +18,6 @@
  */
 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;
@@ -35,7 +27,6 @@ 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;
 
@@ -108,28 +99,4 @@ public class FileExplorerItem extends Fi
        public void setExternalType(String externalType) {
                this.externalType = externalType;
        }
-
-       @Override
-       protected File internalGetFile(String ext) {
-               File f = null;
-               File d = new File(OmFileHelper.getUploadFilesDir(), getHash());
-               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(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_JPG : ext));
-                               break;
-                       case Video:
-                               f = new File(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_MP4 : ext));
-                               break;
-                       case Presentation:
-                               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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -18,6 +18,11 @@
  */
 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 java.io.File;
 import java.util.Date;
 import java.util.List;
@@ -30,6 +35,7 @@ import javax.persistence.Transient;
 import javax.xml.bind.annotation.XmlType;
 
 import org.apache.openmeetings.db.entity.IDataProviderEntity;
+import org.apache.openmeetings.util.OmFileHelper;
 import org.simpleframework.xml.Element;
 
 @MappedSuperclass
@@ -201,14 +207,38 @@ public abstract class FileItem implement
                this.log = log;
        }
 
+       public String getFileName(String ext) {
+               return ext == null ? name : String.format("%s.%s", name, ext);
+       }
+
        public File getFile() {
                return getFile(null);
        }
 
-       protected abstract File internalGetFile(String ext);
-       
        public final File getFile(String ext) {
-               return internalGetFile(ext);
+               File f = null;
+               if (getHash() != null) {
+                       File d = new File(OmFileHelper.getUploadFilesDir(), 
getHash());
+                       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(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_JPG : ext));
+                                       break;
+                               case Recording:
+                               case Video:
+                                       f = new File(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_MP4 : ext));
+                                       break;
+                               case Presentation:
+                                       f = new File(d, String.format("%s.%s", 
getHash(), ext == null ? EXTENSION_SWF : ext));
+                                       break;
+                               case PollChart:
+                               case Folder:
+                               default:
+                       }
+               }
+               return f;
        }
 
        public final boolean exists() {

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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -19,10 +19,8 @@
 package org.apache.openmeetings.db.entity.record;
 
 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;
 
@@ -272,11 +270,7 @@ public class Recording extends FileItem
        }
 
        @Override
-       public File internalGetFile(String ext) {
-               File f = null;
-               if (getId() != null && !isDeleted()) {
-                       f = getRecording(String.format("%s%s.%s", 
recordingFileName, id, ext == null ? EXTENSION_MP4 : ext));
-               }
-               return f;
+       public String getFileName(String ext) {
+               return String.format("%s%s.%s", recordingFileName, id, ext == 
null ? EXTENSION_MP4 : ext);
        }
 }

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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -49,8 +49,8 @@ public class ConvertingErrorsDialog exte
                @Override
                protected void populateItem(ListItem<FileItemLog> item) {
                        FileItemLog l = item.getModelObject();
-                       item.add(new Label("exitCode"));
-                       item.add(new Label("message"));
+                       item.add(new Label("exitCode", l.getExitCode()));
+                       item.add(new Label("message", l.getMessage()));
                        if (!l.isOk()) {
                                item.add(AttributeModifier.replace("class", 
"alert"));
                        }

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=1761062&r1=1761061&r2=1761062&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
 Fri Sep 16 16:55:32 2016
@@ -91,17 +91,17 @@ public class RoomResourceReference exten
                return null;
        }
 
-       protected File getFile(FileExplorerItem r, String ext) {
-               return r.getFile(ext);
+       protected File getFile(FileExplorerItem f, String ext) {
+               return f.getFile(ext);
        }
 
        @Override
-       protected File getFile(FileExplorerItem r) {
-               return getFile(r, null);
+       protected File getFile(FileExplorerItem f) {
+               return getFile(f, null);
        }
        
        @Override
-       protected String getFileName(FileExplorerItem r) {
-               return preview ? String.format("%s.%s", r.getName(), 
EXTENSION_JPG) : r.getName();
+       protected String getFileName(FileExplorerItem f) {
+               return f.getFileName(preview ? EXTENSION_JPG : null);
        }
 }


Reply via email to