Author: solomax
Date: Wed Apr 20 08:59:09 2016
New Revision: 1740070

URL: http://svn.apache.org/viewvc?rev=1740070&view=rev
Log:
[OPENMEETINGS-1030] file conversion/import was cleaned up

Removed:
    
openmeetings/application/branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/stringhandlers/
    
openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/stringhandlers/
Modified:
    
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
    
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java
    
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.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/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-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
    
openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/ConferenceRoomLayoutOptions.xml
    
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html
    
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.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/RecordingsPanel.java
    
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
    
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java
    
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.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/entity/file/FileExplorerItem.java
    
openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/file/FileItem.java
    
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
    
openmeetings/application/trunk/openmeetings-server/src/site/xdoc/ConferenceRoomLayoutOptions.xml
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html
    
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.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/RecordingsPanel.java

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
 Wed Apr 20 08:59:09 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.openmeetings.core.data.file;
 
-import static org.apache.openmeetings.util.OmFileHelper.FLV_EXTENSION;
 import static org.apache.openmeetings.util.OmFileHelper.getUploadFilesDir;
 import static org.apache.openmeetings.util.OmFileHelper.getUploadTempFilesDir;
 import static org.apache.openmeetings.util.OmFileHelper.thumbImagePrefix;
@@ -70,12 +69,12 @@ public class FileProcessor {
                
                // Generate a random string to prevent any problems with
                // foreign characters and duplicates
-               String newName = UUID.randomUUID().toString();
+               String hash = UUID.randomUUID().toString();
 
                String ext = getExt(f);
                String extDot = String.format(".%s", ext);
                log.debug("file extension: " + ext);
-               StoredFile storedFile = new StoredFile(newName, ext); 
+               StoredFile storedFile = new StoredFile(hash, ext); 
 
                // Check variable to see if this file is a presentation
                // check if this is a a file that can be converted by
@@ -96,22 +95,18 @@ public class FileProcessor {
                        return returnError;
                }
 
-               File completeName = new File(isAsIs ? getUploadFilesDir() : 
getUploadTempFilesDir(), newName + extDot);
+               File completeName = new File(isAsIs ? getUploadFilesDir() : 
getUploadTempFilesDir(), hash + extDot);
                log.debug("writing file to: " + completeName);
                FileHelper.copy(is, completeName);
                is.close();
 
-               String hash = newName + extDot;
                if (isImage) {
-                       hash = newName + ".jpg";
                        f.setType(Type.Image);
                } else if (isVideo) {
-                       hash = newName + FLV_EXTENSION;
                        f.setType(Type.Video);
                } else if (isChart) {
                        f.setType(Type.PollChart);
                } else if (isPdf || canBeConverted) {
-                       hash = newName;
                        f.setType(Type.Presentation);
                }
                f.setHash(hash);
@@ -122,16 +117,16 @@ public class FileProcessor {
                log.debug("canBeConverted: " + canBeConverted);
                if (canBeConverted) {
                        // convert to pdf, thumbs, swf and xml-description
-                       returnError = generatePDF.convertPDF(newName, "files", 
true, completeName);
+                       returnError = generatePDF.convertPDF(hash, "files", 
true, completeName);
                } else if (isPdf) {
                        // convert to thumbs, swf and xml-description
-                       returnError = generatePDF.convertPDF(newName, "files", 
false, completeName);
+                       returnError = generatePDF.convertPDF(hash, "files", 
false, completeName);
                } else if (isChart) {
                        log.debug("uploaded chart file");
                } else if (isImage && !isAsIs) {
                        // convert it to JPG
                        log.debug("##### convert it to JPG: ");
-                       returnError = generateImage.convertImage(newName, 
extDot, "files");
+                       returnError = generateImage.convertImage(hash, extDot, 
"files");
                } else if (isAsIs) {
                        ConverterProcessResult processThumb = 
generateThumbs.generateThumb(thumbImagePrefix, completeName, 50);
                        returnError.addItem("processThumb", processThumb);

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java
 Wed Apr 20 08:59:09 2016
@@ -19,6 +19,7 @@
 package org.apache.openmeetings.core.documents;
 
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static 
org.apache.openmeetings.core.documents.CreateLibraryPresentation.generateXMLDocument;
 
 import java.io.File;
 import java.io.FilenameFilter;
@@ -46,37 +47,28 @@ public class GeneratePDF {
        @Autowired
        private ConfigurationDao configurationDao;
 
-       public ConverterProcessResultList convertPDF(String fileName,
-                       String roomName, boolean fullProcessing, File inFile)
-                       throws Exception {
-
+       public ConverterProcessResultList convertPDF(String hash, String 
roomName, boolean fullProcessing, File inFile) throws Exception {
                String inFileName = inFile.getName();
                ConverterProcessResultList returnError = new 
ConverterProcessResultList();
 
                File fileFullPath = new 
File(OmFileHelper.getUploadTempRoomDir(roomName), inFileName);
-               File destinationFolder = 
OmFileHelper.getNewDir(OmFileHelper.getUploadRoomDir(roomName), fileName);
+               File destinationFolder = 
OmFileHelper.getNewDir(OmFileHelper.getUploadRoomDir(roomName), hash);
 
                log.debug("fullProcessing: " + fullProcessing);
                if (fullProcessing) {
-                       ConverterProcessResult processOpenOffice = doJodConvert(
-                                       fileFullPath, destinationFolder, 
fileName);
+                       ConverterProcessResult processOpenOffice = 
doJodConvert(fileFullPath, destinationFolder, hash);
                        returnError.addItem("processOpenOffice", 
processOpenOffice);
-                       ConverterProcessResult processThumb = generateThumbs
-                                       .generateBatchThumb(new 
File(destinationFolder, fileName + ".pdf"), destinationFolder, 80, "thumb");
+                       ConverterProcessResult processThumb = 
generateThumbs.generateBatchThumb(new File(destinationFolder, hash + ".pdf"), 
destinationFolder, 80, "thumb");
                        returnError.addItem("processThumb", processThumb);
-                       ConverterProcessResult processSWF = generateSWF
-                                       .generateSwf(destinationFolder, 
destinationFolder, fileName);
+                       ConverterProcessResult processSWF = 
generateSWF.generateSwf(destinationFolder, destinationFolder, hash);
                        returnError.addItem("processSWF", processSWF);
                } else {
-
                        log.debug("-- generateBatchThumb --");
 
-                       ConverterProcessResult processThumb = generateThumbs
-                                       .generateBatchThumb(fileFullPath, 
destinationFolder, 80, "thumb");
+                       ConverterProcessResult processThumb = 
generateThumbs.generateBatchThumb(fileFullPath, destinationFolder, 80, "thumb");
                        returnError.addItem("processThumb", processThumb);
 
-                       ConverterProcessResult processSWF = 
generateSWF.generateSwf(
-                                       fileFullPath.getParentFile(), 
destinationFolder, fileName);
+                       ConverterProcessResult processSWF = 
generateSWF.generateSwf(fileFullPath.getParentFile(), destinationFolder, hash);
                        returnError.addItem("processSWF", processSWF);
                }
 
@@ -86,15 +78,10 @@ public class GeneratePDF {
                FileHelper.moveRec(inFile, fileWhereToMove);
 
                if (fullProcessing) {
-                       ConverterProcessResult processXML = 
CreateLibraryPresentation
-                                       .generateXMLDocument(destinationFolder,
-                                                       inFileName, fileName + 
".pdf",
-                                                       fileName + ".swf");
+                       ConverterProcessResult processXML = 
generateXMLDocument(destinationFolder, inFileName, hash + ".pdf", hash + 
".swf");
                        returnError.addItem("processXML", processXML);
                } else {
-                       ConverterProcessResult processXML = 
CreateLibraryPresentation
-                                       .generateXMLDocument(destinationFolder,
-                                                       inFileName, null, 
fileName + ".swf");
+                       ConverterProcessResult processXML = 
generateXMLDocument(destinationFolder, inFileName, null, hash + ".swf");
                        returnError.addItem("processXML", processXML);
                }
 
@@ -146,15 +133,11 @@ public class GeneratePDF {
                        argv.add(fileFullPath.getCanonicalPath());
                        argv.add(new File(destinationFolder, outputfile + 
".pdf").getCanonicalPath());
 
-                       return ProcessHelper.executeScript("doJodConvert",
-                                       argv.toArray(new String[argv.size()]));
+                       return ProcessHelper.executeScript("doJodConvert", 
argv.toArray(new String[argv.size()]));
 
                } catch (Exception ex) {
                        log.error("doJodConvert", ex);
                        return new ConverterProcessResult("doJodConvert", 
ex.getMessage(), ex);
                }
        }
-
-       
-
 }

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.java
 Wed Apr 20 08:59:09 2016
@@ -29,7 +29,6 @@ import java.nio.charset.StandardCharsets
 import java.util.ArrayList;
 
 import org.apache.openmeetings.util.OmFileHelper;
-import org.apache.openmeetings.util.stringhandlers.StringComparer;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
 
@@ -45,18 +44,6 @@ public class LibraryDocumentConverter {
                try {
                        log.debug("filePath: " + 
OmFileHelper.getUploadWmlDir().getCanonicalPath());
                        
-                       String fileNameExtName = 
fileName.substring(fileName.length()-4,fileName.length());
-                       if (fileNameExtName.equals(fileExt)){
-                               fileName = 
StringComparer.getInstance().compareForRealPaths(fileName.substring(0, 
fileName.length()-4));
-                       } else {
-                               fileName = 
StringComparer.getInstance().compareForRealPaths(fileName.substring(0, 
fileName.length()));
-                       }
-                       
-                       if (fileName.length() <= 0){
-                               //return new Long(-21);
-                               return "-20";
-                       }
-                       //Add the Folder for the wmlFiles if it does not exist 
yet
                        File file = new File(OmFileHelper.getUploadWmlDir(), 
fileName + fileExt);
                        
                        if (file.exists()){
@@ -75,9 +62,6 @@ public class LibraryDocumentConverter {
                                out.write(xmlString);
                                out.flush();
                        }
-           
-                   //return new Long(1);
-                   
                        return file.getCanonicalPath();
                } catch (Exception err){
                        log.error("writeToLocalFolder",err);

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -23,7 +23,6 @@ import static org.apache.openmeetings.ut
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -43,7 +42,6 @@ import org.apache.openmeetings.db.entity
 import org.apache.openmeetings.db.entity.room.Client;
 import org.apache.openmeetings.db.util.AuthLevelUtil;
 import org.apache.openmeetings.util.OmFileHelper;
-import org.apache.openmeetings.util.crypt.MD5;
 import org.red5.logging.Red5LoggerFactory;
 import org.red5.server.api.IConnection;
 import org.red5.server.api.Red5;
@@ -104,15 +102,15 @@ public class ConferenceLibrary implement
         * Save an Object to the library and returns the file-explorer Id
         * 
         * @param SID
-        * @param room_id
+        * @param roomId
         * @param fileName
         * @param tObjectRef
         * @return - file-explorer Id in case of success, -1 otherwise
         */
-       public Long saveAsObject(String SID, Long room_id, String fileName, 
Object tObjectRef) {
+       public Long saveAsObject(String SID, Long roomId, String fileName, 
Object tObjectRef) {
                try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
+                       Long userId = sessiondataDao.checkSession(SID);
+                       if 
(AuthLevelUtil.hasUserLevel(userDao.getRights(userId))) {
                                // LinkedHashMap tObject = (LinkedHashMap)t;
                                // ArrayList tObject = (ArrayList)t;
 
@@ -124,18 +122,10 @@ public class ConferenceLibrary implement
 
                                log.debug("saveAsObject" + tObject.size());
 
-                               String localFileName = MD5.checksum(new 
Date().toString()) + ".wml";
-
-                               
LibraryDocumentConverter.writeToLocalFolder(localFileName, tObject);
-
-                               // String wmlPath = current_dir + 
File.separatorChar+fileName
-                               // +".xml";
-                               // OwnerID == null
-                               Long fileExplorerId = fileDao.add(fileName, "", 
null,
-                                               null, room_id, users_id, 
Type.WmlFile, localFileName, // WML localFileName
-                                               "", "");
+                               FileExplorerItem file = fileDao.add(fileName, 
null, null, roomId, userId, Type.WmlFile, "", "");
+                               
LibraryDocumentConverter.writeToLocalFolder(file.getHash(), tObject);
 
-                               return fileExplorerId;
+                               return file.getId();
                        }
                } catch (Exception err) {
                        log.error("[saveAsObject] ", err);
@@ -172,7 +162,7 @@ public class ConferenceLibrary implement
                                        return;
                                }
 
-                               ArrayList roomItems = 
libraryWmlLoader.loadWmlFile(fileExplorerItem.getWmlFilePath());
+                               ArrayList roomItems = 
libraryWmlLoader.loadWmlFile(fileExplorerItem.getHash());
 
                                Map whiteboardObjClear = new HashMap();
                                whiteboardObjClear.put(2, "clear");

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -22,6 +22,7 @@ import static org.apache.openmeetings.ut
 
 import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 
 import javax.persistence.EntityManager;
 import javax.persistence.NoResultException;
@@ -44,13 +45,13 @@ public class FileExplorerItemDao {
        @PersistenceContext
        private EntityManager em;
 
-       public Long add(String fileName, String fileHash, Long parentId, Long 
ownerId, Long roomId, Long insertedBy,
-                       Type type, String wmlFilePath, String externalId, 
String externalType) {
+       public FileExplorerItem add(String fileName, Long parentId, Long 
ownerId, Long roomId, Long insertedBy,
+                       Type type, String externalId, String externalType) {
                log.debug(".add(): adding file " + fileName + " roomID: " + 
roomId);
                try {
                        FileExplorerItem fileItem = new FileExplorerItem();
                        fileItem.setName(fileName);
-                       fileItem.setHash(fileHash);
+                       fileItem.setHash(UUID.randomUUID().toString());
                        fileItem.setDeleted(false);
                        fileItem.setParentId(parentId);
                        fileItem.setOwnerId(ownerId);
@@ -59,15 +60,13 @@ public class FileExplorerItemDao {
                        fileItem.setInsertedBy(insertedBy);
                        fileItem.setType(type);
                        fileItem.setUpdated(new Date());
-                       fileItem.setWmlFilePath(wmlFilePath);
                        fileItem.setExternalId(externalId);
                        fileItem.setExternalType(externalType);
 
                        fileItem = em.merge(fileItem);
-                       Long fileItemId = fileItem.getId();
 
-                       log.debug(".add(): file " + fileName + " added as " + 
fileItemId);
-                       return fileItemId;
+                       log.debug(".add(): file " + fileName + " added as " + 
fileItem.getId());
+                       return fileItem;
                } catch (Exception ex2) {
                        log.error(".add(): ", ex2);
                }

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -59,10 +59,6 @@ public class FileExplorerItem extends Fi
        @Element(data = true, required = false)
        private Long size;
 
-       @Column(name = "wml_file_path")
-       @Element(data = true, required = false)
-       private String wmlFilePath;
-
        @Column(name = "external_id")
        private String externalId;
 
@@ -87,14 +83,6 @@ public class FileExplorerItem extends Fi
                this.size = fileSize;
        }
 
-       public String getWmlFilePath() {
-               return wmlFilePath;
-       }
-
-       public void setWmlFilePath(String wmlFilePath) {
-               this.wmlFilePath = wmlFilePath;
-       }
-
        public String getExternalId() {
                return externalId;
        }
@@ -110,5 +98,4 @@ public class FileExplorerItem extends Fi
        public void setExternalType(String externalType) {
                this.externalType = externalType;
        }
-
 }

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -197,4 +197,56 @@ public abstract class FileItem implement
        public void setType(Type type) {
                this.type = type;
        }
+
+       @Override
+       public int hashCode() {
+               final int prime = 31;
+               int result = 1;
+               result = prime * result + ((hash == null) ? 0 : 
hash.hashCode());
+               result = prime * result + ((name == null) ? 0 : 
name.hashCode());
+               result = prime * result + ((ownerId == null) ? 0 : 
ownerId.hashCode());
+               result = prime * result + ((parentId == null) ? 0 : 
parentId.hashCode());
+               result = prime * result + ((roomId == null) ? 0 : 
roomId.hashCode());
+               result = prime * result + ((type == null) ? 0 : 
type.hashCode());
+               return result;
+       }
+
+       @Override
+       public boolean equals(Object obj) {
+               if (this == obj)
+                       return true;
+               if (obj == null)
+                       return false;
+               if (getClass() != obj.getClass())
+                       return false;
+               FileItem other = (FileItem) obj;
+               if (hash == null) {
+                       if (other.hash != null)
+                               return false;
+               } else if (!hash.equals(other.hash))
+                       return false;
+               if (name == null) {
+                       if (other.name != null)
+                               return false;
+               } else if (!name.equals(other.name))
+                       return false;
+               if (ownerId == null) {
+                       if (other.ownerId != null)
+                               return false;
+               } else if (!ownerId.equals(other.ownerId))
+                       return false;
+               if (parentId == null) {
+                       if (other.parentId != null)
+                               return false;
+               } else if (!parentId.equals(other.parentId))
+                       return false;
+               if (roomId == null) {
+                       if (other.roomId != null)
+                               return false;
+               } else if (!roomId.equals(other.roomId))
+                       return false;
+               if (type != other.type)
+                       return false;
+               return true;
+       }
 }

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 Wed Apr 20 08:59:09 2016
@@ -726,53 +726,43 @@ public class BackupImport {
                                while (item != null) {
                                        FileExplorerItem f = 
ser.read(FileExplorerItem.class, item, false);
                                        
-                                       boolean isFolder = false, isImage = 
false, isVideo = false, isPresentation = false, isStoredWmlFile = false, 
isChart = false;
-                                       //HACK to handle old isFolder, isImage, 
isVideo, isRecording, isPresentation, isStoredWmlFile, isChart
+                                       //HACK to handle old isFolder, isImage, 
isVideo, isRecording, isPresentation, isStoredWmlFile, isChart, wmlFilePath
                                        do {
-                                               if 
("isChart".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isChart = true;
-                                               }
-                                               if 
("isImage".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isImage = true;
-                                               }
-                                               if 
("isVideo".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isVideo = true;
-                                               }
-                                               if 
("isRecording".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       log.warn("Recording is 
stored in FileExplorer Items");
-                                                       isVideo = true;
-                                               }
-                                               if 
("isPresentation".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isPresentation = true;
-                                               }
-                                               if 
("isStoredWmlFile".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isStoredWmlFile = true;
-                                               }
-                                               if 
("isFolder".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isFolder = true;
+                                               String name = item1.getName();
+                                               String val = item1.getValue();
+                                               if ("wmlFilePath".equals(name) 
&& !Strings.isEmpty(val)) {
+                                                       
f.setType(FileItem.Type.WmlFile);
+                                                       f.setHash(val);
                                                }
-                                               item1 = listNode1.getNext(); 
//HACK to handle Address inside user
-                                       } while (item1 != null && 
!"fileExplorerItem".equals(item1.getName()));
-                                       
-                                       if (f.getType() == null) {
-                                               if (isChart) {
+                                               if ("isChart".equals(name) && 
"true".equals(val)) {
                                                        
f.setType(FileItem.Type.PollChart);
                                                }
-                                               if (isImage) {
+                                               if ("isImage".equals(name) && 
"true".equals(val)) {
                                                        
f.setType(FileItem.Type.Image);
                                                }
-                                               if (isVideo) {
+                                               if ("isVideo".equals(name) && 
"true".equals(val)) {
+                                                       
f.setType(FileItem.Type.Video);
+                                               }
+                                               if ("isRecording".equals(name) 
&& "true".equals(val)) {
+                                                       log.warn("Recording is 
stored in FileExplorer Items");
                                                        
f.setType(FileItem.Type.Video);
                                                }
-                                               if (isPresentation) {
+                                               if 
("isPresentation".equals(name) && "true".equals(val)) {
                                                        
f.setType(FileItem.Type.Presentation);
                                                }
-                                               if (isStoredWmlFile) {
+                                               if 
("isStoredWmlFile".equals(name) && "true".equals(val)) {
                                                        
f.setType(FileItem.Type.WmlFile);
                                                }
-                                               if (isFolder) {
+                                               if ("isFolder".equals(name) && 
"true".equals(val)) {
                                                        
f.setType(FileItem.Type.Folder);
                                                }
+                                               item1 = listNode1.getNext(); 
//HACK to handle old isFolder, isImage, isVideo, isRecording, isPresentation, 
isStoredWmlFile, isChart, wmlFilePath
+                                       } while (item1 != null && 
!"fileExplorerItem".equals(item1.getName()));
+                                       
+                                       //Some hashes were stored with file 
extension
+                                       int idx = f.getHash() == null ? -1 : 
f.getHash().indexOf('.');
+                                       if (idx > -1) {
+                                               
f.setHash(f.getHash().substring(0, idx));
                                        }
                                        list.add(f);
                                        item = listNode.getNext();
@@ -809,7 +799,9 @@ public class BackupImport {
                                        boolean isFolder = false;
                                        //HACK to handle old isFolder
                                        do {
-                                               if 
("isFolder".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               String name = item1.getName();
+                                               String val = item1.getValue();
+                                               if ("isFolder".equals(name) && 
"true".equals(val)) {
                                                        isFolder = true;
                                                }
                                                item1 = listNode1.getNext(); 
//HACK to handle Address inside user
@@ -879,16 +871,17 @@ public class BackupImport {
                                        //HACK to handle external attendee's 
firstname, lastname, email
                                        boolean contactValid = false;
                                        do {
-                                               if (User.Type.contact == 
mm.getUser().getType() && "firstname".equals(item1.getName())) {
-                                                       
mm.getUser().setFirstname(item1.getValue());
+                                               String name = item1.getName();
+                                               String val = item1.getValue();
+                                               if (User.Type.contact == 
mm.getUser().getType() && "firstname".equals(name)) {
+                                                       
mm.getUser().setFirstname(val);
                                                }
-                                               if (User.Type.contact == 
mm.getUser().getType() && "lastname".equals(item1.getName())) {
-                                                       
mm.getUser().setLastname(item1.getValue());
+                                               if (User.Type.contact == 
mm.getUser().getType() && "lastname".equals(name)) {
+                                                       
mm.getUser().setLastname(val);
                                                }
-                                               if 
("email".equals(item1.getName())) {
-                                                       String email = 
item1.getValue();
+                                               if ("email".equals(name)) {
                                                        if (mm.getAppointment() 
!= null && mm.getAppointment().getOwner() != null) {
-                                                               
mm.setUser(userDao.getContact(email, mm.getAppointment().getOwner()));
+                                                               
mm.setUser(userDao.getContact(val, mm.getAppointment().getOwner()));
                                                        }
                                                        contactValid = true;
                                                }
@@ -988,18 +981,19 @@ public class BackupImport {
                                }
                                String levelId = null, status = null, stateId = 
null;
                                do {
-                                       if (u.getTimeZoneId() == null && 
"omTimeZone".equals(item2.getName())) {
-                                               String jName = item2.getValue();
-                                               u.setTimeZoneId(jName == null ? 
null : tzUtil.getTimeZone(jName).getID());
+                                       String name = item2.getName();
+                                       String val = item2.getValue();
+                                       if (u.getTimeZoneId() == null && 
"omTimeZone".equals(name)) {
+                                               u.setTimeZoneId(val == null ? 
null : tzUtil.getTimeZone(val).getID());
                                        }
-                                       if ("level_id".equals(item2.getName())) 
{
-                                               levelId = item2.getValue();
+                                       if ("level_id".equals(name)) {
+                                               levelId = val;
                                        }
-                                       if ("status".equals(item2.getName())) {
-                                               status = item2.getValue();
+                                       if ("status".equals(name)) {
+                                               status = val;
                                        }
-                                       if ("state_id".equals(item2.getName())) 
{
-                                               stateId = item2.getValue();
+                                       if ("state_id".equals(name)) {
+                                               stateId = val;
                                        }
                                        item2 = listNode2.getNext(); //HACK to 
handle old om_time_zone, level_id, status
                                } while (item2 != null && 
!"user".equals(item2.getName()));
@@ -1071,29 +1065,31 @@ public class BackupImport {
                                        Boolean showMicrophoneStatus = null;
                                        //HACK to handle old hideTopBar, 
hideChat, hideActivitiesAndActions, hideFilesExplorer, hideActionsMenu, 
hideScreenSharing, hideWhiteboard, showMicrophoneStatus
                                        do {
-                                               if 
("hideTopBar".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               String name = item1.getName();
+                                               String val = item1.getValue();
+                                               if ("hideTopBar".equals(name) 
&& "true".equals(val)) {
                                                        
r.hide(RoomElement.TopBar);
                                                }
-                                               if 
("hideChat".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               if ("hideChat".equals(name) && 
"true".equals(val)) {
                                                        
r.hide(RoomElement.Chat);
                                                }
-                                               if 
("hideActivitiesAndActions".equals(item1.getName()) && 
"true".equals(item1.getValue())) {
+                                               if 
("hideActivitiesAndActions".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.Activities);
                                                }
-                                               if 
("hideFilesExplorer".equals(item1.getName()) && 
"true".equals(item1.getValue())) {
+                                               if 
("hideFilesExplorer".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.Files);
                                                }
-                                               if 
("hideActionsMenu".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               if 
("hideActionsMenu".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.ActionMenu);
                                                }
-                                               if 
("hideScreenSharing".equals(item1.getName()) && 
"true".equals(item1.getValue())) {
+                                               if 
("hideScreenSharing".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.ScreenSharing);
                                                }
-                                               if 
("hideWhiteboard".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               if 
("hideWhiteboard".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.Whiteboard);
                                                }
-                                               if 
("showMicrophoneStatus".equals(item1.getName())) {
-                                                       showMicrophoneStatus = 
Boolean.valueOf(item1.getValue());
+                                               if 
("showMicrophoneStatus".equals(name)) {
+                                                       showMicrophoneStatus = 
Boolean.valueOf(val);
                                                }
                                                item1 = listNode1.getNext(); 
//HACK to handle Address inside user
                                        } while (item1 != null && 
!"room".equals(item1.getName()));

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/ConferenceRoomLayoutOptions.xml
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/ConferenceRoomLayoutOptions.xml?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/ConferenceRoomLayoutOptions.xml
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-server/src/site/xdoc/ConferenceRoomLayoutOptions.xml
 Wed Apr 20 08:59:09 2016
@@ -15,79 +15,75 @@
 <document xmlns="http://maven.apache.org/XDOC/2.0";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 
http://maven.apache.org/xsd/xdoc-2.0.xsd";>
-
-    <properties>
-        <title>Layout options for a conference room in OpenMeetings</title>
+       <properties>
+               <title>Layout options for a conference room in 
OpenMeetings</title>
                <author email="[email protected]">Apache 
OpenMeetings Team</author>
-    </properties>
-
-    <body>
-
-        <section name="Layout options for conference rooms">
-
-            <p>Each room has a number of attributes to generate different 
layouts.
-            You can change those values individually for each room in 
Administration &gt; Rooms
-            </p>
-            <p></p>
-            <table>
-                <tr>
-                    <th style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> key </th>
-                    <th style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> default </th>
-                    <th style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> meaning </th>
-                    <th style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> availabe since OpenMeetings version </th>
-                </tr>
-                <tr>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> hideTopBar </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> false </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> Hide the top bar with the menus and exit button </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> 2.x </td>
-                </tr>
-                <tr>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> hideChat </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> false </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> Hide the chat tab and use space for whiteboard </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> 2.x </td>
-                </tr>
-                <tr>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> hideActivitiesAndActions </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> false </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> Hide the activities window with the notofications aber user 
activities</td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> 2.x </td>
-                </tr>
-                <tr>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> hideFilesExplorer </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> false </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> Hide the file explorer</td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> 2.x </td>
-                </tr>
-                <tr>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> hideActionsMenu </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> false </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> Hide the menu with the actions</td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> 2.x </td>
-                </tr>
-                <tr>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> hideScreenSharing </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> false </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> Hide the button to start screensharing/recording</td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> 2.x </td>
-                </tr>
-                <tr>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> hideWhiteboard </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> false </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> Hide the whiteboard, if this option is true, the videos will be in the 
area of the whiteboard</td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> 2.x </td>
-                </tr>
-                <tr>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> showMicrophoneStatus </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> false </td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> Show the current status of the microphone (off/on) on the bottom of each 
video view</td>
-                    <td style="border: 1px solid rgb(204, 204, 204); padding: 
5px;"> 2.x </td>
-                </tr>
-            </table>
-
-        </section>
-        
-    </body>
-
-</document>
\ No newline at end of file
+       </properties>
+       <body>
+               <section name="Layout options for conference rooms">
+                       <p>
+                               Each room has "Hidden room elements" section.
+                               You can choose which elements for each room 
will be hidden in Administration &gt; Rooms<br/>
+                               <br/>
+                               Please NOTE this elements were checkboxes 
before 3.2.0.
+                       </p>
+                       <p></p>
+                       <table>
+                               <tr>
+                                       <th style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Element </th>
+                                       <th style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> default </th>
+                                       <th style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> meaning </th>
+                                       <th style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> available since OpenMeetings version </th>
+                               </tr>
+                               <tr>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> TopBar </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> displayed </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Top bar with the menus and exit button </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> 2.x </td>
+                               </tr>
+                               <tr>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Chat </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> displayed </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Chat tab in the room</td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> 2.x </td>
+                               </tr>
+                               <tr>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Activities </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> displayed </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Activities window with the notifications about user 
activities</td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> 2.x </td>
+                               </tr>
+                               <tr>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Files </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> displayed </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Room file explorer</td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> 2.x </td>
+                               </tr>
+                               <tr>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> ActionMenu </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> displayed </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Menu with the actions</td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> 2.x </td>
+                               </tr>
+                               <tr>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> ScreenSharing </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> displayed </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> The button and menu item to start 
screen-sharing/recording</td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> 2.x </td>
+                               </tr>
+                               <tr>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Whiteboard </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> displayed </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Whiteboard room element, if this element is hidden, 
the videos will be in the area of the whiteboard</td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> 2.x </td>
+                               </tr>
+                               <tr>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> MicrophoneStatus </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> hidden </td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> Current status of the microphone (off/on) on the 
bottom of each video view</td>
+                                       <td style="border: 1px solid rgb(204, 
204, 204); padding: 5px;"> 2.x </td>
+                               </tr>
+                       </table>
+               </section>
+       </body>
+</document>

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.html
 Wed Apr 20 08:59:09 2016
@@ -37,7 +37,9 @@
                </div>
                <div wicket:id="tree-container" class="trees">
                        <div id="tree-anchor" style="height: 2px; width: 
2px;"></div>
-                       <div wicket:id="tree"></div>
+                       <div wicket:id="tree">
+                               <div wicket:id="item"></div>
+                       </div>
                </div>
                <div class="sizes" wicket:id="sizes">
                        <table>

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/common/tree/FileTreePanel.java
 Wed Apr 20 08:59:09 2016
@@ -21,6 +21,7 @@ package org.apache.openmeetings.web.comm
 import static org.apache.openmeetings.web.app.Application.getBean;
 import static org.apache.openmeetings.web.app.WebSession.getUserId;
 
+import java.util.ArrayList;
 import java.util.Date;
 
 import org.apache.openmeetings.db.dao.file.FileExplorerItemDao;
@@ -36,11 +37,13 @@ import org.apache.wicket.Component;
 import org.apache.wicket.ajax.AjaxEventBehavior;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
+import org.apache.wicket.extensions.markup.html.repeater.tree.ITreeProvider;
 import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.list.ListItem;
+import org.apache.wicket.markup.html.list.ListView;
 import org.apache.wicket.markup.html.panel.Panel;
-import org.apache.wicket.markup.repeater.RepeatingView;
 import org.apache.wicket.model.CompoundPropertyModel;
 import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.Model;
@@ -59,7 +62,19 @@ public abstract class FileTreePanel exte
        protected final IModel<String> publicSize = Model.of((String)null);
        final ConvertingErrorsDialog errorsDialog = new 
ConvertingErrorsDialog("errors", Model.of((Recording)null));
        protected FileItemTree<? extends FileItem> selected;
-       protected RepeatingView treesView = new RepeatingView("tree");
+       protected ListView<ITreeProvider<? extends FileItem>> treesView = new 
ListView<ITreeProvider<? extends FileItem>>("tree", new 
ArrayList<ITreeProvider<? extends FileItem>>()) {
+               private static final long serialVersionUID = 1L;
+
+               @Override
+               protected void populateItem(ListItem<ITreeProvider<? extends 
FileItem>> item) {
+                       @SuppressWarnings({ "unchecked", "rawtypes" }) //TODO 
investigate this
+                       FileItemTree<? extends FileItem> fit = new 
FileItemTree("item", FileTreePanel.this, item.getModelObject());
+                       if (selected == null) {
+                               selected = fit;
+                       }
+                       item.add(fit);
+               }
+       };
 
        public FileTreePanel(String id) {
                super(id);

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -35,7 +35,6 @@ import org.apache.openmeetings.db.entity
 import org.apache.openmeetings.db.entity.user.Group;
 import org.apache.openmeetings.db.entity.user.GroupUser;
 import org.apache.openmeetings.web.app.Application;
-import org.apache.openmeetings.web.common.tree.FileItemTree;
 import org.apache.openmeetings.web.common.tree.FileTreePanel;
 import org.apache.openmeetings.web.common.tree.MyRecordingTreeProvider;
 import org.apache.openmeetings.web.common.tree.PublicRecordingTreeProvider;
@@ -88,13 +87,13 @@ public class RoomFilePanel extends FileT
                FileExplorerItem f = new FileExplorerItem();
                f.setOwnerId(getUserId());
                selectedFile.setObject(f);
-               treesView.add(selected = new 
FileItemTree<FileExplorerItem>(treesView.newChildId(), this, new 
FilesTreeProvider(null)));
-               treesView.add(new 
FileItemTree<FileExplorerItem>(treesView.newChildId(), this, new 
FilesTreeProvider(room.getRoom().getId())));
-               treesView.add(new 
FileItemTree<Recording>(treesView.newChildId(), this, new 
MyRecordingTreeProvider()));
-               treesView.add(new 
FileItemTree<Recording>(treesView.newChildId(), this, new 
PublicRecordingTreeProvider(null, null)));
+               treesView.getList().add(new FilesTreeProvider(null));
+               treesView.getList().add(new 
FilesTreeProvider(room.getRoom().getId()));
+               treesView.getList().add(new MyRecordingTreeProvider());
+               treesView.getList().add(new PublicRecordingTreeProvider(null, 
null));
                for (GroupUser ou : 
getBean(UserDao.class).get(getUserId()).getGroupUsers()) {
                        Group o = ou.getGroup();
-                       treesView.add(new 
FileItemTree<Recording>(treesView.newChildId(), this, new 
PublicRecordingTreeProvider(o.getId(), o.getName())));
+                       treesView.getList().add(new 
PublicRecordingTreeProvider(o.getId(), o.getName()));
                }
        }
        

Modified: 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/RecordingsPanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/RecordingsPanel.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/RecordingsPanel.java
 (original)
+++ 
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/user/record/RecordingsPanel.java
 Wed Apr 20 08:59:09 2016
@@ -30,7 +30,6 @@ import org.apache.openmeetings.db.entity
 import org.apache.openmeetings.db.entity.user.Group;
 import org.apache.openmeetings.db.entity.user.GroupUser;
 import org.apache.openmeetings.web.common.UserPanel;
-import org.apache.openmeetings.web.common.tree.FileItemTree;
 import org.apache.openmeetings.web.common.tree.FileTreePanel;
 import org.apache.openmeetings.web.common.tree.MyRecordingTreeProvider;
 import org.apache.openmeetings.web.common.tree.PublicRecordingTreeProvider;
@@ -49,11 +48,11 @@ public class RecordingsPanel extends Use
                        @Override
                        public void defineTrees() {
                                selectedFile.setObject(new Recording());
-                               treesView.add(selected = new 
FileItemTree<Recording>(treesView.newChildId(), this, new 
MyRecordingTreeProvider()));
-                               treesView.add(new 
FileItemTree<Recording>(treesView.newChildId(), this, new 
PublicRecordingTreeProvider(null, null)));
+                               treesView.getList().add(new 
MyRecordingTreeProvider());
+                               treesView.getList().add(new 
PublicRecordingTreeProvider(null, null));
                                for (GroupUser ou : 
getBean(UserDao.class).get(getUserId()).getGroupUsers()) {
                                        Group o = ou.getGroup();
-                                       treesView.add(new 
FileItemTree<Recording>(treesView.newChildId(), this, new 
PublicRecordingTreeProvider(o.getId(), o.getName())));
+                                       treesView.getList().add(new 
PublicRecordingTreeProvider(o.getId(), o.getName()));
                                }
                        }
                        

Modified: 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/data/file/FileProcessor.java
 Wed Apr 20 08:59:09 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.openmeetings.core.data.file;
 
-import static org.apache.openmeetings.util.OmFileHelper.FLV_EXTENSION;
 import static org.apache.openmeetings.util.OmFileHelper.getUploadFilesDir;
 import static org.apache.openmeetings.util.OmFileHelper.getUploadTempFilesDir;
 import static org.apache.openmeetings.util.OmFileHelper.thumbImagePrefix;
@@ -70,12 +69,12 @@ public class FileProcessor {
                
                // Generate a random string to prevent any problems with
                // foreign characters and duplicates
-               String newName = UUID.randomUUID().toString();
+               String hash = UUID.randomUUID().toString();
 
                String ext = getExt(f);
                String extDot = String.format(".%s", ext);
                log.debug("file extension: " + ext);
-               StoredFile storedFile = new StoredFile(newName, ext); 
+               StoredFile storedFile = new StoredFile(hash, ext); 
 
                // Check variable to see if this file is a presentation
                // check if this is a a file that can be converted by
@@ -96,22 +95,18 @@ public class FileProcessor {
                        return returnError;
                }
 
-               File completeName = new File(isAsIs ? getUploadFilesDir() : 
getUploadTempFilesDir(), newName + extDot);
+               File completeName = new File(isAsIs ? getUploadFilesDir() : 
getUploadTempFilesDir(), hash + extDot);
                log.debug("writing file to: " + completeName);
                FileHelper.copy(is, completeName);
                is.close();
 
-               String hash = newName + extDot;
                if (isImage) {
-                       hash = newName + ".jpg";
                        f.setType(Type.Image);
                } else if (isVideo) {
-                       hash = newName + FLV_EXTENSION;
                        f.setType(Type.Video);
                } else if (isChart) {
                        f.setType(Type.PollChart);
                } else if (isPdf || canBeConverted) {
-                       hash = newName;
                        f.setType(Type.Presentation);
                }
                f.setHash(hash);
@@ -122,16 +117,16 @@ public class FileProcessor {
                log.debug("canBeConverted: " + canBeConverted);
                if (canBeConverted) {
                        // convert to pdf, thumbs, swf and xml-description
-                       returnError = generatePDF.convertPDF(newName, "files", 
true, completeName);
+                       returnError = generatePDF.convertPDF(hash, "files", 
true, completeName);
                } else if (isPdf) {
                        // convert to thumbs, swf and xml-description
-                       returnError = generatePDF.convertPDF(newName, "files", 
false, completeName);
+                       returnError = generatePDF.convertPDF(hash, "files", 
false, completeName);
                } else if (isChart) {
                        log.debug("uploaded chart file");
                } else if (isImage && !isAsIs) {
                        // convert it to JPG
                        log.debug("##### convert it to JPG: ");
-                       returnError = generateImage.convertImage(newName, 
extDot, "files");
+                       returnError = generateImage.convertImage(hash, extDot, 
"files");
                } else if (isAsIs) {
                        ConverterProcessResult processThumb = 
generateThumbs.generateThumb(thumbImagePrefix, completeName, 50);
                        returnError.addItem("processThumb", processThumb);

Modified: 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/GeneratePDF.java
 Wed Apr 20 08:59:09 2016
@@ -19,6 +19,7 @@
 package org.apache.openmeetings.core.documents;
 
 import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static 
org.apache.openmeetings.core.documents.CreateLibraryPresentation.generateXMLDocument;
 
 import java.io.File;
 import java.io.FilenameFilter;
@@ -46,37 +47,28 @@ public class GeneratePDF {
        @Autowired
        private ConfigurationDao configurationDao;
 
-       public ConverterProcessResultList convertPDF(String fileName,
-                       String roomName, boolean fullProcessing, File inFile)
-                       throws Exception {
-
+       public ConverterProcessResultList convertPDF(String hash, String 
roomName, boolean fullProcessing, File inFile) throws Exception {
                String inFileName = inFile.getName();
                ConverterProcessResultList returnError = new 
ConverterProcessResultList();
 
                File fileFullPath = new 
File(OmFileHelper.getUploadTempRoomDir(roomName), inFileName);
-               File destinationFolder = 
OmFileHelper.getNewDir(OmFileHelper.getUploadRoomDir(roomName), fileName);
+               File destinationFolder = 
OmFileHelper.getNewDir(OmFileHelper.getUploadRoomDir(roomName), hash);
 
                log.debug("fullProcessing: " + fullProcessing);
                if (fullProcessing) {
-                       ConverterProcessResult processOpenOffice = doJodConvert(
-                                       fileFullPath, destinationFolder, 
fileName);
+                       ConverterProcessResult processOpenOffice = 
doJodConvert(fileFullPath, destinationFolder, hash);
                        returnError.addItem("processOpenOffice", 
processOpenOffice);
-                       ConverterProcessResult processThumb = generateThumbs
-                                       .generateBatchThumb(new 
File(destinationFolder, fileName + ".pdf"), destinationFolder, 80, "thumb");
+                       ConverterProcessResult processThumb = 
generateThumbs.generateBatchThumb(new File(destinationFolder, hash + ".pdf"), 
destinationFolder, 80, "thumb");
                        returnError.addItem("processThumb", processThumb);
-                       ConverterProcessResult processSWF = generateSWF
-                                       .generateSwf(destinationFolder, 
destinationFolder, fileName);
+                       ConverterProcessResult processSWF = 
generateSWF.generateSwf(destinationFolder, destinationFolder, hash);
                        returnError.addItem("processSWF", processSWF);
                } else {
-
                        log.debug("-- generateBatchThumb --");
 
-                       ConverterProcessResult processThumb = generateThumbs
-                                       .generateBatchThumb(fileFullPath, 
destinationFolder, 80, "thumb");
+                       ConverterProcessResult processThumb = 
generateThumbs.generateBatchThumb(fileFullPath, destinationFolder, 80, "thumb");
                        returnError.addItem("processThumb", processThumb);
 
-                       ConverterProcessResult processSWF = 
generateSWF.generateSwf(
-                                       fileFullPath.getParentFile(), 
destinationFolder, fileName);
+                       ConverterProcessResult processSWF = 
generateSWF.generateSwf(fileFullPath.getParentFile(), destinationFolder, hash);
                        returnError.addItem("processSWF", processSWF);
                }
 
@@ -86,15 +78,10 @@ public class GeneratePDF {
                FileHelper.moveRec(inFile, fileWhereToMove);
 
                if (fullProcessing) {
-                       ConverterProcessResult processXML = 
CreateLibraryPresentation
-                                       .generateXMLDocument(destinationFolder,
-                                                       inFileName, fileName + 
".pdf",
-                                                       fileName + ".swf");
+                       ConverterProcessResult processXML = 
generateXMLDocument(destinationFolder, inFileName, hash + ".pdf", hash + 
".swf");
                        returnError.addItem("processXML", processXML);
                } else {
-                       ConverterProcessResult processXML = 
CreateLibraryPresentation
-                                       .generateXMLDocument(destinationFolder,
-                                                       inFileName, null, 
fileName + ".swf");
+                       ConverterProcessResult processXML = 
generateXMLDocument(destinationFolder, inFileName, null, hash + ".swf");
                        returnError.addItem("processXML", processXML);
                }
 
@@ -146,15 +133,11 @@ public class GeneratePDF {
                        argv.add(fileFullPath.getCanonicalPath());
                        argv.add(new File(destinationFolder, outputfile + 
".pdf").getCanonicalPath());
 
-                       return ProcessHelper.executeScript("doJodConvert",
-                                       argv.toArray(new String[argv.size()]));
+                       return ProcessHelper.executeScript("doJodConvert", 
argv.toArray(new String[argv.size()]));
 
                } catch (Exception ex) {
                        log.error("doJodConvert", ex);
                        return new ConverterProcessResult("doJodConvert", 
ex.getMessage(), ex);
                }
        }
-
-       
-
 }

Modified: 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/documents/LibraryDocumentConverter.java
 Wed Apr 20 08:59:09 2016
@@ -29,7 +29,6 @@ import java.nio.charset.StandardCharsets
 import java.util.ArrayList;
 
 import org.apache.openmeetings.util.OmFileHelper;
-import org.apache.openmeetings.util.stringhandlers.StringComparer;
 import org.red5.logging.Red5LoggerFactory;
 import org.slf4j.Logger;
 
@@ -45,18 +44,6 @@ public class LibraryDocumentConverter {
                try {
                        log.debug("filePath: " + 
OmFileHelper.getUploadWmlDir().getCanonicalPath());
                        
-                       String fileNameExtName = 
fileName.substring(fileName.length()-4,fileName.length());
-                       if (fileNameExtName.equals(fileExt)){
-                               fileName = 
StringComparer.getInstance().compareForRealPaths(fileName.substring(0, 
fileName.length()-4));
-                       } else {
-                               fileName = 
StringComparer.getInstance().compareForRealPaths(fileName.substring(0, 
fileName.length()));
-                       }
-                       
-                       if (fileName.length() <= 0){
-                               //return new Long(-21);
-                               return "-20";
-                       }
-                       //Add the Folder for the wmlFiles if it does not exist 
yet
                        File file = new File(OmFileHelper.getUploadWmlDir(), 
fileName + fileExt);
                        
                        if (file.exists()){
@@ -75,9 +62,6 @@ public class LibraryDocumentConverter {
                                out.write(xmlString);
                                out.flush();
                        }
-           
-                   //return new Long(1);
-                   
                        return file.getCanonicalPath();
                } catch (Exception err){
                        log.error("writeToLocalFolder",err);

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -23,7 +23,6 @@ import static org.apache.openmeetings.ut
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -43,7 +42,6 @@ import org.apache.openmeetings.db.entity
 import org.apache.openmeetings.db.entity.room.Client;
 import org.apache.openmeetings.db.util.AuthLevelUtil;
 import org.apache.openmeetings.util.OmFileHelper;
-import org.apache.openmeetings.util.crypt.MD5;
 import org.red5.logging.Red5LoggerFactory;
 import org.red5.server.api.IConnection;
 import org.red5.server.api.Red5;
@@ -104,15 +102,15 @@ public class ConferenceLibrary implement
         * Save an Object to the library and returns the file-explorer Id
         * 
         * @param SID
-        * @param room_id
+        * @param roomId
         * @param fileName
         * @param tObjectRef
         * @return - file-explorer Id in case of success, -1 otherwise
         */
-       public Long saveAsObject(String SID, Long room_id, String fileName, 
Object tObjectRef) {
+       public Long saveAsObject(String SID, Long roomId, String fileName, 
Object tObjectRef) {
                try {
-                       Long users_id = sessiondataDao.checkSession(SID);
-                       if 
(AuthLevelUtil.hasUserLevel(userDao.getRights(users_id))) {
+                       Long userId = sessiondataDao.checkSession(SID);
+                       if 
(AuthLevelUtil.hasUserLevel(userDao.getRights(userId))) {
                                // LinkedHashMap tObject = (LinkedHashMap)t;
                                // ArrayList tObject = (ArrayList)t;
 
@@ -124,18 +122,10 @@ public class ConferenceLibrary implement
 
                                log.debug("saveAsObject" + tObject.size());
 
-                               String localFileName = MD5.checksum(new 
Date().toString()) + ".wml";
-
-                               
LibraryDocumentConverter.writeToLocalFolder(localFileName, tObject);
-
-                               // String wmlPath = current_dir + 
File.separatorChar+fileName
-                               // +".xml";
-                               // OwnerID == null
-                               Long fileExplorerId = fileDao.add(fileName, "", 
null,
-                                               null, room_id, users_id, 
Type.WmlFile, localFileName, // WML localFileName
-                                               "", "");
+                               FileExplorerItem file = fileDao.add(fileName, 
null, null, roomId, userId, Type.WmlFile, "", "");
+                               
LibraryDocumentConverter.writeToLocalFolder(file.getHash(), tObject);
 
-                               return fileExplorerId;
+                               return file.getId();
                        }
                } catch (Exception err) {
                        log.error("[saveAsObject] ", err);
@@ -172,7 +162,7 @@ public class ConferenceLibrary implement
                                        return;
                                }
 
-                               ArrayList roomItems = 
libraryWmlLoader.loadWmlFile(fileExplorerItem.getWmlFilePath());
+                               ArrayList roomItems = 
libraryWmlLoader.loadWmlFile(fileExplorerItem.getHash());
 
                                Map whiteboardObjClear = new HashMap();
                                whiteboardObjClear.put(2, "clear");

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -22,6 +22,7 @@ import static org.apache.openmeetings.ut
 
 import java.util.Date;
 import java.util.List;
+import java.util.UUID;
 
 import javax.persistence.EntityManager;
 import javax.persistence.NoResultException;
@@ -44,13 +45,13 @@ public class FileExplorerItemDao {
        @PersistenceContext
        private EntityManager em;
 
-       public Long add(String fileName, String fileHash, Long parentId, Long 
ownerId, Long roomId, Long insertedBy,
-                       Type type, String wmlFilePath, String externalId, 
String externalType) {
+       public FileExplorerItem add(String fileName, Long parentId, Long 
ownerId, Long roomId, Long insertedBy,
+                       Type type, String externalId, String externalType) {
                log.debug(".add(): adding file " + fileName + " roomID: " + 
roomId);
                try {
                        FileExplorerItem fileItem = new FileExplorerItem();
                        fileItem.setName(fileName);
-                       fileItem.setHash(fileHash);
+                       fileItem.setHash(UUID.randomUUID().toString());
                        fileItem.setDeleted(false);
                        fileItem.setParentId(parentId);
                        fileItem.setOwnerId(ownerId);
@@ -59,15 +60,13 @@ public class FileExplorerItemDao {
                        fileItem.setInsertedBy(insertedBy);
                        fileItem.setType(type);
                        fileItem.setUpdated(new Date());
-                       fileItem.setWmlFilePath(wmlFilePath);
                        fileItem.setExternalId(externalId);
                        fileItem.setExternalType(externalType);
 
                        fileItem = em.merge(fileItem);
-                       Long fileItemId = fileItem.getId();
 
-                       log.debug(".add(): file " + fileName + " added as " + 
fileItemId);
-                       return fileItemId;
+                       log.debug(".add(): file " + fileName + " added as " + 
fileItem.getId());
+                       return fileItem;
                } catch (Exception ex2) {
                        log.error(".add(): ", ex2);
                }

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -59,10 +59,6 @@ public class FileExplorerItem extends Fi
        @Element(data = true, required = false)
        private Long size;
 
-       @Column(name = "wml_file_path")
-       @Element(data = true, required = false)
-       private String wmlFilePath;
-
        @Column(name = "external_id")
        private String externalId;
 
@@ -87,14 +83,6 @@ public class FileExplorerItem extends Fi
                this.size = fileSize;
        }
 
-       public String getWmlFilePath() {
-               return wmlFilePath;
-       }
-
-       public void setWmlFilePath(String wmlFilePath) {
-               this.wmlFilePath = wmlFilePath;
-       }
-
        public String getExternalId() {
                return externalId;
        }
@@ -110,5 +98,4 @@ public class FileExplorerItem extends Fi
        public void setExternalType(String externalType) {
                this.externalType = externalType;
        }
-
 }

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=1740070&r1=1740069&r2=1740070&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
 Wed Apr 20 08:59:09 2016
@@ -197,4 +197,56 @@ public abstract class FileItem implement
        public void setType(Type type) {
                this.type = type;
        }
+
+       @Override
+       public int hashCode() {
+               final int prime = 31;
+               int result = 1;
+               result = prime * result + ((hash == null) ? 0 : 
hash.hashCode());
+               result = prime * result + ((name == null) ? 0 : 
name.hashCode());
+               result = prime * result + ((ownerId == null) ? 0 : 
ownerId.hashCode());
+               result = prime * result + ((parentId == null) ? 0 : 
parentId.hashCode());
+               result = prime * result + ((roomId == null) ? 0 : 
roomId.hashCode());
+               result = prime * result + ((type == null) ? 0 : 
type.hashCode());
+               return result;
+       }
+
+       @Override
+       public boolean equals(Object obj) {
+               if (this == obj)
+                       return true;
+               if (obj == null)
+                       return false;
+               if (getClass() != obj.getClass())
+                       return false;
+               FileItem other = (FileItem) obj;
+               if (hash == null) {
+                       if (other.hash != null)
+                               return false;
+               } else if (!hash.equals(other.hash))
+                       return false;
+               if (name == null) {
+                       if (other.name != null)
+                               return false;
+               } else if (!name.equals(other.name))
+                       return false;
+               if (ownerId == null) {
+                       if (other.ownerId != null)
+                               return false;
+               } else if (!ownerId.equals(other.ownerId))
+                       return false;
+               if (parentId == null) {
+                       if (other.parentId != null)
+                               return false;
+               } else if (!parentId.equals(other.parentId))
+                       return false;
+               if (roomId == null) {
+                       if (other.roomId != null)
+                               return false;
+               } else if (!roomId.equals(other.roomId))
+                       return false;
+               if (type != other.type)
+                       return false;
+               return true;
+       }
 }

Modified: 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
URL: 
http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java?rev=1740070&r1=1740069&r2=1740070&view=diff
==============================================================================
--- 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 (original)
+++ 
openmeetings/application/trunk/openmeetings-install/src/main/java/org/apache/openmeetings/backup/BackupImport.java
 Wed Apr 20 08:59:09 2016
@@ -726,53 +726,43 @@ public class BackupImport {
                                while (item != null) {
                                        FileExplorerItem f = 
ser.read(FileExplorerItem.class, item, false);
                                        
-                                       boolean isFolder = false, isImage = 
false, isVideo = false, isPresentation = false, isStoredWmlFile = false, 
isChart = false;
-                                       //HACK to handle old isFolder, isImage, 
isVideo, isRecording, isPresentation, isStoredWmlFile, isChart
+                                       //HACK to handle old isFolder, isImage, 
isVideo, isRecording, isPresentation, isStoredWmlFile, isChart, wmlFilePath
                                        do {
-                                               if 
("isChart".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isChart = true;
-                                               }
-                                               if 
("isImage".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isImage = true;
-                                               }
-                                               if 
("isVideo".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isVideo = true;
-                                               }
-                                               if 
("isRecording".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       log.warn("Recording is 
stored in FileExplorer Items");
-                                                       isVideo = true;
-                                               }
-                                               if 
("isPresentation".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isPresentation = true;
-                                               }
-                                               if 
("isStoredWmlFile".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isStoredWmlFile = true;
-                                               }
-                                               if 
("isFolder".equals(item1.getName()) && "true".equals(item1.getValue())) {
-                                                       isFolder = true;
+                                               String name = item1.getName();
+                                               String val = item1.getValue();
+                                               if ("wmlFilePath".equals(name) 
&& !Strings.isEmpty(val)) {
+                                                       
f.setType(FileItem.Type.WmlFile);
+                                                       f.setHash(val);
                                                }
-                                               item1 = listNode1.getNext(); 
//HACK to handle Address inside user
-                                       } while (item1 != null && 
!"fileExplorerItem".equals(item1.getName()));
-                                       
-                                       if (f.getType() == null) {
-                                               if (isChart) {
+                                               if ("isChart".equals(name) && 
"true".equals(val)) {
                                                        
f.setType(FileItem.Type.PollChart);
                                                }
-                                               if (isImage) {
+                                               if ("isImage".equals(name) && 
"true".equals(val)) {
                                                        
f.setType(FileItem.Type.Image);
                                                }
-                                               if (isVideo) {
+                                               if ("isVideo".equals(name) && 
"true".equals(val)) {
+                                                       
f.setType(FileItem.Type.Video);
+                                               }
+                                               if ("isRecording".equals(name) 
&& "true".equals(val)) {
+                                                       log.warn("Recording is 
stored in FileExplorer Items");
                                                        
f.setType(FileItem.Type.Video);
                                                }
-                                               if (isPresentation) {
+                                               if 
("isPresentation".equals(name) && "true".equals(val)) {
                                                        
f.setType(FileItem.Type.Presentation);
                                                }
-                                               if (isStoredWmlFile) {
+                                               if 
("isStoredWmlFile".equals(name) && "true".equals(val)) {
                                                        
f.setType(FileItem.Type.WmlFile);
                                                }
-                                               if (isFolder) {
+                                               if ("isFolder".equals(name) && 
"true".equals(val)) {
                                                        
f.setType(FileItem.Type.Folder);
                                                }
+                                               item1 = listNode1.getNext(); 
//HACK to handle old isFolder, isImage, isVideo, isRecording, isPresentation, 
isStoredWmlFile, isChart, wmlFilePath
+                                       } while (item1 != null && 
!"fileExplorerItem".equals(item1.getName()));
+                                       
+                                       //Some hashes were stored with file 
extension
+                                       int idx = f.getHash() == null ? -1 : 
f.getHash().indexOf('.');
+                                       if (idx > -1) {
+                                               
f.setHash(f.getHash().substring(0, idx));
                                        }
                                        list.add(f);
                                        item = listNode.getNext();
@@ -809,7 +799,9 @@ public class BackupImport {
                                        boolean isFolder = false;
                                        //HACK to handle old isFolder
                                        do {
-                                               if 
("isFolder".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               String name = item1.getName();
+                                               String val = item1.getValue();
+                                               if ("isFolder".equals(name) && 
"true".equals(val)) {
                                                        isFolder = true;
                                                }
                                                item1 = listNode1.getNext(); 
//HACK to handle Address inside user
@@ -879,16 +871,17 @@ public class BackupImport {
                                        //HACK to handle external attendee's 
firstname, lastname, email
                                        boolean contactValid = false;
                                        do {
-                                               if (User.Type.contact == 
mm.getUser().getType() && "firstname".equals(item1.getName())) {
-                                                       
mm.getUser().setFirstname(item1.getValue());
+                                               String name = item1.getName();
+                                               String val = item1.getValue();
+                                               if (User.Type.contact == 
mm.getUser().getType() && "firstname".equals(name)) {
+                                                       
mm.getUser().setFirstname(val);
                                                }
-                                               if (User.Type.contact == 
mm.getUser().getType() && "lastname".equals(item1.getName())) {
-                                                       
mm.getUser().setLastname(item1.getValue());
+                                               if (User.Type.contact == 
mm.getUser().getType() && "lastname".equals(name)) {
+                                                       
mm.getUser().setLastname(val);
                                                }
-                                               if 
("email".equals(item1.getName())) {
-                                                       String email = 
item1.getValue();
+                                               if ("email".equals(name)) {
                                                        if (mm.getAppointment() 
!= null && mm.getAppointment().getOwner() != null) {
-                                                               
mm.setUser(userDao.getContact(email, mm.getAppointment().getOwner()));
+                                                               
mm.setUser(userDao.getContact(val, mm.getAppointment().getOwner()));
                                                        }
                                                        contactValid = true;
                                                }
@@ -988,18 +981,19 @@ public class BackupImport {
                                }
                                String levelId = null, status = null, stateId = 
null;
                                do {
-                                       if (u.getTimeZoneId() == null && 
"omTimeZone".equals(item2.getName())) {
-                                               String jName = item2.getValue();
-                                               u.setTimeZoneId(jName == null ? 
null : tzUtil.getTimeZone(jName).getID());
+                                       String name = item2.getName();
+                                       String val = item2.getValue();
+                                       if (u.getTimeZoneId() == null && 
"omTimeZone".equals(name)) {
+                                               u.setTimeZoneId(val == null ? 
null : tzUtil.getTimeZone(val).getID());
                                        }
-                                       if ("level_id".equals(item2.getName())) 
{
-                                               levelId = item2.getValue();
+                                       if ("level_id".equals(name)) {
+                                               levelId = val;
                                        }
-                                       if ("status".equals(item2.getName())) {
-                                               status = item2.getValue();
+                                       if ("status".equals(name)) {
+                                               status = val;
                                        }
-                                       if ("state_id".equals(item2.getName())) 
{
-                                               stateId = item2.getValue();
+                                       if ("state_id".equals(name)) {
+                                               stateId = val;
                                        }
                                        item2 = listNode2.getNext(); //HACK to 
handle old om_time_zone, level_id, status
                                } while (item2 != null && 
!"user".equals(item2.getName()));
@@ -1071,29 +1065,31 @@ public class BackupImport {
                                        Boolean showMicrophoneStatus = null;
                                        //HACK to handle old hideTopBar, 
hideChat, hideActivitiesAndActions, hideFilesExplorer, hideActionsMenu, 
hideScreenSharing, hideWhiteboard, showMicrophoneStatus
                                        do {
-                                               if 
("hideTopBar".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               String name = item1.getName();
+                                               String val = item1.getValue();
+                                               if ("hideTopBar".equals(name) 
&& "true".equals(val)) {
                                                        
r.hide(RoomElement.TopBar);
                                                }
-                                               if 
("hideChat".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               if ("hideChat".equals(name) && 
"true".equals(val)) {
                                                        
r.hide(RoomElement.Chat);
                                                }
-                                               if 
("hideActivitiesAndActions".equals(item1.getName()) && 
"true".equals(item1.getValue())) {
+                                               if 
("hideActivitiesAndActions".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.Activities);
                                                }
-                                               if 
("hideFilesExplorer".equals(item1.getName()) && 
"true".equals(item1.getValue())) {
+                                               if 
("hideFilesExplorer".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.Files);
                                                }
-                                               if 
("hideActionsMenu".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               if 
("hideActionsMenu".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.ActionMenu);
                                                }
-                                               if 
("hideScreenSharing".equals(item1.getName()) && 
"true".equals(item1.getValue())) {
+                                               if 
("hideScreenSharing".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.ScreenSharing);
                                                }
-                                               if 
("hideWhiteboard".equals(item1.getName()) && "true".equals(item1.getValue())) {
+                                               if 
("hideWhiteboard".equals(name) && "true".equals(val)) {
                                                        
r.hide(RoomElement.Whiteboard);
                                                }
-                                               if 
("showMicrophoneStatus".equals(item1.getName())) {
-                                                       showMicrophoneStatus = 
Boolean.valueOf(item1.getValue());
+                                               if 
("showMicrophoneStatus".equals(name)) {
+                                                       showMicrophoneStatus = 
Boolean.valueOf(val);
                                                }
                                                item1 = listNode1.getNext(); 
//HACK to handle Address inside user
                                        } while (item1 != null && 
!"room".equals(item1.getName()));


Reply via email to