Author: solomax
Date: Mon Apr 23 10:59:44 2012
New Revision: 1329175

URL: http://svn.apache.org/viewvc?rev=1329175&view=rev
Log:
OPENMEETINGS-111 OMTimezone is retrievable by the exact name only, full list of 
timezones available printed in case nothing was found

Modified:
    
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java

Modified: 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java
URL: 
http://svn.apache.org/viewvc/incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java?rev=1329175&r1=1329174&r2=1329175&view=diff
==============================================================================
--- 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java 
(original)
+++ 
incubator/openmeetings/trunk/singlewebapp/src/org/openmeetings/cli/Admin.java 
Mon Apr 23 10:59:44 2012
@@ -26,10 +26,12 @@ import org.apache.commons.cli.ParseExcep
 import org.apache.commons.cli.Parser;
 import org.apache.commons.cli.PosixParser;
 import org.openmeetings.app.OpenmeetingsVariables;
+import org.openmeetings.app.data.basic.dao.OmTimeZoneDaoImpl;
 import org.openmeetings.app.data.file.FileUtils;
 import org.openmeetings.app.documents.InstallationDocumentHandler;
 import org.openmeetings.app.installation.ImportInitvalues;
 import org.openmeetings.app.installation.InstallationConfig;
+import org.openmeetings.app.persistence.beans.basic.OmTimeZone;
 import org.openmeetings.app.remote.red5.ScopeApplicationAdapter;
 import org.openmeetings.servlet.outputhandler.BackupExport;
 import org.openmeetings.servlet.outputhandler.BackupImportController;
@@ -269,7 +271,6 @@ public class Admin {
                                        String login = 
cmdl.getOptionValue("user");
                                        String email = 
cmdl.getOptionValue("email");
                                        String group = 
cmdl.getOptionValue("group");
-                                       String tz = cmdl.getOptionValue("tz");
                                        if 
(cmdl.hasOption("skip-default-rooms")) {
                                                cfg.createDefaultRooms = "0";
                                        }
@@ -337,6 +338,19 @@ public class Admin {
                                        }
 
                                        ClassPathXmlApplicationContext ctx = 
getApplicationContext(ctxName);
+                                       OmTimeZoneDaoImpl tzDao =  
ctx.getBean(OmTimeZoneDaoImpl.class);
+                                       String tz = null;
+                                       if (cmdl.hasOption("tz")) {
+                                               tz = cmdl.getOptionValue("tz");
+                                               tz = tzDao.getOmTimeZone(tz) == 
null ? null : tz;
+                                       }
+                                       if (tz == null) {
+                                               System.out.println("Please 
enter timezone, Possible timezones are:");
+                                               for (OmTimeZone omTz : 
tzDao.getOmTimeZones()) {
+                                                       
System.out.println(omTz.getJname());
+                                               }
+                                               System.exit(1);
+                                       }
                                        ImportInitvalues importInit = 
ctx.getBean(ImportInitvalues.class);
                                        importInit.loadAll(new File(omHome, 
ImportInitvalues.languageFolderName).getAbsolutePath(), cfg, login, pass, 
email, group, tz);
                                        


Reply via email to