Author: solomax
Date: Sat Sep 21 06:50:21 2013
New Revision: 1525200

URL: http://svn.apache.org/r1525200
Log:
[OPENMEETINGS-780] code clean up

Modified:
    
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/flvrecord/converter/BaseConverter.java
    
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
    
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/documents/GenerateSWF.java
    
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java

Modified: 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/flvrecord/converter/BaseConverter.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/flvrecord/converter/BaseConverter.java?rev=1525200&r1=1525199&r2=1525200&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/flvrecord/converter/BaseConverter.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/data/flvrecord/converter/BaseConverter.java
 Sat Sep 21 06:50:21 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.openmeetings.data.flvrecord.converter;
 
+import static org.apache.openmeetings.OpenmeetingsVariables.webAppRootKey;
 import static org.apache.openmeetings.utils.OmFileHelper.MP4_EXTENSION;
 import static org.apache.openmeetings.utils.OmFileHelper.OGG_EXTENSION;
 
@@ -25,7 +26,6 @@ import java.io.File;
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.openmeetings.OpenmeetingsVariables;
 import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
 import org.apache.openmeetings.db.dao.record.FlvRecordingMetaDataDao;
 import org.apache.openmeetings.db.dao.record.FlvRecordingMetaDeltaDao;
@@ -41,8 +41,7 @@ import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
 
 public abstract class BaseConverter {
-       private static final Logger log = Red5LoggerFactory.getLogger(
-                       BaseConverter.class, 
OpenmeetingsVariables.webAppRootKey);
+       private static final Logger log = 
Red5LoggerFactory.getLogger(BaseConverter.class, webAppRootKey);
 
        @Autowired
        private ConfigurationDao configurationDao;
@@ -53,10 +52,7 @@ public abstract class BaseConverter {
 
        private String getPath(String key, String app) {
                String path = configurationDao.getConfValue(key, String.class, 
"");
-               if (null == path) {
-                       path = "";
-               }
-               if (!path.equals("") && !path.endsWith(File.separator)) {
+               if (!"".equals(path) && !path.endsWith(File.separator)) {
                        path += File.separator;
                }
                path += app;

Modified: 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java?rev=1525200&r1=1525199&r2=1525200&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/db/dao/basic/ConfigurationDao.java
 Sat Sep 21 06:50:21 2013
@@ -98,7 +98,7 @@ public class ConfigurationDao implements
 
        /**
         * Return a object using a custom type and a default value if the key 
is not
-        * present
+        * present, or value is not set
         * 
         * Example: Integer my_key = getConfValue("my_key", Integer.class, 
"15");
         * 
@@ -114,8 +114,11 @@ public class ConfigurationDao implements
                        if (list == null || list.isEmpty()) {
                                log.warn("Could not find key in configuration 
CONF_KEY: " + key);
                        } else {
+                               String val = list.get(0).getConf_value();
                                // Use the custom value as default value
-                               defaultValue = list.get(0).getConf_value();
+                               if (val != null) {
+                                       defaultValue = val;
+                               }
                        }
 
                        if (defaultValue == null) {

Modified: 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/documents/GenerateSWF.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/documents/GenerateSWF.java?rev=1525200&r1=1525199&r2=1525200&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/documents/GenerateSWF.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/documents/GenerateSWF.java
 Sat Sep 21 06:50:21 2013
@@ -18,12 +18,13 @@
  */
 package org.apache.openmeetings.documents;
 
+import static org.apache.openmeetings.OpenmeetingsVariables.webAppRootKey;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.openmeetings.OpenmeetingsVariables;
 import org.apache.openmeetings.db.dao.basic.ConfigurationDao;
 import org.apache.openmeetings.documents.beans.ConverterProcessResult;
 import org.apache.openmeetings.utils.ProcessHelper;
@@ -33,44 +34,38 @@ import org.springframework.beans.factory
 
 public class GenerateSWF {
 
-       public static final Logger log = Red5LoggerFactory
-                       .getLogger(GenerateSWF.class, 
OpenmeetingsVariables.webAppRootKey);
+       public static final Logger log = 
Red5LoggerFactory.getLogger(GenerateSWF.class, webAppRootKey);
 
        @Autowired
        private ConfigurationDao configurationDao;
 
-       public final static boolean isPosix = System.getProperty("os.name")
-                       .toUpperCase().indexOf("WINDOWS") == -1;
+       public final static boolean isPosix = 
System.getProperty("os.name").toUpperCase().indexOf("WINDOWS") == -1;
 
        public final static String execExt = isPosix ? "" : ".exe";
 
        private String getPathToSwfTools() {
-               String pathToSWFTools = configurationDao.getConfValue(
-                               "swftools_path", String.class, "");
+               String pathToSWFTools = 
configurationDao.getConfValue("swftools_path", String.class, "");
                // If SWFTools Path is not blank a File.separator at the end of 
the path
                // is needed
-               if (!pathToSWFTools.equals("")
-                               && !pathToSWFTools.endsWith(File.separator)) {
+               if (!"".equals(pathToSWFTools) && 
!pathToSWFTools.endsWith(File.separator)) {
                        pathToSWFTools = pathToSWFTools + File.separator;
                }
                return pathToSWFTools;
        }
 
        private String getSwfZoom() {
-               String valueForSwfZoom = configurationDao.getConfValue(
-                               "swftools_zoom", String.class, "");
+               String valueForSwfZoom = 
configurationDao.getConfValue("swftools_zoom", String.class, "");
                // WARNING CODE NOT COMPLETE: If SWFTools zoom (dpi) should be 
an integer between 50 and  600 with a default value of 100 dpi
-               if (valueForSwfZoom.equals("")) {
+               if ("".equals(valueForSwfZoom)) {
                        valueForSwfZoom = "72";
                }
                return valueForSwfZoom;
        }
 
        private String getSwfJpegQuality() {
-               String valueForSwfJpegQuality = configurationDao.getConfValue(
-                               "swftools_jpegquality", String.class, "");
+               String valueForSwfJpegQuality = 
configurationDao.getConfValue("swftools_jpegquality", String.class, "");
                // WARNING CODE NOT COMPLETE: If SWFTools JPEG Quality should 
be an integer between 1 and 100, with a default value of 85
-               if (valueForSwfJpegQuality.equals("")) {
+               if ("".equals(valueForSwfJpegQuality)) {
                        valueForSwfJpegQuality = "85";
                }
                return valueForSwfJpegQuality;
@@ -95,31 +90,27 @@ public class GenerateSWF {
        /**
         * Generates an SWF from the list of files.
         */
-       public ConverterProcessResult generateSwfByImages(List<String> images,
-                       String outputfile, int fps) {
+       public ConverterProcessResult generateSwfByImages(List<String> images, 
String outputfile, int fps) {
                List<String> argvList = Arrays.asList(new String[] {
                                getPathToSwfTools() + "png2swf" + execExt, 
"-s", 
                                "insertstop", // Insert Stop command into every 
frame
                                "-o", outputfile, "-r", Integer.toString(fps), 
"-z" });
 
                argvList.addAll(images);
-               return ProcessHelper.executeScript("generateSwfByImages",
-                               argvList.toArray(new String[0]));
+               return ProcessHelper.executeScript("generateSwfByImages", 
argvList.toArray(new String[0]));
        }
 
        /**
         * Combines a bunch of SWFs into one SWF by concatenate.
         */
-       public ConverterProcessResult generateSWFByCombine(List<String> swfs,
-                       String outputswf, int fps) {
+       public ConverterProcessResult generateSWFByCombine(List<String> swfs, 
String outputswf, int fps) {
                List<String> argvList = Arrays.asList(new String[] {
                                getPathToSwfTools() + "swfcombine" + execExt, 
"-s",
                                "insertstop", // Insert Stop command into every 
frame
                                "-o", outputswf, "-r", Integer.toString(fps), 
"-z", "-a" });
 
                argvList.addAll(swfs);
-               return ProcessHelper.executeScript("generateSwfByImages",
-                               argvList.toArray(new String[0]));
+               return ProcessHelper.executeScript("generateSWFByCombine", 
argvList.toArray(new String[0]));
        }
 
        public ConverterProcessResult generateSWFByFFMpeg(String inputWildCard,

Modified: 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java?rev=1525200&r1=1525199&r2=1525200&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
 Sat Sep 21 06:50:21 2013
@@ -933,12 +933,12 @@ public class ImportInitvalues {
                
                int initProgress = progress;
                int progressDelta = 76 - progress;
-               double deltaProgressPerLanguageFile = new 
Double(progressDelta)/new Double(listlanguages.size());
+               double deltaProgressPerLanguageFile = ((double)progressDelta) / 
listlanguages.size();
                
                /** Read all languages files */
                for (int langId : listlanguages.keySet()) {
                        loadLanguagesFile(listlanguages, fieldCache, langId);
-                       progress = (int) (initProgress + Math.round( new 
Double(langId) * deltaProgressPerLanguageFile ));
+                       progress = (int)(initProgress + 
Math.round(deltaProgressPerLanguageFile * langId));
                }
                log.debug("All languages are imported");
        }


Reply via email to