Author: tchemit Date: 2012-09-02 17:11:02 +0200 (Sun, 02 Sep 2012) New Revision: 589 Url: http://forge.codelutin.com/repositories/revision/echobase/589 Log: refs #1438: Choix d'une base de travail (admin ok, still need to review the embedded application creation (with internal db)) - fix users hql request - improve code - clean actions and much much more :) Added: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java trunk/echobase-ui/src/main/env/dev/resources/log4j.properties trunk/echobase-ui/src/main/env/jetty-context.xml trunk/echobase-ui/src/main/env/prod/resources/log4j.properties trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp trunk/echobase-ui/src/main/webapp/images/connect.png trunk/echobase-ui/src/main/webapp/images/disconnect.png Removed: trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties trunk/echobase-ui/src/main/env/dev/resources/log4j.xml trunk/echobase-ui/src/main/env/prod/resources/log4j.xml trunk/echobase-ui/src/main/filters/ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/connectToDbInformations.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseDateConverter.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBasePredicates.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/I18nAble.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/CellValueParser.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/EchoBaseCsvUtil.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/ResultValueParser.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserDAOImpl.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CategoryImpl.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CellImpl.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/EchotypeDAOImpl.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/OperationImpl.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/references/SpeciesCategoryImpl.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/InputFile.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java trunk/echobase-domain/src/main/resources/echobase-internaldb.properties trunk/echobase-domain/src/main/resources/echobase-workingdb.properties trunk/echobase-domain/src/main/xmi/echobase-internal.properties trunk/echobase-domain/src/main/xmi/echobase-internal.zargo trunk/echobase-domain/src/main/xmi/echobase.properties trunk/echobase-domain/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java trunk/echobase-domain/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java trunk/echobase-domain/src/test/resources/log4j.properties trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java trunk/echobase-services/src/main/resources/embedded/echobase.properties trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties trunk/echobase-ui/pom.xml trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Download.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Configure.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Download.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/LaunchOperationImport.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml trunk/echobase-ui/src/main/resources/config/struts-importData.xml trunk/echobase-ui/src/main/resources/config/struts-user.xml trunk/echobase-ui/src/main/resources/echobase.properties trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties trunk/echobase-ui/src/main/resources/struts.xml trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/exportQuery.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/newLibreOfficeQuery.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Create.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Delete.jsp trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Update.jsp trunk/echobase-ui/src/main/webapp/css/screen.css Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfiguration.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% @@ -73,7 +72,8 @@ log.info(this + " is initializing..."); } try { - applicationConfig.loadDefaultOptions(EchoBaseConfigurationOption.values()); + applicationConfig.loadDefaultOptions( + EchoBaseConfigurationOption.values()); if (propos != null) { for (Map.Entry<Object, Object> entry : propos.entrySet()) { @@ -133,6 +133,7 @@ Preconditions.checkNotNull(file); return file; } + public File getInternalDbDirectory() { File file = applicationConfig.getOptionAsFile(EchoBaseConfigurationOption.INTERNAL_DB_DIRECTORY.key); Preconditions.checkNotNull(file); @@ -167,13 +168,6 @@ return v; } - public URL getApplicationSite() { - URL url = applicationConfig.getOptionAsURL( - EchoBaseConfigurationOption.SITE_URL.key); - Preconditions.checkNotNull(url); - return url; - } - public Class<?> getDriverClass() { Class<?> klass = applicationConfig.getOptionAsClass( TopiaContextFactory.CONFIG_DRIVER); @@ -181,13 +175,6 @@ return klass; } - public String getJdbcUrl() { - String jdbcUrl = applicationConfig.getOption( - TopiaContextFactory.CONFIG_URL); - Preconditions.checkNotNull(jdbcUrl); - return jdbcUrl; - } - public boolean isEmbedded() { Class<?> driverClass = getDriverClass(); return driverClass.getName().toLowerCase().contains("h2"); Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseConfigurationOption.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% @@ -40,33 +39,31 @@ public enum EchoBaseConfigurationOption implements ApplicationConfig.OptionDef { /** Main directory where to put echobase data (logs, and others...). */ - DATA_DIRECTORY("data.directory", + DATA_DIRECTORY("echobase.data.directory", n_("echobase.config.data.directory.description"), "/var/local/echobase", File.class), INTERNAL_DB_DIRECTORY( - "internal.db.directory", + "echobase.internal.db.directory", n_("echobase.config.internal.db.directory.description"), - "${data.directory}/internaldb", - File.class), - VERSION("project.version", - "Version de l'application", + "${echobase.data.directory}/internaldb", File.class), + EMBEDDED("echobase.embedded", + n_("echobase.config.embedded.description"), + "false", boolean.class), + VERSION("echobase.version", + n_("echobase.config.version.description"), "", Version.class), - SITE_URL("project.siteUrl", - "URL du site de l'application", - "", URL.class), - CSV_SEPARATOR("csv.separator", - "Caractère de séparation pour les fichiers csv", + CSV_SEPARATOR("echobase.csv.separator", + n_("echobase.config.csv.separator.description"), ";", char.class), - WAR_DIRECTORY("war.directory", - "Répertoire où est stoqué le war", - "${data.directory}/war", File.class), - WAR_LOCATION("war.location", - "Chemin complêt d'accès au war", - "${war.directory}/echobase-ui-${project.version}.war", + WAR_DIRECTORY("echobase.war.directory", + n_("echobase.config.war.directory.description"), + "${echobase.data.directory}/war", File.class), + WAR_LOCATION("echobase.war.location", + n_("echobase.config.war.location.description"), + "${echobase.war.directory}/echobase-ui-${echobase.version}.war", File.class); - /** Configuration key. */ protected final String key; Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseDateConverter.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseDateConverter.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseDateConverter.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseFunctions.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBasePredicates.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBasePredicates.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBasePredicates.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/EchoBaseTechnicalException.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/I18nAble.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/I18nAble.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/I18nAble.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/CellValueParser.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/CellValueParser.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/CellValueParser.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% @@ -126,4 +125,4 @@ } return result; } -} \ No newline at end of file +} Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/EchoBaseCsvUtil.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/EchoBaseCsvUtil.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/EchoBaseCsvUtil.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/ResultValueParser.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/ResultValueParser.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/csv/ResultValueParser.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Added: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java (rev 0) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,90 @@ +package fr.ifremer.echobase.entities; + +/* + * #%L + * EchoBase :: Domain + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.I18nAble; +import org.hibernate.dialect.H2Dialect; +import org.hibernate.dialect.PostgreSQLDialect; + +import java.util.Properties; + +import static org.nuiton.i18n.I18n.n_; + +/** + * To define a type of driver (h2 or postgres for the moment). + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public enum DriverType implements I18nAble { + + H2(org.h2.Driver.class, + H2Dialect.class, + n_("echobase.common.driverType.h2")) { + @Override + public String getPilotFileName(Properties config) { + String h2Version = config.getProperty("h2Version"); + return h2Version == null ? null : "h2-" + h2Version + ".jar"; + } + }, + POSTGRESQL(org.postgresql.Driver.class, + PostgreSQLDialect.class, + n_("echobase.common.driverType.postgres")) { + @Override + public String getPilotFileName(Properties config) { + String pgVersion = config.getProperty("postgresqlVersion"); + return pgVersion == null ? null : "postgresql-" + pgVersion + ".jar"; + } + }; + + private final Class<?> driverClass; + + private final Class<?> dialectClass; + + private final String i18nKey; + + DriverType(Class<?> driverClass, + Class<?> dialectClass, + String i18nKey) { + this.driverClass = driverClass; + this.dialectClass = dialectClass; + this.i18nKey = i18nKey; + } + + public Class<?> getDriverClass() { + return driverClass; + } + + public Class<?> getDialectClass() { + return dialectClass; + } + + public abstract String getPilotFileName(Properties config); + + @Override + public String getI18nKey() { + return i18nKey; + } + +} Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/DriverType.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserDAOImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserDAOImpl.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/EchoBaseUserDAOImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% @@ -38,10 +37,9 @@ users = findAll(); } else { - String fqn = getTopiaEntityEnum().getImplementationFQN(); - - computeAndAddRecordsToPager("SELECT COUNT()* FROM " + fqn, pager); - users = findAllByQuery("FROM " + fqn, pager); + String hql = "FROM " + getTopiaEntityEnum().getImplementationFQN(); + computeAndAddRecordsToPager("SELECT COUNT(*) " + hql, pager); + users = findAllByQuery(hql); } return users; } Added: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java (rev 0) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,51 @@ +package fr.ifremer.echobase.entities; + +/* + * #%L + * EchoBase :: Domain + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.google.common.collect.Lists; +import org.apache.commons.lang3.StringUtils; +import org.nuiton.topia.TopiaException; + +import java.util.List; + +public class ExportQueryDAOImpl<E extends ExportQuery> extends ExportQueryDAOAbstract<E> { + + public boolean isQueryExists(String id, String queryName) throws TopiaException { + + String hql = "SELECT COUNT(*)" + + " FROM " + getTopiaEntityEnum().getImplementationFQN() + + " WHERE " + ExportQuery.PROPERTY_NAME + " = :name"; + + List<Object> params = Lists.<Object>newArrayList("name", queryName); + + if (StringUtils.isNotBlank(id)) { + hql += " AND " + ExportQuery.TOPIA_ID + " = :id"; + params.add("id"); + params.add(id); + } + + boolean result = existsByQuery(hql, params.toArray()); + return result; + } +} Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/ExportQueryDAOImpl.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CategoryImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CategoryImpl.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CategoryImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CellImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CellImpl.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/CellImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/EchotypeDAOImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/EchotypeDAOImpl.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/EchotypeDAOImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/OperationImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/OperationImpl.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/OperationImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/TransitImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/data/VoyageImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/references/SpeciesCategoryImpl.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/references/SpeciesCategoryImpl.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/entities/references/SpeciesCategoryImpl.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/EchoBaseIOUtil.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/InputFile.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/InputFile.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/io/InputFile.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseDbMeta.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,7 @@ package fr.ifremer.echobase.persistence; /* * #%L - * EchoBase :: Entities + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBaseEntityHelper.java 2012-09-02 15:11:02 UTC (rev 589) @@ -2,7 +2,7 @@ /* * #%L - * EchoBase :: Entities + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% @@ -47,22 +47,6 @@ /** Logger. */ private static final Log log = LogFactory.getLog(EchoBaseEntityHelper.class); - public static Connection newJDBCConnection(JdbcConfiguration configuration) throws SQLException { - - String jdbcUrl = configuration.getUrl(); - String login = configuration.getLogin(); - String password = configuration.getPassword(); - - Connection conn = DriverManager.getConnection(jdbcUrl, login, password); - - if (log.isDebugEnabled()) { - log.debug("connexion reussie pour l'utilisateur " + login + - " at [" + jdbcUrl + ']'); - } - - return conn; - } - public static TopiaContext newTransactionFromRootContext(TopiaContext otherTx) throws TopiaException { TopiaContext tx = ((TopiaContextImplementor) otherTx).getRootContext().beginTransaction(); return tx; @@ -98,8 +82,17 @@ Connection conn = null; try { - conn = newJDBCConnection(configuration); + String jdbcUrl = configuration.getUrl(); + String login = configuration.getLogin(); + String password = configuration.getPassword(); + conn = DriverManager.getConnection(jdbcUrl, login, password); + + if (log.isDebugEnabled()) { + log.debug("connexion reussie pour l'utilisateur " + login + + " at [" + jdbcUrl + ']'); + } + } finally { if (conn != null) { try { @@ -114,15 +107,6 @@ } } -// public static JdbcConfiguration newJdbcConfiguration(Properties dbConf) { -// -// JdbcConfiguration result = new JdbcConfiguration(); -// result.setUrl(dbConf.getProperty(TopiaContextFactory.CONFIG_URL)); -// result.setLogin(dbConf.getProperty(TopiaContextFactory.CONFIG_USER)); -// result.setPassword(dbConf.getProperty(TopiaContextFactory.CONFIG_PASS)); -// return result; -// } - public static void closeConnection(TopiaContext transaction) { if (transaction == null) { if (log.isTraceEnabled()) { Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchoBasePersistenceHelper.java 2012-09-02 15:11:02 UTC (rev 589) @@ -2,7 +2,7 @@ /* * #%L - * EchoBase :: Entities + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% @@ -25,9 +25,11 @@ import fr.ifremer.echobase.entities.EchoBaseDAOHelper; import fr.ifremer.echobase.entities.EchoBaseEntityEnum; +import fr.ifremer.echobase.entities.EchoBaseUserImpl; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; import org.nuiton.topia.TopiaRuntimeException; +import org.nuiton.topia.framework.TopiaContextImplementor; import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.topia.persistence.TopiaPersistenceHelper; @@ -58,4 +60,20 @@ public <E extends TopiaEntity> TopiaDAO<E> getDAO(TopiaContext tx, EchoBaseEntityEnum type) { return (TopiaDAO<E>) getDAO(tx, type.getContract()); } + + /** + * Tests if the internal database schema created. + * + * @param tx transaction + * @return {@code true} if the schema is already created, {@code false} + * otherwise + * @throws TopiaException if something was wrong while requesting database + */ + public boolean isInternalSchemaCreated(TopiaContext tx) throws TopiaException { + + boolean schemaFound = + ((TopiaContextImplementor) tx).isSchemaExist(EchoBaseUserImpl.class); + + return schemaFound; + } } Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,8 +1,32 @@ package fr.ifremer.echobase.persistence; +/* + * #%L + * EchoBase :: Domain + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + import com.google.common.base.Charsets; import fr.ifremer.echobase.EchoBaseConfiguration; import fr.ifremer.echobase.EchoBaseConfigurationOption; +import fr.ifremer.echobase.entities.DriverType; import fr.ifremer.echobase.entities.EchoBaseDAOHelper; import fr.ifremer.echobase.entities.EchoBaseInternalDAOHelper; import org.apache.commons.logging.Log; @@ -45,26 +69,17 @@ public static Properties loadWorkingDbConfiguration(JdbcConfiguration jdbcConfiguration) { Properties result = new RecursiveProperties(); - Class<?> driverType; - Class<?> dialectType; - switch (jdbcConfiguration.getDriverType()) { - case H2: - driverType = org.h2.Driver.class; - dialectType = org.hibernate.dialect.H2Dialect.class; - break; - case POSTGRESQL: - driverType = org.postgresql.Driver.class; - dialectType = org.hibernate.dialect.PostgreSQLDialect.class; - break; - default: - throw new IllegalStateException("Could not find driver..."); - } + DriverType driverType = + jdbcConfiguration.getDriverType(); result.setProperty("configuration.url", jdbcConfiguration.getUrl()); result.setProperty("configuration.login", jdbcConfiguration.getLogin()); - result.setProperty("configuration.password", jdbcConfiguration.getPassword()); - result.setProperty("configuration.driver", driverType.getName()); - result.setProperty("configuration.dialect", dialectType.getName()); + result.setProperty("configuration.password", + jdbcConfiguration.getPassword()); + result.setProperty("configuration.driver", + driverType.getDriverClass().getName()); + result.setProperty("configuration.dialect", + driverType.getDialectClass().getName()); loadProperties(result, USER_DB_PROPERTIES, EchoBaseDAOHelper.getImplementationClassesAsString()); Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/EchobaseTopiaContexts.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/persistence/JdbcConfiguration.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,6 +1,6 @@ /* * #%L - * T3 :: Domain + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% @@ -22,16 +22,13 @@ */ package fr.ifremer.echobase.persistence; +import fr.ifremer.echobase.entities.DriverType; + import java.io.File; import java.io.Serializable; public class JdbcConfiguration implements Serializable { - public enum DriverType { - H2, - POSTGRESQL - } - public static JdbcConfiguration newConfig(String url, String login, String password, @@ -75,7 +72,7 @@ /** Jdbc driver. */ protected DriverType driverType; - private JdbcConfiguration() { + protected JdbcConfiguration() { // avoid constructor (use the static factory methods) } Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/AbstractEchobaseActionConfiguration.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/DefaultEchoBaseServiceContext.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseService.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceContext.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/EchoBaseServiceSupport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ProgressionModel.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Services - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java =================================================================== --- trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,5 +1,28 @@ package fr.ifremer.echobase.services; +/* + * #%L + * EchoBase :: Domain + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + /** * Contract to provide some services. * Property changes on: trunk/echobase-domain/src/main/java/fr/ifremer/echobase/services/ServiceFactoryAware.java ___________________________________________________________________ Modified: svn:keywords - Author Date Id Revision + Author Date Id Revision HeadURL Modified: trunk/echobase-domain/src/main/resources/echobase-internaldb.properties =================================================================== --- trunk/echobase-domain/src/main/resources/echobase-internaldb.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/resources/echobase-internaldb.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,6 +1,6 @@ ### # #%L -# T3 :: Domain +# EchoBase :: Domain # $Id$ # $HeadURL$ # %% @@ -28,5 +28,5 @@ hibernate.connection.username=sa hibernate.connection.password=sa hibernate.connection.driver_class=org.h2.Driver -hibernate.connection.url=jdbc:h2:file:${internal.db.directory}/echobase-user +hibernate.connection.url=jdbc:h2:file:${echobase.internal.db.directory}/echobase-user Modified: trunk/echobase-domain/src/main/resources/echobase-workingdb.properties =================================================================== --- trunk/echobase-domain/src/main/resources/echobase-workingdb.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/resources/echobase-workingdb.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,6 +1,6 @@ ### # #%L -# T3 :: Domain +# EchoBase :: Domain # $Id$ # $HeadURL$ # %% Copied: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties (from rev 588, trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties) =================================================================== --- trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties (rev 0) +++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,59 @@ +echobase.common.admin= +echobase.common.areaOfOperation= +echobase.common.author= +echobase.common.authorEmail= +echobase.common.calibration= +echobase.common.cell= +echobase.common.data= +echobase.common.dataAcquisition= +echobase.common.dataCentre= +echobase.common.dataCentreEmail= +echobase.common.dataProcessing= +echobase.common.dataQuality= +echobase.common.datum= +echobase.common.depthStratum= +echobase.common.description= +echobase.common.distributionStatement= +echobase.common.driverType.h2= +echobase.common.driverType.postgres= +echobase.common.echoBaseUser= +echobase.common.email= +echobase.common.entityId= +echobase.common.entityModificationLog= +echobase.common.entityType= +echobase.common.exportQuery= +echobase.common.id= +echobase.common.institution= +echobase.common.keywords= +echobase.common.lastModifiedDate= +echobase.common.lastModifiedUser= +echobase.common.litteratureReferences= +echobase.common.metadata= +echobase.common.mission= +echobase.common.missionAbstract= +echobase.common.modificationDate= +echobase.common.modificationText= +echobase.common.modificationUser= +echobase.common.name= +echobase.common.organisationLevelAcknowledgements= +echobase.common.organisationReferences= +echobase.common.password= +echobase.common.platform= +echobase.common.principalInvestigator= +echobase.common.principalInvestigatorEmail= +echobase.common.project= +echobase.common.referenceDatum= +echobase.common.source= +echobase.common.species= +echobase.common.sqlQuery= +echobase.common.transect= +echobase.common.transit= +echobase.common.vessel= +echobase.common.voyage= +echobase.config.csv.separator.description= +echobase.config.data.directory.description= +echobase.config.embedded.description= +echobase.config.internal.db.directory.description= +echobase.config.version.description= +echobase.config.war.directory.description= +echobase.config.war.location.description= Property changes on: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_en_GB.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Copied: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties (from rev 588, trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties) =================================================================== --- trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties (rev 0) +++ trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,59 @@ +echobase.common.admin=Administrateur +echobase.common.areaOfOperation=AreaOfOperation +echobase.common.author=Auteur +echobase.common.authorEmail=Courriel de l'auteur +echobase.common.calibration=Calibration +echobase.common.cell=Cell +echobase.common.data=Data +echobase.common.dataAcquisition=DataAcquisition +echobase.common.dataCentre=Centre de données +echobase.common.dataCentreEmail=Courriel du centre de données +echobase.common.dataProcessing=DataProcessing +echobase.common.dataQuality=DataQuality +echobase.common.datum=Datum +echobase.common.depthStratum=DepthStratum +echobase.common.description=Description +echobase.common.distributionStatement=distributionStatement +echobase.common.driverType.h2=Base H2 +echobase.common.driverType.postgres=Base Postgresql +echobase.common.echoBaseUser=Utilisateur +echobase.common.email=Courriel +echobase.common.entityId=Identifiant de l'entité +echobase.common.entityModificationLog=Journal des modifications +echobase.common.entityType=Type de l'entité +echobase.common.exportQuery=Requête d'export +echobase.common.id=Identifiant +echobase.common.institution=Institution +echobase.common.keywords=Môts clefs +echobase.common.lastModifiedDate=Date de dernière modification +echobase.common.lastModifiedUser=Utilisateur de dernière modification +echobase.common.litteratureReferences=Références +echobase.common.metadata=Metadata +echobase.common.mission=Mission +echobase.common.missionAbstract=Résumé de la mission +echobase.common.modificationDate=Date de modification +echobase.common.modificationText=Modification +echobase.common.modificationUser=Utilisateur +echobase.common.name=Nom +echobase.common.organisationLevelAcknowledgements=organisationLevelAcknowledgements +echobase.common.organisationReferences=Références organisation +echobase.common.password=Mot de passe +echobase.common.platform=Platform +echobase.common.principalInvestigator=Chercheur +echobase.common.principalInvestigatorEmail=Courriel du chercheur +echobase.common.project=Projet +echobase.common.referenceDatum=ReferenceDatum +echobase.common.source=Source +echobase.common.species=Espèce +echobase.common.sqlQuery=Requête SQL +echobase.common.transect=Transect +echobase.common.transit=Transit +echobase.common.vessel=Navire +echobase.common.voyage=Campagne +echobase.config.csv.separator.description= +echobase.config.data.directory.description=Répertoire des données de l'application +echobase.config.embedded.description= +echobase.config.internal.db.directory.description=Répertoire de la base interna +echobase.config.version.description=Version de l'application +echobase.config.war.directory.description=Répertoire où sont accessibles les wars +echobase.config.war.location.description=chemin d'accèss au war embarqué à utiliser pour créer des applications embarquées Property changes on: trunk/echobase-domain/src/main/resources/i18n/echobase-domain_fr_FR.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties =================================================================== --- trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/resources/i18n/echobase-entities_en_GB.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,52 +0,0 @@ -echobase.common.admin= -echobase.common.areaOfOperation= -echobase.common.author= -echobase.common.authorEmail= -echobase.common.calibration= -echobase.common.cell= -echobase.common.data= -echobase.common.dataAcquisition= -echobase.common.dataCentre= -echobase.common.dataCentreEmail= -echobase.common.dataProcessing= -echobase.common.dataQuality= -echobase.common.datum= -echobase.common.depthStratum= -echobase.common.description= -echobase.common.distributionStatement= -echobase.common.echoBaseUser= -echobase.common.email= -echobase.common.entityId= -echobase.common.entityModificationLog= -echobase.common.entityType= -echobase.common.exportQuery= -echobase.common.id= -echobase.common.institution= -echobase.common.keywords= -echobase.common.lastModifiedDate= -echobase.common.lastModifiedUser= -echobase.common.litteratureReferences= -echobase.common.metadata= -echobase.common.mission= -echobase.common.missionAbstract= -echobase.common.modificationDate= -echobase.common.modificationText= -echobase.common.modificationUser= -echobase.common.name= -echobase.common.organisationLevelAcknowledgements= -echobase.common.organisationReferences= -echobase.common.password= -echobase.common.platform= -echobase.common.principalInvestigator= -echobase.common.principalInvestigatorEmail= -echobase.common.project= -echobase.common.referenceDatum= -echobase.common.source= -echobase.common.species= -echobase.common.sqlQuery= -echobase.common.transect= -echobase.common.transit= -echobase.common.vessel= -echobase.common.voyage= -echobase.config.data.directory.description= -echobase.config.internal.db.directory.description= Deleted: trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties =================================================================== --- trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/resources/i18n/echobase-entities_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,52 +0,0 @@ -echobase.common.admin=Administrateur -echobase.common.areaOfOperation=AreaOfOperation -echobase.common.author=Auteur -echobase.common.authorEmail=Courriel de l'auteur -echobase.common.calibration=Calibration -echobase.common.cell=Cell -echobase.common.data=Data -echobase.common.dataAcquisition=DataAcquisition -echobase.common.dataCentre=Centre de données -echobase.common.dataCentreEmail=Courriel du centre de données -echobase.common.dataProcessing=DataProcessing -echobase.common.dataQuality=DataQuality -echobase.common.datum=Datum -echobase.common.depthStratum=DepthStratum -echobase.common.description=Description -echobase.common.distributionStatement=distributionStatement -echobase.common.echoBaseUser=Utilisateur -echobase.common.email=Courriel -echobase.common.entityId=Identifiant de l'entité -echobase.common.entityModificationLog=Journal des modifications -echobase.common.entityType=Type de l'entité -echobase.common.exportQuery=Requête d'export -echobase.common.id=Identifiant -echobase.common.institution=Institution -echobase.common.keywords=Môts clefs -echobase.common.lastModifiedDate=Date de dernière modification -echobase.common.lastModifiedUser=Utilisateur de dernière modification -echobase.common.litteratureReferences=Références -echobase.common.metadata=Metadata -echobase.common.mission=Mission -echobase.common.missionAbstract=Résumé de la mission -echobase.common.modificationDate=Date de modification -echobase.common.modificationText=Modification -echobase.common.modificationUser=Utilisateur -echobase.common.name=Nom -echobase.common.organisationLevelAcknowledgements=organisationLevelAcknowledgements -echobase.common.organisationReferences=Références organisation -echobase.common.password=Mot de passe -echobase.common.platform=Platform -echobase.common.principalInvestigator=Chercheur -echobase.common.principalInvestigatorEmail=Courriel du chercheur -echobase.common.project=Projet -echobase.common.referenceDatum=ReferenceDatum -echobase.common.source=Source -echobase.common.species=Espèce -echobase.common.sqlQuery=Requête SQL -echobase.common.transect=Transect -echobase.common.transit=Transit -echobase.common.vessel=Navire -echobase.common.voyage=Campagne -echobase.config.data.directory.description=Chemin de l'application -echobase.config.internal.db.directory.description= Modified: trunk/echobase-domain/src/main/xmi/echobase-internal.properties =================================================================== --- trunk/echobase-domain/src/main/xmi/echobase-internal.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/xmi/echobase-internal.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ ### # #%L -# EchoBase :: Entities -# +# EchoBase :: Domain # $Id$ # $HeadURL$ # %% @@ -51,18 +50,27 @@ fr.ifremer.echobase.entities.EchoBaseUser.class.tagValue.naturalIdMutable=true fr.ifremer.echobase.entities.EchoBaseUser.attribute.email.tagValue.naturalId=true + +fr.ifremer.echobase.entities.ExportQuery.class.tagValue.naturalIdMutable=true +fr.ifremer.echobase.entities.ExportQuery.attribute.name.tagValue.naturalId=true + +fr.ifremer.echobase.entities.WorkingDbConfiguration.class.tagValue.naturalIdMutable=true +fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.url.tagValue.naturalId=true +fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.driverType.tagValue.naturalId=true + +############################################################################### +### Not Null ################################################################## +############################################################################### + fr.ifremer.echobase.entities.EchoBaseUser.attribute.email.tagValue.notNull=true fr.ifremer.echobase.entities.EchoBaseUser.attribute.password.tagValue.notNull=true -fr.ifremer.echobase.entities.ExportQuery.class.tagValue.naturalIdMutable=true -fr.ifremer.echobase.entities.ExportQuery.attribute.name.tagValue.naturalId=true fr.ifremer.echobase.entities.ExportQuery.attribute.description.tagValue.notNull=true fr.ifremer.echobase.entities.ExportQuery.attribute.sqlQuery.tagValue.notNull=true fr.ifremer.echobase.entities.ExportQuery.attribute.lastModifiedDate.tagValue.notNull=true fr.ifremer.echobase.entities.ExportQuery.attribute.lastModifiedUser.tagValue.notNull=true -fr.ifremer.echobase.entities.WorkingDbConfiguration.class.tagValue.naturalIdMutable=true -fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.url.tagValue.naturalId=true fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.url.tagValue.notNull=true -fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.login.tagValue.naturalId=true -fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.login.tagValue.notNull=true \ No newline at end of file +fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.login.tagValue.notNull=true +fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.description.tagValue.notNull=true +fr.ifremer.echobase.entities.WorkingDbConfiguration.attribute.driverType.tagValue.notNull=true Modified: trunk/echobase-domain/src/main/xmi/echobase-internal.zargo =================================================================== (Binary files differ) Modified: trunk/echobase-domain/src/main/xmi/echobase.properties =================================================================== --- trunk/echobase-domain/src/main/xmi/echobase.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/main/xmi/echobase.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ ### # #%L -# EchoBase :: Entities -# +# EchoBase :: Domain # $Id$ # $HeadURL$ # %% Modified: trunk/echobase-domain/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java =================================================================== --- trunk/echobase-domain/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/test/java/fr/ifremer/echobase/EchoBaseDateConverterTest.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java =================================================================== --- trunk/echobase-domain/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/test/java/fr/ifremer/echobase/persistence/EchoBaseDbMetaTest.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ /* * #%L - * EchoBase :: Entities - * + * EchoBase :: Domain * $Id$ * $HeadURL$ * %% Modified: trunk/echobase-domain/src/test/resources/log4j.properties =================================================================== --- trunk/echobase-domain/src/test/resources/log4j.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-domain/src/test/resources/log4j.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,7 +1,6 @@ ### # #%L -# EchoBase :: Entities -# +# EchoBase :: Domain # $Id$ # $HeadURL$ # %% Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/UserService.java 2012-09-02 15:11:02 UTC (rev 589) @@ -27,7 +27,6 @@ import fr.ifremer.echobase.EchoBaseTechnicalException; import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.entities.EchoBaseUserDAO; -import fr.ifremer.echobase.entities.EchoBaseUserImpl; import org.apache.commons.lang3.StringUtils; import org.nuiton.topia.TopiaException; import org.nuiton.topia.persistence.TopiaFilterPagerUtil; @@ -55,7 +54,7 @@ public List<EchoBaseUser> getUsers(TopiaFilterPagerUtil.FilterPagerBean pager) { try { - EchoBaseUserDAO dao = getDAO(EchoBaseUser.class, EchoBaseUserDAO.class); + EchoBaseUserDAO dao = getDAO(); List<EchoBaseUser> users = dao.findAll(pager); return users; } catch (TopiaException eee) { @@ -66,7 +65,7 @@ public EchoBaseUser getUserByEmail(String email) { Preconditions.checkNotNull(email); try { - EchoBaseUserDAO dao = getDAO(EchoBaseUser.class, EchoBaseUserDAO.class); + EchoBaseUserDAO dao = getDAO(); EchoBaseUser user = dao.findByEmail(email); return user; } catch (TopiaException eee) { @@ -77,8 +76,7 @@ public EchoBaseUser getUserById(String userId) { Preconditions.checkNotNull(userId); try { - EchoBaseUserDAO dao = getDAO(EchoBaseUser.class, EchoBaseUserDAO.class); - EchoBaseUser user = dao.findByTopiaId(userId); + EchoBaseUser user = getDAO().findByTopiaId(userId); EchoBaseUser result = newUser(); result.setEmail(user.getEmail()); result.setPassword(user.getPassword()); @@ -91,14 +89,13 @@ public void createOrUpdate(EchoBaseUser user) { try { - EchoBaseUserDAO dao = getDAO(EchoBaseUser.class, EchoBaseUserDAO.class); EchoBaseUser userToCreateOrUpdate; // No id, creating new one entity String id = user.getTopiaId(); String password = user.getPassword(); if (StringUtils.isEmpty(id)) { - userToCreateOrUpdate = dao.create( + userToCreateOrUpdate = getDAO().create( EchoBaseUser.PROPERTY_EMAIL, user.getEmail(), EchoBaseUser.PROPERTY_PASSWORD, encodePassword(password) ); @@ -121,7 +118,7 @@ try { EchoBaseUser userToDelete = getEntityById(EchoBaseUser.class, user.getTopiaId()); - getDAO(EchoBaseUser.class).delete(userToDelete); + getDAO().delete(userToDelete); commitInternalTransaction("Could not delete user"); } catch (TopiaException eee) { throw new EchoBaseTechnicalException(eee); @@ -137,13 +134,13 @@ public void createDefaultUsers() { EchoBaseUser user; - user = new EchoBaseUserImpl(); + user = newUser(); user.setEmail(DEFAULT_ADMIN_EMAIL); user.setPassword(DEFAULT_ADMIN_PASSWORD); user.setAdmin(true); createOrUpdate(user); - user = new EchoBaseUserImpl(); + user = newUser(); user.setEmail(DEFAULT_USER_EMAIL); user.setPassword(DEFAULT_USER_PASSWORD); user.setAdmin(false); @@ -156,6 +153,14 @@ } public EchoBaseUser newUser() { - return new EchoBaseUserImpl(); + try { + return getDAO().newInstance(); + } catch (TopiaException e) { + throw new EchoBaseTechnicalException(e); + } } + + protected EchoBaseUserDAO getDAO() { + return getDAO(EchoBaseUser.class, EchoBaseUserDAO.class); + } } Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/embeddedapplication/EmbeddedApplicationService.java 2012-09-02 15:11:02 UTC (rev 589) @@ -25,19 +25,20 @@ import com.google.common.base.Charsets; import com.google.common.base.Preconditions; +import fr.ifremer.echobase.EchoBaseTechnicalException; +import fr.ifremer.echobase.entities.EchoBaseUser; +import fr.ifremer.echobase.entities.ExportQuery; import fr.ifremer.echobase.io.EchoBaseIOUtil; -import fr.ifremer.echobase.EchoBaseTechnicalException; +import fr.ifremer.echobase.entities.DriverType; import fr.ifremer.echobase.persistence.EchobaseTopiaContexts; import fr.ifremer.echobase.persistence.JdbcConfiguration; -import fr.ifremer.echobase.entities.EchoBaseUser; -import fr.ifremer.echobase.entities.ExportQuery; import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext; import fr.ifremer.echobase.services.EchoBaseServiceContext; import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.UserService; -import fr.ifremer.echobase.services.exportquery.ExportQueryNameAlreadyExistException; import fr.ifremer.echobase.services.exportdb.ExportDbConfiguration; import fr.ifremer.echobase.services.exportdb.ExportDbService; +import fr.ifremer.echobase.services.exportquery.ExportQueryNameAlreadyExistException; import fr.ifremer.echobase.services.exportquery.ExportQueryService; import fr.ifremer.echobase.services.importdb.ImportDbConfiguration; import fr.ifremer.echobase.services.importdb.ImportDbService; @@ -261,15 +262,15 @@ return driverDir; } - public String getH2PilotFilename(Properties config) { - String h2Version = config.getProperty("h2Version"); - return h2Version == null ? null : "h2-" + h2Version + ".jar"; - } +// public String getH2PilotFilename(Properties config) { +// String h2Version = config.getProperty("h2Version"); +// return h2Version == null ? null : "h2-" + h2Version + ".jar"; +// } - public String getPostgresqlPilotFilename(Properties config) { - String pgVersion = config.getProperty("postgresqlVersion"); - return pgVersion == null ? null : "postgresql-" + pgVersion + ".jar"; - } +// public String getPostgresqlPilotFilename(Properties config) { +// String pgVersion = config.getProperty("postgresqlVersion"); +// return pgVersion == null ? null : "postgresql-" + pgVersion + ".jar"; +// } protected void copyEmbeddedFiles(File zipDirectory) throws IOException, URISyntaxException { @@ -283,8 +284,8 @@ File driverDir = getPilotsDirectory(zipDirectory); FileUtil.createDirectoryIfNecessary(driverDir); - copyEmbeddedFiles(getH2PilotFilename(config), driverDir, null); - copyEmbeddedFiles(getPostgresqlPilotFilename(config), driverDir, null); + copyEmbeddedFiles(DriverType.H2.getPilotFileName(config), driverDir, null); + copyEmbeddedFiles(DriverType.POSTGRESQL.getPilotFileName(config), driverDir, null); } protected void copyEmbeddedFiles(String resourceName, Modified: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/exportquery/ExportQueryService.java 2012-09-02 15:11:02 UTC (rev 589) @@ -24,18 +24,13 @@ package fr.ifremer.echobase.services.exportquery; import com.google.common.base.Charsets; -import com.google.common.collect.Lists; import fr.ifremer.echobase.EchoBaseTechnicalException; import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.entities.ExportQuery; import fr.ifremer.echobase.entities.ExportQueryDAO; -import fr.ifremer.echobase.entities.ExportQueryImpl; import fr.ifremer.echobase.services.EchoBaseServiceSupport; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.persistence.TopiaDAO; import org.nuiton.util.PagerUtil; import org.nuiton.util.csv.Export; @@ -50,9 +45,6 @@ */ public class ExportQueryService extends EchoBaseServiceSupport { - /** Logger. */ - private static final Log log = LogFactory.getLog(ExportQueryService.class); - public ExportQuery getExportQuery(String topiaId) { ExportQuery exportQuery = getEntityById(ExportQuery.class, topiaId); ExportQuery entityToSave = newExportQuery(); @@ -69,8 +61,7 @@ EchoBaseUser user) throws ExportQueryNameAlreadyExistException { try { - ExportQueryDAO dao = getDAO(ExportQuery.class, - ExportQueryDAO.class); + ExportQueryDAO dao = getDAO(); // No id, creating new one entity String id = exportQuery.getTopiaId(); @@ -79,28 +70,9 @@ String queryName = exportQuery.getName(); - - String hql = "FROM " + dao.getTopiaEntityEnum().getImplementationFQN() + - " WHERE " + ExportQuery.PROPERTY_NAME + " = :queryName"; - List<Object> params = Lists.<Object>newArrayList("queryName", queryName); - - if (!mustCreate) { - hql += " AND " + ExportQuery.TOPIA_ID + " = :id"; - params.add("id"); - params.add(id); - } -// TopiaQuery query = dao.createQuery(); -// query.addWhere(ExportQuery.PROPERTY_NAME, TopiaQuery.Op.EQ, queryName); -// -// if (!mustCreate) { -// query.addWhere(ExportQuery.TOPIA_ID, TopiaQuery.Op.NEQ, id); -// } - // check query does not already exists with this name - boolean queryExists = dao.existsByQuery("SELECT COUNT(*) " + hql, params.toArray()); + boolean queryExists = dao.isQueryExists(id, queryName); -// boolean queryExists = dao.existByQuery(query); - if (queryExists) { throw new ExportQueryNameAlreadyExistException(); } @@ -131,7 +103,8 @@ public void delete(String topiaId) { try { - TopiaDAO<ExportQuery> dao = getDAO(ExportQuery.class); + ExportQueryDAO dao = getDAO(); + ExportQuery entityToDelete = dao.findByTopiaId(topiaId); dao.delete(entityToDelete); @@ -206,7 +179,11 @@ } public ExportQuery newExportQuery() { - return new ExportQueryImpl(); + try { + return getDAO().newInstance(); + } catch (TopiaException e) { + throw new EchoBaseTechnicalException(e); + } } public String processLibreOfficeSqlQuery(String libreOfficeQuery) { @@ -215,4 +192,9 @@ return result; } + protected ExportQueryDAO getDAO() { + return getDAO(ExportQuery.class, + ExportQueryDAO.class); + } + } Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,35 @@ +package fr.ifremer.echobase.services.workingDb; + +/* + * #%L + * EchoBase :: Services + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class WorkingDbConfigurationAlreadyExistException extends Exception { + + private static final long serialVersionUID = 1L; +} \ No newline at end of file Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationAlreadyExistException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,35 @@ +package fr.ifremer.echobase.services.workingDb; + +/* + * #%L + * EchoBase :: Services + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +/** + * TODO + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class WorkingDbConfigurationNotFoundException extends Exception { + + private static final long serialVersionUID = 1L; +} \ No newline at end of file Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationNotFoundException.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java =================================================================== --- trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java (rev 0) +++ trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,132 @@ +package fr.ifremer.echobase.services.workingDb; + +/* + * #%L + * EchoBase :: Services + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.google.common.base.Preconditions; +import fr.ifremer.echobase.EchoBaseTechnicalException; +import fr.ifremer.echobase.entities.WorkingDbConfiguration; +import fr.ifremer.echobase.entities.WorkingDbConfigurationDAO; +import fr.ifremer.echobase.services.EchoBaseServiceSupport; +import org.nuiton.topia.TopiaException; + +import java.util.List; + +/** + * To manager {@link WorkingDbConfiguration}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class WorkingDbConfigurationService extends EchoBaseServiceSupport { + + public List<WorkingDbConfiguration> getWorkingDbConfigurations() { + try { + List<WorkingDbConfiguration> result = getDAO().findAll(); + return result; + } catch (TopiaException eee) { + throw new EchoBaseTechnicalException(eee); + } + } + + public WorkingDbConfiguration getConfigurationByUrl(String url) { + Preconditions.checkNotNull(url); + try { + WorkingDbConfiguration result = getDAO().findByUrl(url); + return result; + } catch (TopiaException eee) { + throw new EchoBaseTechnicalException(eee); + } + } + + public WorkingDbConfiguration getEditableConf(String id) throws WorkingDbConfigurationNotFoundException { + WorkingDbConfiguration entity = getExistingConf(id); + WorkingDbConfiguration result = newConfiguration(); + result.setTopiaId(entity.getTopiaId()); + result.setDescription(entity.getDescription()); + result.setDriverType(entity.getDriverType()); + result.setLogin(entity.getLogin()); + result.setUrl(entity.getUrl()); + return result; + } + + public WorkingDbConfiguration create(WorkingDbConfiguration conf) throws WorkingDbConfigurationAlreadyExistException { + try { + + // check not already exists ? + boolean exists = isUrlAlreadyUsed(conf.getUrl()); + if (exists) { + throw new WorkingDbConfigurationAlreadyExistException(); + } + + WorkingDbConfiguration result = getDAO().create(conf); + + commitInternalTransaction("Could not create working db configuration"); + return result; + } catch (TopiaException eee) { + throw new EchoBaseTechnicalException(eee); + } + } + + public void delete(String id) throws WorkingDbConfigurationNotFoundException { + try { + WorkingDbConfiguration entity = getExistingConf(id); + getDAO().delete(entity); + commitInternalTransaction("Could not delete working db configuration"); + } catch (TopiaException eee) { + throw new EchoBaseTechnicalException(eee); + } + } + + + public WorkingDbConfiguration newConfiguration() { + try { + return getDAO().newInstance(); + } catch (TopiaException e) { + throw new EchoBaseTechnicalException(e); + } + } + + public boolean isUrlAlreadyUsed(String url) { + try { + return getDAO().existByProperties( + WorkingDbConfiguration.PROPERTY_URL, url); + } catch (TopiaException e) { + throw new EchoBaseTechnicalException(e); + } + } + + protected WorkingDbConfiguration getExistingConf(String id) throws WorkingDbConfigurationNotFoundException { + WorkingDbConfiguration entity = + getEntityById(WorkingDbConfiguration.class, id); + if (entity == null) { + throw new WorkingDbConfigurationNotFoundException(); + } + return entity; + } + + protected WorkingDbConfigurationDAO getDAO() { + return getDAO(WorkingDbConfiguration.class, + WorkingDbConfigurationDAO.class); + } +} \ No newline at end of file Property changes on: trunk/echobase-services/src/main/java/fr/ifremer/echobase/services/workingDb/WorkingDbConfigurationService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/echobase-services/src/main/resources/embedded/echobase.properties =================================================================== --- trunk/echobase-services/src/main/resources/embedded/echobase.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-services/src/main/resources/embedded/echobase.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -32,11 +32,12 @@ data.directory=. # where to find war -war.directory=${data.directory} +war.directory=${echobase.data.directory} +#FIXME use instead an working db configuration # Database configuration -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.connection.driver_class=org.h2.Driver -hibernate.connection.username=sa -hibernate.connection.password=sa -hibernate.connection.url=jdbc:h2:file:${data.directory}/db/echobase;CACHE_SIZE=65536;AUTO_SERVER=TRUE +#hibernate.dialect=org.hibernate.dialect.H2Dialect +#hibernate.connection.driver_class=org.h2.Driver +#hibernate.connection.username=sa +#hibernate.connection.password=sa +#hibernate.connection.url=jdbc:h2:file:${data.directory}/db/echobase;CACHE_SIZE=65536;AUTO_SERVER=TRUE Modified: trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties =================================================================== --- trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-services/src/main/resources/i18n/echobase-services_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -45,6 +45,6 @@ echobase.importError.transit.notfound=Transit non trouvé pour la campagne %s et la date %s (ligne %s) echobase.importLabel.withFile=%s avec le fichier %s echobase.info.modifiedProperty=Propriété '%s', ancienne valeur \: '%s', nouvelle valeur \: '%s' -echobase.info.newEntityCreated= +echobase.info.newEntityCreated=Une nouvelle entité à été créée (%s) echobase.info.onePropertyModified=Une propriété a été modifiée \: echobase.info.somePropertiesModified=%s propriétés ont été modifiées \: Modified: trunk/echobase-ui/pom.xml =================================================================== --- trunk/echobase-ui/pom.xml 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/pom.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -1,6 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> @@ -96,16 +98,24 @@ <pluginManagement> <plugins> + <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <configuration> <stopKey>A</stopKey> <stopPort>1269</stopPort> + <contextXml>${basedir}/src/main/env/jetty-context.xml</contextXml> <webAppConfig> <contextPath>/echobase</contextPath> </webAppConfig> <jvmArgs>-Xms512m -Xmx1512m</jvmArgs> + <systemProperties> + <systemProperty> + <name>echobase.log.dir</name> + <value>${project.build.directory}/echobase.log</value> + </systemProperty> + </systemProperties> </configuration> </plugin> @@ -114,10 +124,30 @@ <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <path>/echobase</path> + <uriEncoding>UTF-8</uriEncoding> + <systemProperties> + <echobase.log.dir> + ${project.build.directory}/echobase.log + </echobase.log.dir> + </systemProperties> </configuration> </plugin> <plugin> + <groupId>org.apache.tomcat.maven</groupId> + <artifactId>tomcat6-maven-plugin</artifactId> + <configuration> + <path>/echobase</path> + <uriEncoding>UTF-8</uriEncoding> + <systemProperties> + <echobase.log.dir> + ${project.build.directory}/echobase.log + </echobase.log.dir> + </systemProperties> + </configuration> + </plugin> + + <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <archive> Added: trunk/echobase-ui/src/main/env/dev/resources/log4j.properties =================================================================== --- trunk/echobase-ui/src/main/env/dev/resources/log4j.properties (rev 0) +++ trunk/echobase-ui/src/main/env/dev/resources/log4j.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,33 @@ +### +# #%L +# T3 :: Web +# +# $Id$ +# $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/env/dev/resources/log... $ +# %% +# Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### +# Global logging configuration +log4j.rootLogger=WARN, stdout + +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=[%t] %d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n + +# package level +log4j.logger.fr.ifremer=INFO Property changes on: trunk/echobase-ui/src/main/env/dev/resources/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Deleted: trunk/echobase-ui/src/main/env/dev/resources/log4j.xml =================================================================== --- trunk/echobase-ui/src/main/env/dev/resources/log4j.xml 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/env/dev/resources/log4j.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - #%L - EchoBase :: UI - - $Id$ - $HeadURL$ - %% - Copyright (C) 2011 - 2012 Ifremer, Codelutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --> - -<!DOCTYPE log4j:configuration SYSTEM - "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"> -<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> - - <!-- ================================= --> - <!-- Preserve messages in a local file --> - <!-- ================================= --> - - <!-- A time/date based rolling appender --> - <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="${echobase.log.dir}/echobase.log"/> - <param name="Append" value="false"/> - <param name="DatePattern" value="'.'yyyy-MM-dd"/> - - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/> - </layout> - </appender> - - <!-- ============================== --> - <!-- Append messages to the console --> - <!-- ============================== --> - - <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> - <param name="Target" value="System.out"/> - - <layout class="org.apache.log4j.PatternLayout"> - <!-- The default pattern: Date Priority [Category] Message\n --> - <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c] %m%n"/> - </layout> - </appender> - - <logger name="org.nuiton"> - <level value="WARN"/> - </logger> - - <root> - <priority value="INFO"/> - <appender-ref ref="FILE"/> - <appender-ref ref="CONSOLE"/> - </root> - -</log4j:configuration> Added: trunk/echobase-ui/src/main/env/jetty-context.xml =================================================================== --- trunk/echobase-ui/src/main/env/jetty-context.xml (rev 0) +++ trunk/echobase-ui/src/main/env/jetty-context.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + #%L + Pollen :: UI (struts2) + $Id$ + $HeadURL: http://svn.chorem.org/svn/pollen/trunk/pollen-ui-struts2/src/jetty/jetty-con... $ + %% + Copyright (C) 2009 - 2012 CodeLutin, Tony Chemit + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> + +<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://www.eclipse.org/jetty/configure.dtd"> + +<Configure class="org.eclipse.jetty.webapp.WebAppContext"> + <Call name="setAttribute"> + <Arg>org.eclipse.jetty.server.webapp.WebInfIncludeJarPattern</Arg> + <Arg>.*/.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg> + </Call> +</Configure> \ No newline at end of file Property changes on: trunk/echobase-ui/src/main/env/jetty-context.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/env/prod/resources/log4j.properties =================================================================== --- trunk/echobase-ui/src/main/env/prod/resources/log4j.properties (rev 0) +++ trunk/echobase-ui/src/main/env/prod/resources/log4j.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,42 @@ +### +# #%L +# T3 :: Web +# +# $Id$ +# $HeadURL: https://svn.mpl.ird.fr/osiris/t3/trunk/t3-web/src/main/env/prod/resources/lo... $ +# %% +# Copyright (C) 2010 - 2012 IRD, Codelutin, Tony Chemit +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### +# Global logging configuration +log4j.rootLogger=ERROR, stdout, file + +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n + +# file output... +log4j.appender.file=org.apache.log4j.RollingFileAppender +log4j.appender.file.File=${echobase.log.dir}/t3.log +log4j.appender.file.MaxFileSize=10MB +log4j.appender.file.MaxBackupIndex=4 +log4j.appender.file.layout=org.apache.log4j.PatternLayout +log4j.appender.file.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n + +log4j.logger.fr.ifremer=INFO +log4j.logger.org.nuiton=WARN +log4j.logger.org.nuiton.topia.migration=INFO Property changes on: trunk/echobase-ui/src/main/env/prod/resources/log4j.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Deleted: trunk/echobase-ui/src/main/env/prod/resources/log4j.xml =================================================================== --- trunk/echobase-ui/src/main/env/prod/resources/log4j.xml 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/env/prod/resources/log4j.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -1,60 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!-- - #%L - EchoBase :: UI - - $Id$ - $HeadURL$ - %% - Copyright (C) 2011 - 2012 Ifremer, Codelutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --> - -<!DOCTYPE log4j:configuration SYSTEM - "http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/xml/doc-files/log4j.dtd"> -<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/' - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://jakarta.apache.org/log4j/ "> - - <!-- ================================= --> - <!-- Preserve messages in a local file --> - <!-- ================================= --> - - <!-- A time/date based rolling appender --> - <appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender"> - <param name="File" value="${echobase.log.dir}/echobase.log"/> - <param name="Append" value="false"/> - <param name="DatePattern" value="'.'yyyy-MM-dd"/> - - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/> - </layout> - </appender> - - <logger name="org"> - <level value="WARN"/> - </logger> - - <logger name="fr.ifremer"> - <level value="INFO"/> - </logger> - - <root> - <priority value="ERROR"/> - <appender-ref ref="FILE"/> - </root> - -</log4j:configuration> Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationContext.java 2012-09-02 15:11:02 UTC (rev 589) @@ -46,22 +46,28 @@ private static final Log log = LogFactory.getLog(EchoBaseApplicationContext.class); + /** Key to store the single instance of the application context */ + private static final String APPLICATION_CONTEXT_PARAMETER = + "echobaseApplicationContext"; + protected EchoBaseConfiguration configuration; protected EchoBaseDbMeta dbMeta; - protected TopiaContext rootContext; - - /** Key to store the single instance of the application context */ - private static final String APPLICATION_CONTEXT_PARAMETER = - "t3ApplicationContext"; - /** Root context for the internal database. */ protected TopiaContext internalRootContext; /** Set of all loggued user sessions to be close at shutdown time. */ - protected Set<EchoBaseSession> t3Sessions; + protected Set<EchoBaseSession> sessions; + /** + * Flag setted to true when internal db was just created (should then + * display in ui created user password). + * + * @since 1.1 + */ + protected boolean defaultUsersCreated; + public static EchoBaseApplicationContext getApplicationContext(ActionContext actionContext) { Map<String, Object> application = actionContext.getApplication(); EchoBaseApplicationContext result = @@ -88,34 +94,34 @@ } public Set<EchoBaseSession> getEchoBaseSessions() { - return t3Sessions; + return sessions; } - public synchronized void registerEchoBaseSession(EchoBaseSession t3Session) { - Preconditions.checkNotNull(t3Session); - Preconditions.checkNotNull(t3Session.getUser()); - if (t3Sessions == null) { - t3Sessions = Sets.newHashSet(); + public synchronized void registerEchoBaseSession(EchoBaseSession session) { + Preconditions.checkNotNull(session); + Preconditions.checkNotNull(session.getUser()); + if (sessions == null) { + sessions = Sets.newHashSet(); } if (log.isInfoEnabled()) { log.info("Register user session for [" + - t3Session.getUser().getEmail() + "]"); + session.getUser().getEmail() + "]"); } - t3Sessions.add(t3Session); + sessions.add(session); } - public synchronized void destroyEchoBaseSession(EchoBaseSession t3Session) { - Preconditions.checkNotNull(t3Session); - Preconditions.checkNotNull(t3Session.getUser()); - Preconditions.checkNotNull(t3Sessions); + public synchronized void destroyEchoBaseSession(EchoBaseSession session) { + Preconditions.checkNotNull(session); + Preconditions.checkNotNull(session.getUser()); + Preconditions.checkNotNull(sessions); if (log.isInfoEnabled()) { log.info("Destroy user session for [" + - t3Session.getUser().getEmail() + "]"); + session.getUser().getEmail() + "]"); } // remove session from active ones - t3Sessions.remove(t3Session); + sessions.remove(session); // close session - t3Session.close(); + session.close(); } public EchoBaseConfiguration getConfiguration() { @@ -126,12 +132,12 @@ this.configuration = configuration; } - public TopiaContext getRootContext() { - return rootContext; + public TopiaContext getInternalRootContext() { + return internalRootContext; } - public void setRootContext(TopiaContext rootContext) { - this.rootContext = rootContext; + public void setInternalRootContext(TopiaContext internalRootContext) { + this.internalRootContext = internalRootContext; } public EchoBaseDbMeta getDbMeta() { @@ -141,4 +147,12 @@ public void setDbMeta(EchoBaseDbMeta dbMeta) { this.dbMeta = dbMeta; } + + public boolean isDefaultUsersCreated() { + return defaultUsersCreated; + } + + public void setDefaultUsersCreated(boolean defaultUsersCreated) { + this.defaultUsersCreated = defaultUsersCreated; + } } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseApplicationListener.java 2012-09-02 15:11:02 UTC (rev 589) @@ -23,12 +23,12 @@ */ package fr.ifremer.echobase.ui; +import com.google.common.base.Preconditions; import fr.ifremer.echobase.EchoBaseConfiguration; +import fr.ifremer.echobase.entities.EchoBaseUser; +import fr.ifremer.echobase.persistence.EchoBaseDbMeta; import fr.ifremer.echobase.persistence.EchoBaseEntityHelper; import fr.ifremer.echobase.persistence.EchobaseTopiaContexts; -import fr.ifremer.echobase.persistence.EchoBaseDbMeta; -import fr.ifremer.echobase.entities.EchoBaseUser; -import fr.ifremer.echobase.entities.EchoBaseUserImpl; import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext; import fr.ifremer.echobase.services.EchoBaseServiceContext; import fr.ifremer.echobase.services.UserService; @@ -42,7 +42,7 @@ import org.nuiton.i18n.init.DefaultI18nInitializer; import org.nuiton.topia.TopiaContext; import org.nuiton.topia.TopiaException; -import org.nuiton.topia.framework.TopiaContextImplementor; +import org.nuiton.topia.TopiaRuntimeException; import org.nuiton.util.converter.ConverterUtil; import javax.servlet.ServletContext; @@ -98,16 +98,21 @@ EchobaseTopiaContexts.newInternalDb(configuration); // initialize application context - EchoBaseApplicationContext applicationContext = new EchoBaseApplicationContext(); + EchoBaseApplicationContext applicationContext = + new EchoBaseApplicationContext(); EchoBaseApplicationContext.setApplicationContext( sce.getServletContext(), applicationContext); applicationContext.setConfiguration(configuration); applicationContext.setDbMeta(EchoBaseDbMeta.newDbMeta()); - applicationContext.setRootContext(internalRootContext); + applicationContext.setInternalRootContext(internalRootContext); // init database (and create minimal admin user if required) - initInternalDatabase(applicationContext); + try { + initInternalDatabase(applicationContext); + } catch (TopiaException e) { + throw new TopiaRuntimeException("Could not init internal db", e); + } } @Override @@ -128,7 +133,7 @@ try { // release internal db TopiaContext rootContext = - applicationContext.getRootContext(); + applicationContext.getInternalRootContext(); EchoBaseEntityHelper.releaseRootContext(rootContext); } finally { @@ -151,67 +156,48 @@ * {@code admin/admin}</li> * </ul> * - * @param applicationContext application context where to store global internal db root context + * @param context application context where to store global internal db root context */ - protected void initInternalDatabase(EchoBaseApplicationContext applicationContext) { + protected void initInternalDatabase(EchoBaseApplicationContext context) throws TopiaException { - EchoBaseConfiguration configuration = - applicationContext.getConfiguration(); + Preconditions.checkNotNull(context); - TopiaContext internalRootContext = applicationContext.getRootContext(); + EchoBaseConfiguration configuration = context.getConfiguration(); + Preconditions.checkNotNull(configuration); - EchoBaseServiceContext serviceContext = DefaultEchoBaseServiceContext.newContext( - Locale.getDefault(), - null, - null, - configuration, - applicationContext.getDbMeta() - ); + EchoBaseDbMeta dbMeta = context.getDbMeta(); + Preconditions.checkNotNull(dbMeta); - try { + TopiaContext rootContext = context.getInternalRootContext(); + Preconditions.checkNotNull(rootContext); - boolean schemaExist = isInternalSchemaCreated(internalRootContext); + boolean schemaExist = dbMeta.getPersistenceHelper().isInternalSchemaCreated(rootContext); - if (schemaExist) { + if (schemaExist) { - if (configuration.isUpdateSchema()) { - if (log.isInfoEnabled()) { - log.info("Will update schema..."); - } - internalRootContext.updateSchema(); - } - } else { + if (configuration.isUpdateSchema()) { if (log.isInfoEnabled()) { - log.info("Will create schema..."); + log.info("Will update schema..."); } - internalRootContext.createSchema(); + rootContext.updateSchema(); } - - } catch (Exception e) { - throw new IllegalStateException("could not start db", e); + } else { + if (log.isInfoEnabled()) { + log.info("Will create schema..."); + } + rootContext.createSchema(); } + TopiaContext tx = rootContext.beginTransaction(); try { - createAdminUser(serviceContext); - - } catch (Exception e) { - throw new IllegalStateException( - "could not create default admin user", e); - } - } - - /** - * Creates the adminsitrator ({@code admin/admin}) on the database. - * - * @param serviceContext service context - * @throws TopiaException if could not create the user. - */ - protected void createAdminUser(EchoBaseServiceContext serviceContext) throws TopiaException { - - TopiaContext transaction = serviceContext.getInternalTransaction().beginTransaction(); - serviceContext.setInternalTransaction(transaction); - try { - + EchoBaseServiceContext serviceContext = + DefaultEchoBaseServiceContext.newContext( + Locale.getDefault(), + tx, + null, + configuration, + dbMeta + ); UserService service = serviceContext.getService(UserService.class); List<EchoBaseUser> users = service.getUsers(); @@ -221,42 +207,13 @@ // no users in database create the admin user if (log.isInfoEnabled()) { log.info("No user in database, will create default " + - "admin user (password admin)."); + "users."); } service.createDefaultUsers(); } } finally { - transaction.closeContext(); + EchoBaseEntityHelper.closeConnection(tx); } } - - /** - * Tests if the internal database schema created. - * - * @param rootContext internal root context - * @return {@code true} if the schema is already created, {@code false} - * otherwise - * @throws TopiaException if something was wrong while requesting database - */ - protected boolean isInternalSchemaCreated(TopiaContext rootContext) throws TopiaException { - - boolean schemaFound = - ((TopiaContextImplementor) rootContext).isSchemaExist(EchoBaseUserImpl.class); - - return schemaFound; - } - - /** - * Try to close the given transaction. - * - * @param tx the transaction to close - * @throws TopiaException if could not close the transaction - */ - protected void closeTransaction(TopiaContext tx) throws TopiaException { - if (tx != null && !tx.isClosed()) { - tx.closeContext(); - } - } - } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseInternalDbTransactionFilter.java 2012-09-02 15:11:02 UTC (rev 589) @@ -60,7 +60,7 @@ EchoBaseApplicationContext applicationContext = EchoBaseActionSupport.getEchoBaseApplicationContext(); - TopiaContext rootContext = applicationContext.getRootContext(); + TopiaContext rootContext = applicationContext.getInternalRootContext(); try { TopiaContext transaction = rootContext.beginTransaction(); if (log.isDebugEnabled()) { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSession.java 2012-09-02 15:11:02 UTC (rev 589) @@ -23,16 +23,14 @@ */ package fr.ifremer.echobase.ui; +import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.opensymphony.xwork2.ActionContext; +import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.persistence.EchoBaseEntityHelper; import fr.ifremer.echobase.persistence.EchobaseTopiaContexts; import fr.ifremer.echobase.persistence.JdbcConfiguration; -import fr.ifremer.echobase.entities.EchoBaseUser; -import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationConfiguration; -import fr.ifremer.echobase.services.exportdb.ExportDbConfiguration; -import fr.ifremer.echobase.services.importdata.AbstractImportConfiguration; -import fr.ifremer.echobase.services.importdb.ImportDbConfiguration; +import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaContext; @@ -40,6 +38,7 @@ import javax.servlet.http.HttpSession; import java.io.Closeable; +import java.io.Serializable; import java.util.Map; import java.util.Set; import java.util.TreeMap; @@ -55,24 +54,27 @@ /** Logger. */ private static final Log log = LogFactory.getLog(EchoBaseSession.class); + /** Key to store the {@link EchoBaseSession} instance in the session's map. */ + private static final String SESSION_PARAMETER = "echoBaseSession"; + /** Key to set User connected in this session. */ - protected static final String PROPERTY_USER = "echobaseUser"; + private static final String PROPERTY_USER = "echobaseUser"; - /** Key to keep import db configuration in this session. */ - protected static final String PROPERTY_IMPORT_DB_CONFIGURATION = "importDbConfiguration"; + /** Key to set root context of working db selected by user (if any). */ + private static final String PROPERTY_WORKING_DB_CONFIGURATION = "workingDbConfiguration"; - /** Key to keep export db configuration in this session. */ - protected static final String PROPERTY_EXPORT_DB_CONFIGURATION = "exportDbConfiguration"; + /** Key to set root context of working db selected by user (if any). */ + private static final String PROPERTY_WORKING_DB_ROOT_CONTEXT = "workingDbRootContext"; - /** Key to keep embedded application configuration in this session. */ - protected static final String PROPERTY_EMBEDDED_APPLICATION_CONFIGURATION = "embeddedApplicationConfiguration"; + public static final String SESSION_TOKEN_MESSAGES = "messages"; - /** Key to store the {@link EchoBaseSession} instance in the session's map. */ - private static final String SESSION_PARAMETER = "echoBaseSession"; + public static final String SESSION_TOKEN_ERRORS = "errors"; - /** Key to set root context of working db selected by user (if any). */ - private static final String PROPERTY_ROOT_CONTEXT = "rootContext"; + public static final String SESSION_TOKEN_WARNINGS = "warnings"; + /** To store all properties in this session. */ + protected Map<String, Object> store; + /** * Obtain the user T3 session. * <p/> @@ -86,25 +88,25 @@ */ public static EchoBaseSession getEchoBaseSession(ActionContext actionContext) { Map<String, Object> session = actionContext.getSession(); - EchoBaseSession t3Session = (EchoBaseSession) + EchoBaseSession userSession = (EchoBaseSession) session.get(SESSION_PARAMETER); - if (t3Session == null) { + if (userSession == null) { // let's create it - t3Session = new EchoBaseSession(); - session.put(SESSION_PARAMETER, t3Session); + userSession = new EchoBaseSession(); + session.put(SESSION_PARAMETER, userSession); } - return t3Session; + return userSession; } public static EchoBaseSession getEchoBaseSession(HttpSession session) { - EchoBaseSession t3Session = (EchoBaseSession) + EchoBaseSession userSession = (EchoBaseSession) session.getAttribute(EchoBaseSession.SESSION_PARAMETER); - if (t3Session == null) { + if (userSession == null) { // let's create it - t3Session = new EchoBaseSession(); - session.setAttribute(SESSION_PARAMETER, t3Session); + userSession = new EchoBaseSession(); + session.setAttribute(SESSION_PARAMETER, userSession); } - return t3Session; + return userSession; } public static void removeEchoBaseSession(ActionContext actionContext) { @@ -112,10 +114,6 @@ session.remove(EchoBaseSession.SESSION_PARAMETER); } - - /** To store all properties in this session. */ - protected Map<String, Object> store; - /** * Gets the informations of user as soon as the user is loggued. * @@ -125,14 +123,9 @@ return get(PROPERTY_USER, EchoBaseUser.class); } - /** - * Tests if user is loggued (means the {@link #getUser} is not null). - * - * @return {@code true} if user is loggued, {@code false} otherwise - */ - public boolean isUserInSession() { - boolean result = getUser() != null; - return result; + public boolean isAdmin() { + EchoBaseUser user = getUser(); + return user != null && user.isAdmin(); } /** @@ -144,61 +137,19 @@ set(PROPERTY_USER, user); } - public ImportDbConfiguration getImportDbConfiguration() { - return get(PROPERTY_IMPORT_DB_CONFIGURATION, ImportDbConfiguration.class); + public JdbcConfiguration getWorkingDbConfiguration() { + return get(PROPERTY_WORKING_DB_CONFIGURATION, JdbcConfiguration.class); } - public void setImportDbConfiguration(ImportDbConfiguration configuration) { - set(PROPERTY_IMPORT_DB_CONFIGURATION, configuration); + public TopiaContext getWorkingDbRootContext() { + return get(PROPERTY_WORKING_DB_ROOT_CONTEXT, TopiaContext.class); } - public ExportDbConfiguration getExportDbConfiguration() { - return get(PROPERTY_EXPORT_DB_CONFIGURATION, ExportDbConfiguration.class); + public boolean isWorkingDbSelected() { + return contains(PROPERTY_WORKING_DB_CONFIGURATION); } - public void setExportDbConfiguration(ExportDbConfiguration configuration) { - set(PROPERTY_EXPORT_DB_CONFIGURATION, configuration); - } - - public EmbeddedApplicationConfiguration getEmbeddedApplicationConfiguration() { - return get(PROPERTY_EMBEDDED_APPLICATION_CONFIGURATION, EmbeddedApplicationConfiguration.class); - } - - public void setEmbeddedApplicationConfiguration(EmbeddedApplicationConfiguration configuration) { - set(PROPERTY_EMBEDDED_APPLICATION_CONFIGURATION, configuration); - } - - public <M extends AbstractImportConfiguration> M getImportDataConfiguration(Class<M> configurationType) { - return get(configurationType.getSimpleName(), configurationType); - } - - public <M extends AbstractImportConfiguration> void setImportDataConfiguration(M configuration) { - set(configuration.getClass().getSimpleName(), configuration); - } - - public <M extends AbstractImportConfiguration> void removeImportDataConfiguration(Class<M> configurationType) { - set(configurationType.getSimpleName(), null); - } - /** - * Gets the t3 database url selected by user. - * - * @return the t3 database url selected by user or {@code null} if not in session - */ - public String getWorkingDatabaseUrl() { - TopiaContext rootContext = getRootContext(); - String result = null; - if (rootContext != null) { - result = EchobaseTopiaContexts.getDbUrl(rootContext); - } - return result; - } - - public TopiaContext getRootContext() { - return get(PROPERTY_ROOT_CONTEXT, TopiaContext.class); - } - - /** * Initialize the t3 database configuration from the given connection * configuration. * <p/> @@ -218,34 +169,128 @@ TopiaContext rootContext = EchobaseTopiaContexts.newWorkingDb(jdbcConfiguration); + // keep configuration is session + set(PROPERTY_WORKING_DB_CONFIGURATION, jdbcConfiguration); + // store it in session - set(PROPERTY_ROOT_CONTEXT, rootContext); + set(PROPERTY_WORKING_DB_ROOT_CONTEXT, rootContext); if (log.isInfoEnabled()) { log.info("User database initialized at " + jdbcConfiguration.getUrl()); } + } + public <C extends AbstractEchobaseActionConfiguration> C getActionConfiguration(Class<C> configurationType) { + return get(configurationType.getName(), configurationType); } + public <C extends AbstractEchobaseActionConfiguration> void setActionConfiguration(C configurationType) { + set(configurationType.getClass().getName(), configurationType); + } + + public <C extends AbstractEchobaseActionConfiguration> void removeActionConfiguration(Class<C> configurationType) { + remove(configurationType.getName()); + } + public void releaseWorkingDb() { - TopiaContext rootContext = getRootContext(); + if (isWorkingDbSelected()) { - if (rootContext != null) { + try { + TopiaContext rootContext = getWorkingDbRootContext(); + EchoBaseEntityHelper.releaseRootContext(rootContext); + } finally { + remove(PROPERTY_WORKING_DB_CONFIGURATION); + remove(PROPERTY_WORKING_DB_ROOT_CONTEXT); + } + } + } - remove(PROPERTY_ROOT_CONTEXT); + public <T extends Serializable> T getDynamicData(String token) { + Object result = getDynamicData().get(token); + return (T) result; + } - EchoBaseEntityHelper.releaseRootContext(rootContext); + public <T extends Serializable> Set<T> getDynamicSetData(String token) { + Object result = getDynamicData().get(token); + return (Set<T>) result; + } + + public <T extends Serializable> T consumeDynamicData(String token) { + T result = getDynamicData(token); + if (result != null) { + removeDynamicData(token); } + return result; } + public <T extends Serializable> Set<T> consumeDynamicSetData(String token) { + Set<T> result = getDynamicSetData(token); + if (result != null) { + removeDynamicData(token); + } + return result; + } + + public <T extends Serializable> void putDynamicSetData(String token, Set<T> data) { + getDynamicData().put(token, data); + if (log.isDebugEnabled()) { + log.debug("Dynamic attributes size : " + getDynamicData().size()); + } + } + + public void putDynamicData(String token, Serializable data) { + getDynamicData().put(token, data); + if (log.isDebugEnabled()) { + log.debug("Dynamic attributes size : " + getDynamicData().size()); + } + } + + public void removeDynamicData(String token) { + getDynamicData().remove(token); + if (log.isDebugEnabled()) { + log.debug("Dynamic attributes size : " + getDynamicData().size()); + } + } + + public void clearDynamicData() { + if (store != null) { + store.clear(); + if (log.isDebugEnabled()) { + log.debug("Dynamic attributes size : " + store.size()); + } + } + } + + protected Map<String, Object> getDynamicData() { + if (store == null) { + store = Maps.newHashMap(); + } + return store; + } + + public void addMessage(String messageScope, String message) { + Set<String> messages = getDynamicSetData(messageScope); + if (messages == null) { + messages = Sets.newHashSet(message); + putDynamicSetData(messageScope, messages); + } else { + messages.add(message); + } + } + + /** Protect session constructor. */ + protected EchoBaseSession() { + store = new TreeMap<String, Object>(); + } + /** * Remove form this session, the object from his given key and returns it. * * @param key the key of object to remove from this session * @return the removed object from session, or {@code null} if not found */ - public Object remove(String key) { + protected Object remove(String key) { Object remove = store.remove(key); if (log.isInfoEnabled()) { log.info("Remove from user session data [" + key + "] = " + remove); @@ -260,16 +305,11 @@ * @return {@code true} if an object was found in this session, * {@code false} otherwise */ - public boolean contains(String key) { + protected boolean contains(String key) { boolean result = store.containsKey(key); return result; } - /** Protect session constructor. */ - public EchoBaseSession() { - store = new TreeMap<String, Object>(); - } - /** * Gets from this session an object given his key and his type. * @@ -305,11 +345,6 @@ } } - public boolean isAdmin() { - EchoBaseUser user = getUser(); - return user != null && user.isAdmin(); - } - /** * Release any resources contained in the user session. * <p/> Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseSessionListener.java 2012-09-02 15:11:02 UTC (rev 589) @@ -23,6 +23,8 @@ */ package fr.ifremer.echobase.ui; +import fr.ifremer.echobase.entities.EchoBaseUser; + import javax.servlet.ServletContext; import javax.servlet.http.HttpSessionEvent; import javax.servlet.http.HttpSessionListener; @@ -45,7 +47,8 @@ @Override public void sessionDestroyed(HttpSessionEvent se) { EchoBaseSession session = EchoBaseSession.getEchoBaseSession(se.getSession()); - if (session.isUserInSession()) { + EchoBaseUser user = session.getUser(); + if (user != null) { // only destroy the session if a user is loggued (otherwise there // is nothing to clear) Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/EchoBaseWorkingDbTransactionFilter.java 2012-09-02 15:11:02 UTC (rev 589) @@ -23,6 +23,7 @@ * #L% */ +import com.google.common.base.Preconditions; import com.opensymphony.xwork2.ActionContext; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -60,12 +61,6 @@ return (TopiaContext) request.getAttribute(USER_TRANSACTION); } -// public static TopiaContext getTransaction(ServletRequest request) { -// TopiaContext topiaContext = (TopiaContext) -// request.getAttribute(USER_TRANSACTION); -// return topiaContext; -// } - @Override public void init(FilterConfig filterConfig) throws ServletException { super.init(filterConfig); @@ -76,8 +71,11 @@ public TopiaContext beginTransaction(ServletRequest request) { HttpSession session = ((HttpServletRequest) request).getSession(); + Preconditions.checkNotNull(session); EchoBaseSession userSession = EchoBaseSession.getEchoBaseSession(session); - TopiaContext rootContext = userSession.getRootContext(); + Preconditions.checkNotNull(userSession); + TopiaContext rootContext = userSession.getWorkingDbRootContext(); + Preconditions.checkNotNull(rootContext); try { TopiaContext transaction = rootContext.beginTransaction(); if (log.isDebugEnabled()) { Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,102 @@ +package fr.ifremer.echobase.ui.actions; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.opensymphony.xwork2.interceptor.annotations.InputConfig; +import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.IOException; + +/** + * BAse action for long action configuration. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public abstract class AbstractConfigureAction<M extends AbstractEchobaseActionConfiguration> extends EchoBaseActionSupport { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(AbstractConfigureAction.class); + + private final Class<M> modelType; + + private M model; + + protected abstract M createModel(); + + protected abstract void prepareExecuteAction(M model) throws IOException; + + protected AbstractConfigureAction(Class<M> modelType) { + this.modelType = modelType; + } + + @Override + public final String input() throws Exception { + + // always remove configuration from session anytime coming here + getEchoBaseSession().removeActionConfiguration(modelType); + + prepareInputAction(getModel()); + + return INPUT; + } + + @InputConfig(methodName = "input") + @Override + public final String execute() throws Exception { + + prepareExecuteAction(getModel()); + + setInSession(getModel()); + return SUCCESS; + } + + public final M getModel() { + if (model == null) { + if (log.isInfoEnabled()) { + log.info("Will create model " + modelType.getName()); + } + model = createModel(); + } + return model; + } + + protected void prepareInputAction(M model) { + // by default nothing to prepare + } + + protected final void setInSession(M model) { + getEchoBaseSession().setActionConfiguration(model); + } + + protected final M getFromSession() { + return getEchoBaseSession().getActionConfiguration(modelType); + } + +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractConfigureAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/AbstractWaitAndExecAction.java 2012-09-02 15:11:02 UTC (rev 589) @@ -27,24 +27,49 @@ import com.opensymphony.xwork2.Preparable; import fr.ifremer.echobase.persistence.EchoBaseEntityHelper; import fr.ifremer.echobase.services.AbstractEchobaseActionConfiguration; +import fr.ifremer.echobase.services.EchoBaseService; import org.nuiton.topia.TopiaContext; +import java.io.IOException; + /** * Abstract long action using the exec and wait interceptor. * * @author tchemit <chemit@codelutin.com> * @since 0.2 */ -public abstract class AbstractWaitAndExecAction<M extends AbstractEchobaseActionConfiguration> extends EchoBaseActionSupport implements Preparable { +public abstract class AbstractWaitAndExecAction<M extends AbstractEchobaseActionConfiguration, S extends EchoBaseService> extends EchoBaseActionSupport implements Preparable { private static final long serialVersionUID = 1L; - /** Configuration of the export action. */ + /** + * Model type ot use. + * + * @since 1.1 + */ + private final Class<M> modelType; + + /** + * Service type to use in this action. + * + * @since 1.1 + */ + private final Class<S> serviceType; + + /** Configuration of the action. */ private M model; /** Shared actionContext to reuse all invocation of this same action. */ private ActionContext actionContext; + protected AbstractWaitAndExecAction(Class<M> modelType, + Class<S> serviceType) { + this.modelType = modelType; + this.serviceType = serviceType; + } + + protected abstract void startAction(S service, M model) throws Exception; + public final M getModel() { return model; } @@ -62,13 +87,9 @@ // now we need to propagate it ActionContext.setContext(actionContext); } - model = initModel(); + model = getEchoBaseSession().getActionConfiguration(modelType); } - protected abstract M initModel(); - - protected abstract void startAction(M model) throws Exception; - @Override public final String execute() throws Exception { @@ -81,30 +102,42 @@ // we must use a standalone transaction since it will pass through // in more than one request - TopiaContext topiaContext = - EchoBaseEntityHelper.newTransactionFromRootContext(getServiceContext().getTransaction()); + TopiaContext tx = EchoBaseEntityHelper.newTransactionFromRootContext( + getServiceContext().getTransaction()); try { - serviceContext.setTransaction(topiaContext); + getServiceContext().setTransaction(tx); - startAction(model); + S service = getService(serviceType); + startAction(service, model); + model.endAction(); return SUCCESS; } finally { try { - EchoBaseEntityHelper.closeConnection(topiaContext); + EchoBaseEntityHelper.closeConnection(tx); } finally { closeAction(model); } - - } } protected void closeAction(M model) throws Exception { // by default do nothing } + + protected void destroyModel(M model) throws IOException { + + try { + // clean configuration + model.destroy(); + } finally { + + // remove configuration from session + getEchoBaseSession().removeActionConfiguration(modelType); + } + } } \ No newline at end of file Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/EchoBaseActionSupport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -23,6 +23,7 @@ */ package fr.ifremer.echobase.ui.actions; +import com.google.common.base.Preconditions; import com.google.common.collect.Maps; import com.opensymphony.xwork2.ActionContext; import fr.ifremer.echobase.EchoBaseConfiguration; @@ -31,17 +32,22 @@ import fr.ifremer.echobase.services.DefaultEchoBaseServiceContext; import fr.ifremer.echobase.services.EchoBaseService; import fr.ifremer.echobase.services.EchoBaseServiceContext; +import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.ServiceFactoryAware; import fr.ifremer.echobase.ui.EchoBaseApplicationContext; import fr.ifremer.echobase.ui.EchoBaseInternalDbTransactionFilter; import fr.ifremer.echobase.ui.EchoBaseSession; import fr.ifremer.echobase.ui.EchoBaseWorkingDbTransactionFilter; +import org.apache.commons.collections.CollectionUtils; +import org.apache.struts2.interceptor.ParameterAware; +import org.apache.struts2.interceptor.SessionAware; import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.web.struts2.BaseAction; import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Date; +import java.util.List; import java.util.Map; /** @@ -81,8 +87,30 @@ /** EchoBase User session. */ private transient EchoBaseSession echoBaseSession; - protected transient EchoBaseServiceContext serviceContext; + /** + * Service context used to access and create services. + * + * @since 1.0 + */ + private transient EchoBaseServiceContext serviceContext; + /** + * Parameters injected if you put {@link ParameterAware} contract on your + * action. + * + * @see ParameterAware + * @since 1.1 + */ + private transient Map<String, String[]> parameters; + + /** + * Session injected if you put {@link SessionAware} contract on your action. + * + * @see SessionAware + * @since 1.1 + */ + private transient Map<String, Object> session; + public EchoBaseSession getEchoBaseSession() { if (echoBaseSession == null) { @@ -92,13 +120,7 @@ return echoBaseSession; } - /** - * Fabrique pour récupérer le ServiceContext tel qu'il devrait être fourni - * à la fabrication d'un service. - * - * @return service context - */ - protected EchoBaseServiceContext getServiceContext() { + public EchoBaseServiceContext getServiceContext() { if (serviceContext == null) { serviceContext = DefaultEchoBaseServiceContext.newContext( getLocale(), @@ -124,11 +146,15 @@ } public boolean isAdmin() { - EchoBaseSession session = getEchoBaseSession(); - boolean result = session.isAdmin(); + boolean result = getEchoBaseSession().isAdmin(); return result; } + public boolean isWorkingDbSelected() { + boolean result = getEchoBaseSession().isWorkingDbSelected(); + return result; + } + public String formatDate(Date date) { String result = dateFormat.format(date); return result; @@ -139,20 +165,110 @@ return result; } - public <E extends TopiaEntity> Map<String, String> sortAndDecorate(Collection<E> beans, String context) { - DecoratorService decoratorService = getService(DecoratorService.class); - return decoratorService.sortAndDecorate(getLocale(), beans, context); + public void setParameters(Map<String, String[]> parameters) { + this.parameters = parameters; } + public void setSession(Map<String, Object> session) { + this.session = session; + } + + public void addFlashMessage(String message) { + getEchoBaseSession().addMessage(EchoBaseSession.SESSION_TOKEN_MESSAGES, message); + } + + public void addFlashError(String message) { + getEchoBaseSession().addMessage(EchoBaseSession.SESSION_TOKEN_ERRORS, message); + } + + public void addFlashWarning(String message) { + getEchoBaseSession().addMessage(EchoBaseSession.SESSION_TOKEN_WARNINGS, message); + } + + public Collection<String> getFlashMessages() { + Collection<String> result = getEchoBaseSession().consumeDynamicSetData(EchoBaseSession.SESSION_TOKEN_MESSAGES); + return result; + } + + public Collection<String> getFlashErrors() { + Collection<String> result = getEchoBaseSession().consumeDynamicSetData(EchoBaseSession.SESSION_TOKEN_ERRORS); + return result; + } + + public Collection<String> getFlashWarnings() { + Collection<String> result = getEchoBaseSession().consumeDynamicSetData(EchoBaseSession.SESSION_TOKEN_WARNINGS); + return result; + } + + public boolean hasFlashMessages() { + Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_MESSAGES); + return CollectionUtils.isNotEmpty(result); + } + + public boolean hasFlashErrors() { + Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_ERRORS); + return CollectionUtils.isNotEmpty(result); + } + + public boolean hasFlashWarnings() { + Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_WARNINGS); + return CollectionUtils.isNotEmpty(result); + } + + public void clearFlashMessages() { + Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_MESSAGES); + if (result != null) { + result.clear(); + } + } + + public void clearFlashErrors() { + Collection<String> result = getEchoBaseSession().getDynamicSetData(EchoBaseSession.SESSION_TOKEN_ERRORS); + if (result != null) { + result.clear(); + } + } + + public boolean hasAnyErrors() { + boolean result = super.hasErrors(); + return result || hasFlashErrors(); + } + protected static ActionContext getActionContext() { return ActionContext.getContext(); } - protected <E extends Enum<E> & I18nAble> Map<String, String> decorateEnums(E... enumValues) { + protected final <E extends Enum<E> & I18nAble> Map<String, String> decorateEnums(E... enumValues) { Map<String, String> result = Maps.newLinkedHashMap(); for (E enumValue : enumValues) { result.put(enumValue.name(), _(enumValue.getI18nKey())); } return result; } + + protected final <E extends TopiaEntity> Map<String, String> loadSortAndDecorate(Class<E> beanType) { + + EchoBaseServiceSupport service = getService(EchoBaseServiceSupport.class); + List<E> beans = service.getEntities(beanType); + + DecoratorService decoratorService = getService(DecoratorService.class); + return decoratorService.sortAndDecorate(getLocale(), beans, null); + } + + + protected Map<String, String[]> getParameters() { + Preconditions.checkNotNull( + parameters, + "You must put ParameterAware contract on your action " + + getClass().getName()); + return parameters; + } + + protected Map<String, Object> getSession() { + Preconditions.checkNotNull( + session, + "You must put SessionAware contract on your action " + + getClass().getName()); + return session; + } } Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,44 @@ +package fr.ifremer.echobase.ui.actions; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +/** + * Go to home. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class Home extends EchoBaseActionSupport { + + private static final long serialVersionUID = 1L; + + @Override + public String execute() throws Exception { + + if (!isWorkingDbSelected()) { + addFlashMessage(_("echobase.label.noWorkingDbSelected")); + } + return SUCCESS; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/Home.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/AbstractLoadPage.java 2012-09-02 15:11:02 UTC (rev 589) @@ -84,7 +84,7 @@ if (entityType == null) { // no table selected - addActionMessage(_("echobase.info.no.table.selected")); + addFlashMessage(_("echobase.info.no.table.selected")); } else { // load table metas Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ExportTable.java 2012-09-02 15:11:02 UTC (rev 589) @@ -95,11 +95,10 @@ @Override public String execute() throws Exception { - ExportService exportService = getService(ExportService.class); + TableMeta<EchoBaseEntityEnum> table = getServiceContext().getDbMeta().getTable(entityType); + String content = getService(ExportService.class).exportData(table, + exportAsSeen); - TableMeta<EchoBaseEntityEnum> table = serviceContext.getDbMeta().getTable(entityType); - String content = exportService.exportData(table, exportAsSeen); - if (log.isDebugEnabled()) { log.debug("file to export " + content); } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntities.java 2012-09-02 15:11:02 UTC (rev 589) @@ -92,9 +92,7 @@ log.debug("sord = " + ascendantOrder); } - DbEditorService service = getService(DbEditorService.class); - - datas = service.getDatas( + datas = getService(DbEditorService.class).getDatas( entityType, pager, sortColumn, Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetEntity.java 2012-09-02 15:11:02 UTC (rev 589) @@ -74,12 +74,11 @@ @Override public String execute() throws Exception { - DbEditorService service = getService(DbEditorService.class); + TableMeta<EchoBaseEntityEnum> table = + getServiceContext().getDbMeta().getTable(entityType); - TableMeta<EchoBaseEntityEnum> table = serviceContext.getDbMeta().getTable(entityType); + datas = getService(DbEditorService.class).getData(table, id); - datas = service.getData(table, id); - Object length = datas.remove("length"); if (length != null) { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/GetForeignEntities.java 2012-09-02 15:11:02 UTC (rev 589) @@ -24,11 +24,8 @@ package fr.ifremer.echobase.ui.actions.dbeditor; import fr.ifremer.echobase.entities.EchoBaseEntityEnum; -import fr.ifremer.echobase.services.DbEditorService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.nuiton.topia.persistence.TopiaEntity; -import java.util.List; import java.util.Map; /** @@ -58,10 +55,7 @@ @Override public String execute() throws Exception { - DbEditorService service = getService(DbEditorService.class); - List<? extends TopiaEntity> foreignEntities = - service.getForeignDatas(entityType.getContract()); - entities = sortAndDecorate(foreignEntities, null); + entities = loadSortAndDecorate(entityType.getContract()); return SUCCESS; } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/ImportTable.java 2012-09-02 15:11:02 UTC (rev 589) @@ -127,14 +127,13 @@ @InputConfig(methodName = "input") public String execute() throws Exception { - ImportService importService = getService(ImportService.class); - try { - result = importService.importDatas(getEntityType(), - importFileFileName, - importFile, - createIfNotFound, - getEchoBaseSession().getUser()); + result = getService(ImportService.class).importDatas( + getEntityType(), + importFileFileName, + importFile, + createIfNotFound, + getEchoBaseSession().getUser()); } catch (Exception eee) { @@ -143,7 +142,7 @@ false); error = eee; - addActionError(_("echobase.info.import.failed")); + addFlashError(_("echobase.info.import.failed")); if (log.isErrorEnabled()) { log.error("Error while import ", eee); Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/dbeditor/SaveEntity.java 2012-09-02 15:11:02 UTC (rev 589) @@ -50,11 +50,6 @@ /** id of entity to save. */ protected String topiaId; -// /** Metas of the table */ -// protected TableMeta<EchoBaseEntityEnum> tableMeta; - - protected Map<String, String[]> params; - public EchoBaseEntityEnum getEntityType() { return entityType; } @@ -71,14 +66,16 @@ public String execute() throws Exception { DbEditorService service = getService(DbEditorService.class); + TableMeta<EchoBaseEntityEnum> tableMeta = service.getTableMeta(entityType); Map<String, String> properties = Maps.newHashMap(); List<String> columnNames = tableMeta.getColumnNames(); + Map<String, String[]> parameters = getParameters(); for (String columnName : columnNames) { - if (params.containsKey(columnName)) { + if (parameters.containsKey(columnName)) { // there is a such property to edit - String[] values = params.get(columnName); + String[] values = parameters.get(columnName); if (values.length > 0) { @@ -96,15 +93,7 @@ properties, getEchoBaseSession().getUser()); - return SUCCESS; } - - @Override - public void setParameters(Map<String, String[]> parameters) { - params = Maps.newHashMap(); - params.putAll(parameters); - } - } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Build.java 2012-09-02 15:11:02 UTC (rev 589) @@ -35,29 +35,21 @@ * @author tchemit <chemit@codelutin.com> * @since 0.2 */ -public class Build extends AbstractWaitAndExecAction<EmbeddedApplicationConfiguration> { +public class Build extends AbstractWaitAndExecAction<EmbeddedApplicationConfiguration, EmbeddedApplicationService> { private static final long serialVersionUID = 1L; /** Logger. */ private static final Log log = LogFactory.getLog(Build.class); - /** Service to build the embedded application archive. */ - protected transient EmbeddedApplicationService service; - - @Override - protected EmbeddedApplicationConfiguration initModel() { - return getEchoBaseSession().getEmbeddedApplicationConfiguration(); + public Build() { + super(EmbeddedApplicationConfiguration.class, + EmbeddedApplicationService.class); } @Override - public void prepare() throws Exception { - super.prepare(); - service = getService(EmbeddedApplicationService.class); - } - - @Override - protected void startAction(EmbeddedApplicationConfiguration model) throws Exception { + protected void startAction(EmbeddedApplicationService service, + EmbeddedApplicationConfiguration model) throws Exception { if (log.isInfoEnabled()) { log.info("Start build of embedded application to file " + model.getFileName()); Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Configure.java 2012-09-02 15:11:02 UTC (rev 589) @@ -25,10 +25,9 @@ import fr.ifremer.echobase.EchoBaseConfiguration; import fr.ifremer.echobase.entities.data.Voyage; -import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationConfiguration; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.collections.CollectionUtils; +import fr.ifremer.echobase.ui.actions.AbstractConfigureAction; +import org.apache.commons.collections.MapUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -36,7 +35,7 @@ import org.nuiton.util.Version; import java.io.File; -import java.util.List; +import java.io.IOException; import java.util.Map; /** @@ -45,24 +44,18 @@ * @author tchemit <chemit@codelutin.com> * @since 0.2 */ -public class Configure extends EchoBaseActionSupport { +public class Configure extends AbstractConfigureAction<EmbeddedApplicationConfiguration> { private static final long serialVersionUID = 1L; /** Logger. */ private static final Log log = LogFactory.getLog(Configure.class); - /** action model. */ - protected EmbeddedApplicationConfiguration model; - /** Universe of voyages to export in db. */ protected Map<String, String> voyages; - public EmbeddedApplicationConfiguration getModel() { - if (model == null) { - model = new EmbeddedApplicationConfiguration(); - } - return model; + public Configure() { + super(EmbeddedApplicationConfiguration.class); } public Map<String, String> getVoyages() { @@ -70,61 +63,49 @@ } @Override - public String input() throws Exception { + protected EmbeddedApplicationConfiguration createModel() { + return new EmbeddedApplicationConfiguration(); + } - // always remove configuration from session anytime coming here - getEchoBaseSession().setExportDbConfiguration(null); + @Override + protected void prepareInputAction(EmbeddedApplicationConfiguration model) { - // creates the action model - EmbeddedApplicationConfiguration actionModel = getModel(); - // give default embedded application archive file name EchoBaseConfiguration configuration = getConfiguration(); Version version = configuration.getApplicationVersion(); String fileName = "echobase-embedded-" + version.toString(); - actionModel.setFileName(fileName); + model.setFileName(fileName); // gets war location File warLocation = configuration.getWarLocation(); if (!warLocation.exists()) { - addActionError(_("echobase.error.warlocation.notFound", - warLocation)); + addFlashError(_("echobase.error.warlocation.notFound", + warLocation)); } - actionModel.setWarLocation(warLocation); + model.setWarLocation(warLocation); - EchoBaseServiceSupport service = - getService(EchoBaseServiceSupport.class); - List<Voyage> allVoyages = service.getEntities(Voyage.class); + voyages = loadSortAndDecorate(Voyage.class); - if (CollectionUtils.isEmpty(allVoyages)) { - addActionMessage(_("echobase.info.no.voyagee.found")); + if (MapUtils.isEmpty(voyages)) { + addFlashMessage(_("echobase.info.no.voyagee.found")); } - voyages = sortAndDecorate(allVoyages, null); - - return INPUT; } @Override - public String execute() throws Exception { + protected void prepareExecuteAction(EmbeddedApplicationConfiguration model) throws IOException { - EmbeddedApplicationConfiguration configuration = getModel(); - // creates a new temporary working directory File tempDirectory = FileUtils.getTempDirectory(); File dataDirectory = new File( tempDirectory, "echobase-embeddedApplication-" + System.currentTimeMillis()); FileUtil.createDirectoryIfNecessary(dataDirectory); - configuration.setWorkingDirectory(dataDirectory); + model.setWorkingDirectory(dataDirectory); if (log.isInfoEnabled()) { log.info("Temporary directory to use : " + dataDirectory); } File warLocation = getConfiguration().getWarLocation(); - configuration.setWarLocation(warLocation); - - // store configuration in session - getEchoBaseSession().setEmbeddedApplicationConfiguration(configuration); - return SUCCESS; + model.setWarLocation(warLocation); } } \ No newline at end of file Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Download.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Download.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/embeddedApplication/Download.java 2012-09-02 15:11:02 UTC (rev 589) @@ -77,16 +77,16 @@ public String execute() throws Exception { EmbeddedApplicationConfiguration model = - getEchoBaseSession().getEmbeddedApplicationConfiguration(); + getEchoBaseSession().getActionConfiguration(EmbeddedApplicationConfiguration.class); if (model == null) { - addActionError(_("echobase.error.no.embeddedApplication.configurationFound")); + addFlashError(_("echobase.error.no.embeddedApplication.configurationFound")); return ERROR; } File file = model.getEmbeddedApplicationFile(); if (file == null) { - addActionError(_("echobase.error.no.embeddedApplication.exportFileFound")); + addFlashError(_("echobase.error.no.embeddedApplication.exportFileFound")); return ERROR; } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Configure.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Configure.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Configure.java 2012-09-02 15:11:02 UTC (rev 589) @@ -24,13 +24,14 @@ package fr.ifremer.echobase.ui.actions.exportDb; import fr.ifremer.echobase.services.exportdb.ExportDbConfiguration; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import fr.ifremer.echobase.ui.actions.AbstractConfigureAction; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.FileUtil; import java.io.File; +import java.io.IOException; /** * Configure the complete db export. @@ -38,21 +39,22 @@ * @author tchemit <chemit@codelutin.com> * @since 0.2 */ -public class Configure extends EchoBaseActionSupport { +public class Configure extends AbstractConfigureAction<ExportDbConfiguration> { private static final long serialVersionUID = 1L; /** Logger. */ private static final Log log = LogFactory.getLog(Configure.class); - protected ExportDbConfiguration model; + public Configure() { + super(ExportDbConfiguration.class); + } - public ExportDbConfiguration getModel() { - if (model == null) { - model = new ExportDbConfiguration(); - model.setFileName("echobase"); - } - return model; + @Override + protected ExportDbConfiguration createModel() { + ExportDbConfiguration result = new ExportDbConfiguration(); + result.setFileName("echobase"); + return result; } public void setFileName(String fileName) { @@ -60,30 +62,16 @@ } @Override - public String input() throws Exception { + protected void prepareExecuteAction(ExportDbConfiguration model) throws IOException { - // always remove configuration from session anytime coming here - getEchoBaseSession().setExportDbConfiguration(null); - return INPUT; - } - - @Override - public String execute() throws Exception { - - ExportDbConfiguration configuration = getModel(); - File tempDirectory = FileUtils.getTempDirectory(); - File dataDirectory = new File( - tempDirectory, - "echobase-exportDb-" + System.currentTimeMillis()); + File dataDirectory = new File(tempDirectory, + "echobase-exportDb-" + + System.currentTimeMillis()); FileUtil.createDirectoryIfNecessary(dataDirectory); - configuration.setWorkingDirectory(dataDirectory); + model.setWorkingDirectory(dataDirectory); if (log.isInfoEnabled()) { log.info("Temporary directory to use : " + dataDirectory); } - - // store configuration in session - getEchoBaseSession().setExportDbConfiguration(configuration); - return SUCCESS; } } \ No newline at end of file Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Download.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Download.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Download.java 2012-09-02 15:11:02 UTC (rev 589) @@ -73,16 +73,16 @@ public String execute() throws Exception { ExportDbConfiguration model = - getEchoBaseSession().getExportDbConfiguration(); + getEchoBaseSession().getActionConfiguration(ExportDbConfiguration.class); if (model == null) { - addActionError(_("echobase.error.no.exportDb.configurationFound")); + addFlashError(_("echobase.error.no.exportDb.configurationFound")); return ERROR; } File exportFile = model.getExportFile(); if (exportFile == null) { - addActionError(_("echobase.error.no.exportDb.exportFileFound")); + addFlashError(_("echobase.error.no.exportDb.exportFileFound")); return ERROR; } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportDb/Export.java 2012-09-02 15:11:02 UTC (rev 589) @@ -35,29 +35,20 @@ * @author tchemit <chemit@codelutin.com> * @since 0.2 */ -public class Export extends AbstractWaitAndExecAction<ExportDbConfiguration> { +public class Export extends AbstractWaitAndExecAction<ExportDbConfiguration, ExportDbService> { private static final long serialVersionUID = 1L; /** Logger. */ private static final Log log = LogFactory.getLog(Export.class); - /** service to execute the export. */ - protected transient ExportDbService service; - - @Override - protected ExportDbConfiguration initModel() { - return getEchoBaseSession().getExportDbConfiguration(); + public Export() { + super(ExportDbConfiguration.class, ExportDbService.class); } @Override - public void prepare() throws Exception { - super.prepare(); - service = getService(ExportDbService.class); - } - - @Override - protected void startAction(ExportDbConfiguration model) throws Exception { + protected void startAction(ExportDbService service, + ExportDbConfiguration model) throws Exception { if (log.isInfoEnabled()) { log.info("Start export to file " + model.getFileName()); } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ExportQueryResult.java 2012-09-02 15:11:02 UTC (rev 589) @@ -77,7 +77,7 @@ columnNames = service.getColumnNames(sql); } catch (EchoBaseTechnicalException e) { //TODO add a real nice message - addActionError(e.getMessage()); + addFlashError(e.getMessage()); if (log.isErrorEnabled()) { log.error("coudl not execute query " + sql, e); } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/exportQuery/ManageExportQuery.java 2012-09-02 15:11:02 UTC (rev 589) @@ -26,14 +26,13 @@ import com.opensymphony.xwork2.Preparable; import fr.ifremer.echobase.entities.EchoBaseUser; import fr.ifremer.echobase.entities.ExportQuery; -import fr.ifremer.echobase.services.exportquery.ExportQueryService; import fr.ifremer.echobase.services.exportquery.ExportQueryNameAlreadyExistException; +import fr.ifremer.echobase.services.exportquery.ExportQueryService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import java.util.Collection; import java.util.Map; /** @@ -167,35 +166,15 @@ return SUCCESS; } - private boolean checkQuery(String sql) { - boolean result; - try { - getService().testSql(sql); - result = true; - } catch (Exception e) { - Throwable cause = e.getCause(); - if (log.isWarnEnabled()) { - log.warn("Invalid sql ", cause); - } - addFieldError("query.sqlQuery", - _("echobase.error.invalid.sql", cause.getMessage())); - result = false; - } - return result; - } - @Override public void prepare() throws Exception { - Collection<ExportQuery> sqlQueries = - getService().getEntities(ExportQuery.class); + queries = loadSortAndDecorate(ExportQuery.class); - queries = sortAndDecorate(sqlQueries, null); + if (queries.isEmpty()) { - if (sqlQueries.isEmpty()) { - // no query saved - addActionMessage(_("echobase.info.no.sqlQuery.saved")); + addFlashMessage(_("echobase.info.no.sqlQuery.saved")); } else { String selectedQueryId = getQuery().getTopiaId(); @@ -205,11 +184,11 @@ if (isNewQuery() || isNewLibreOfficeQuery()) { // new query in progress - addActionMessage(_("echobase.info.new.sqlQuery.inprogress")); + addFlashMessage(_("echobase.info.new.sqlQuery.inprogress")); } else { // no query selected - addActionMessage(_("echobase.info.no.sqlQuery.selected")); + addFlashMessage(_("echobase.info.no.sqlQuery.selected")); } } else { @@ -225,10 +204,27 @@ if (!canUpdateQuery) { // this user can not update selected query - addActionMessage( + addFlashMessage( _("echobase.info.sqlQuery.not.modifiable")); } } } } + + private boolean checkQuery(String sql) { + boolean result; + try { + getService().testSql(sql); + result = true; + } catch (Exception e) { + Throwable cause = e.getCause(); + if (log.isWarnEnabled()) { + log.warn("Invalid sql ", cause); + } + addFieldError("query.sqlQuery", + _("echobase.error.invalid.sql", cause.getMessage())); + result = false; + } + return result; + } } \ No newline at end of file Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractConfigureImport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -23,22 +23,17 @@ */ package fr.ifremer.echobase.ui.actions.importData; -import com.opensymphony.xwork2.interceptor.annotations.InputConfig; import fr.ifremer.echobase.io.EchoBaseIOUtil; import fr.ifremer.echobase.io.InputFile; -import fr.ifremer.echobase.services.DecoratorService; -import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.importdata.AbstractImportConfiguration; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import fr.ifremer.echobase.ui.actions.AbstractConfigureAction; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.persistence.TopiaEntity; import org.nuiton.util.FileUtil; import java.io.File; -import java.util.List; -import java.util.Map; +import java.io.IOException; /** * Configure a accoustic data import. @@ -46,7 +41,7 @@ * @author tchemit <chemit@codelutin.com> * @since 0.3 */ -public abstract class AbstractConfigureImport<M extends AbstractImportConfiguration> extends EchoBaseActionSupport { +public abstract class AbstractConfigureImport<M extends AbstractImportConfiguration> extends AbstractConfigureAction<M> { private static final long serialVersionUID = 1L; @@ -54,75 +49,28 @@ private static final Log log = LogFactory.getLog(AbstractConfigureImport.class); - protected final Class<M> modelType; - - protected M model; - protected AbstractConfigureImport(Class<M> modelType) { - this.modelType = modelType; + super(modelType); } - public final M getModel() { - if (model == null) { - model = createModel(); - } - return model; - } - - protected abstract M createModel(); - @Override - public String input() throws Exception { - - // always remove configuration from session anytime coming here - getEchoBaseSession().removeImportDataConfiguration(modelType); - - return INPUT; - } - - @InputConfig(methodName = "input") - @Override - public String execute() throws Exception { - - M importModel = getModel(); + protected void prepareExecuteAction(M model) throws IOException { File tempDirectory = FileUtils.getTempDirectory(); File dataDirectory = new File( tempDirectory, "echobase-importData-" + System.currentTimeMillis()); FileUtil.createDirectoryIfNecessary(dataDirectory); - importModel.setWorkingDirectory(dataDirectory); + model.setWorkingDirectory(dataDirectory); if (log.isInfoEnabled()) { log.info("Temporary directory to use : " + dataDirectory); } - for (InputFile inputFile : importModel.getInputFiles()) { + for (InputFile inputFile : model.getInputFiles()) { if (inputFile.hasFile()) { EchoBaseIOUtil.copyFile(inputFile, dataDirectory); } } - setInSession(importModel); - return SUCCESS; } - protected final void setInSession(M model) { - getEchoBaseSession().setImportDataConfiguration(model); - } - - protected final M getFromSession() { - return getEchoBaseSession().getImportDataConfiguration(modelType); - } - - public final void setModel(M model) { - this.model = model; - } - - protected <E extends TopiaEntity> Map<String, String> loadSortAndDecorate(EchoBaseServiceSupport service, Class<E> beanType) { - - DecoratorService decoratorService = - service.getService(DecoratorService.class); - - List<E> beans = service.getEntities(beanType); - return decoratorService.sortAndDecorate(getLocale(), beans, null); - } } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/AbstractLaunchImport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -23,9 +23,9 @@ */ package fr.ifremer.echobase.ui.actions.importData; -import fr.ifremer.echobase.services.importdata.ImportException; import fr.ifremer.echobase.services.importdata.AbstractImportConfiguration; import fr.ifremer.echobase.services.importdata.AbstractImportDataService; +import fr.ifremer.echobase.services.importdata.ImportException; import fr.ifremer.echobase.ui.actions.AbstractWaitAndExecAction; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.commons.logging.Log; @@ -37,33 +37,21 @@ * @author tchemit <chemit@codelutin.com> * @since 0.3 */ -public class AbstractLaunchImport<M extends AbstractImportConfiguration, S extends AbstractImportDataService<M>> extends AbstractWaitAndExecAction<M> { +public class AbstractLaunchImport<M extends AbstractImportConfiguration, S extends AbstractImportDataService<M>> extends AbstractWaitAndExecAction<M, S> { private static final long serialVersionUID = 1L; /** Logger. */ private static final Log log = LogFactory.getLog(AbstractLaunchImport.class); - protected final Class<M> modelType; - - protected final Class<S> serviceType; - - protected transient S service; - protected transient Exception error; protected String result; protected AbstractLaunchImport(Class<M> modelType, Class<S> serviceType) { - this.modelType = modelType; - this.serviceType = serviceType; + super(modelType, serviceType); } - @Override - protected M initModel() { - return getEchoBaseSession().getImportDataConfiguration(modelType); - } - public String getResult() { return result; } @@ -84,28 +72,19 @@ } @Override - public void prepare() throws Exception { - - super.prepare(); - - service = getService(serviceType); - } - - @Override - protected void startAction(M model) throws Exception { + protected void startAction(S service, M model) throws Exception { if (log.isInfoEnabled()) { log.info("Start imports for " + getModel()); } try { - result = service.doImport(model, - getEchoBaseSession().getUser()); + result = service.doImport(model, getEchoBaseSession().getUser()); - addActionMessage(_("echobase.info.import.succeded")); + addFlashMessage(_("echobase.info.import.succeded")); } catch (ImportException e) { - addActionError(_("echobase.info.import.failed")); + addFlashError(_("echobase.info.import.failed")); if (log.isErrorEnabled()) { log.error("Error while import ", e); @@ -115,13 +94,4 @@ } } - @Override - protected void closeAction(M model) throws Exception { - - // clean configuration - model.destroy(); - - // remove configuration from session - getEchoBaseSession().removeImportDataConfiguration(modelType); - } } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureAcousticImport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -24,7 +24,6 @@ package fr.ifremer.echobase.ui.actions.importData; import fr.ifremer.echobase.entities.data.Voyage; -import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.importdata.AcousticImportConfiguration; import fr.ifremer.echobase.services.importdata.CellPositionReference; @@ -56,22 +55,14 @@ } @Override - public String input() throws Exception { - - super.input(); - - EchoBaseServiceSupport service = - getService(EchoBaseServiceSupport.class); - - voyages = loadSortAndDecorate(service, Voyage.class); + protected void prepareInputAction(AcousticImportConfiguration model) { + voyages = loadSortAndDecorate(Voyage.class); cellPositionReferences = decorateEnums(CellPositionReference.values()); - if (getModel().getCellPositionReference() == null) { + if (model.getCellPositionReference() == null) { - getModel().setCellPositionReference(CellPositionReference.START); + model.setCellPositionReference(CellPositionReference.START); } - - return INPUT; } public Map<String, String> getVoyages() { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCatchesImport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -24,7 +24,6 @@ package fr.ifremer.echobase.ui.actions.importData; import fr.ifremer.echobase.entities.data.Voyage; -import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.importdata.CatchesImportConfiguration; import java.io.File; @@ -53,16 +52,8 @@ } @Override - public String input() throws Exception { - - super.input(); - - EchoBaseServiceSupport service = - getService(EchoBaseServiceSupport.class); - - voyages = loadSortAndDecorate(service, Voyage.class); - - return INPUT; + protected void prepareInputAction(CatchesImportConfiguration model) { + voyages = loadSortAndDecorate(Voyage.class); } public Map<String, String> getVoyages() { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureCommonImport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -27,7 +27,6 @@ import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.entities.references.AreaOfOperation; import fr.ifremer.echobase.entities.references.Mission; -import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.importdata.CommonImportConfiguration; import fr.ifremer.echobase.services.importdata.CommonImportMode; @@ -66,24 +65,16 @@ } @Override - public String input() throws Exception { - - super.input(); - - EchoBaseServiceSupport service = - getService(EchoBaseServiceSupport.class); - - missions = loadSortAndDecorate(service, Mission.class); - voyages = loadSortAndDecorate(service, Voyage.class); - areaOfOperations = loadSortAndDecorate(service, AreaOfOperation.class); + protected void prepareInputAction(CommonImportConfiguration model) { + missions = loadSortAndDecorate(Mission.class); + voyages = loadSortAndDecorate(Voyage.class); + areaOfOperations = loadSortAndDecorate(AreaOfOperation.class); importModes = decorateEnums(CommonImportMode.values()); - if (getModel().getImportMode() == null) { + if (model.getImportMode() == null) { - getModel().setImportMode(CommonImportMode.ALL); + model.setImportMode(CommonImportMode.ALL); } - - return INPUT; } @InputConfig(methodName = "input") Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureOperationImport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -24,7 +24,6 @@ package fr.ifremer.echobase.ui.actions.importData; import fr.ifremer.echobase.entities.data.Voyage; -import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.importdata.OperationImportConfiguration; import java.io.File; @@ -53,15 +52,8 @@ } @Override - public String input() throws Exception { - - super.input(); - - EchoBaseServiceSupport service = - getService(EchoBaseServiceSupport.class); - - voyages = loadSortAndDecorate(service, Voyage.class); - return INPUT; + protected void prepareInputAction(OperationImportConfiguration model) { + voyages = loadSortAndDecorate(Voyage.class); } public Map<String, String> getVoyages() { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/ConfigureResultsImport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -26,7 +26,6 @@ import com.opensymphony.xwork2.interceptor.annotations.InputConfig; import fr.ifremer.echobase.entities.data.Voyage; import fr.ifremer.echobase.entities.references.Vessel; -import fr.ifremer.echobase.services.EchoBaseServiceSupport; import fr.ifremer.echobase.services.importdata.ResultsImportConfiguration; import fr.ifremer.echobase.services.importdata.ResultsImportMode; @@ -64,22 +63,15 @@ } @Override - public String input() throws Exception { - - super.input(); - - EchoBaseServiceSupport service = - getService(EchoBaseServiceSupport.class); - - voyages = loadSortAndDecorate(service, Voyage.class); - vessels = loadSortAndDecorate(service, Vessel.class); + protected void prepareInputAction(ResultsImportConfiguration model) { + voyages = loadSortAndDecorate(Voyage.class); + vessels = loadSortAndDecorate(Vessel.class); importModes = decorateEnums(ResultsImportMode.values()); - if (getModel().getImportMode() == null) { + if (model.getImportMode() == null) { - getModel().setImportMode(ResultsImportMode.VOYAGE); + model.setImportMode(ResultsImportMode.VOYAGE); } - return INPUT; } @InputConfig(methodName = "input") Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/CreateMission.java 2012-09-02 15:11:02 UTC (rev 589) @@ -26,8 +26,8 @@ import com.google.common.base.Preconditions; import fr.ifremer.echobase.entities.references.Mission; import fr.ifremer.echobase.entities.references.MissionImpl; +import fr.ifremer.echobase.services.importdata.CommonImportService; import fr.ifremer.echobase.services.importdata.MissionNameAlreadyExistException; -import fr.ifremer.echobase.services.importdata.CommonImportService; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -70,7 +70,7 @@ if (log.isInfoEnabled()) { log.info("Created mission : " + missionSaved.getTopiaId()); } - addActionMessage( + addFlashMessage( _("echobase.information.mission.created", missionSaved.getName())); result = SUCCESS; } catch (MissionNameAlreadyExistException e) { Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/LaunchOperationImport.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/LaunchOperationImport.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importData/LaunchOperationImport.java 2012-09-02 15:11:02 UTC (rev 589) @@ -37,8 +37,7 @@ private static final long serialVersionUID = 1L; public LaunchOperationImport() { - super(OperationImportConfiguration.class, - OperationImportService.class); + super(OperationImportConfiguration.class, OperationImportService.class); } } \ No newline at end of file Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Configure.java 2012-09-02 15:11:02 UTC (rev 589) @@ -26,13 +26,14 @@ import fr.ifremer.echobase.io.EchoBaseIOUtil; import fr.ifremer.echobase.io.InputFile; import fr.ifremer.echobase.services.importdb.ImportDbConfiguration; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import fr.ifremer.echobase.ui.actions.AbstractConfigureAction; import org.apache.commons.io.FileUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.util.FileUtil; import java.io.File; +import java.io.IOException; /** * Configure a db import. @@ -40,62 +41,48 @@ * @author tchemit <chemit@codelutin.com> * @since 0.2 */ -public class Configure extends EchoBaseActionSupport { +public class Configure extends AbstractConfigureAction<ImportDbConfiguration> { private static final long serialVersionUID = 1L; /** Logger. */ private static final Log log = LogFactory.getLog(Configure.class); - protected ImportDbConfiguration model; - - public ImportDbConfiguration getModel() { - if (model == null) { - model = new ImportDbConfiguration(getLocale()); - } - return model; + public Configure() { + super(ImportDbConfiguration.class); } - public void setInputFileName(String fileName) { - getModel().getInput().setFileName(fileName); - } - - public void setInput(File file) { - getModel().getInput().setFile(file); - } - - public void setInputContentType(String contentType) { - getModel().getInput().setContentType(contentType); - } - @Override - public String input() throws Exception { - - // always remove configuration from session anytime coming here - getEchoBaseSession().setImportDbConfiguration(null); - return INPUT; + protected ImportDbConfiguration createModel() { + return new ImportDbConfiguration(getLocale()); } @Override - public String execute() throws Exception { + protected void prepareExecuteAction(ImportDbConfiguration model) throws IOException { - ImportDbConfiguration configuration = getModel(); - File tempDirectory = FileUtils.getTempDirectory(); File dataDirectory = new File( tempDirectory, "echobase-importDb-" + System.currentTimeMillis()); FileUtil.createDirectoryIfNecessary(dataDirectory); - configuration.setWorkingDirectory(dataDirectory); + model.setWorkingDirectory(dataDirectory); if (log.isInfoEnabled()) { log.info("Temporary directory to use : " + dataDirectory); } - InputFile input = configuration.getInput(); + InputFile input = model.getInput(); EchoBaseIOUtil.copyFile(input, dataDirectory); + } - // store configuration in session - getEchoBaseSession().setImportDbConfiguration(configuration); - return SUCCESS; + public void setInputFileName(String fileName) { + getModel().getInput().setFileName(fileName); } + + public void setInput(File file) { + getModel().getInput().setFile(file); + } + + public void setInputContentType(String contentType) { + getModel().getInput().setContentType(contentType); + } } Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/importDb/Import.java 2012-09-02 15:11:02 UTC (rev 589) @@ -35,31 +35,20 @@ * @author tchemit <chemit@codelutin.com> * @since 0.2 */ -public class Import extends AbstractWaitAndExecAction<ImportDbConfiguration> { +public class Import extends AbstractWaitAndExecAction<ImportDbConfiguration, ImportDbService> { private static final long serialVersionUID = 1L; /** Logger. */ private static final Log log = LogFactory.getLog(Import.class); - /** service to execute the import. */ - protected transient ImportDbService service; - - @Override - protected ImportDbConfiguration initModel() { - return getEchoBaseSession().getImportDbConfiguration(); + public Import() { + super(ImportDbConfiguration.class, ImportDbService.class); } @Override - public void prepare() throws Exception { - - super.prepare(); - - service = getService(ImportDbService.class); - } - - @Override - protected void startAction(ImportDbConfiguration model) throws Exception { + protected void startAction(ImportDbService service, + ImportDbConfiguration model) throws Exception { if (log.isInfoEnabled()) { log.info("Start imports with file " + model.getInput().getFileName()); @@ -71,12 +60,6 @@ @Override protected void closeAction(ImportDbConfiguration model) throws Exception { - // clean configuration - model.destroy(); - - // remove configuration from session - getEchoBaseSession().setImportDbConfiguration(null); + destroyModel(model); } - - } \ No newline at end of file Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/ConnectToDbInformations.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,114 +0,0 @@ -/* - * #%L - * EchoBase :: UI - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.ui.actions.user; - -import fr.ifremer.echobase.EchoBaseConfiguration; -import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationService; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.lang3.StringUtils; -import org.nuiton.topia.TopiaContextFactory; - -import java.io.File; -import java.util.Properties; - -/** - * Display a page to show connection details. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class ConnectToDbInformations extends EchoBaseActionSupport { - - private static final long serialVersionUID = 1L; - - protected String jdbcUrl; - - protected String jdbcLogin; - - protected String jdbcPassword; - - protected String jdbcDriver; - - protected File jdbcPilot; - - protected boolean askPassword; - - public String getJdbcUrl() { - return jdbcUrl; - } - - public String getJdbcLogin() { - return jdbcLogin; - } - - public String getJdbcPassword() { - return jdbcPassword; - } - - public String getJdbcDriver() { - return jdbcDriver; - } - - public File getJdbcPilot() { - return jdbcPilot; - } - - public boolean isAskPassword() { - return askPassword; - } - - @Override - public String execute() throws Exception { - EchoBaseConfiguration configuration = - getEchoBaseApplicationContext().getConfiguration(); - Properties properties = configuration.getProperties(); - if (configuration.isEmbedded()) { - jdbcPassword = properties.getProperty(TopiaContextFactory.CONFIG_PASS); - } else { - askPassword = true; - jdbcPassword = "***"; - } - jdbcUrl = properties.getProperty(TopiaContextFactory.CONFIG_URL); - jdbcLogin = properties.getProperty(TopiaContextFactory.CONFIG_USER); - jdbcDriver = properties.getProperty(TopiaContextFactory.CONFIG_DRIVER); - - EmbeddedApplicationService service = - getService(EmbeddedApplicationService.class); - - String pilotName; - - if ("org.h2.Driver".equals(jdbcDriver)) { - pilotName = service.getH2PilotFilename(properties); - } else { - pilotName = service.getPostgresqlPilotFilename(properties); - } - - if (StringUtils.isNotEmpty(pilotName)) { - File driverDirectory = service.getPilotsDirectory( - configuration.getDataDirectory()); - jdbcPilot = new File(driverDirectory, pilotName); - } - return SUCCESS; - } -} Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Create.java 2012-09-02 15:11:02 UTC (rev 589) @@ -42,17 +42,16 @@ private static final long serialVersionUID = 1L; - protected transient UserService userService; - protected EchoBaseUser user; - public UserService getUserService() { - if (userService == null) { - userService = getService(UserService.class); + public EchoBaseUser getUser() { + if (user == null) { + user = getService(UserService.class).newUser(); } - return userService; + return user; } + @Override public String execute() throws Exception { EchoBaseUser userToCreate = getUser(); String userEmail = userToCreate.getEmail(); @@ -62,10 +61,10 @@ } // create user - getUserService().createOrUpdate(userToCreate); + getService(UserService.class).createOrUpdate(userToCreate); // add info message - addActionMessage(_("echobase.info.user.create", userEmail)); + addFlashMessage(_("echobase.info.user.create", userEmail)); return SUCCESS; } @@ -86,7 +85,7 @@ // check login not already used EchoBaseUser login; try { - login = getUserService().getUserByEmail(userEmail); + login = getService(UserService.class).getUserByEmail(userEmail); } catch (Exception e) { // could not get user @@ -108,12 +107,4 @@ } } - - public EchoBaseUser getUser() { - if (user == null) { - user = getUserService().newUser(); - } - return user; - } - } \ No newline at end of file Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Delete.java 2012-09-02 15:11:02 UTC (rev 589) @@ -32,8 +32,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.struts2.interceptor.ParameterAware; -import java.util.Map; - /** * To delete a user. * @@ -46,50 +44,22 @@ private static final long serialVersionUID = 1L; - protected transient UserService userService; - protected EchoBaseUser user; - private Map<String, String[]> parameters; - - public UserService getUserService() { - if (userService == null) { - userService = getService(UserService.class); - } - return userService; - } - - public String execute() throws Exception { - - EchoBaseUser userToDelete = getUser(); - String userEmail = userToDelete.getEmail(); - - if (log.isInfoEnabled()) { - log.info("will delete user " + userEmail); - } - - // delete user - getUserService().delete(userToDelete); - - // add info message - addActionMessage(_("echobase.info.user.delete", userEmail)); - return SUCCESS; - } - public EchoBaseUser getUser() { if (user == null) { - user = getUserService().newUser(); + user = getService(UserService.class).newUser(); } return user; } @Override public void prepare() throws Exception { - String userId = parameters.get("user.topiaId")[0]; + String userId = getParameters().get("user.topiaId")[0]; if (!StringUtils.isEmpty(userId)) { // load user - user = getUserService().getUserById(userId); + user = getService(UserService.class).getUserById(userId); // do not want to have the password user.setPassword(""); if (log.isInfoEnabled()) { @@ -99,7 +69,20 @@ } @Override - public void setParameters(Map<String, String[]> parameters) { - this.parameters = parameters; + public String execute() throws Exception { + + EchoBaseUser userToDelete = getUser(); + String userEmail = userToDelete.getEmail(); + + if (log.isInfoEnabled()) { + log.info("will delete user " + userEmail); + } + + // delete user + getService(UserService.class).delete(userToDelete); + + // add info message + addFlashMessage(_("echobase.info.user.delete", userEmail)); + return SUCCESS; } } \ No newline at end of file Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/GetUsers.java 2012-09-02 15:11:02 UTC (rev 589) @@ -87,5 +87,4 @@ return SUCCESS; } - } Copied: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java (from rev 588, trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java) =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,112 @@ +/* + * #%L + * EchoBase :: UI + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2011 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ +package fr.ifremer.echobase.ui.actions.user; + +import com.opensymphony.xwork2.ActionContext; +import com.opensymphony.xwork2.interceptor.I18nInterceptor; +import fr.ifremer.echobase.entities.EchoBaseUser; +import fr.ifremer.echobase.services.UserService; +import fr.ifremer.echobase.ui.EchoBaseSession; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.struts2.interceptor.SessionAware; + +import java.util.Locale; +import java.util.Map; + +/** + * Login and Logout action. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Login extends EchoBaseActionSupport implements SessionAware { + + protected static final Log log = LogFactory.getLog(Login.class); + + private static final long serialVersionUID = 1L; + + protected String email; + + protected String password; + + protected String redirectAction; + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRedirectAction() { + return redirectAction; + } + + public void setRedirectAction(String redirectAction) { + this.redirectAction = redirectAction; + } + + @Override + public String execute() throws Exception { + + EchoBaseUser user = getService(UserService.class).getUserByEmail(email); + + EchoBaseSession userSession = getEchoBaseSession(); + + // user is authorized, keep it in his echoBaseSession + userSession.setUser(user); + + // let's register + getEchoBaseApplicationContext().registerEchoBaseSession(userSession); + + Map<String,Object> session = getSession(); + + // add locale in echoBaseSession if required + Object o = session.get(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE); + if (o == null) { + + // push the locale in echoBaseSession to be able to use it everywhere + Locale locale = ActionContext.getContext().getLocale(); + session.put(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE, locale); + } + + // redecode parameters + if (log.isInfoEnabled()) { + log.info("success login for user " + email + + ", will redirect to " + redirectAction); + } + return "redirect"; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Login.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/LoginAction.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,135 +0,0 @@ -/* - * #%L - * EchoBase :: UI - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.ui.actions.user; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.interceptor.I18nInterceptor; -import fr.ifremer.echobase.entities.EchoBaseUser; -import fr.ifremer.echobase.services.UserService; -import fr.ifremer.echobase.ui.EchoBaseSession; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.struts2.interceptor.SessionAware; - -import java.util.Locale; -import java.util.Map; - -/** - * Login and Logout action. - * - * @author tchemit <chemit@codelutin.com> - * @since 0.1 - */ -public class LoginAction extends EchoBaseActionSupport implements SessionAware { - - protected static final Log log = LogFactory.getLog(LoginAction.class); - - private static final long serialVersionUID = 1L; - - protected String email; - - protected String password; - - protected String redirectAction; - - private transient Map<String, Object> session; - - protected transient UserService userService; - - public UserService getUserService() { - if (userService == null) { - userService = getService(UserService.class); - } - return userService; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getRedirectAction() { - return redirectAction; - } - - public void setRedirectAction(String redirectAction) { - this.redirectAction = redirectAction; - } - - public String doLogin() throws Exception { - - EchoBaseUser user = getUserService().getUserByEmail(email); - - EchoBaseSession userSession = getEchoBaseSession(); - - // user is authorized, keep it in his echoBaseSession - userSession.setUser(user); - - // add locale in echoBaseSession if required - Object o = session.get(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE); - if (o == null) { - - // push the locale in echoBaseSession to be able to use it everywhere - Locale locale = ActionContext.getContext().getLocale(); - session.put(I18nInterceptor.DEFAULT_SESSION_ATTRIBUTE, locale); - } - - // redecode parameters - if (log.isInfoEnabled()) { - log.info("success login for user " + email + - ", will redirect to " + redirectAction); - } - return "redirect"; - } - - public String doLogout() { - - EchoBaseSession userSession = getEchoBaseSession(); - - // remove echoBaseSession from application session - getEchoBaseApplicationContext().destroyEchoBaseSession(userSession); - - // clean it from ActionContext (we never know...) - EchoBaseSession.removeEchoBaseSession(getActionContext()); - - return SUCCESS; - } - - @Override - public void setSession(Map<String, Object> session) { - this.session = session; - } -} Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,52 @@ +package fr.ifremer.echobase.ui.actions.user; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.ui.EchoBaseSession; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; + +/** + * Log out from EchoBase. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class Logout extends EchoBaseActionSupport { + + private static final long serialVersionUID = 1L; + + @Override + public String execute() throws Exception { + + EchoBaseSession userSession = getEchoBaseSession(); + + // remove echoBaseSession from application session + getEchoBaseApplicationContext().destroyEchoBaseSession(userSession); + + // clean it from ActionContext (we never know...) + EchoBaseSession.removeEchoBaseSession(getActionContext()); + + return SUCCESS; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Logout.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/user/Update.java 2012-09-02 15:11:02 UTC (rev 589) @@ -32,8 +32,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.struts2.interceptor.ParameterAware; -import java.util.Map; - /** * To update a user. * @@ -46,17 +44,13 @@ private static final long serialVersionUID = 1L; - protected transient UserService userService; - protected EchoBaseUser user; - private Map<String, String[]> parameters; - - public UserService getUserService() { - if (userService == null) { - userService = getService(UserService.class); + public EchoBaseUser getUser() { + if (user == null) { + user = getService(UserService.class).newUser(); } - return userService; + return user; } @Override @@ -69,20 +63,20 @@ } // update user - getUserService().createOrUpdate(userToUpdate); + getService(UserService.class).createOrUpdate(userToUpdate); // add info message - addActionMessage(_("echobase.info.user.update", userEmail)); + addFlashMessage(_("echobase.info.user.update", userEmail)); return SUCCESS; } @Override public void prepare() throws Exception { - String userId = parameters.get("user.topiaId")[0]; + String userId = getParameters().get("user.topiaId")[0]; if (!StringUtils.isEmpty(userId)) { // load user - user = getUserService().getUserById(userId); + user = getService(UserService.class).getUserById(userId); // do not want to update password user.setPassword(""); if (log.isInfoEnabled()) { @@ -91,15 +85,4 @@ } } - public EchoBaseUser getUser() { - if (user == null) { - user = getUserService().newUser(); - } - return user; - } - - @Override - public void setParameters(Map<String, String[]> parameters) { - this.parameters = parameters; - } } \ No newline at end of file Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,114 @@ +package fr.ifremer.echobase.ui.actions.workingDb; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.opensymphony.xwork2.Preparable; +import fr.ifremer.echobase.entities.DriverType; +import fr.ifremer.echobase.entities.WorkingDbConfiguration; +import fr.ifremer.echobase.services.workingDb.WorkingDbConfigurationService; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.struts2.interceptor.ParameterAware; + +import java.util.Map; + +/** + * Connects to an existing working db. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public abstract class AbstractWorkingDbAction extends EchoBaseActionSupport implements Preparable, ParameterAware { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = + LogFactory.getLog(AbstractWorkingDbAction.class); + + /** All available working db configuration from database. */ + protected Map<String, String> confs; + + /** All available driver types. */ + protected Map<String, String> driverTypes; + + /** Current working db configuration. */ + protected WorkingDbConfiguration conf; + + public boolean isNewConf() { + return false; + } + + public final Map<String, String> getConfs() { + return confs; + } + + public final WorkingDbConfiguration getConf() { + if (conf == null) { + conf = getService().newConfiguration(); + } + return conf; + } + + public Map<String, String> getDriverTypes() { + return driverTypes; + } + + public final boolean isConfExists() { + return StringUtils.isNotBlank(getConf().getTopiaId()); + } + + @Override + public void prepare() throws Exception { + + driverTypes = decorateEnums(DriverType.values()); + + confs = loadSortAndDecorate(WorkingDbConfiguration.class); + + if (confs.isEmpty()) { + + // no conf saved + addFlashMessage( + _("echobase.info.no.workingDbConfiguration.saved")); + } + + String[] ids = getParameters().get("conf.topiaId"); + String id = ids == null || ids.length == 0 ? null : ids[0]; + if (!StringUtils.isEmpty(id)) { + + // load conf + conf = getService().getEditableConf(id); + if (log.isInfoEnabled()) { + log.info("Selected conf " + conf.getUrl()); + } + } + } + + protected final WorkingDbConfigurationService getService() { + return getService(WorkingDbConfigurationService.class); + } + +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/AbstractWorkingDbAction.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,100 @@ +package fr.ifremer.echobase.ui.actions.workingDb; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.opensymphony.xwork2.interceptor.annotations.InputConfig; +import fr.ifremer.echobase.persistence.EchoBaseEntityHelper; +import fr.ifremer.echobase.persistence.JdbcConfiguration; + +import java.sql.SQLException; + +/** + * Connects to an existing working db. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class Connect extends AbstractWorkingDbAction { + + private static final long serialVersionUID = 1L; + + protected String password; + + protected JdbcConfiguration jdbcConf; + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + @InputConfig(methodName = INPUT) + @Override + public String execute() throws Exception { + + String result = INPUT; + + try { + EchoBaseEntityHelper.checkJDBCConnection(jdbcConf); + getEchoBaseSession().initWorkingDb(jdbcConf); + addFlashMessage(_("echobase.info.workingDbconfiguration.connected", + conf.getUrl())); + result = SUCCESS; + + } catch (SQLException e) { + jdbcConf = null; + addFieldError( + "password", + _("echobase.error.workingDbConfiguration.couldNotConnect", + e.getMessage())); + } + + return result; + } + + @Override + public void validate() { + + jdbcConf = JdbcConfiguration.newConfig( + getConf().getUrl(), + getConf().getLogin(), + password, + getConf().getDriverType() + ); + + // check connexion is ok + try { + EchoBaseEntityHelper.checkJDBCConnection(jdbcConf); + } catch (SQLException e) { + jdbcConf = null; + addFieldError( + "password", + _("echobase.error.workingDbConfiguration.couldNotConnect", + e.getMessage())); + } + + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Connect.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,110 @@ +package fr.ifremer.echobase.ui.actions.workingDb; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import com.opensymphony.xwork2.interceptor.annotations.InputConfig; +import fr.ifremer.echobase.entities.WorkingDbConfiguration; +import org.apache.commons.lang.StringUtils; + +/** + * To create a new {@link WorkingDbConfiguration}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class Create extends AbstractWorkingDbAction { + + private static final long serialVersionUID = 1L; + + public boolean isNewConf() { + return true; + } + + public String createConf() throws Exception { + + // new workingDbConfiguration in progress + addFlashMessage( + _("echobase.info.new.workingDbConfiguration.inprogress")); + + return INPUT; + } + + public String cloneConf() throws Exception { + + getConf().setTopiaId(null); + + // new workingDbConfiguration in progress + addFlashMessage( + _("echobase.info.new.workingDbConfiguration.inprogress")); + + return INPUT; + } + + @InputConfig(methodName = INPUT) + @Override + public String execute() throws Exception { + + conf = getService().create(getConf()); + + addFlashMessage(_("echobase.info.workingDbconfiguration.created", + conf.getUrl())); + + return SUCCESS; + } + + @Override + public void validate() { + + if (StringUtils.isBlank(getConf().getUrl())) { + addFieldError( + "conf.url", + _("echobase.error.workingDbConfiguration.url.required")); + } else { + + if (!isConfExists()) { + + // when creating a request + // check this url does not exists + + boolean urlUsed = getService().isUrlAlreadyUsed(getConf().getUrl()); + if (urlUsed) { + addFieldError("conf.url", + _("echobase.error.workingDbConfiguration.url.already.exists")); + } + } + } + + if (StringUtils.isBlank(getConf().getLogin())) { + addFieldError( + "conf.login", + _("echobase.error.workingDbConfiguration.login.required")); + } + + if (StringUtils.isBlank(getConf().getDescription())) { + addFieldError( + "conf.description", + _("echobase.error.workingDbConfiguration.description.required")); + } + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Create.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,67 @@ +package fr.ifremer.echobase.ui.actions.workingDb; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.entities.WorkingDbConfiguration; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +/** + * To delete a selected {@link WorkingDbConfiguration}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class Delete extends AbstractWorkingDbAction { + + private static final long serialVersionUID = 1L; + + /** Logger. */ + private static final Log log = LogFactory.getLog(Delete.class); + + public String confirmDelete() { + + return SUCCESS; + } + + @Override + public String execute() throws Exception { + + String result = INPUT; + try { + getService().delete(getConf().getTopiaId()); + addFlashMessage(_("echobase.info.workingDbconfiguration.deleted", + conf.getUrl())); + + conf = null; + result = SUCCESS; + } catch (Exception e) { + if (log.isErrorEnabled()) { + log.error("Could not delete workgingDbconfiguration", e); + } + } + + return result; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Delete.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,48 @@ +package fr.ifremer.echobase.ui.actions.workingDb; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.entities.WorkingDbConfiguration; +import fr.ifremer.echobase.persistence.JdbcConfiguration; + +/** + * Disconnects from a {@link WorkingDbConfiguration}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class Disconnect extends AbstractWorkingDbAction { + + private static final long serialVersionUID = 1L; + + @Override + public String execute() throws Exception { + JdbcConfiguration sessionConf = + getEchoBaseSession().getWorkingDbConfiguration(); + getEchoBaseSession().releaseWorkingDb(); + addFlashMessage(_("echobase.info.workingDbconfiguration.disconnected", + sessionConf.getUrl())); + return SUCCESS; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Disconnect.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,79 @@ +package fr.ifremer.echobase.ui.actions.workingDb; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.EchoBaseConfiguration; +import fr.ifremer.echobase.persistence.JdbcConfiguration; +import fr.ifremer.echobase.services.embeddedapplication.EmbeddedApplicationService; +import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; +import org.apache.commons.lang3.StringUtils; + +import java.io.File; +import java.util.Properties; + +/** + * Display a page to show connection details. + * + * @author tchemit <chemit@codelutin.com> + * @since 0.1 + */ +public class Information extends EchoBaseActionSupport { + + private static final long serialVersionUID = 1L; + + protected JdbcConfiguration dbConfiguration; + + protected File jdbcPilot; + + public JdbcConfiguration getDbConfiguration() { + return dbConfiguration; + } + + public File getJdbcPilot() { + return jdbcPilot; + } + + @Override + public String execute() throws Exception { + + EchoBaseConfiguration configuration = + getEchoBaseApplicationContext().getConfiguration(); + + dbConfiguration = getEchoBaseSession().getWorkingDbConfiguration(); + + Properties properties = configuration.getProperties(); + + String pilotName = + dbConfiguration.getDriverType().getPilotFileName(properties); + + if (StringUtils.isNotEmpty(pilotName)) { + EmbeddedApplicationService service = + getService(EmbeddedApplicationService.class); + File driverDirectory = service.getPilotsDirectory( + configuration.getDataDirectory()); + jdbcPilot = new File(driverDirectory, pilotName); + } + return SUCCESS; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/Information.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java (rev 0) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,50 @@ +package fr.ifremer.echobase.ui.actions.workingDb; + +/* + * #%L + * EchoBase :: UI + * $Id$ + * $HeadURL:$ + * %% + * Copyright (C) 2011 - 2012 Ifremer, Codelutin + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +import fr.ifremer.echobase.entities.WorkingDbConfiguration; + +/** + * Display the page to manage and use {@link WorkingDbConfiguration}. + * + * @author tchemit <chemit@codelutin.com> + * @since 1.1 + */ +public class ShowList extends AbstractWorkingDbAction { + + private static final long serialVersionUID = 1L; + + @Override + public String execute() throws Exception { + + if (!isConfExists()) { + + // no workingDbConfiguration selected + addFlashMessage( + _("echobase.info.no.workingDbConfiguration.selected")); + } + + return SUCCESS; + } +} Property changes on: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/actions/workingDb/ShowList.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckInUserSessionInterceptor.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,92 +0,0 @@ -/* - * #%L - * EchoBase :: UI - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.ui.interceptors; - -import com.google.common.collect.Sets; -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.util.TextParseUtil; -import fr.ifremer.echobase.ui.EchoBaseSession; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.Collections; -import java.util.Set; - -/** - * To check if some data are in the user session. - * - * @author tchemit <chemit@codelutin.com> - * @see EchoBaseSession - * @since 0.1 - */ -public class CheckInUserSessionInterceptor extends AbstractCheckInterceptor { - - private static final long serialVersionUID = 1L; - - /** Logger. */ - protected static final Log log = - LogFactory.getLog(CheckInUserSessionInterceptor.class); - - private Set<String> parameters = Collections.emptySet(); - - /** - * Allows <code>sessionParametersToClean</code> attribute to be set as comma-separated-values (csv). - * - * @param parameters the sessionParametersToClean to set - */ - public void setParameters(String parameters) { - this.parameters = - TextParseUtil.commaDelimitedStringToSet(parameters); - } - - @Override - protected boolean doCheck(ActionInvocation invocation) { - EchoBaseActionSupport action = (EchoBaseActionSupport) invocation.getAction(); - - EchoBaseSession echoBaseSession = action.getEchoBaseSession(); - Set<String> missingKeys = null; - for (String parameter : parameters) { - boolean ok = echoBaseSession.contains(parameter); - if (!ok) { - if (missingKeys == null) { - missingKeys = Sets.newHashSet(); - } - missingKeys.add(parameter); - } - } - if (CollectionUtils.isNotEmpty(missingKeys)) { - // there is something missing in the user session - String message = "Some objects were not found in session : " + - missingKeys + ", " + "redirect to " + redirectAction; - if (log.isInfoEnabled()) { - log.info(message); - } - return false; - } - return true; - } - -} Modified: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CheckLogguedInterceptor.java 2012-09-02 15:11:02 UTC (rev 589) @@ -27,7 +27,7 @@ import fr.ifremer.echobase.EchoBaseConfiguration; import fr.ifremer.echobase.ui.EchoBaseSession; import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import fr.ifremer.echobase.ui.actions.user.LoginAction; +import fr.ifremer.echobase.ui.actions.user.Login; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -74,12 +74,12 @@ if (log.isInfoEnabled()) { log.info("AutotLogin with admin/admin user"); } - LoginAction logAction = new LoginAction(); + Login logAction = new Login(); logAction.setSession(invocation.getInvocationContext().getSession()); logAction.setEmail("admin"); logAction.setPassword("admin"); try { - logAction.doLogin(); + logAction.execute(); } catch (Exception eee) { if (log.isErrorEnabled()) { log.error("Could not auto-login", eee); Deleted: trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java =================================================================== --- trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/java/fr/ifremer/echobase/ui/interceptors/CleanEchoBaseSessionInterceptor.java 2012-09-02 15:11:02 UTC (rev 589) @@ -1,79 +0,0 @@ -/* - * #%L - * EchoBase :: UI - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2011 Ifremer, Codelutin - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ -package fr.ifremer.echobase.ui.interceptors; - -import com.opensymphony.xwork2.ActionInvocation; -import com.opensymphony.xwork2.interceptor.AbstractInterceptor; -import com.opensymphony.xwork2.util.TextParseUtil; -import fr.ifremer.echobase.ui.EchoBaseSession; -import fr.ifremer.echobase.ui.actions.EchoBaseActionSupport; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.util.Collections; -import java.util.Set; - -/** - * Interceptor to remove some stuff from user session. - * - * @author tchemit <chemit@codelutin.com> - * @see EchoBaseSession - * @since 0.1 - */ -public class CleanEchoBaseSessionInterceptor extends AbstractInterceptor { - private static final long serialVersionUID = 1L; - - /** Logger. */ - private static final Log log = - LogFactory.getLog(CleanEchoBaseSessionInterceptor.class); - - private Set<String> parameters = Collections.emptySet(); - - /** - * <code>parameters</code> to remove from session as comma-separated-values (csv). - * - * @param parameters the parameters to set - */ - public void setParameters(String parameters) { - this.parameters = - TextParseUtil.commaDelimitedStringToSet(parameters); - } - - @Override - public String intercept(ActionInvocation invocation) throws Exception { - - EchoBaseActionSupport action = (EchoBaseActionSupport) invocation.getAction(); - - EchoBaseSession echoBaseSession = action.getEchoBaseSession(); - - for (String paramName : parameters) { - Object value = echoBaseSession.remove(paramName); - if (log.isDebugEnabled()) { - log.debug("Removed [" + paramName + "] : " + value); - } - } - - return invocation.invoke(); - } -} Modified: trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/resources/config/struts-exportQuery.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -38,6 +38,11 @@ <param name="namespace">export</param> <param name="query.topiaId">${query.topiaId}</param> </result-type> + <result-type name="showList" + class="org.apache.struts2.dispatcher.ServletDispatcherResult"> + <param name="location">/WEB-INF/jsp/exportQuery/exportQuery.jsp</param> + <param name="query.topiaId">${query.topiaId}</param> + </result-type> </result-types> @@ -54,7 +59,7 @@ <action name="manageExportQuery" class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery"> <interceptor-ref name="paramsPrepareParamsStackLoggued"/> - <result>/WEB-INF/jsp/exportQuery/exportQuery.jsp</result> + <result type="showList"/> </action> <!-- Display the result of the export query execution --> @@ -81,7 +86,7 @@ <action name="clone" method="cloneQuery" class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery"> <interceptor-ref name="paramsPrepareParamsStackLoggued"/> - <result name="input">/WEB-INF/jsp/exportQuery/exportQuery.jsp</result> + <result name="input" type="showList"/> <result type="redirectExportQuery"/> </action> @@ -89,7 +94,7 @@ <action name="save" method="saveQuery" class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery"> <interceptor-ref name="paramsPrepareParamsStackLoggued"/> - <result name="input">/WEB-INF/jsp/exportQuery/exportQuery.jsp</result> + <result name="input" type="showList"/> <result type="redirectExportQuery"/> </action> @@ -97,14 +102,14 @@ <action name="confirmDelete" method="confirmDeleteQuery" class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery"> <interceptor-ref name="paramsPrepareParamsStackLoggued"/> - <result>/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp</result> + <result>/WEB-INF/jsp/exportQuery/confirmDelete.jsp</result> </action> <!-- Delete the export query --> <action name="delete" method="deleteQuery" class="fr.ifremer.echobase.ui.actions.exportQuery.ManageExportQuery"> <interceptor-ref name="paramsPrepareParamsStackLoggued"/> - <result name="input">/WEB-INF/jsp/exportQuery/exportQuery.jsp</result> + <result name="input" type="showList"/> <result type="redirectExportQuery"/> </action> Modified: trunk/echobase-ui/src/main/resources/config/struts-importData.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-importData.xml 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/resources/config/struts-importData.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -74,7 +74,7 @@ <result type="json"/> </action> - <!-- Create a new mission --> + <!-- CreateOrUpdate a new mission --> <action name="createMission" class="fr.ifremer.echobase.ui.actions.importData.CreateMission"> <interceptor-ref name="prepareParamsStackLoggued"/> Modified: trunk/echobase-ui/src/main/resources/config/struts-user.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-user.xml 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/resources/config/struts-user.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -34,21 +34,16 @@ <default-interceptor-ref name="basicStackLoggued"/> <!-- Login --> - <action name="login" class="fr.ifremer.echobase.ui.actions.user.LoginAction" - method="doLogin"> + <action name="login" class="fr.ifremer.echobase.ui.actions.user.Login" + method="execute"> <result name="input">/WEB-INF/jsp/user/login.jsp</result> <result name="redirect" type="redirect">${redirectAction}</result> <interceptor-ref name="paramsPrepareParamsStack"/> </action> <!-- Logout --> - <action name="logout" - class="fr.ifremer.echobase.ui.actions.user.LoginAction" - method="doLogout"> - <result type="redirectAction"> - <param name="namespace">/</param> - <param name="actionName">home</param> - </result> + <action name="logout" class="fr.ifremer.echobase.ui.actions.user.Logout"> + <result type="redirectToHome"/> <interceptor-ref name="checkUserLoggued"/> <interceptor-ref name="basicStack"/> </action> @@ -76,12 +71,6 @@ <result>/WEB-INF/jsp/modificationLogs.jsp</result> </action> - <!-- Get db connexion informations --> - <action name="connectToDbInformations" - class="fr.ifremer.echobase.ui.actions.user.ConnectToDbInformations"> - <result>/WEB-INF/jsp/connectToDbInformations.jsp</result> - </action> - <!-- Get list of users in database --> <action name="getUsers" class="fr.ifremer.echobase.ui.actions.user.GetUsers"> Added: trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml =================================================================== --- trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml (rev 0) +++ trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,113 @@ +<!-- + #%L + EchoBase :: UI + $Id$ + $HeadURL:$ + %% + Copyright (C) 2011 - 2012 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> +<!DOCTYPE struts PUBLIC + "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN" + "http://struts.apache.org/dtds/struts-2.3.dtd"> + +<struts> + + <package name="workingDb" extends="loggued" namespace="/workingDb"> + + <result-types> + + <result-type name="redirectWorkingDbConfiguration" + class="org.apache.struts2.dispatcher.ServletActionRedirectResult"> + <param name="actionName">showList</param> + <param name="namespace">workingDbConfiguration</param> + <param name="conf.topiaId">${conf.topiaId}</param> + </result-type> + + <result-type name="showList" + class="org.apache.struts2.dispatcher.ServletDispatcherResult"> + <param name="location">/WEB-INF/jsp/workingDb/manage.jsp</param> + <param name="conf.topiaId">${conf.topiaId}</param> + </result-type> + </result-types> + + <!-- Get db connexion informations --> + <action name="information" + class="fr.ifremer.echobase.ui.actions.workingDb.Information"> + <result>/WEB-INF/jsp/workingDb/information.jsp</result> + </action> + + <!-- Display workingDbConfiguration main page --> + <action name="showList" + class="fr.ifremer.echobase.ui.actions.workingDb.ShowList"> + <result type="showList"/> + </action> + + <!-- Create a new workingDbConfiguration --> + <action name="create" method="createConf" + class="fr.ifremer.echobase.ui.actions.workingDb.Create"> + <result name="input" type="showList"/> + <result type="redirectWorkingDbConfiguration"/> + </action> + + <!-- Clone the workingDbConfiguration --> + <action name="clone" method="cloneConf" + class="fr.ifremer.echobase.ui.actions.workingDb.Create"> + <interceptor-ref name="prepareParamsStackLoggued"/> + <result name="input" type="showList"/> + <result type="redirectWorkingDbConfiguration"/> + </action> + + <!-- Save the workingDbConfiguration --> + <action name="save" method="execute" + class="fr.ifremer.echobase.ui.actions.workingDb.Create"> + <interceptor-ref name="prepareParamsStackLoggued"/> + <result name="input" type="showList"/> + <result type="redirectWorkingDbConfiguration"/> + </action> + + <!-- Confirm to delete the workingDbConfiguration --> + <action name="confirmDelete" method="confirmDelete" + class="fr.ifremer.echobase.ui.actions.workingDb.Delete"> + <interceptor-ref name="prepareParamsStackLoggued"/> + <result>/WEB-INF/jsp/workingDb/confirmDelete.jsp</result> + </action> + + <!-- Delete the workingDbConfiguration --> + <action name="delete" method="execute" + class="fr.ifremer.echobase.ui.actions.workingDb.Delete"> + <interceptor-ref name="prepareParamsStackLoggued"/> + <result name="input" type="showList"/> + <result type="redirectWorkingDbConfiguration"/> + </action> + + <!-- Connect to selected workingDbConfiguration --> + <action name="connect" method="execute" + class="fr.ifremer.echobase.ui.actions.workingDb.Connect"> + <interceptor-ref name="prepareParamsStackLoggued"/> + <result name="input" type="showList"/> + <result type="redirectToHome"/> + </action> + + <!-- Disconnect from current workingDbConfiguration --> + <action name="disconnect" + class="fr.ifremer.echobase.ui.actions.workingDb.Disconnect"> + <result type="showList"/> + </action> + + </package> + +</struts> Property changes on: trunk/echobase-ui/src/main/resources/config/struts-workingDb.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/resources/echobase.properties =================================================================== --- trunk/echobase-ui/src/main/resources/echobase.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/resources/echobase.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -22,15 +22,5 @@ # #L% ### -project.version=${project.version} -project.site.url=${project.url} - -hibernate.hbm2ddl.auto=none -hibernate.show_sql=false -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.connection.provider_class=org.nuiton.topia.framework.TopiaConnectionProvider - -hibernate.connection.driver_class=org.h2.Driver -hibernate.connection.url=jdbc:h2:file:${data.directory}/db/echobase -hibernate.connection.username=sa -hibernate.connection.password=sa \ No newline at end of file +echobase.version=${project.version} +echobase.site.url=${project.url} Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties =================================================================== --- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_en_GB.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,14 +1,19 @@ echobase.action.backToUserList= echobase.action.cancel=Cancel +echobase.action.clone= echobase.action.cloneSqlQuery= +echobase.action.cloneWorkingDbConfiguration= echobase.action.configureImport= +echobase.action.connectToWorkingDb= echobase.action.create= echobase.action.createEmbeddedApplication= echobase.action.createMission= echobase.action.createNewMission=Create a new mission echobase.action.createSqlQuery= +echobase.action.createWorkingDbConfiguration= echobase.action.delete= echobase.action.deleteSqlQuery= +echobase.action.deleteWorkingDbConfiguration= echobase.action.downloadEmbeddedApplicationFile= echobase.action.downloadExportDbFile= echobase.action.export= @@ -21,17 +26,21 @@ echobase.action.logout= echobase.action.newLibreOfficeQuery=New Libre office request echobase.action.newQuery=New request +echobase.action.newWorkingDbContiguration= echobase.action.reloadSqlQuery= echobase.action.reset= echobase.action.return= echobase.action.save= echobase.action.saveSqlQuery=Update query +echobase.action.saveWorkingDbConfiguration= echobase.action.show.embedded.documentation=Show embedded application documentation echobase.action.show.import.documentation=Show import documentation echobase.action.toEnglish=Use english version echobase.action.toFrench=Use the french version echobase.action.usingEnglish=English version used echobase.action.usingFrench=French version used +echobase.action.workingDbconfiguration.connect= +echobase.action.workingDbconfiguration.disconnect= echobase.common.acousticDensityUnit= echobase.common.acquisitionSoftwareVersionER60= echobase.common.acquisitionSoftwareVersionME70= @@ -129,6 +138,7 @@ echobase.common.voyageDescription= echobase.common.voyageFile= echobase.confirm.delete.query=Confirm to delete export query +echobase.confirm.delete.workingDbConfiguration= echobase.error.bad.password=Bad password echobase.error.email.already.used=Email already used echobase.error.invalid.sql=Invalid request \: %s @@ -141,26 +151,47 @@ echobase.error.query.name.already.exists=Query name already used echobase.error.required.email=Email is required echobase.error.required.password=Password is required +echobase.error.url.already.exists= echobase.error.warlocation.notFound=War not found at location %s +echobase.error.workingDbConfiguration.couldNotConnect= +echobase.error.workingDbConfiguration.description.required= +echobase.error.workingDbConfiguration.login.required= +echobase.error.workingDbConfiguration.password.required= +echobase.error.workingDbConfiguration.url.already.exists= +echobase.error.workingDbConfiguration.url.required= echobase.header.request.result= echobase.info.dbeditor.propertyDiffsResult= +echobase.info.downloadEchoBase=Téléchargement de l'application et des fichiers d'import +echobase.info.echoBaseForge=Gestion du projet echobase.info.import.failed=L'import a échoué. echobase.info.import.succeded= +echobase.info.lastDevDocumentation=Documentation en cours (disponible dans la prochaine version stable) +echobase.info.lastStableDocumentation=Documentation de la dernière version stable echobase.info.new.sqlQuery.inprogress=New query creation in progress +echobase.info.new.workingDbConfiguration.inprogress= echobase.info.no.sqlQuery.saved= echobase.info.no.sqlQuery.selected= echobase.info.no.table.selected= echobase.info.no.voyagee.found= +echobase.info.no.workingDbConfiguration.saved= +echobase.info.no.workingDbConfiguration.selected= echobase.info.sqlQuery.not.modifiable=Current user can not udate the selected query +echobase.info.usefulLinks=Quelques liens utiles echobase.info.user.create= echobase.info.user.delete= echobase.info.user.update= +echobase.info.workingDbConfiguration.not.modifiable= +echobase.info.workingDbconfiguration.connected= +echobase.info.workingDbconfiguration.created= +echobase.info.workingDbconfiguration.deleted= +echobase.info.workingDbconfiguration.disconnected= echobase.information.mission.created= echobase.information.one.file.required= echobase.label.admin.user.create= echobase.label.admin.user.delete= echobase.label.admin.user.edit= echobase.label.createIfNotFound= +echobase.label.driverType= echobase.label.embeddedApplicationFileName= echobase.label.embeddedWarFileName= echobase.label.exportAsSeen=Export as seen on screen @@ -168,6 +199,7 @@ echobase.label.exportFileName= echobase.label.importFile= echobase.label.login= +echobase.label.noWorkingDbSelected= echobase.label.numberOfCreatedEntities= echobase.label.numberOfUpdatedEntities= echobase.label.query.description= @@ -176,6 +208,12 @@ echobase.label.sqlQueries= echobase.label.user.login= echobase.label.voyageToSelect= +echobase.label.workingDbConfiguration.description= +echobase.label.workingDbConfiguration.login= +echobase.label.workingDbConfiguration.password= +echobase.label.workingDbConfiguration.url= +echobase.label.workingDbConfigurations= +echobase.label.workingDbSelected= echobase.legend.connectionToDb.detail= echobase.legend.dbeditor.edit= echobase.legend.dbeditor.show=Detail of '%s' @@ -188,6 +226,9 @@ echobase.legend.libreOfficeQuery=Requète "libre office" echobase.legend.sqlQuery.configuration= echobase.legend.sqlQuery.result= +echobase.legend.workingDbConfiguration.configuration= +echobase.legend.workingDbConfiguration.create= +echobase.legend.workingDbConfiguration.use= echobase.menu.connectToDbInformations= echobase.menu.createEmbeddedApplication= echobase.menu.editData=Modify datas @@ -205,6 +246,7 @@ echobase.message.warnExportInProgress= echobase.message.warnImportInProgress= echobase.title.confirm.deleteQuery=Delete a export query +echobase.title.confirm.deleteWorkingDbConfiguration= echobase.title.connectToDbInformations= echobase.title.createEmbeddedApplication= echobase.title.createMission= @@ -228,3 +270,7 @@ echobase.title.newLibreOfficeQuery=Import a new "Libre-Office" request echobase.title.users= echobase.title.welcome= +echobase.title.workingDbConfiguration= +echobase.tooltip.disconnectWorkingDb= +echobase.tooltip.logout= +echobase.tooltip.selectWorkingDb= Modified: trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties =================================================================== --- trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/resources/i18n/echobase-ui_fr_FR.properties 2012-09-02 15:11:02 UTC (rev 589) @@ -1,14 +1,19 @@ echobase.action.backToUserList=Retour à la liste des utilisateurs echobase.action.cancel=Annuler +echobase.action.clone=Cloner echobase.action.cloneSqlQuery=Cloner +echobase.action.cloneWorkingDbConfiguration=Cloner echobase.action.configureImport=Configurer l'import +echobase.action.connectToWorkingDb=Se connecter echobase.action.create=Créer echobase.action.createEmbeddedApplication=Créer l'application echobase.action.createMission=Créer la mission echobase.action.createNewMission=Créer une nouvelle mission echobase.action.createSqlQuery=Enregistrer -echobase.action.delete=Suppression +echobase.action.createWorkingDbConfiguration=Enregistrer +echobase.action.delete=Supprimer echobase.action.deleteSqlQuery=Supprimer +echobase.action.deleteWorkingDbConfiguration=Supprimer echobase.action.downloadEmbeddedApplicationFile=Télécharger l'application embarquée echobase.action.downloadExportDbFile=Télécharger le fichier d'export de la base complête echobase.action.export=Exporter @@ -21,17 +26,21 @@ echobase.action.logout=Déconnexion echobase.action.newLibreOfficeQuery=Nouvelle requète Libre office echobase.action.newQuery=Nouvelle requète +echobase.action.newWorkingDbContiguration=Nouvelle configuration de base de travail echobase.action.reloadSqlQuery=Recharger echobase.action.reset=Annuler echobase.action.return=Retour echobase.action.save=Sauvegarder echobase.action.saveSqlQuery=Mettre à jour +echobase.action.saveWorkingDbConfiguration=Mettre à jour echobase.action.show.embedded.documentation=Accéder à la documentation d'utilisation d'une application emabrquée echobase.action.show.import.documentation=Accéder à la documentation de l'import echobase.action.toEnglish=Utiliser la version anglaise echobase.action.toFrench=Utiliser la version française echobase.action.usingEnglish=Version anglaise utilisé echobase.action.usingFrench=Version française utilisé +echobase.action.workingDbconfiguration.connect=Sélectionner une base de travail +echobase.action.workingDbconfiguration.disconnect=Se déconnecter echobase.common.acousticDensityUnit=acousticDensityUnit echobase.common.acquisitionSoftwareVersionER60=acquisitionSoftwareVersion (ER60 instrument) echobase.common.acquisitionSoftwareVersionME70=acquisitionSoftwareVersion (ME70 instrument) @@ -129,6 +138,7 @@ echobase.common.voyageDescription=Description echobase.common.voyageFile= echobase.confirm.delete.query=Confirmer la suppression de la requète suivante +echobase.confirm.delete.workingDbConfiguration=Confirmer la suppression de la configuration suivante echobase.error.bad.password=Mot de passe incorrrect echobase.error.email.already.used=Nom d'utilisateur déjà pris echobase.error.invalid.sql=Requète non valide \: %s @@ -141,26 +151,47 @@ echobase.error.query.name.already.exists=Nom de requète déjà utilisé echobase.error.required.email=L'email est obligatoire echobase.error.required.password=Le mot de passe est obligatoire +echobase.error.url.already.exists=Il existe déjà une configuration avec cette url echobase.error.warlocation.notFound=L'application n'a pas été trouvé à l'emplacement suivant %s +echobase.error.workingDbConfiguration.couldNotConnect=Impossible de se connecter (%s) +echobase.error.workingDbConfiguration.description.required=Description obligatoire +echobase.error.workingDbConfiguration.login.required=Login obligatoire +echobase.error.workingDbConfiguration.password.required=Mot de passe obligatoire +echobase.error.workingDbConfiguration.url.already.exists=Une connexion existe déjà avec cette url +echobase.error.workingDbConfiguration.url.required=Url obligatoire echobase.header.request.result=Résultat de la requète sql echobase.info.dbeditor.propertyDiffsResult=Résultat d'import de données +echobase.info.downloadEchoBase=Téléchargement de l'application et des fichiers d'import +echobase.info.echoBaseForge=Gestion du projet echobase.info.import.failed=L'import a échoué. echobase.info.import.succeded=L'import a réussi. +echobase.info.lastDevDocumentation=Documentation en cours (disponible dans la prochaine version stable) +echobase.info.lastStableDocumentation=Documentation de la dernière version stable echobase.info.new.sqlQuery.inprogress=Nouvelle requète en cours de création +echobase.info.new.workingDbConfiguration.inprogress=Nouvelle configuration de base de travail en cours de création echobase.info.no.sqlQuery.saved=Aucune requète d'export sql enregistrée echobase.info.no.sqlQuery.selected=Aucune requète d'export sql sélectionnée echobase.info.no.table.selected=Aucune table sélectionnée echobase.info.no.voyagee.found=Aucune campagne à exporter +echobase.info.no.workingDbConfiguration.saved=Aucune configuration de base de travail enregistrée +echobase.info.no.workingDbConfiguration.selected=Sélectionner une configuration pour ensuite vous y connecter echobase.info.sqlQuery.not.modifiable=Vous ne pouvez pas modifier la requète sélectionnée +echobase.info.usefulLinks=Quelques liens utiles echobase.info.user.create=L'utilisateur '%s' a été créée echobase.info.user.delete=L'utilisateur '%s' a été supprimé echobase.info.user.update=L'utilisateur '%s' a été mis à jour +echobase.info.workingDbConfiguration.not.modifiable=Configuration de base de travail non modifiable +echobase.info.workingDbconfiguration.connected=Connexion à la base de travail '%s' réussie +echobase.info.workingDbconfiguration.created=Configuration à la base de travail '%s' créée +echobase.info.workingDbconfiguration.deleted=Configuration à la base de travail '%s' supprimée +echobase.info.workingDbconfiguration.disconnected=Déconnexion de la base de travail '%s' echobase.information.mission.created=La mission %s a été créée echobase.information.one.file.required=Veuillez renseigner l'un des fichiers à importer echobase.label.admin.user.create=Création d'un utilisateur echobase.label.admin.user.delete=Suppression d'un utilisateur echobase.label.admin.user.edit=Mise à jour d'un utilisateur echobase.label.createIfNotFound=Créer les entités non trouvées en base +echobase.label.driverType=Type de base echobase.label.embeddedApplicationFileName=Nom de l'archive à télécharger echobase.label.embeddedWarFileName=Nom du war à utiliser echobase.label.exportAsSeen=Exporter "comme à l'écran" @@ -168,6 +199,7 @@ echobase.label.exportFileName=Nom du fichier d'export echobase.label.importFile=Fichier à importer echobase.label.login=Connexion +echobase.label.noWorkingDbSelected=Aucune base de travail sélectionnée echobase.label.numberOfCreatedEntities=Nombre d'entitiés créées echobase.label.numberOfUpdatedEntities=Nombre d'entitiés mises à jour echobase.label.query.description=Description @@ -176,6 +208,12 @@ echobase.label.sqlQueries=Requêtes enregistrées echobase.label.user.login=Utilisateur \: %s echobase.label.voyageToSelect=Voyage à exporter +echobase.label.workingDbConfiguration.description=Description +echobase.label.workingDbConfiguration.login=Login +echobase.label.workingDbConfiguration.password=Mot de passe +echobase.label.workingDbConfiguration.url=Url de connexion +echobase.label.workingDbConfigurations=Bases de travail enregistrées +echobase.label.workingDbSelected=Base de travail sélectionnée <strong>%s</strong> echobase.legend.connectionToDb.detail=Détail de la connection à la base de données echobase.legend.dbeditor.edit=Edition de '%s' echobase.legend.dbeditor.show=Visualisation de '%s' @@ -188,7 +226,10 @@ echobase.legend.libreOfficeQuery=Requète "libre office" echobase.legend.sqlQuery.configuration=Configuration de la requète echobase.legend.sqlQuery.result=Résultats de la requète -echobase.menu.connectToDbInformations=Informations de connection à la base de données +echobase.legend.workingDbConfiguration.configuration=Configuration de la base de travail +echobase.legend.workingDbConfiguration.create=Création d'une configuration de base de travail +echobase.legend.workingDbConfiguration.use=Configuration de base de travail +echobase.menu.connectToDbInformations=Informations de connection à la base de travail echobase.menu.createEmbeddedApplication=Créer une application embarquée echobase.menu.editData=Modifier les données echobase.menu.export=Exporter des données @@ -205,6 +246,7 @@ echobase.message.warnExportInProgress=Merci de ne pas fermer la fenêtre pour pouvoir accéder aux résultats de l'export. echobase.message.warnImportInProgress=Merci de ne pas fermer la fenêtre pour pouvoir accéder aux résultats de l'import. echobase.title.confirm.deleteQuery=Supprimer une requète +echobase.title.confirm.deleteWorkingDbConfiguration=Supprimer la connexion echobase.title.connectToDbInformations=Informations de connection à la base de données echobase.title.createEmbeddedApplication=Création de l'application embarquée echobase.title.createMission=Créer une mission @@ -228,3 +270,7 @@ echobase.title.newLibreOfficeQuery=Importer une requète Libre-office echobase.title.users=Adminitration des utilisateurs echobase.title.welcome=Bienvenue dans EchoBase +echobase.title.workingDbConfiguration=Administration des bases de travail +echobase.tooltip.disconnectWorkingDb=Changer de base de travail +echobase.tooltip.logout=Se déconnecter +echobase.tooltip.selectWorkingDb=Sélectionner une base de travail Modified: trunk/echobase-ui/src/main/resources/struts.xml =================================================================== --- trunk/echobase-ui/src/main/resources/struts.xml 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/resources/struts.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -51,16 +51,20 @@ <package name="default" extends="json-default" abstract="true" namespace="/"> + <result-types> + <result-type name="redirectToHome" + class="org.apache.struts2.dispatcher.ServletActionRedirectResult"> + <param name="actionName">home</param> + <param name="namespace">/</param> + </result-type> + </result-types> + <interceptors> <!-- to remove parameter from context --> <interceptor name="paramRemover" class="com.opensymphony.xwork2.interceptor.ParameterRemoverInterceptor"/> - <!-- to clean some properties from the echobase session --> - <interceptor name="cleanEchoBaseSession" - class="fr.ifremer.echobase.ui.interceptors.CleanEchoBaseSessionInterceptor"/> - <!-- to check if user is loggued --> <interceptor name="checkUserLoggued" class="fr.ifremer.echobase.ui.interceptors.CheckLogguedInterceptor"> @@ -73,9 +77,6 @@ <param name="redirectAction">/home</param> </interceptor> - <interceptor name="checkEchobaseSession" - class="fr.ifremer.echobase.ui.interceptors.CheckInUserSessionInterceptor"/> - </interceptors> <!-- default action to use everywhere (fix i18n when not translated) --> @@ -125,8 +126,7 @@ <default-action-ref name="home"/> <!-- go to home --> - <action name="home" - class="fr.ifremer.echobase.ui.actions.EchoBaseActionSupport"> + <action name="home" class="fr.ifremer.echobase.ui.actions.Home"> <result>/WEB-INF/jsp/home.jsp</result> @@ -135,13 +135,9 @@ </action> <!-- go to home --> - <action name="changeLang" - class="fr.ifremer.echobase.ui.actions.EchoBaseActionSupport"> + <action name="changeLang" class="fr.ifremer.echobase.ui.actions.Home"> - <result type="redirectAction"> - <param name="namespace">/</param> - <param name="actionName">home</param> - </result> + <result type="redirectToHome"/> <interceptor-ref name="i18nStack"/> <!-- remove the request_locale parameter from request --> @@ -155,6 +151,7 @@ <include file="config/struts-dbeditor.xml"/> <include file="config/struts-user.xml"/> + <include file="config/struts-workingDb.xml"/> <include file="config/struts-importData.xml"/> <include file="config/struts-embeddedApplication.xml"/> <include file="config/struts-exportQuery.xml"/> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/decorators/layout-default.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -49,28 +49,60 @@ <%-- body --%> <div> -<div class="containerSize"> -<div id="body" class="ui-corner-all"> + <div class="containerSize"> + <div id="body" class="ui-corner-all"> - <h2><d:title default="EchoBase"/></h2> + <h2><d:title default="EchoBase"/></h2> - <s:if test="hasActionMessages()"> - <div class="info_success"> - <s:actionmessage/> - </div> - </s:if> + <s:if test="hasFlashMessages()"> + <div class="info_success clearfix"> + <ul class="actionMessages fleft"> + <s:iterator value="flashMessages" var="message"> + <li><span><s:property value="#message" escapeHtml="false"/></span> + </li> + </s:iterator> + </ul> + </div> + </s:if> - <s:if test="hasActionErrors()"> - <div class="info_error"> - <s:actionerror/> + <s:if test="hasFlashWarnings()"> + <div class="info_warning clearfix"> + <ul class="actionWarnings fleft"> + <s:iterator value="flashWarnings" var="message"> + <li><span><s:property value="#message" escapeHtml="false"/></span> + </li> + </s:iterator> + </ul> + </div> + </s:if> + <s:if test="hasFlashErrors()"> + <div class="info_error clearfix"> + <ul class="actionErrors fleft"> + <s:iterator value="flashErrors" var="message"> + <li><span><s:property value="#message" escapeHtml="false"/></span> + </li> + </s:iterator> + </ul> + </div> + </s:if> + + <%--<s:if test="hasActionMessages()">--%> + <%--<div class="info_success">--%> + <%--<s:actionmessage/>--%> + <%--</div>--%> + <%--</s:if>--%> + + <%--<s:if test="hasActionErrors()">--%> + <%--<div class="info_error">--%> + <%--<s:actionerror/>--%> + <%--</div>--%> + <%--</s:if>--%> + + <d:body/> </div> - </s:if> - <d:body/> + <%@ include file="/WEB-INF/includes/footer.jsp" %> + </div> </div> - -<%@ include file="/WEB-INF/includes/footer.jsp" %> -</div> -</div> </body> </html> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/decorators.xml 2012-09-02 15:11:02 UTC (rev 589) @@ -35,6 +35,7 @@ <pattern>/exportQuery/newLibreOfficeQuery*</pattern> <pattern>/exportQuery/confirmDelete*</pattern> <pattern>/importData/get*</pattern> + <pattern>/workingDb/confirmDelete*</pattern> </excludes> <decorator name="layout-default" page="layout-default.jsp"> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/includes/header.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -34,51 +34,100 @@ <div id='headerRight'> <div> - <s:text name="echobase.label.user.login"> - <s:param> - <s:property value="#session.echoBaseSession.echoBaseUser.email"/> - </s:param> - </s:text> <ul> <li> - <s:a action="logout" namespace="/user"> + <s:a action="logout" namespace="/user" id='logout' + alt='%{getText("echobase.tooltip.logout")}' + title='%{getText("echobase.tooltip.logout")}'> <s:text name="echobase.action.logout"/> </s:a> </li> <li> + <s:text name="echobase.label.user.login"> + <s:param> + <s:property value="#session.echoBaseSession.user.email"/> + </s:param> + </s:text> </li> + <li>|</li> + <s:if test="workingDbSelected"> + <li> + <s:a action="disconnect" namespace="/workingDb" id='disconnect' + title='%{getText("echobase.tooltip.disconnectWorkingDb")}' + alt='%{getText("echobase.tooltip.disconnectWorkingDb")}'> + <s:text name="echobase.action.workingDbconfiguration.disconnect"/> + </s:a> + </li> + <li> + <s:text name="echobase.label.workingDbSelected"> + <s:param> + <s:property + value="#session.echoBaseSession.workingDbConfiguration.url"/> + </s:param> + </s:text> + </li> + </s:if> + <s:else> + <li> + <s:a action="showList" namespace="/workingDb" id='connect' + title='%{getText("echobase.tooltip.selectWorkingDb")}' + alt='%{getText("echobase.tooltip.selectWorkingDb")}'> + <s:text name="echobase.action.workingDbconfiguration.connect"/> + </s:a> + </li> + <li> + <s:text name="echobase.label.noWorkingDbSelected"/> + </li> + </s:else> </ul> </div> <br/> - <br/> </div> <div class="cleanBoth menu"> <ul> <s:if test="%{admin}"> - <li> - <s:a action="configure" namespace="/importDb" method="input" cssClass="impBase"> + <s:if test="%{workingDbSelected}"> + <li> + <s:a action="configure" namespace="/importDb" method="input" + cssClass="impBase"> <span><s:text name="echobase.menu.importDb"/></s:a></span> - </li> - <li> - <s:a action="configure" namespace="/exportDb" method="input" cssClass="expBase"> + </li> + <li> + <s:a action="configure" namespace="/exportDb" method="input" + cssClass="expBase"> <span><s:text name="echobase.menu.exportDb"/></s:a></span> - </li> + </li> + <li> + <s:a action="selectImportType" namespace="/importData" + method="input" cssClass="impDonnee"> + <span><s:text name="echobase.menu.importData"/></s:a></span> + </li> + <li> + <s:a action="dbeditor" namespace="/dbeditor" cssClass="modif"> + <span><s:text name="echobase.menu.editData"/></span> + </s:a> + </li> + <li> + <s:a action="logs" namespace="/user" cssClass="journal"> + <span><s:text name="echobase.menu.logs"/></span> + </s:a> + </li> + <li> + <s:a action="information" namespace="/workingDb" cssClass="info"> + <span> + <s:text name="echobase.menu.connectToDbInformations"/> + </span> + </s:a> + </li> + <li> + <s:a action="manageExportQuery" namespace="/exportQuery" + cssClass="expDonnee"> + <span><s:text name="echobase.menu.export"/></span> + </s:a> + </li> + </s:if> <li> - <s:a action="selectImportType" namespace="/importData" method="input" cssClass="impDonnee"> - <span><s:text name="echobase.menu.importData"/></s:a></span> - </li> - <li> - <s:a action="manageExportQuery" namespace="/exportQuery" cssClass="expDonnee"> - <span><s:text name="echobase.menu.export"/></span> - </s:a> - </li> - <li> - <s:a action="dbeditor" namespace="/dbeditor" cssClass="modif"> - <span><s:text name="echobase.menu.editData"/></span> - </s:a> - </li> - <li> <s:a action="userList" namespace="/user" cssClass="user"> <span><s:text name="echobase.menu.users"/></span> </s:a> @@ -86,41 +135,38 @@ <li> <s:a action="configure" namespace="/embeddedApplication" method="input" cssClass="appli"> - <span><s:text name="echobase.menu.createEmbeddedApplication"/></span> + <span> + <s:text name="echobase.menu.createEmbeddedApplication"/> + </span> </s:a> </li> - <li> - <s:a action="logs" namespace="/user" cssClass="journal"> - <span><s:text name="echobase.menu.logs"/></span> - </s:a> - </li> - <li> - <s:a action="connectToDbInformations" namespace="/user" cssClass="info"> - <span><s:text name="echobase.menu.connectToDbInformations"/></span> - </s:a> - </li> </s:if> <s:else> - <li> - <s:a action="manageExportQuery" namespace="/exportQuery" cssClass="expDonnee"> - <span><s:text name="echobase.menu.export"/></span> - </s:a> - </li> - <li> - <s:a action="dbeditor" namespace="/dbeditor" cssClass="modif"> - <span><s:text name="echobase.menu.viewData"/></span> - </s:a> - </li> - <li> - <s:a action="logs" namespace="/user" cssClass="journal"> - <span><s:text name="echobase.menu.logs"/></span> - </s:a> - </li> - <li> - <s:a action="connectToDbInformations" namespace="/user" cssClass="info"> - <span><s:text name="echobase.menu.connectToDbInformations"/></span> - </s:a> - </li> + <s:if test="%{workingDbSelected}"> + <li> + <s:a action="manageExportQuery" namespace="/exportQuery" + cssClass="expDonnee"> + <span><s:text name="echobase.menu.export"/></span> + </s:a> + </li> + <li> + <s:a action="dbeditor" namespace="/dbeditor" cssClass="modif"> + <span><s:text name="echobase.menu.viewData"/></span> + </s:a> + </li> + <li> + <s:a action="logs" namespace="/user" cssClass="journal"> + <span><s:text name="echobase.menu.logs"/></span> + </s:a> + </li> + <li> + <s:a action="information" namespace="/workingDb" cssClass="info"> + <span> + <s:text name="echobase.menu.connectToDbInformations"/> + </span> + </s:a> + </li> + </s:if> </s:else> </ul> </div> Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/connectToDbInformations.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/connectToDbInformations.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/connectToDbInformations.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -1,52 +0,0 @@ -<%-- -#%L - EchoBase :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2011 Ifremer, Codelutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% ---%> -<%@page contentType="text/html" pageEncoding="UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> -<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> - -<title><s:text name="echobase.title.connectToDbInformations"/></title> - -<br/> -<fieldset> - <legend><s:text name="echobase.legend.connectionToDb.detail"/></legend> - <s:label key="jdbcUrl" label='%{getText("echobase.common.jdbcUrl")}'/> - <s:label key="jdbcLogin" label='%{getText("echobase.common.jdbcLogin")}'/> - <s:label key="jdbcPassword" label='%{getText("echobase.common.jdbcPassword")} (*)'/> - <s:label key="jdbcDriver" label='%{getText("echobase.common.jdbcDriver")}'/> - <s:if test="jdbcPilot != null"> - <s:label key="jdbcPilot" label='%{getText("echobase.common.jdbcPilotPath")}'/> - </s:if> -</fieldset> - -<br/> -<s:if test="askPassword"> - <div> - (*) <s:text name="echobase.message.askAdministratorPassword"/>. - </div> -</s:if> - -</div> - - - Copied: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp (from rev 588, trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp) =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,75 @@ +<%-- + #%L + EchoBase :: UI + + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 - 2012 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + + +<script type="text/javascript"> + + function cancel() { + $('#confirmDeleteDialog').dialog('close'); + return false; + } +</script> + +<div class="dialogContainer ui-corner-all"> + + <s:label key="echobase.confirm.delete.query" theme="simple"/> + + <fieldset class="ui-corner-all"> + + + + <s:textarea name="query.name" required="true" cols="160" rows="1" + readonly="true" + label="%{getText('echobase.label.query.name')}"/> + + <s:textarea name="query.description" required="true" cols="160" rows="2" + readonly="true" + label="%{getText('echobase.label.query.description')}"/> + + <s:textarea name="query.sqlQuery" required="true" cols="160" rows="4" + label="%{getText('echobase.label.query.sql')}"/> + + <br/> + + <s:form namespace="/exportQuery"> + + <s:hidden key="query.topiaId" label=''/> + + <ul class="toolbar floatRight"> + <li> + <s:submit onclick="return cancel();" theme="simple" + key="echobase.action.cancel"/> + </li> + <li> + <s:submit action="delete" theme="simple" + key="echobase.action.delete"/> + </li> + </ul> + </s:form> + </fieldset> + +</div> \ No newline at end of file Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDelete.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/confirmDeleteQuery.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -1,75 +0,0 @@ -<%-- - #%L - EchoBase :: UI - - $Id$ - $HeadURL$ - %% - Copyright (C) 2011 - 2012 Ifremer, Codelutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --%> -<%@page contentType="text/html" pageEncoding="UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> - - -<script type="text/javascript"> - - function cancel() { - $('#confirDeleteDialog').dialog('close'); - return false; - } -</script> - -<div class="dialogContainer ui-corner-all"> - - <s:label key="echobase.confirm.delete.query" theme="simple"/> - - <fieldset class="ui-corner-all"> - - - - <s:textarea name="query.name" required="true" cols="160" rows="1" - readonly="true" - label="%{getText('echobase.label.query.name')}"/> - - <s:textarea name="query.description" required="true" cols="160" rows="2" - readonly="true" - label="%{getText('echobase.label.query.description')}"/> - - <s:textarea name="query.sqlQuery" required="true" cols="160" rows="4" - label="%{getText('echobase.label.query.sql')}"/> - - <br/> - - <s:form namespace="/exportQuery"> - - <s:hidden key="query.topiaId" label=''/> - - <ul class="toolbar floatRight"> - <li> - <s:submit onclick="return cancel();" theme="simple" - key="echobase.action.cancel"/> - </li> - <li> - <s:submit action="delete" theme="simple" - key="echobase.action.deleteSqlQuery"/> - </li> - </ul> - </s:form> - </fieldset> - -</div> \ No newline at end of file Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/exportQuery.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/exportQuery.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/exportQuery.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -27,10 +27,6 @@ <s:set var="noError" value="!hasErrors()"/> -<%--s:set var="queryExists" value="query.topiaId != null && query.topiaId != ''"/--%> -<%--s:set var="canUpdateQuery" - value="%{admin or query.lastModifiedUser == echoBaseSession.echoBaseUser.email}"/--%> - <script type="text/javascript"> function reloadPage(params) { @@ -83,7 +79,7 @@ function confirmDeleteQuery() { var url = "<s:url action='confirmDelete' namespace='/exportQuery'/>?" + $.param({ 'query.topiaId':'<s:property value="query.topiaId"/>'}); - var dialog = $("#confirDeleteDialog"); + var dialog = $("#confirmDeleteDialog"); dialog.load(url); dialog.dialog('open'); return false; @@ -144,12 +140,12 @@ </li> <li> <s:submit action="clone" theme="simple" - key="echobase.action.cloneSqlQuery"/> + key="echobase.action.clone"/> </li> <s:if test="canUpdateQuery"> <li> <s:submit onclick="return confirmDeleteQuery();" theme="simple" - key="echobase.action.deleteSqlQuery"/> + key="echobase.action.delete"/> </li> <li> <s:submit action="save" theme="simple" @@ -176,7 +172,7 @@ title="%{getText('echobase.title.newLibreOfficeQuery')}" autoOpen="false" modal="true" width="780"/> -<sj:dialog id="confirDeleteDialog" resizable="false" +<sj:dialog id="confirmDeleteDialog" resizable="false" title="%{getText('echobase.title.confirm.deleteQuery')}" autoOpen="false" modal="true" width="780"/> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/newLibreOfficeQuery.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/newLibreOfficeQuery.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/exportQuery/newLibreOfficeQuery.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -67,7 +67,6 @@ <title><s:text name="echobase.title.export"/></title> <div class="dialogContainer ui-corner-all"> - <%--s:form--%> <fieldset class="ui-corner-all"> <legend><s:text name="echobase.legend.libreOfficeQuery"/></legend> @@ -86,5 +85,4 @@ </li> </ul> </fieldset> - <%--/s:form--%> </div> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -28,30 +28,33 @@ <div class="fontsize11"> <fieldset> <legend> - Quelques liens utiles + <s:text name="echobase.info.usefulLinks"/> </legend> <ul> <li> - <s:a href="http://maven-site.forge.codelutin.com/echobase"> - Documentation de la dernière version stable + <s:a href="http://maven-site.forge.codelutin.com/echobase" + target='#stableDoc'> + <s:text name="echobase.info.lastStableDocumentation"/> </s:a> </li> <li> - <s:a href="http://maven-site.forge.codelutin.com/echobase/SNAPSHOT"> - Documentation en cours (disponible dans la prochaine version stable) + <s:a href="http://maven-site.forge.codelutin.com/echobase/SNAPSHOT" + target='#devDoc'> + <s:text name="echobase.info.lastDevDocumentation"/> </s:a> </li> <li> - <s:a href="http://forge.codelutin.com/projects/echobase/files"> - Téléchargement de l'application et des fichiers d'import + <s:a href="http://forge.codelutin.com/projects/echobase/files" + target='#forge'> + <s:text name="echobase.info.downloadEchoBase"/> </s:a> </li> <li> - <s:a href="http://forge.codelutin.com/projects/echobase"> - Gestion du projet + <s:a href="http://forge.codelutin.com/projects/echobase" + target='#forge'> + <s:text name="echobase.info.echoBaseForge"/> </s:a> </li> </ul> </fieldset> - </div> \ No newline at end of file Deleted: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -1,93 +0,0 @@ -<%-- -#%L - EchoBase :: UI - $Id$ - $HeadURL$ - %% - Copyright (C) 2011 Ifremer, Codelutin - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% ---%> -<%@page contentType="text/html" pageEncoding="UTF-8" %> -<%@ taglib prefix="s" uri="/struts-tags" %> -<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> -<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> -<script type="text/javascript" - src="<s:url value='/js/gridHelper.js' />"></script> -<s:set var="emptySelection"> - <s:text name="echobase.message.noEntrySelection"/> -</s:set> -<script type="text/javascript"> - - jQuery(document).ready(function () { - $.addRowSelectTopic('datas', function (event) { - $('#extraInfos').show(); - var id = $("tr[aria-selected=true] td[aria-describedby='datas_entityId']").text(); - $('#modificationEntityId').html(id); - - var text = $("tr[aria-selected=true] td[aria-describedby='datas_modificationText']").text(); - $('#modificationTextContainter').html(text); - }); - $.addClearSelectTopic('datas', function (event) { - $('#extraInfos').hide(); - $('#modificationTextContainter').html("${emptySelection}"); - }); - $.addEvenAndOddClasses('datas'); - }); -</script> - -<title><s:text name="echobase.title.entityModificationLogs"/></title> -<s:url id="loadUrl" action="getEntityModificationLogs" namespace="/user" - escapeAmp="false"/> - -<sjg:grid id="datas" dataType="json" href="%{loadUrl}" gridModel="datas" - pager="true" pagerButtons="true" pagerInput="true" navigator="true" - autowidth="true" rownumbers="false" viewrecords="true" - navigatorEdit="false" navigatorSearch="true" - navigatorDelete="false" navigatorAdd="false" - rowList="10,15,20,50,100,250,500" rowNum="10" - onSelectRowTopics='datas-rowSelect' - onCompleteTopics="datas-clearSelect,datas-CompleteTopics" - navigatorSearchOptions="{multipleGroup:false,multipleSearch:false,sopt:['eq','ne','cn','nc','bw','bn','ew','en','lt','le','gt','ge','nu','nn']}"> - - <sjg:gridColumn name="entityType" sortable="true" - title="%{getText('echobase.common.entityType')}"/> - <sjg:gridColumn name="entityId" sortable="true" - title="%{getText('echobase.common.entityId')}"/> - <sjg:gridColumn name="modificationDate" sortable="true" - title="%{getText('echobase.common.modificationDate')}"/> - <sjg:gridColumn name="modificationText" sortable="true" - title="%{getText('echobase.common.modificationText')}"/> - <sjg:gridColumn name="modificationUser" sortable="true" - title="%{getText('echobase.common.modificationUser')}"/> - -</sjg:grid> -<br/> -<fieldset> - <legend><s:text name="echobase.title.modification.detail"/></legend> - <div id="extraInfos"> - <s:label key='echobase.common.entityId' value=''/> - <div class="clearBoth"/> - <pre id='modificationEntityId' style="font-weight: bold;"></pre> - <br/> - </div> - <s:label key='echobase.common.modificationText' value=''/> - <div class="clearBoth"/> - <br/> - <pre id='modificationTextContainter' style="font-weight: bold;"></pre> -</fieldset> - - - Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Create.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Create.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Create.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -40,10 +40,14 @@ <s:checkbox key="user.admin" label="%{getText('echobase.common.admin')}"/> </fieldset> <ul class="toolbar floatRight"> - <li><s:submit action="user-Create" key="echobase.action.create" - theme="simple"/></li> - <li><s:submit action="userList" key="echobase.action.backToUserList" - theme="simple"/></li> + <li> + <s:submit action="user-Create" key="echobase.action.create" + theme="simple"/> + </li> + <li> + <s:submit action="userList" key="echobase.action.backToUserList" + theme="simple"/> + </li> </ul> </s:form> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Delete.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Delete.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Delete.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -39,10 +39,14 @@ disabled="true"/> </fieldset> <ul class="toolbar floatRight"> - <li><s:submit action="user-Delete" - key="echobase.action.delete" theme="simple"/></li> - <li><s:submit action="userList" key="echobase.action.backToUserList" - theme="simple"/></li> + <li> + <s:submit action="user-Delete" key="echobase.action.delete" + theme="simple"/> + </li> + <li> + <s:submit action="userList" key="echobase.action.backToUserList" + theme="simple"/> + </li> </ul> </s:form> Modified: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Update.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Update.jsp 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/user/Update.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -46,10 +46,14 @@ </div> </fieldset> <ul class="toolbar floatRight"> - <li><s:submit action="user-Update" - key="echobase.action.save" theme="simple"/></li> - <li><s:submit action="userList" key="echobase.action.backToUserList" - theme="simple"/></li> + <li> + <s:submit action="user-Update" + key="echobase.action.save" theme="simple"/> + </li> + <li> + <s:submit action="userList" key="echobase.action.backToUserList" + theme="simple"/> + </li> </ul> </s:form> Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,73 @@ +<%-- + #%L + EchoBase :: UI + $Id$ + $HeadURL:$ + %% + Copyright (C) 2011 - 2012 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + +<script type="text/javascript"> + + function cancel() { + $('#confirmDeleteDialog').dialog('close'); + return false; + } +</script> + +<div class="dialogContainer ui-corner-all"> + + <s:label key="echobase.confirm.delete.workingDbConfiguration" theme="simple"/> + + <fieldset class="ui-corner-all"> + + <s:select key="conf.driverType" cssStyle="font-size: 140%" + disabled="true" label="%{getText('echobase.label.driverType')}" + list="driverTypes"/> + + <s:textarea name="conf.url" cols="160" rows="1" readonly="true" + label="%{getText('echobase.label.workingDbConfiguration.url')}"/> + + <s:textarea name="conf.description" cols="160" rows="2" readonly="true" + label="%{getText('echobase.label.workingDbConfiguration.description')}"/> + + <s:textarea name="conf.login" readonly="true" cols="160" rows="4" + label="%{getText('echobase.label.workingDbConfiguration.login')}"/> + + <br/> + + <s:form namespace="/workingDb"> + + <s:hidden key="conf.topiaId" label=''/> + + <ul class="toolbar floatRight"> + <li> + <s:submit onclick="return cancel();" theme="simple" + key="echobase.action.cancel"/> + </li> + <li> + <s:submit action="delete" theme="simple" + key="echobase.action.delete"/> + </li> + </ul> + </s:form> + </fieldset> + +</div> \ No newline at end of file Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/confirmDelete.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,48 @@ +<%-- +#%L + EchoBase :: UI + $Id$ + $HeadURL: http://svn.forge.codelutin.com/svn/echobase/trunk/echobase-ui/src/main/webap... $ + %% + Copyright (C) 2011 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% +--%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> +<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> + +<title><s:text name="echobase.title.connectToDbInformations"/></title> + +<br/> +<fieldset> + <legend><s:text name="echobase.legend.connectionToDb.detail"/></legend> + <s:label key="dbConfiguration.url" + label='%{getText("echobase.common.jdbcUrl")}'/> + <s:label key="dbConfiguration.login" + label='%{getText("echobase.common.jdbcLogin")}'/> + <s:label key="dbConfiguration.password" + label='%{getText("echobase.common.jdbcPassword")}'/> + <s:label key="dbConfiguration.driver.name" + label='%{getText("echobase.common.jdbcDriver")}'/> + <s:if test="jdbcPilot != null"> + <s:label key="jdbcPilot" + label='%{getText("echobase.common.jdbcPilotPath")}'/> + </s:if> +</fieldset> + + + Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/information.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Added: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,151 @@ +<%-- + #%L + EchoBase :: UI + $Id$ + $HeadURL:$ + %% + Copyright (C) 2011 - 2012 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> + +<s:set var="noError" value="!hasErrors()"/> + +<script type="text/javascript"> + + function confirmDelete() { + var url = "<s:url action='confirmDelete' namespace='/workingDb'/>?" + + $.param({ 'conf.topiaId':'<s:property value="conf.topiaId"/>'}); + var dialog = $("#confirmDeleteDialog"); + dialog.load(url); + dialog.dialog('open'); + return false; + } + + function reloadPage(params) { + var url = "<s:url action='showList' namespace='/workingDb'/>?"; + window.location = url + $.param(params); + return false; + } + +</script> + +<title><s:text name="echobase.title.workingDbConfiguration"/></title> + +<s:if test="admin"> + <s:form id="createForm" namespace="/workingDb"> + <ul class="toolbar floatLeft"> + <li> + <s:submit theme="simple" action="create" + key="echobase.action.newWorkingDbContiguration"/> + </li> + </ul> + </s:form> +</s:if> + +<s:form id="workginDbConfigurationForm" namespace="/workingDb"> + <fieldset> + <legend><s:text name="echobase.label.workingDbConfigurations"/></legend> + <s:select key="conf.topiaId" cssStyle="font-size: 140%" + label="%{getText('echobase.label.workingDbConfigurations')}" + list="confs" headerKey="" headerValue="" theme="simple"/> + </fieldset> + + <s:if test="confExists or newConf"> + <fieldset> + <legend> + <s:if test="confExists"> + <s:text name="echobase.legend.workingDbConfiguration.use"/> + </s:if> + <s:else> + <s:text name="echobase.legend.workingDbConfiguration.create"/> + + </s:else> + </legend> + + <s:select key="conf.driverType" cssStyle="font-size: 140%" + label="%{getText('echobase.label.driverType')}" required="true" + list="driverTypes" disabled="%{confExists}"/> + + <s:textfield key="conf.url" required="true" size="80" + readonly="%{confExists}" + label="%{getText('echobase.label.workingDbConfiguration.url')}"/> + + <s:textfield key="conf.login" required="true" size="80" + readonly="%{confExists}" + label="%{getText('echobase.label.workingDbConfiguration.login')}"/> + + <s:textarea key="conf.description" required="true" cols="160" rows="4" + readonly="%{confExists}" + label="%{getText('echobase.label.workingDbConfiguration.description')}"/> + + <s:if test="confExists"> + <s:password key="password" required="true" size="80" + label="%{getText('echobase.label.workingDbConfiguration.password')}"/> + </s:if> + + <ul id="dbeditorToolbar" class="toolbar floatRight"> + <s:if test="confExists"> + <li> + <s:submit action="connect" theme="simple" + key="echobase.action.connectToWorkingDb"/> + </li> + <s:if test="admin"> + <li> + <s:submit action="clone" theme="simple" + key="echobase.action.clone"/> + </li> + <li> + <s:submit onclick="return confirmDelete();" theme="simple" + key="echobase.action.delete"/> + </li> + </s:if> + </s:if> + <s:else> + <li> + <s:submit action="showList" theme="simple" + key="echobase.action.cancel"/> + </li> + <li> + <s:submit action="save" theme="simple" + key="echobase.action.createWorkingDbConfiguration"/> + </li> + </s:else> + </ul> + </fieldset> + </s:if> +</s:form> + +<br/> + +<sj:dialog id="confirmDeleteDialog" resizable="false" autoOpen="false" + title="%{getText('echobase.title.confirm.deleteWorkingDbConfiguration')}" + modal="true" width="780"/> + +<script type="text/javascript"> + + jQuery(document).ready(function () { + + $('[name="conf.topiaId"]').change(function (event) { + reloadPage({'conf.topiaId':this.value}); + }); + }); + +</script> + + Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/manage.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native Copied: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp (from rev 588, trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/modificationLogs.jsp) =================================================================== --- trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp (rev 0) +++ trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp 2012-09-02 15:11:02 UTC (rev 589) @@ -0,0 +1,93 @@ +<%-- +#%L + EchoBase :: UI + $Id$ + $HeadURL$ + %% + Copyright (C) 2011 Ifremer, Codelutin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% +--%> +<%@page contentType="text/html" pageEncoding="UTF-8" %> +<%@ taglib prefix="s" uri="/struts-tags" %> +<%@ taglib prefix="sj" uri="/struts-jquery-tags" %> +<%@ taglib prefix="sjg" uri="/struts-jquery-grid-tags" %> +<script type="text/javascript" + src="<s:url value='/js/gridHelper.js' />"></script> +<s:set var="emptySelection"> + <s:text name="echobase.message.noEntrySelection"/> +</s:set> +<script type="text/javascript"> + + jQuery(document).ready(function () { + $.addRowSelectTopic('datas', function (event) { + $('#extraInfos').show(); + var id = $("tr[aria-selected=true] td[aria-describedby='datas_entityId']").text(); + $('#modificationEntityId').html(id); + + var text = $("tr[aria-selected=true] td[aria-describedby='datas_modificationText']").text(); + $('#modificationTextContainter').html(text); + }); + $.addClearSelectTopic('datas', function (event) { + $('#extraInfos').hide(); + $('#modificationTextContainter').html("${emptySelection}"); + }); + $.addEvenAndOddClasses('datas'); + }); +</script> + +<title><s:text name="echobase.title.entityModificationLogs"/></title> +<s:url id="loadUrl" action="getEntityModificationLogs" namespace="/user" + escapeAmp="false"/> + +<sjg:grid id="datas" dataType="json" href="%{loadUrl}" gridModel="datas" + pager="true" pagerButtons="true" pagerInput="true" navigator="true" + autowidth="true" rownumbers="false" viewrecords="true" + navigatorEdit="false" navigatorSearch="true" + navigatorDelete="false" navigatorAdd="false" + rowList="10,15,20,50,100,250,500" rowNum="10" + onSelectRowTopics='datas-rowSelect' + onCompleteTopics="datas-clearSelect,datas-CompleteTopics" + navigatorSearchOptions="{multipleGroup:false,multipleSearch:false,sopt:['eq','ne','cn','nc','bw','bn','ew','en','lt','le','gt','ge','nu','nn']}"> + + <sjg:gridColumn name="entityType" sortable="true" + title="%{getText('echobase.common.entityType')}"/> + <sjg:gridColumn name="entityId" sortable="true" + title="%{getText('echobase.common.entityId')}"/> + <sjg:gridColumn name="modificationDate" sortable="true" + title="%{getText('echobase.common.modificationDate')}"/> + <sjg:gridColumn name="modificationText" sortable="true" + title="%{getText('echobase.common.modificationText')}"/> + <sjg:gridColumn name="modificationUser" sortable="true" + title="%{getText('echobase.common.modificationUser')}"/> + +</sjg:grid> +<br/> +<fieldset> + <legend><s:text name="echobase.title.modification.detail"/></legend> + <div id="extraInfos"> + <s:label key='echobase.common.entityId' value=''/> + <div class="clearBoth"/> + <pre id='modificationEntityId' style="font-weight: bold;"></pre> + <br/> + </div> + <s:label key='echobase.common.modificationText' value=''/> + <div class="clearBoth"/> + <br/> + <pre id='modificationTextContainter' style="font-weight: bold;"></pre> +</fieldset> + + + Property changes on: trunk/echobase-ui/src/main/webapp/WEB-INF/jsp/workingDb/modificationLogs.jsp ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/echobase-ui/src/main/webapp/css/screen.css =================================================================== --- trunk/echobase-ui/src/main/webapp/css/screen.css 2012-09-01 11:35:19 UTC (rev 588) +++ trunk/echobase-ui/src/main/webapp/css/screen.css 2012-09-02 15:11:02 UTC (rev 589) @@ -672,7 +672,8 @@ #headerRight span{ color:#f9a806; } -#headerRight a{ + +#headerRight a#logout{ display:block; text-indent:-999999px; background:url(../images/deconnexion.jpg) no-repeat 0 0; @@ -683,6 +684,26 @@ background-position:0 -18px; } +#headerRight a{ + display:block; + text-indent:-999999px; + height:18px; + width:18px; +} + +#headerRight li{ + padding-left:5px; +} + +#headerRight a#connect{ + background:url(../images/connect.png) no-repeat 0 0; +} + + +#headerRight a#disconnect{ + background:url(../images/disconnect.png) no-repeat 0 0; +} + .top a.anglais { line-height:20px; display: block; Added: trunk/echobase-ui/src/main/webapp/images/connect.png =================================================================== (Binary files differ) Property changes on: trunk/echobase-ui/src/main/webapp/images/connect.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/echobase-ui/src/main/webapp/images/disconnect.png =================================================================== (Binary files differ) Property changes on: trunk/echobase-ui/src/main/webapp/images/disconnect.png ___________________________________________________________________ Added: svn:mime-type + image/png