[Suiviobsmer-commits] r354 - in trunk: . src/site/rst suiviobsmer-business suiviobsmer-business/src/main/filters suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/mock suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services suiviobsmer-business/s
Author: fdesbois Date: 2010-02-16 12:00:05 +0000 (Tue, 16 Feb 2010) New Revision: 354 Added: trunk/suiviobsmer-business/src/main/filters/Wao.properties trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoBusinessException.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoContext.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoException.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoGlobal.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoMigrationCallBack.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoRunner.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoRunnerImpl.java trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityCalendarImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityMonthImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityProfessionImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityZoneImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/BoatImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/CompanyImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ContactImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ElligibleBoatImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/FishingZoneImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/NewsImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ProfessionImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleRowImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ShipOwnerImpl.hbm.xml trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/WaoUserImpl.hbm.xml trunk/suiviobsmer-business/src/main/xmi/wao.properties trunk/suiviobsmer-business/src/main/xmi/wao.zargo trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoGlobalTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoRunnerTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoUtilsTest.java trunk/suiviobsmer-business/src/test/resources/WaoTest.properties trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/WaoPage.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/WaoPropertyChangeListener.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/WaoManager.java Removed: trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerBusinessException.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerContext.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerException.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobal.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerMigrationCallBack.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunner.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerImpl.java trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobalTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerUtilsTest.java trunk/suiviobsmer-business/src/test/resources/TopiaContextSuiviObsmer.properties trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/SuiviObsmerPage.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SuiviObsmerPropertyChangeListener.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/SuiviObsmerManager.java Modified: trunk/pom.xml trunk/src/site/rst/business-rules.rst trunk/src/site/rst/installation.rst trunk/suiviobsmer-business/README.txt trunk/suiviobsmer-business/pom.xml trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/MD5.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/BoatFilterImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/CompanyBoatInfosImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactAverageReactivityImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactState.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactStateStatisticsImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/FacadeRowImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ImportResultsImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/UserFilterImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityCalendarImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityMonthImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityProfessionImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/CompanyImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ContactDAOImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ContactImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/FishingZoneImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ProfessionImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/WaoUserImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/ExportHelper.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/ImportHelper.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/SamplingExport.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/WaoCsvHeader.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/mock/ServiceNewsMock.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ActivityCalendarImport.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceBoatImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceContactImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceNewsImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceReferentialImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceSamplingImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceSynthesisImpl.java trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceUserImpl.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/ImportHelperTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/SampleRowImplTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ActivityCalendarImportTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceBoatImplTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceReferentialImplTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceSamplingImplTest.java trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceSynthesisImplTest.java trunk/suiviobsmer-ui/pom.xml trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/GenericSelectModel.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/BooleanImage.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Chart.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/FeedBack.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Layout.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/SubmitContext.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/AbstractMappedGridDataSource.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BoatDataSource.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BusinessUtils.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ChartUtils.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ContactDataSource.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ExportStreamResponse.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SynthesisId.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/Confirm.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/PopupPageLink.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/ZoneUpdater.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Administration.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/BoatActivityCalendar.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/ExceptionReport.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Index.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowHistoric.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Synthesis.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/UserProfile.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/AppModule.java trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/ContactModelFactory.java trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/components/Layout.tml trunk/suiviobsmer-ui/src/main/resources/log4j.properties trunk/suiviobsmer-ui/src/main/webapp/WEB-INF/web.xml trunk/suiviobsmer-ui/src/main/webapp/css/common.css Log: Big refactor, change SuiviObsmer name by Wao in poms and class names + add install doc - Must change packages and modules names Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/pom.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -14,8 +14,8 @@ </parent> <groupId>fr.ifremer</groupId> - <artifactId>suiviobsmer</artifactId> - <version>1.0.0-SNAPSHOT</version> + <artifactId>wao</artifactId> + <version>1.0-SNAPSHOT</version> <modules> <module>suiviobsmer-ui</module> @@ -144,13 +144,6 @@ <artifactId>winstone</artifactId> <version>0.9.10-hudson-16</version> </dependency> - - <!-- base postgres --> - <!--dependency> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - <version>8.3-603.jdbc4</version> - </dependency--> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -164,7 +157,7 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>SuiviObsmer</name> + <name>Wao</name> <description>Application pour le suivi d'embarquements sur des bateaux de pêches dans le cadre d'observations scientifiques.</description> <inceptionYear>2009</inceptionYear> Modified: trunk/src/site/rst/business-rules.rst =================================================================== --- trunk/src/site/rst/business-rules.rst 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/src/site/rst/business-rules.rst 2010-02-16 12:00:05 UTC (rev 354) @@ -8,7 +8,7 @@ - Création : - * (obligatoire) métier : toujours une nouvelle métier + * (obligatoire) métier : toujours un nouveau métier * (obligatoire) zone de pêche : au moins une zone de pêche doit être ajouté à la ligne * (obligatoire) programme : déjà existant ou nouveau programme * (obligatoire) période : modifiable si cela ne pose pas de problème sur des données d'embarquements réels Modified: trunk/src/site/rst/installation.rst =================================================================== --- trunk/src/site/rst/installation.rst 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/src/site/rst/installation.rst 2010-02-16 12:00:05 UTC (rev 354) @@ -18,12 +18,98 @@ Note Il est fortement conseillé de modifier le mot de passe par défaut du super admin ! (dans le profile utilisateur) +Fichier de configuration +------------------------ + +Il est nécessaire de créer un fichier de configuration pour décrire la +connexion à la base et certains paramètres nécessaires à l'application. +Ce fichier se nomme Wao.properties et peut être placé dans : + +- /etc/Wao.properties +- $HOME/.Wao.properties + +Un fichier par défaut existe depuis le war de l'application avec les paramètres +suivant :: + + ## Default properties for H2 database + hibernate.hbm2ddl.auto=create + hibernate.show_sql=false + hibernate.dialect=org.hibernate.dialect.H2Dialect + hibernate.connection.username=sa + hibernate.connection.password= + hibernate.connection.driver_class=org.h2.Driver + ## Database location in user home + hibernate.connection.url=jdbc:h2:file:~/.local/wao/h2data + + ## Logs for activityCalendar in user home + wao.log.activityCalendar.access=${user.home}/.local/wao/log/activity-access.log + wao.log.activityCalendar.import=${user.home}/.local/wao/log/activity.log + + ## Config for sending Email + wao.email.host=smtp + wao.email.port=25 + wao.email.from=admin at wao.org + + ## Server path for link in mails (must be override) + wao.server.path=localhost:8080/wao + + ## Version (not necessary to override it) + wao.version=1.0 + +Par défaut la base de données utilise le SGBD H2 qui créera un fichier dans +le dossier $HOME/.local/wao nommé **h2data.h2.db**. Il est possible d'utiliser +une base de données postgresql en écrasant la configuration pour hibernate :: + + # use postgresql + hibernate.hbm2ddl.auto=update + hibernate.show_sql=false + hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect + hibernate.connection.username=dbuser + hibernate.connection.password=password + hibernate.connection.driver_class=org.postgresql.Driver + hibernate.connection.url=jdbc:postgresql:dbname + +Les chaînes dbuser, dbname et password devront être changées pour correspondre +à la configuration de la base de données pour postgresql. + +Logs de l'application +--------------------- + +Un fichier de log nommé wao.log permettant de voir le comportement de +l'application sera automatiquement créé dans le dossier /var/log/wao. +Voici la configuration pour les logs de l'application :: + + log4j.appender.globalfile=org.apache.log4j.RollingFileAppender + log4j.appender.globalfile.File=/var/log/wao/wao.log + log4j.appender.globalfile.MaxFileSize=500KB + log4j.appender.globalfile.Append=true + log4j.appender.globalfile.MaxBackupIndex=10 + log4j.appender.globalfile.Threshold=TRACE + log4j.appender.globalfile.layout=org.apache.log4j.PatternLayout + log4j.appender.globalfile.layout.ConversionPattern=%d{yyyy/MM/dd hh:mm:ss} %5p (%F:%L) %m%n + +Il est possible de changer cette configuration en la modifiant dans un fichier +log4j.properties placé au même niveau que le fichier war de l'application. + +Note + Le niveau de log par défaut est placé à DEBUG pour l'ensemble de l'application + (package : **log4j.logger.fr.ifremer.suiviobsmer=DEBUG**) + + Références ---------- - `Tomcat`_ -- WarLauncher de `Nuiton-utils`_ +- `WarLauncher`_ de `Nuiton-utils`_ +- ApplicationConfig de `Nuiton-utils`_ +- `Log4j`_ .. _Tomcat: http://tomcat.apache.org/ -.. _Nuiton-utils: http://maven-site.nuiton.org/nuiton-utils/Warlauncher.html \ No newline at end of file +.. _WarLauncher: http://maven-site.nuiton.org/nuiton-utils/Warlauncher.html + +.. _Nuiton-utils: http://maven-site.nuiton.org/nuiton-utils + +.. _ApplicationConfig: http://maven-site.nuiton.org/nuiton-utils + +.. _Log4j: http://logging.apache.org/log4j/1.2/index.html \ No newline at end of file Modified: trunk/suiviobsmer-business/README.txt =================================================================== --- trunk/suiviobsmer-business/README.txt 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/README.txt 2010-02-16 12:00:05 UTC (rev 354) @@ -1 +1 @@ -Look at README.txt in SuiviObsmer-ui to launch the application +Look at README.txt in Wao-ui to launch the application Modified: trunk/suiviobsmer-business/pom.xml =================================================================== --- trunk/suiviobsmer-business/pom.xml 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/pom.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -9,11 +9,11 @@ <parent> <groupId>fr.ifremer</groupId> - <artifactId>suiviobsmer</artifactId> - <version>1.0.0-SNAPSHOT</version> + <artifactId>wao</artifactId> + <version>1.0-SNAPSHOT</version> </parent> - <groupId>fr.ifremer.suiviobsmer</groupId> + <groupId>fr.ifremer.wao</groupId> <artifactId>suiviobsmer-business</artifactId> @@ -30,10 +30,12 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-email</artifactId> </dependency> + <!-- Utils --> <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> </dependency> + <!-- Logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> @@ -46,15 +48,12 @@ <groupId>log4j</groupId> <artifactId>log4j</artifactId> </dependency> + <!-- CSV lib --> <dependency> - <groupId>org.nuiton</groupId> - <artifactId>nuiton-utils</artifactId> - </dependency> - <dependency> <groupId>net.sourceforge.javacsv</groupId> <artifactId>javacsv</artifactId> </dependency> - <!-- ToPIA --> + <!-- ToPIA --> <dependency> <groupId>org.nuiton.topia</groupId> <artifactId>topia-persistence</artifactId> @@ -63,8 +62,7 @@ <groupId>org.nuiton.topia</groupId> <artifactId>topia-service-migration</artifactId> </dependency> - - <!-- base h2 --> + <!-- SGBD --> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> @@ -73,12 +71,7 @@ <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> </dependency> - - <!-- base postgres --> - <!--dependency> - <groupId>postgresql</groupId> - <artifactId>postgresql</artifactId> - </dependency--> + <!-- Tests --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -89,8 +82,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>SuiviObsmer :: Business</name> - <description>Métier de l'application SuiviObsmer</description> + <name>Wao :: Business</name> + <description>Métier de l'application Wao</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> @@ -104,13 +97,13 @@ <build> <!-- FIXME les filtres ne fonctionnent pas ! --> - <!-- Filter for resolving maven properties in SuiviObsmer.properties in resource folder --> + <!-- Filter for resolving maven properties in Wao.properties in resource folder --> <resources> <resource> <directory>src/main/filters</directory> <filtering>true</filtering> <includes> - <include>SuiviObsmer.properties</include> + <include>Wao.properties</include> </includes> </resource> <resource> @@ -151,7 +144,7 @@ <phase>generate-sources</phase> <id>copy-version-files</id> <configuration> - <includes>**/suiviobsmer.objectmodel</includes> + <includes>**/wao.objectmodel</includes> <copyVersionDir>${basedir}/src/main/resources/oldmappings/%MODELNAME% </copyVersionDir> <copyVersionFiles>**/*.hbm.xml</copyVersionFiles> Deleted: trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties =================================================================== --- trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties 2010-02-16 12:00:05 UTC (rev 354) @@ -1,20 +0,0 @@ -## Default properties for H2 database -hibernate.hbm2ddl.auto=create -hibernate.show_sql=false - -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.connection.username=sa -hibernate.connection.password= -hibernate.connection.driver_class=org.h2.Driver -hibernate.connection.url=jdbc:h2:file:~/.local/wao/h2data - -suiviobsmer.log.activityCalendar.access=${user.home}/.local/wao/log/activity-access.log -suiviobsmer.log.activityCalendar.import=${user.home}/.local/wao/log/activity.log - -## Config for sending Email -suiviobsmer.email.host=smtp.free.fr -suiviobsmer.email.port=25 -suiviobsmer.email.from=admin at wao.org - -## Version -suiviobsmer.version=1.0 \ No newline at end of file Copied: trunk/suiviobsmer-business/src/main/filters/Wao.properties (from rev 350, trunk/suiviobsmer-business/src/main/filters/SuiviObsmer.properties) =================================================================== --- trunk/suiviobsmer-business/src/main/filters/Wao.properties (rev 0) +++ trunk/suiviobsmer-business/src/main/filters/Wao.properties 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,24 @@ +## Default properties for H2 database +hibernate.hbm2ddl.auto=create +hibernate.show_sql=false +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.connection.username=sa +hibernate.connection.password= +hibernate.connection.driver_class=org.h2.Driver +## Database location in user home +hibernate.connection.url=jdbc:h2:file:~/.local/wao/h2data + +## Logs for activityCalendar in user home +wao.log.activityCalendar.access=${user.home}/.local/wao/log/activity-access.log +wao.log.activityCalendar.import=${user.home}/.local/wao/log/activity.log + +## Config for sending Email +wao.email.host=smtp +wao.email.port=25 +wao.email.from=admin at wao.org + +## Server path for link in mails (must be override) +wao.server.path=localhost:8080/wao + +## Version (not necessary to override it) +wao.version=1.0 \ No newline at end of file Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/MD5.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/MD5.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/MD5.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,5 +1,5 @@ /* *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Deleted: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerBusinessException.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerBusinessException.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerBusinessException.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,66 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer; - -/** - * SuiviObsmerBusinessException - * - * Created: 22 déc. 2009 - * - * @param <T> - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class SuiviObsmerBusinessException extends SuiviObsmerException { - - protected Type type; - - protected Class<?> serviceClass; - - public SuiviObsmerBusinessException(Type type, Class<?> serviceClass, String msg) { - super(msg); - this.type = type; - this.serviceClass = serviceClass; - } - - public SuiviObsmerBusinessException(Type type, Class<?> serviceClass, String msg, Throwable cause) { - super(msg, cause); - this.type = type; - this.serviceClass = serviceClass; - } - - public static enum Type { - IMPORT_ERROR, NOT_EXISTS, ALREADY_EXISTS, SYNTAX, BAD_CONNECTION, ILLEGAL_CONNECTION; - } - - public Type getType() { - return this.type; - } - - public String getServiceName() { - return this.serviceClass.getSimpleName(); - } - -} Deleted: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerContext.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerContext.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerContext.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,243 +0,0 @@ -/** - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - - -package fr.ifremer.suiviobsmer; - - -import fr.ifremer.suiviobsmer.entity.ActivityCalendar; -import java.io.IOException; -import java.util.Date; -import java.util.Properties; -import org.apache.commons.lang.RandomStringUtils; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.mail.EmailException; -import org.apache.commons.mail.SimpleEmail; -import org.apache.log4j.Level; -import org.apache.log4j.PatternLayout; -import org.apache.log4j.RollingFileAppender; -import org.hibernate.exception.SQLGrammarException; -import org.nuiton.topia.TopiaContext; -import org.nuiton.topia.TopiaContextFactory; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.TopiaNotFoundException; -import org.nuiton.topia.persistence.TopiaEntity; -import org.nuiton.topia.persistence.TopiaId; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * ContextUtilSuiviObsmer.java - * - * Created on 2009-11-23 - * - * @author fdesbois - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public class SuiviObsmerContext { - - private static final Logger log = LoggerFactory.getLogger(SuiviObsmerContext.class); - - public static final String PROP_FILENAME_LOG_ACTIVITY_IMPORT = - "suiviobsmer.log.activityCalendar.import"; - public static final String PROP_FILENAME_LOG_ACTIVITY_ACCESS = - "suiviobsmer.log.activityCalendar.access"; - public static final String PROP_EMAIL_HOST = "suiviobsmer.email.host"; - public static final String PROP_EMAIL_PORT = "suiviobsmer.email.port"; - public static final String PROP_EMAIL_FROM = "suiviobsmer.email.from"; - public static final String PROP_VERSION = "suiviobsmer.version"; - public static final String PROP_SERVER = "suiviobsmer.server.path"; - - private static SuiviObsmerRunner runner; - - private static boolean activityCalendarImport; - - private static org.apache.log4j.Logger activityCalendarAccessLogger; - - public static void setRunner(SuiviObsmerRunner run) { - if (log.isDebugEnabled()) { - log.debug("set runner in context"); - } - runner = run; - } - - public static Date getCurrentDate() { - return runner.getCurrentDate(); - } - - public static String getProperty(String key) { - return runner.getConfiguration().getOption(key); - } - - public static TopiaContext getTopiaRootContext() throws SuiviObsmerException { - if (runner.getConfiguration() == null) { - throw new SuiviObsmerException("Configuration must be set before initializing context"); - } - try { - Properties props = runner.getConfiguration().getOptions(); - return TopiaContextFactory.getContext(props); - } catch (TopiaNotFoundException eee) { - serviceException(null, eee.getMessage(), eee); - } - return null; - } - - public static void setActivityCalendarImport(boolean value) { - activityCalendarImport = value; - } - - public static boolean isActivityCalendarImportRun() { - return activityCalendarImport; - } - - public static void addActivityCalendarAccessLog(String message) throws IOException { - if (activityCalendarAccessLogger == null) { - // Define appender configuration only once - String filename = getProperty(PROP_FILENAME_LOG_ACTIVITY_ACCESS); - - PatternLayout layout = new PatternLayout(); - layout.setConversionPattern("%d %m%n"); - RollingFileAppender appender = new RollingFileAppender(); - appender.setName("ActivityCalendarAccess"); - appender.setFile(filename); - appender.setImmediateFlush(true); - appender.setMaxFileSize("2MB"); - appender.setMaxBackupIndex(10); - appender.setAppend(true); - appender.setThreshold(Level.INFO); - appender.setLayout(layout); - appender.activateOptions(); - - activityCalendarAccessLogger = - org.apache.log4j.Logger.getLogger(ActivityCalendar.class); - - activityCalendarAccessLogger.addAppender(appender); - } - - if (log.isDebugEnabled()) { - log.debug("message : " + message); - } - - activityCalendarAccessLogger.info(message); - } - - public static void serviceException(TopiaContext transaction, String message, Exception eee) throws SuiviObsmerException { - if (log.isDebugEnabled()) { - log.debug("An error occured",eee); - } - if (!(eee instanceof SuiviObsmerException)) { - //if (!(eee instanceof TopiaException)) { - try { - if (transaction != null && !transaction.isClosed()) { - if (log.isInfoEnabled()) { - log.info("Saving annulation : Transaction rollback"); - } - transaction.rollbackTransaction(); - //transaction.closeContext(); - } - } catch (TopiaException eeee) { - throw new SuiviObsmerException("Fatal topia error when close context", eeee); - } - //} - if (eee instanceof SQLGrammarException && log.isErrorEnabled()) { - log.error("SQL executed with error : " + ((SQLGrammarException)eee).getSQL()); - } - throw new SuiviObsmerException(message,eee); - } else { - throw (SuiviObsmerException)eee; - } - } - - public static void closeTransaction(TopiaContext transaction) throws SuiviObsmerException { - try { - if (transaction != null) { - transaction.closeContext(); - } - } catch (TopiaException eee) { - throw new SuiviObsmerException("Fatal topia error when close context", eee); - } - } - - /** - * Generate a random string of "length" character alphanumeric. - * @param length number of characters for the final string - * @return a String of "length" character - */ - public static String createRandomString(int length) { -// Random random = new Random(); -// StringBuilder sb = new StringBuilder(); -// while (sb.length() < length) { -// sb.append(Integer.toHexString(random.nextInt())); -// } -// return sb.toString(); - return RandomStringUtils.randomAlphanumeric(length); - } - - public static String encodeString(String string) { - return MD5.encode(string); - } - - public static String convertId(String topiaId) { - if (topiaId != null && !topiaId.isEmpty()) { - int index = topiaId.indexOf('#'); - String id = topiaId.replace('#', 'K'); - return id.substring(index); - } - return ""; - } - - public static String prepareSampleRowCode(String code) { - // Replace single number after year by a double one : 2010_111 -> 2010_0111 - code = code.replaceFirst("_(\\d{3})$", "_0$1"); - // Replace single number after year by a double one : 2010_11 -> 2010_0011 - code = code.replaceFirst("_(\\d{2})$", "_00$1"); - // Replace single number after year by a double one : 2010_1 -> 2010_0001 - code = code.replaceFirst("_(\\d)$", "_000$1"); - return code; - } - - public static <E extends TopiaEntity> boolean prepareTopiaId(Class<E> entityClass, E entity) { - String topiaId = entity.getTopiaId(); - // TODO-FD20100211 : add this behavior in topia in a - // new method createOrUpdate - if (StringUtils.isEmpty(entity.getTopiaId())) { - topiaId = TopiaId.create(entityClass); - entity.setTopiaId(topiaId); - return true; - } - return false; - } - - public static void sendEmail(String to, String subject, String msg) throws EmailException { - SimpleEmail email = new SimpleEmail(); - email.setHostName(getProperty(PROP_EMAIL_HOST)); - email.setSmtpPort(Integer.parseInt(getProperty(PROP_EMAIL_PORT))); - email.setFrom(getProperty(PROP_EMAIL_FROM)); - email.addTo(to); - email.setSubject(subject); - email.setMsg(msg); - email.setCharset("UTF-8"); - email.send(); - } -} Deleted: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerException.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerException.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerException.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,44 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer; - -/** - * SuiviObsmerException - * - * Created: 7 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class SuiviObsmerException extends Exception { - - public SuiviObsmerException(String msg) { - super(msg); - } - - public SuiviObsmerException(String msg, Throwable cause) { - super(msg, cause); - } -} Deleted: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobal.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobal.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobal.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,98 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer; - -import fr.ifremer.suiviobsmer.entity.Company; -import fr.ifremer.suiviobsmer.entity.CompanyDAO; -import fr.ifremer.suiviobsmer.entity.WaoUser; -import fr.ifremer.suiviobsmer.entity.WaoUserDAO; -import org.nuiton.topia.TopiaContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * SuiviObsmerGlobal - * - * Created: 27 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class SuiviObsmerGlobal { - - private static final Logger log = LoggerFactory.getLogger(SuiviObsmerGlobal.class); - - /** - * Create a default admin user if no user already exist. - * - * @throws SuiviObsmerException - */ - static void createDefaultAdmin() throws SuiviObsmerException { - TopiaContext transaction = null; - try { - transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); - - WaoUserDAO dao = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); - - long nbUsers = dao.size(); - - if (log.isInfoEnabled()) { - log.info("Nb existing users : " + nbUsers); - } - - if (nbUsers == 0) { - - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); - - if (log.isInfoEnabled()) { - log.info("Create first admin : login=\"admin\" / password=\"password\""); - } - - Company company = companyDAO.create(Company.ACTIVE, false, Company.NAME, "ADMIN"); - - String password = SuiviObsmerContext.encodeString("password"); - - WaoUser user = dao.create( - WaoUser.ADMIN, true, - WaoUser.ACTIVE, true, - WaoUser.LOGIN, "admin", - WaoUser.PASSWORD, password, - WaoUser.FIRST_NAME, "Super", - WaoUser.LAST_NAME, "Admin"); - company.addWaoUser(user); - user.setCompany(company); - - transaction.commitTransaction(); - } - - //transaction.closeContext(); - } catch (Exception eee) { - SuiviObsmerContext.serviceException(null, "Error during database initialization", eee); - } finally { - SuiviObsmerContext.closeTransaction(transaction); - } - } - -} Deleted: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerMigrationCallBack.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerMigrationCallBack.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerMigrationCallBack.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,44 +0,0 @@ -package fr.ifremer.suiviobsmer; - -import fr.ifremer.suiviobsmer.entity.SampleRow; -import fr.ifremer.suiviobsmer.entity.SampleRowDAO; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.framework.TopiaContextImplementor; -import org.nuiton.topia.migration.ManualMigrationCallback; -import org.nuiton.util.Version; - -import java.util.List; - -public class SuiviObsmerMigrationCallBack extends ManualMigrationCallback { - - /** - * Logger - */ - private static final Log log = LogFactory.getLog(SuiviObsmerMigrationCallBack.class); - - public void migrateTo_0_4(TopiaContextImplementor tx, - boolean showSql, - boolean showProgression) throws TopiaException { - - if (log.isInfoEnabled()) { - log.info("Migrate to version 0.4"); - } - - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(tx); - for (SampleRow row : dao.findAll()) { - String newCode = SuiviObsmerContext.prepareSampleRowCode(row.getCode()); - row.setCode(newCode); - } - } - - - @Override - public boolean askUser(Version dbVersion, - Version applicationVersion, - List<Version> versions) { - // Always migrate the database - return true; - } -} \ No newline at end of file Deleted: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunner.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunner.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunner.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,68 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer; - -import java.util.Date; -import org.nuiton.util.ApplicationConfig; - -/** - * SuiviObsmerRun - * - * Created: 24 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public interface SuiviObsmerRunner { - - /** - * Start the application. - * - * @throws SuiviObsmerException - */ - void start() throws SuiviObsmerException; - - /** - * Stop the application. - * - * @throws SuiviObsmerException - */ - void stop() throws SuiviObsmerException; - - /** - * Return the current date, depends on environment. - * - * @return the current Date - */ - Date getCurrentDate(); - - /** - * Return the configuration depends on environment. - * - * @return the ApplicationConfig which contains the application properties - */ - ApplicationConfig getConfiguration(); - -} Deleted: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,97 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer; - -import java.util.Date; -import java.util.Locale; - -import org.nuiton.i18n.I18n; -import org.nuiton.topia.TopiaException; -import org.nuiton.topia.migration.ManualMigrationEngine; -import org.nuiton.util.ApplicationConfig; - -/** - * StartSuiviObsmer - * - * Created: 24 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class SuiviObsmerRunnerImpl implements SuiviObsmerRunner { - - private ApplicationConfig configuration; - - public SuiviObsmerRunnerImpl() { - } - - @Override - public void start() throws SuiviObsmerException { - try { - configuration = new ApplicationConfig(); - configuration.setConfigFileName("SuiviObsmer.properties"); - configuration.parse(new String[]{}); - configuration.setOption("topia.persistence.classes", - SuiviObsmerModelDAOHelper.getImplementationClassesAsString()); - - // migration configuration - configuration.setOption(ManualMigrationEngine.MIGRATION_APPLICATION_VERSION, SuiviObsmerModelDAOHelper.getModelVersion()); - configuration.setOption(ManualMigrationEngine.MIGRATION_MAPPING_DIRECTORY, "oldmappings"); - configuration.setOption(ManualMigrationEngine.MIGRATION_MODEL_NAME, "SuiviObsmerModel"); - configuration.setOption("topia.service.migration", ManualMigrationEngine.class.getName()); - configuration.setOption(ManualMigrationEngine.MIGRATION_CALLBACK, SuiviObsmerMigrationCallBack.class.getName()); - - configuration.printConfig(); - - I18n.init(Locale.FRANCE); - // Use the context to set the runner for default environment. - SuiviObsmerContext.setRunner(this); - // Create the default admin in database - SuiviObsmerGlobal.createDefaultAdmin(); - } catch (Exception eee) { - SuiviObsmerContext.serviceException(null, "Error during loadConfiguration from " + - "'SuiviObsmer.properties' file", eee); - } - } - - @Override - public void stop() throws SuiviObsmerException { - try { - SuiviObsmerContext.getTopiaRootContext().closeContext(); - } catch (TopiaException eee) { - SuiviObsmerContext.serviceException(null, "Error when closing Topia root context", eee); - } - } - - @Override - public Date getCurrentDate() { - return new Date(); - } - - @Override - public ApplicationConfig getConfiguration() { - return configuration; - } -} Copied: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoBusinessException.java (from rev 350, trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerBusinessException.java) =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoBusinessException.java (rev 0) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoBusinessException.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,66 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer; + +/** + * WaoBusinessException + * + * Created: 22 déc. 2009 + * + * @param <T> + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class WaoBusinessException extends WaoException { + + protected Type type; + + protected Class<?> serviceClass; + + public WaoBusinessException(Type type, Class<?> serviceClass, String msg) { + super(msg); + this.type = type; + this.serviceClass = serviceClass; + } + + public WaoBusinessException(Type type, Class<?> serviceClass, String msg, Throwable cause) { + super(msg, cause); + this.type = type; + this.serviceClass = serviceClass; + } + + public static enum Type { + IMPORT_ERROR, NOT_EXISTS, ALREADY_EXISTS, SYNTAX, BAD_CONNECTION, ILLEGAL_CONNECTION; + } + + public Type getType() { + return this.type; + } + + public String getServiceName() { + return this.serviceClass.getSimpleName(); + } + +} Property changes on: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoBusinessException.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: svn:mergeinfo + Copied: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoContext.java (from rev 350, trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerContext.java) =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoContext.java (rev 0) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoContext.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,243 @@ +/** + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + + +package fr.ifremer.suiviobsmer; + + +import fr.ifremer.suiviobsmer.entity.ActivityCalendar; +import java.io.IOException; +import java.util.Date; +import java.util.Properties; +import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.mail.EmailException; +import org.apache.commons.mail.SimpleEmail; +import org.apache.log4j.Level; +import org.apache.log4j.PatternLayout; +import org.apache.log4j.RollingFileAppender; +import org.hibernate.exception.SQLGrammarException; +import org.nuiton.topia.TopiaContext; +import org.nuiton.topia.TopiaContextFactory; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.TopiaNotFoundException; +import org.nuiton.topia.persistence.TopiaEntity; +import org.nuiton.topia.persistence.TopiaId; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * WaoContext.java + * + * Created on 2009-11-23 + * + * @author fdesbois + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class WaoContext { + + private static final Logger log = LoggerFactory.getLogger(WaoContext.class); + + public static final String PROP_FILENAME_LOG_ACTIVITY_IMPORT = + "wao.log.activityCalendar.import"; + public static final String PROP_FILENAME_LOG_ACTIVITY_ACCESS = + "wao.log.activityCalendar.access"; + public static final String PROP_EMAIL_HOST = "wao.email.host"; + public static final String PROP_EMAIL_PORT = "wao.email.port"; + public static final String PROP_EMAIL_FROM = "wao.email.from"; + public static final String PROP_VERSION = "wao.version"; + public static final String PROP_SERVER = "wao.server.path"; + + private static WaoRunner runner; + + private static boolean activityCalendarImport; + + private static org.apache.log4j.Logger activityCalendarAccessLogger; + + public static void setRunner(WaoRunner run) { + if (log.isDebugEnabled()) { + log.debug("set runner in context"); + } + runner = run; + } + + public static Date getCurrentDate() { + return runner.getCurrentDate(); + } + + public static String getProperty(String key) { + return runner.getConfiguration().getOption(key); + } + + public static TopiaContext getTopiaRootContext() throws WaoException { + if (runner.getConfiguration() == null) { + throw new WaoException("Configuration must be set before initializing context"); + } + try { + Properties props = runner.getConfiguration().getOptions(); + return TopiaContextFactory.getContext(props); + } catch (TopiaNotFoundException eee) { + serviceException(null, eee.getMessage(), eee); + } + return null; + } + + public static void setActivityCalendarImport(boolean value) { + activityCalendarImport = value; + } + + public static boolean isActivityCalendarImportRun() { + return activityCalendarImport; + } + + public static void addActivityCalendarAccessLog(String message) throws IOException { + if (activityCalendarAccessLogger == null) { + // Define appender configuration only once + String filename = getProperty(PROP_FILENAME_LOG_ACTIVITY_ACCESS); + + PatternLayout layout = new PatternLayout(); + layout.setConversionPattern("%d %m%n"); + RollingFileAppender appender = new RollingFileAppender(); + appender.setName("ActivityCalendarAccess"); + appender.setFile(filename); + appender.setImmediateFlush(true); + appender.setMaxFileSize("2MB"); + appender.setMaxBackupIndex(10); + appender.setAppend(true); + appender.setThreshold(Level.INFO); + appender.setLayout(layout); + appender.activateOptions(); + + activityCalendarAccessLogger = + org.apache.log4j.Logger.getLogger(ActivityCalendar.class); + + activityCalendarAccessLogger.addAppender(appender); + } + + if (log.isDebugEnabled()) { + log.debug("message : " + message); + } + + activityCalendarAccessLogger.info(message); + } + + public static void serviceException(TopiaContext transaction, String message, Exception eee) throws WaoException { + if (log.isDebugEnabled()) { + log.debug("An error occured",eee); + } + if (!(eee instanceof WaoException)) { + //if (!(eee instanceof TopiaException)) { + try { + if (transaction != null && !transaction.isClosed()) { + if (log.isInfoEnabled()) { + log.info("Saving annulation : Transaction rollback"); + } + transaction.rollbackTransaction(); + //transaction.closeContext(); + } + } catch (TopiaException eeee) { + throw new WaoException("Fatal topia error when close context", eeee); + } + //} + if (eee instanceof SQLGrammarException && log.isErrorEnabled()) { + log.error("SQL executed with error : " + ((SQLGrammarException)eee).getSQL()); + } + throw new WaoException(message,eee); + } else { + throw (WaoException)eee; + } + } + + public static void closeTransaction(TopiaContext transaction) throws WaoException { + try { + if (transaction != null) { + transaction.closeContext(); + } + } catch (TopiaException eee) { + throw new WaoException("Fatal topia error when close context", eee); + } + } + + /** + * Generate a random string of "length" character alphanumeric. + * @param length number of characters for the final string + * @return a String of "length" character + */ + public static String createRandomString(int length) { +// Random random = new Random(); +// StringBuilder sb = new StringBuilder(); +// while (sb.length() < length) { +// sb.append(Integer.toHexString(random.nextInt())); +// } +// return sb.toString(); + return RandomStringUtils.randomAlphanumeric(length); + } + + public static String encodeString(String string) { + return MD5.encode(string); + } + + public static String convertId(String topiaId) { + if (topiaId != null && !topiaId.isEmpty()) { + int index = topiaId.indexOf('#'); + String id = topiaId.replace('#', 'K'); + return id.substring(index); + } + return ""; + } + + public static String prepareSampleRowCode(String code) { + // Replace single number after year by a double one : 2010_111 -> 2010_0111 + code = code.replaceFirst("_(\\d{3})$", "_0$1"); + // Replace single number after year by a double one : 2010_11 -> 2010_0011 + code = code.replaceFirst("_(\\d{2})$", "_00$1"); + // Replace single number after year by a double one : 2010_1 -> 2010_0001 + code = code.replaceFirst("_(\\d)$", "_000$1"); + return code; + } + + public static <E extends TopiaEntity> boolean prepareTopiaId(Class<E> entityClass, E entity) { + String topiaId = entity.getTopiaId(); + // TODO-FD20100211 : add this behavior in topia in a + // new method createOrUpdate + if (StringUtils.isEmpty(entity.getTopiaId())) { + topiaId = TopiaId.create(entityClass); + entity.setTopiaId(topiaId); + return true; + } + return false; + } + + public static void sendEmail(String to, String subject, String msg) throws EmailException { + SimpleEmail email = new SimpleEmail(); + email.setHostName(getProperty(PROP_EMAIL_HOST)); + email.setSmtpPort(Integer.parseInt(getProperty(PROP_EMAIL_PORT))); + email.setFrom(getProperty(PROP_EMAIL_FROM)); + email.addTo(to); + email.setSubject(subject); + email.setMsg(msg); + email.setCharset("UTF-8"); + email.send(); + } +} Copied: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoException.java (from rev 350, trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerException.java) =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoException.java (rev 0) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoException.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,44 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer; + +/** + * WaoException + * + * Created: 7 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class WaoException extends Exception { + + public WaoException(String msg) { + super(msg); + } + + public WaoException(String msg, Throwable cause) { + super(msg, cause); + } +} Copied: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoGlobal.java (from rev 350, trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobal.java) =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoGlobal.java (rev 0) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoGlobal.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,98 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer; + +import fr.ifremer.suiviobsmer.entity.Company; +import fr.ifremer.suiviobsmer.entity.CompanyDAO; +import fr.ifremer.suiviobsmer.entity.WaoUser; +import fr.ifremer.suiviobsmer.entity.WaoUserDAO; +import org.nuiton.topia.TopiaContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * WaoGlobal + * + * Created: 27 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class WaoGlobal { + + private static final Logger log = LoggerFactory.getLogger(WaoGlobal.class); + + /** + * Create a default admin user if no user already exist. + * + * @throws WaoException + */ + static void createDefaultAdmin() throws WaoException { + TopiaContext transaction = null; + try { + transaction = WaoContext.getTopiaRootContext().beginTransaction(); + + WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); + + long nbUsers = dao.size(); + + if (log.isInfoEnabled()) { + log.info("Nb existing users : " + nbUsers); + } + + if (nbUsers == 0) { + + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); + + if (log.isInfoEnabled()) { + log.info("Create first admin : login=\"admin\" / password=\"password\""); + } + + Company company = companyDAO.create(Company.ACTIVE, false, Company.NAME, "ADMIN"); + + String password = WaoContext.encodeString("password"); + + WaoUser user = dao.create( + WaoUser.ADMIN, true, + WaoUser.ACTIVE, true, + WaoUser.LOGIN, "admin", + WaoUser.PASSWORD, password, + WaoUser.FIRST_NAME, "Super", + WaoUser.LAST_NAME, "Admin"); + company.addWaoUser(user); + user.setCompany(company); + + transaction.commitTransaction(); + } + + //transaction.closeContext(); + } catch (Exception eee) { + WaoContext.serviceException(null, "Error during database initialization", eee); + } finally { + WaoContext.closeTransaction(transaction); + } + } + +} Property changes on: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoGlobal.java ___________________________________________________________________ Added: svn:keywords + Author Date Revision Added: svn:mergeinfo + Copied: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoMigrationCallBack.java (from rev 350, trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerMigrationCallBack.java) =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoMigrationCallBack.java (rev 0) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoMigrationCallBack.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,64 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ +package fr.ifremer.suiviobsmer; + +import fr.ifremer.suiviobsmer.entity.SampleRow; +import fr.ifremer.suiviobsmer.entity.SampleRowDAO; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.framework.TopiaContextImplementor; +import org.nuiton.topia.migration.ManualMigrationCallback; +import org.nuiton.util.Version; + +import java.util.List; + +public class WaoMigrationCallBack extends ManualMigrationCallback { + + /** + * Logger + */ + private static final Log log = LogFactory.getLog(WaoMigrationCallBack.class); + + public void migrateTo_0_4(TopiaContextImplementor tx, + boolean showSql, + boolean showProgression) throws TopiaException { + + if (log.isInfoEnabled()) { + log.info("Migrate to version 0.4"); + } + + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(tx); + for (SampleRow row : dao.findAll()) { + String newCode = WaoContext.prepareSampleRowCode(row.getCode()); + row.setCode(newCode); + } + } + + + @Override + public boolean askUser(Version dbVersion, + Version applicationVersion, + List<Version> versions) { + // Always migrate the database + return true; + } +} \ No newline at end of file Property changes on: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoMigrationCallBack.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL Added: svn:mergeinfo + Copied: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoRunner.java (from rev 350, trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunner.java) =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoRunner.java (rev 0) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoRunner.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,68 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer; + +import java.util.Date; +import org.nuiton.util.ApplicationConfig; + +/** + * WaoRun + * + * Created: 24 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public interface WaoRunner { + + /** + * Start the application. + * + * @throws WaoException + */ + void start() throws WaoException; + + /** + * Stop the application. + * + * @throws WaoException + */ + void stop() throws WaoException; + + /** + * Return the current date, depends on environment. + * + * @return the current Date + */ + Date getCurrentDate(); + + /** + * Return the configuration depends on environment. + * + * @return the ApplicationConfig which contains the application properties + */ + ApplicationConfig getConfiguration(); + +} Copied: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoRunnerImpl.java (from rev 350, trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerImpl.java) =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoRunnerImpl.java (rev 0) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/WaoRunnerImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,97 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer; + +import java.util.Date; +import java.util.Locale; + +import org.nuiton.i18n.I18n; +import org.nuiton.topia.TopiaException; +import org.nuiton.topia.migration.ManualMigrationEngine; +import org.nuiton.util.ApplicationConfig; + +/** + * StartWao + * + * Created: 24 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class WaoRunnerImpl implements WaoRunner { + + private ApplicationConfig configuration; + + public WaoRunnerImpl() { + } + + @Override + public void start() throws WaoException { + try { + configuration = new ApplicationConfig(); + configuration.setConfigFileName("Wao.properties"); + configuration.parse(new String[]{}); + configuration.setOption("topia.persistence.classes", + WaoModelDAOHelper.getImplementationClassesAsString()); + + // migration configuration + configuration.setOption(ManualMigrationEngine.MIGRATION_APPLICATION_VERSION, WaoModelDAOHelper.getModelVersion()); + configuration.setOption(ManualMigrationEngine.MIGRATION_MAPPING_DIRECTORY, "oldmappings"); + configuration.setOption(ManualMigrationEngine.MIGRATION_MODEL_NAME, "WaoModel"); + configuration.setOption("topia.service.migration", ManualMigrationEngine.class.getName()); + configuration.setOption(ManualMigrationEngine.MIGRATION_CALLBACK, WaoMigrationCallBack.class.getName()); + + configuration.printConfig(); + + I18n.init(Locale.FRANCE); + // Use the context to set the runner for default environment. + WaoContext.setRunner(this); + // Create the default admin in database + WaoGlobal.createDefaultAdmin(); + } catch (Exception eee) { + WaoContext.serviceException(null, "Error during loadConfiguration from " + + "'Wao.properties' file", eee); + } + } + + @Override + public void stop() throws WaoException { + try { + WaoContext.getTopiaRootContext().closeContext(); + } catch (TopiaException eee) { + WaoContext.serviceException(null, "Error when closing Topia root context", eee); + } + } + + @Override + public Date getCurrentDate() { + return new Date(); + } + + @Override + public ApplicationConfig getConfiguration() { + return configuration; + } +} Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/BoatFilterImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/BoatFilterImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/BoatFilterImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/CompanyBoatInfosImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/CompanyBoatInfosImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/CompanyBoatInfosImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactAverageReactivityImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactAverageReactivityImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactAverageReactivityImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,3 +1,23 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.bean; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactFilterImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactState.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactState.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactState.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactStateStatisticsImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactStateStatisticsImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ContactStateStatisticsImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,3 +1,23 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.bean; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/FacadeRowImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/FacadeRowImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/FacadeRowImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,3 +1,23 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.bean; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ImportResultsImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ImportResultsImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/ImportResultsImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/SamplingFilterImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,7 +21,7 @@ package fr.ifremer.suiviobsmer.bean; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoContext; import fr.ifremer.suiviobsmer.entity.FishingZone; import fr.ifremer.suiviobsmer.entity.SampleRow; import java.util.Calendar; @@ -93,9 +93,9 @@ if (getNbMonthFinishedFromToday() != null) { // Only rows which are not finished will be kept - // Date current = SuiviObsmerContext.getCurrentDate(); + // Date current = WaoContext.getCurrentDate(); Calendar calendar = new GregorianCalendar(); - calendar.setTime(SuiviObsmerContext.getCurrentDate()); + calendar.setTime(WaoContext.getCurrentDate()); calendar.add(Calendar.MONTH, getNbMonthFinishedFromToday()); query.add(main + "." + SampleRow.PERIOD_END, Op.GE, calendar.getTime()); } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/UserFilterImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/UserFilterImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/bean/UserFilterImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,3 +1,23 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.bean; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityCalendarImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityCalendarImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityCalendarImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityMonthImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityMonthImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityMonthImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityProfessionImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityProfessionImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ActivityProfessionImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,9 +21,9 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; import fr.ifremer.suiviobsmer.bean.ContactState; import java.io.Serializable; import java.util.Date; @@ -56,20 +56,20 @@ * * @param company which is the creator of the contact * @return true if the contact can be created, false otherwise - * @throws SuiviObsmerException + * @throws WaoException * @see fr.ifremer.suiviobsmer.bean.ContactState#isFinalState() */ @Override - public boolean canCreateContact(Company company) throws SuiviObsmerException { + public boolean canCreateContact(Company company) throws WaoException { boolean result = true; if (!getActive()) { result = false; } else { TopiaContext transaction = null; try { - transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + transaction = WaoContext.getTopiaRootContext().beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); Contact contact = dao.findByQuery(dao.createQueryLastContactForBoat(this, company)); if (contact != null) { @@ -79,12 +79,12 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer les informations privées du navire lié à la société " + "'" + company.getName() + "'", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } return result; @@ -96,29 +96,29 @@ * * @param fromDate the date to start calcul * @return a number of boarding done on the boat for all companies - * @throws SuiviObsmerException + * @throws WaoException * @see fr.ifremer.suiviobsmer.entity.ContactDAO#createQueryDoneContactsFromDate(Boat, Date) */ @Override - public int getNbBoarding(Date fromDate) throws SuiviObsmerException { + public int getNbBoarding(Date fromDate) throws WaoException { TopiaContext transaction = null; int result = 0; try { - transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + transaction = WaoContext.getTopiaRootContext().beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); TopiaQuery query = dao.createQueryDoneContactsFromDate(this, fromDate); result = query.executeCount(transaction); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer le nombre d'embarquements réels depuis le " + "'" + fromDate + "'", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,9 +21,9 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; import org.nuiton.topia.framework.TopiaQuery; import java.io.Serializable; import org.nuiton.topia.TopiaContext; @@ -54,17 +54,17 @@ * * @param fromDate the date to start calcul * @return a number of boarding done on the boat for the current company - * @throws SuiviObsmerException + * @throws WaoException * @see fr.ifremer.suiviobsmer.entity.ContactDAO#createQueryDoneContactsFromDate(Boat, Date) */ @Override - public int getNbBoardingForCompany(Date fromDate) throws SuiviObsmerException { + public int getNbBoardingForCompany(Date fromDate) throws WaoException { TopiaContext transaction = null; int result = 0; try { - transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + transaction = WaoContext.getTopiaRootContext().beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); TopiaQuery query = dao.createQueryDoneContactsFromDate(getBoat(), fromDate); query.add(Contact.OBSERVER + "." + WaoUser.COMPANY, getCompany()); @@ -73,12 +73,12 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer le nombre d'embarquements réels depuis le " + "'" + fromDate + "' pour la société '" + getCompany().getName() + "'", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/CompanyImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/CompanyImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/CompanyImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,7 +21,7 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoContext; import java.io.Serializable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,10 +46,10 @@ /** * Return a simplified id instead of using topiaId * @return a simplified id - * @see SuiviObsmerUtils#convertId(java.lang.String) + * @see WaoUtils#convertId(java.lang.String) */ @Override public String getId() { - return SuiviObsmerContext.convertId(getTopiaId()); + return WaoContext.convertId(getTopiaId()); } } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ContactDAOImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ContactDAOImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ContactDAOImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ContactImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ContactImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ContactImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/FishingZoneImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/FishingZoneImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/FishingZoneImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ProfessionImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ProfessionImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/ProfessionImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,9 +21,9 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; import java.io.Serializable; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -56,15 +56,15 @@ * If nbDays is negative and superior to the current value, * the real tides value will be set to 0. * @param nbDays to add or remove (if negative) - * @throws SuiviObsmerException for saving problem + * @throws WaoException for saving problem */ @Override - public void addRealTideTime(int nbDays) throws SuiviObsmerException { + public void addRealTideTime(int nbDays) throws WaoException { TopiaContext transaction = null; try { - transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + transaction = WaoContext.getTopiaRootContext().beginTransaction(); - SampleMonthDAO dao = SuiviObsmerModelDAOHelper.getSampleMonthDAO(transaction); + SampleMonthDAO dao = WaoModelDAOHelper.getSampleMonthDAO(transaction); SampleMonth month = dao.findByTopiaId(getTopiaId()); int result = month.getRealTidesValue() + nbDays; if (result < 0) { @@ -79,11 +79,11 @@ transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible d'enregistrer le nombre de marées réels pour le mois de " + formatMonth() + " [ligne : " + this.getSampleRow().getCode() + "]", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } @@ -97,7 +97,7 @@ @Override public boolean isCurrentMonth() { Calendar current = new GregorianCalendar(); - current.setTime(SuiviObsmerContext.getCurrentDate()); + current.setTime(WaoContext.getCurrentDate()); Calendar calendar = new GregorianCalendar(); calendar.setTime(getPeriodDate()); Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,8 +21,8 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; @@ -207,7 +207,7 @@ } @Override - public boolean addRealTideTime(Contact contact) throws SuiviObsmerException { + public boolean addRealTideTime(Contact contact) throws WaoException { if (contact.getTideEndDate() == null || contact.getTideBeginDate() == null) { return false; } @@ -224,7 +224,7 @@ } @Override - public void removeRealTideTime(Contact contact) throws SuiviObsmerException { + public void removeRealTideTime(Contact contact) throws WaoException { if (contact.getTideEndDate() == null || contact.getTideBeginDate() == null) { return; } @@ -245,14 +245,14 @@ @Override public boolean isStarted() { - Date current = SuiviObsmerContext.getCurrentDate(); + Date current = WaoContext.getCurrentDate(); return current.after(getPeriodBegin()) || current.equals(getPeriodBegin()); } @Override public boolean isFinished(int nbMonths) { Calendar calendar = new GregorianCalendar(); - calendar.setTime(SuiviObsmerContext.getCurrentDate()); + calendar.setTime(WaoContext.getCurrentDate()); calendar.add(Calendar.MONTH, nbMonths); return calendar.getTime().after(getPeriodEnd()); } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/WaoUserImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/WaoUserImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/entity/WaoUserImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,7 +21,7 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoContext; import java.io.Serializable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -59,11 +59,11 @@ /** * Return a simplified id instead of using topiaId * @return a simplified id - * @see SuiviObsmerUtils#convertId(java.lang.String) + * @see WaoUtils#convertId(java.lang.String) */ @Override public String getId() { - return SuiviObsmerContext.convertId(getTopiaId()); + return WaoContext.convertId(getTopiaId()); } @Override Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/ExportHelper.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/ExportHelper.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/ExportHelper.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,3 +1,23 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.io; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/ImportHelper.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/ImportHelper.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/ImportHelper.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -86,7 +86,7 @@ time.setTime(timeFormat.parse(code)); } else { // Use current date with no time as a reference if no code is set - time.setTime(SuiviObsmerContext.getCurrentDate()); + time.setTime(WaoContext.getCurrentDate()); time.set(Calendar.HOUR_OF_DAY, 0); time.set(Calendar.MINUTE, 0); time.set(Calendar.SECOND, 0); @@ -102,14 +102,14 @@ result.set(Calendar.SECOND, time.get(Calendar.SECOND)); result.set(Calendar.MILLISECOND, time.get(Calendar.MILLISECOND)); } else { - result.setTime(SuiviObsmerContext.getCurrentDate()); + result.setTime(WaoContext.getCurrentDate()); } return result.getTime(); } public static String readSampleRowCode(CsvReader reader) throws IOException { String code = read(reader, SAMPLING.PLAN_CODE); - return SuiviObsmerContext.prepareSampleRowCode(code); + return WaoContext.prepareSampleRowCode(code); } /** Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/SamplingExport.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/SamplingExport.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/SamplingExport.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,3 +1,23 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.io; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/WaoCsvHeader.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/WaoCsvHeader.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/io/WaoCsvHeader.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,3 +1,23 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.io; Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/mock/ServiceNewsMock.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/mock/ServiceNewsMock.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/mock/ServiceNewsMock.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,7 +21,7 @@ package fr.ifremer.suiviobsmer.mock; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.entity.News; import fr.ifremer.suiviobsmer.entity.NewsImpl; import fr.ifremer.suiviobsmer.services.ServiceNews; @@ -47,7 +47,7 @@ private static final Logger log = LoggerFactory.getLogger(ServiceNewsMock.class); @Override - public List<News> getNews() throws SuiviObsmerException { + public List<News> getNews() throws WaoException { List<News> results = new ArrayList<News>(); Integer[] tab = new Integer[12]; @@ -106,7 +106,7 @@ } @Override - public void saveNews(News news, boolean delete) throws SuiviObsmerException { + public void saveNews(News news, boolean delete) throws WaoException { throw new UnsupportedOperationException("Not supported yet."); } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ActivityCalendarImport.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ActivityCalendarImport.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ActivityCalendarImport.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -123,8 +123,8 @@ public ActivityCalendarImport(InputStream input) throws IOException { super(); this.input = input; - String filename = SuiviObsmerContext.getProperty( - SuiviObsmerContext.PROP_FILENAME_LOG_ACTIVITY_IMPORT); + String filename = WaoContext.getProperty( + WaoContext.PROP_FILENAME_LOG_ACTIVITY_IMPORT); File file = new File(filename); file.getParentFile().mkdirs(); if (file.exists()) { @@ -137,10 +137,10 @@ @Override public void run() { TopiaContext transaction = null; - SuiviObsmerContext.setActivityCalendarImport(true); + WaoContext.setActivityCalendarImport(true); int currRow = 1; try { - transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + transaction = WaoContext.getTopiaRootContext().beginTransaction(); CsvReader reader = new CsvReader(input, Charset.forName("UTF-8")); @@ -156,11 +156,11 @@ Map<ActivityCalendarKey, ActivityCalendar> availableCalendars = new HashMap<ActivityCalendarKey, ActivityCalendar>(); - BoatDAO boatDAO = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); - ActivityCalendarDAO calendarDAO = SuiviObsmerModelDAOHelper.getActivityCalendarDAO(transaction); - ActivityMonthDAO monthDAO = SuiviObsmerModelDAOHelper.getActivityMonthDAO(transaction); - ActivityProfessionDAO professionDAO = SuiviObsmerModelDAOHelper.getActivityProfessionDAO(transaction); - ActivityZoneDAO zoneDAO = SuiviObsmerModelDAOHelper.getActivityZoneDAO(transaction); + BoatDAO boatDAO = WaoModelDAOHelper.getBoatDAO(transaction); + ActivityCalendarDAO calendarDAO = WaoModelDAOHelper.getActivityCalendarDAO(transaction); + ActivityMonthDAO monthDAO = WaoModelDAOHelper.getActivityMonthDAO(transaction); + ActivityProfessionDAO professionDAO = WaoModelDAOHelper.getActivityProfessionDAO(transaction); + ActivityZoneDAO zoneDAO = WaoModelDAOHelper.getActivityZoneDAO(transaction); while(reader.readRecord()) { currRow++; @@ -334,7 +334,7 @@ } } finally { IOUtils.closeQuietly(writer); - SuiviObsmerContext.setActivityCalendarImport(false); + WaoContext.setActivityCalendarImport(false); try { transaction.closeContext(); } catch (TopiaException te) { Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceBoatImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceBoatImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceBoatImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -23,11 +23,11 @@ import com.csvreader.CsvReader; import com.csvreader.CsvWriter; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException.Type; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoBusinessException.Type; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.topia.framework.TopiaQuery.Op; @@ -75,18 +75,18 @@ protected TopiaContext rootContext; - public ServiceBoatImpl() throws SuiviObsmerException { - rootContext = SuiviObsmerContext.getTopiaRootContext(); + public ServiceBoatImpl() throws WaoException { + rootContext = WaoContext.getTopiaRootContext(); } @Override - public Map<Integer, Boat> getBoatsByFilter(BoatFilter filter) throws SuiviObsmerException { + public Map<Integer, Boat> getBoatsByFilter(BoatFilter filter) throws WaoException { TopiaContext transaction = null; Map<Integer, Boat> results = new HashMap<Integer, Boat>(); try { transaction = rootContext.beginTransaction(); - BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); TopiaQuery query = dao.createQuery("B"); query = createQueryForBoatFilter(query, filter); @@ -104,21 +104,21 @@ results = dao.findAllMappedByQuery(query, Boat.IMMATRICULATION, Integer.class); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee); + WaoContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public int getNbBoatsByFilter(BoatFilter filter) throws SuiviObsmerException { + public int getNbBoatsByFilter(BoatFilter filter) throws WaoException { TopiaContext transaction = null; int result = 0; try { transaction = rootContext.beginTransaction(); - BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); TopiaQuery query = dao.createQuery("B"); query = createQueryForBoatFilter(query, filter); @@ -126,9 +126,9 @@ result = query.executeCount(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee); + WaoContext.serviceException(transaction, "Impossible de filtrer la liste des navires", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @@ -176,7 +176,7 @@ */ @Override public CompanyBoatInfos getCompanyBoatInfos(int boatImmatriculation, Company company) - throws SuiviObsmerException { + throws WaoException { Map<String, ElligibleBoat> elligibleBoats = new HashMap<String, ElligibleBoat>(); CompanyBoatInfos result = new CompanyBoatInfosImpl(); @@ -188,11 +188,11 @@ try { transaction = rootContext.beginTransaction(); - BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); Boat boat = dao.findByImmatriculation(boatImmatriculation); - BoatInfosDAO boatInfosDAO = SuiviObsmerModelDAOHelper.getBoatInfosDAO(transaction); + BoatInfosDAO boatInfosDAO = WaoModelDAOHelper.getBoatInfosDAO(transaction); BoatInfos boatInfos = boatInfosDAO.findByProperties( BoatInfos.BOAT, boat, BoatInfos.COMPANY, company); if (boatInfos == null) { @@ -224,7 +224,7 @@ } // Last contact - ContactDAO contactDAO = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO contactDAO = WaoModelDAOHelper.getContactDAO(transaction); TopiaQuery query = contactDAO.createQueryLastContactForBoat(boat, company). addLoad(Contact.SAMPLE_ROW, Contact.OBSERVER); @@ -236,33 +236,33 @@ // transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer les informations du navire " + "immatriculé '" + boatImmatriculation + "'" + " pour la société '" + company.getName() + "'", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override public void createUpdateCompanyBoatInfos(CompanyBoatInfos companyBoatInfos) - throws SuiviObsmerException { + throws WaoException { TopiaContext transaction = null; try { transaction = rootContext.beginTransaction(); - BoatInfosDAO dao = SuiviObsmerModelDAOHelper.getBoatInfosDAO(transaction); + BoatInfosDAO dao = WaoModelDAOHelper.getBoatInfosDAO(transaction); BoatInfos boatInfos = companyBoatInfos.getBoatInfos(); - SuiviObsmerContext.prepareTopiaId(BoatInfos.class, boatInfos); + WaoContext.prepareTopiaId(BoatInfos.class, boatInfos); dao.update(boatInfos); - ElligibleBoatDAO elligibleDAO = SuiviObsmerModelDAOHelper.getElligibleBoatDAO(transaction); + ElligibleBoatDAO elligibleDAO = WaoModelDAOHelper.getElligibleBoatDAO(transaction); for (ElligibleBoat elligible : companyBoatInfos.getElligibleBoatsValues()) { - SuiviObsmerContext.prepareTopiaId(ElligibleBoat.class, elligible); + WaoContext.prepareTopiaId(ElligibleBoat.class, elligible); elligibleDAO.update(elligible); } @@ -276,16 +276,16 @@ } catch (Exception eee) { Boat boat = companyBoatInfos.getBoatInfos().getBoat(); Company company = companyBoatInfos.getCompany(); - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de créer ou modifier les informations liés au navire " + boat.getImmatriculation() + " pour la société " + company.getName(), eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } @Override - public List<Boat> getBoatsByImmatriculations(String immatriculations) throws SuiviObsmerException { + public List<Boat> getBoatsByImmatriculations(String immatriculations) throws WaoException { List<Boat> boats = new ArrayList<Boat>(); TopiaContext transaction = null; if (StringUtils.isEmpty(immatriculations)) { @@ -294,7 +294,7 @@ try { transaction = rootContext.beginTransaction(); - BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); Pattern pattern = Pattern.compile("\\d{6}"); Matcher matcher = pattern.matcher(immatriculations); @@ -303,7 +303,7 @@ int immatriculation = Integer.parseInt(res); Boat boat = dao.findByImmatriculation(immatriculation); if (boat == null) { - throw new SuiviObsmerBusinessException(Type.NOT_EXISTS, ServiceBoat.class, + throw new WaoBusinessException(Type.NOT_EXISTS, ServiceBoat.class, "Immatriculation " + immatriculation + " incorrect, ne référence aucun navire"); } boats.add(boat); @@ -311,36 +311,36 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "La chaîne d'immatriculations est incorrect ! Chaque immatriculation doit posséder 6 chiffres", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return boats; } @Override - public Boat getBoat(String boatId) throws SuiviObsmerException { + public Boat getBoat(String boatId) throws WaoException { TopiaContext transaction = null; Boat result = null; try { transaction = rootContext.beginTransaction(); - BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); result = dao.findByTopiaId(boatId); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de charger le navire", eee); + WaoContext.serviceException(transaction, "Impossible de charger le navire", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override - public List<String> getBoatNamesStartWith(String input) throws SuiviObsmerException { + public List<String> getBoatNamesStartWith(String input) throws WaoException { TopiaContext transaction = null; List<String> results = new ArrayList<String>(); try { @@ -348,16 +348,16 @@ input = StringUtils.upperCase(input); - BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); results = (List<String>)dao.createQuery().addDistinct().setSelect(Boat.NAME).add(Boat.NAME, Op.LIKE, input + "%").execute(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer les navires avec un nom commencant par '" + input + "'", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @@ -372,11 +372,11 @@ * @param input Stream corresponding to Csv file * @return an array with two int : the first corresponding to total number * of boats imported and the second corresponding only to new boats added. - * @throws SuiviObsmerException + * @throws WaoException * @see com.csvreader.CsvReader */ @Override - public int[] importBoatCsv(InputStream input) throws SuiviObsmerException { + public int[] importBoatCsv(InputStream input) throws WaoException { TopiaContext transaction = null; int[] result = new int[]{0,0}; try { @@ -388,8 +388,8 @@ long startTime = System.currentTimeMillis(); long tic; - BoatDAO boatDAO = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); - ShipOwnerDAO shipOwnerDAO = SuiviObsmerModelDAOHelper.getShipOwnerDAO(transaction); + BoatDAO boatDAO = WaoModelDAOHelper.getBoatDAO(transaction); + ShipOwnerDAO shipOwnerDAO = WaoModelDAOHelper.getShipOwnerDAO(transaction); Map<String, ShipOwner> availableShipOwners = new HashMap<String, ShipOwner>(); @@ -475,19 +475,19 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Problème d'import du fichier CSV. Vérifiez l'en-tête du fichier : [ NAVS_COD,CARN_NOM," + "CARN_LONGUEUR_HT,CARN_ANNEE,QUARTIER_IMMA,PER_COD,PER_NOM,PER_PRENOM,NAVS_ACTIVE ]"/* et l'encodage [ UTF-8 ] */ + " Voir documentation pour plus de détails.", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override - public InputStream exportBoatCsv(BoatFilter filter) throws SuiviObsmerException { + public InputStream exportBoatCsv(BoatFilter filter) throws WaoException { TopiaContext transaction = null; InputStream result = null; CsvWriter writer = null; @@ -515,7 +515,7 @@ export.writeHeaders(); // Get boats from database filterd by filter in argument - BoatDAO dao = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + BoatDAO dao = WaoModelDAOHelper.getBoatDAO(transaction); TopiaQuery query = dao.createQuery("B"); query = createQueryForBoatFilter(query, filter); @@ -561,38 +561,38 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible d'exporter les navires sélectionnés", eee); } finally { if (writer != null) { writer.close(); } - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override - public void importActivityCalendarCsv(InputStream input) throws SuiviObsmerException { - if (!SuiviObsmerContext.isActivityCalendarImportRun()) { + public void importActivityCalendarCsv(InputStream input) throws WaoException { + if (!WaoContext.isActivityCalendarImportRun()) { try { ActivityCalendarImport calendarImport = new ActivityCalendarImport(input); new Thread(calendarImport).start(); } catch (IOException eee) { - SuiviObsmerContext.serviceException(null, + WaoContext.serviceException(null, "Problème d'import du fichier CSV des calendriers d'activité", eee); } } } @Override - public ActivityCalendar getLastActivityCalendar(WaoUser user, Boat boat) throws SuiviObsmerException { + public ActivityCalendar getLastActivityCalendar(WaoUser user, Boat boat) throws WaoException { TopiaContext transaction = null; ActivityCalendar result = null; try { transaction = rootContext.beginTransaction(); - ActivityCalendarDAO dao = SuiviObsmerModelDAOHelper.getActivityCalendarDAO(transaction); + ActivityCalendarDAO dao = WaoModelDAOHelper.getActivityCalendarDAO(transaction); TopiaQuery query = dao.createQuery("A"). add("A." + ActivityCalendar.BOAT, boat); @@ -620,7 +620,7 @@ // Log ActivityCalendar access only for non admin user if (!user.getAdmin()) { Company company = user.getCompany(); - SuiviObsmerContext.addActivityCalendarAccessLog( + WaoContext.addActivityCalendarAccessLog( "Calendrier " + result.getYear() + " du navire " + boat.getName() + " (" + boat.getImmatriculation() + ") vu " + "par " + user.getFullName() + " de la société " + @@ -629,27 +629,27 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de charger le dernier calendrier d'activité du navire " + boat.getName() + " (" + boat.getImmatriculation() + ")", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override public InputStream getActivityCalendarLogFile() throws FileNotFoundException { - String filename = SuiviObsmerContext.getProperty( - SuiviObsmerContext.PROP_FILENAME_LOG_ACTIVITY_IMPORT); + String filename = WaoContext.getProperty( + WaoContext.PROP_FILENAME_LOG_ACTIVITY_IMPORT); File file = new File(filename); return new FileInputStream(file); } @Override public InputStream getActivityCalendarLogAccessFile() throws FileNotFoundException { - String filename = SuiviObsmerContext.getProperty( - SuiviObsmerContext.PROP_FILENAME_LOG_ACTIVITY_ACCESS); + String filename = WaoContext.getProperty( + WaoContext.PROP_FILENAME_LOG_ACTIVITY_ACCESS); File file = new File(filename); return new FileInputStream(file); } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceContactImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceContactImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceContactImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -25,11 +25,11 @@ import com.csvreader.CsvWriter; import fr.ifremer.suiviobsmer.io.ImportHelper; import fr.ifremer.suiviobsmer.io.ImportHelper.*; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException.Type; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoBusinessException.Type; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoContext; import fr.ifremer.suiviobsmer.bean.ContactState; import java.io.IOException; import java.io.InputStream; @@ -95,18 +95,18 @@ protected TopiaContext rootContext; - public ServiceContactImpl() throws SuiviObsmerException { - rootContext = SuiviObsmerContext.getTopiaRootContext(); + public ServiceContactImpl() throws WaoException { + rootContext = WaoContext.getTopiaRootContext(); } @Override - public Map<String, Contact> getContacts(ContactFilter filter) throws SuiviObsmerException { + public Map<String, Contact> getContacts(ContactFilter filter) throws WaoException { Map<String, Contact> results = new HashMap<String, Contact>(); TopiaContext transaction = null; try { transaction = rootContext.beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); TopiaQuery query = dao.createQuery("C").addDistinct(); @@ -122,22 +122,22 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de filtrer la liste des contacts", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public int getNbContacts(ContactFilter filter) throws SuiviObsmerException { + public int getNbContacts(ContactFilter filter) throws WaoException { TopiaContext transaction = null; int result = 0; try { transaction = rootContext.beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); TopiaQuery query = dao.createQuery("C"); query = filter.prepareQueryForContact(query); @@ -145,10 +145,10 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de compter le nombre de contacts filtrés", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @@ -164,18 +164,18 @@ } @Override - public void saveContact(Contact contact, boolean delete) throws SuiviObsmerException { + public void saveContact(Contact contact, boolean delete) throws WaoException { TopiaContext transaction = null; try { transaction = rootContext.beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); if (log.isDebugEnabled()) { log.debug("Create date : " + contact.getTopiaCreateDate()); } - SuiviObsmerContext.prepareTopiaId(Contact.class, contact); + WaoContext.prepareTopiaId(Contact.class, contact); if (delete) { dao.delete(contact); } else { @@ -185,16 +185,16 @@ transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de sauvegarder le contact", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } @Override public InputStream exportContactCsv(ContactFilter filter) - throws SuiviObsmerException { + throws WaoException { TopiaContext transaction = null; InputStream result = null; CsvWriter writer = null; @@ -232,7 +232,7 @@ DateFormat dateFormat = CONTACT.getDateFormat(); // Get contacts from database - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); TopiaQuery query = dao.createQuery("C"); query.addOrderDesc("C." + TopiaEntity.TOPIA_CREATE_DATE); @@ -317,19 +317,19 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible d'exporter les contacts", eee); } finally { if (writer != null) { writer.close(); } - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override - public ImportResults importContactCsv(WaoUser user, InputStream input) throws SuiviObsmerException { + public ImportResults importContactCsv(WaoUser user, InputStream input) throws WaoException { TopiaContext transaction = null; ImportResults result = new ImportResultsImpl(); int currRow = 1; @@ -340,11 +340,11 @@ reader = new CsvReader(input, Charset.forName("UTF-8")); reader.readHeaders(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); - WaoUserDAO userDAO = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); - BoatDAO boatDAO = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); + WaoUserDAO userDAO = WaoModelDAOHelper.getWaoUserDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); + BoatDAO boatDAO = WaoModelDAOHelper.getBoatDAO(transaction); long tic; tic = System.currentTimeMillis(); @@ -357,7 +357,7 @@ ContactState contactState = ContactState.createContactStateEnum(state); if (contactState == null) { - throw new SuiviObsmerBusinessException(Type.IMPORT_ERROR, this.getClass(), + throw new WaoBusinessException(Type.IMPORT_ERROR, this.getClass(), "Erreur ligne " + currRow + " : " + "Etat du contact invalide '" + state + "', valeurs possibles : " + ContactState.availableStates()); @@ -372,7 +372,7 @@ company = companyDAO.findContainsWaoUser(observer); // For a user, check if the observer as the same company as the current user } else if (!observer.getCompany().equals(company)) { - throw new SuiviObsmerBusinessException(Type.IMPORT_ERROR, this.getClass(), + throw new WaoBusinessException(Type.IMPORT_ERROR, this.getClass(), "Erreur ligne " + currRow + " : " + "L'observateur avec pour login '" + observerId + "' n'appartient pas à votre société !"); } @@ -389,7 +389,7 @@ if (boat != null) { - ElligibleBoatDAO elligibleDAO = SuiviObsmerModelDAOHelper.getElligibleBoatDAO(transaction); + ElligibleBoatDAO elligibleDAO = WaoModelDAOHelper.getElligibleBoatDAO(transaction); ElligibleBoat elligible = elligibleDAO.findByProperties( ElligibleBoat.BOAT, boat, ElligibleBoat.SAMPLE_ROW, row); @@ -514,7 +514,7 @@ //transaction.closeContext(); } catch (ParseException eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Erreur ligne " + currRow + " : " + "Le format des dates est incorrect, il doit être de la forme : JJ/MM/AAAA", eee); } catch (Exception eee) { @@ -525,10 +525,10 @@ log.error("Reader error", ex); } } - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible d'importer les contacts", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceNewsImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceNewsImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceNewsImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,9 +21,9 @@ package fr.ifremer.suiviobsmer.services; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; import fr.ifremer.suiviobsmer.entity.News; import fr.ifremer.suiviobsmer.entity.NewsDAO; import fr.ifremer.suiviobsmer.services.ServiceNews; @@ -51,53 +51,53 @@ protected TopiaContext rootContext; - public ServiceNewsImpl() throws SuiviObsmerException { - rootContext = SuiviObsmerContext.getTopiaRootContext(); + public ServiceNewsImpl() throws WaoException { + rootContext = WaoContext.getTopiaRootContext(); } @Override - public List<News> getNews() throws SuiviObsmerException { + public List<News> getNews() throws WaoException { TopiaContext transaction = null; List<News> results = new ArrayList<News>(); try { transaction = rootContext.beginTransaction(); - NewsDAO dao = SuiviObsmerModelDAOHelper.getNewsDAO(transaction); + NewsDAO dao = WaoModelDAOHelper.getNewsDAO(transaction); results = dao.findAllWithOrder(TopiaEntity.TOPIA_CREATE_DATE + " DESC"); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer l'ensemble des news", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public void saveNews(News news, boolean delete) throws SuiviObsmerException { + public void saveNews(News news, boolean delete) throws WaoException { TopiaContext transaction = null; try { transaction = rootContext.beginTransaction(); - NewsDAO dao = SuiviObsmerModelDAOHelper.getNewsDAO(transaction); + NewsDAO dao = WaoModelDAOHelper.getNewsDAO(transaction); if (delete) { dao.delete(news); } else { - SuiviObsmerContext.prepareTopiaId(News.class, news); + WaoContext.prepareTopiaId(News.class, news); dao.update(news); } transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer l'ensemble des news", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceReferentialImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceReferentialImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceReferentialImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -22,9 +22,9 @@ package fr.ifremer.suiviobsmer.services; import com.csvreader.CsvReader; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoContext; import fr.ifremer.suiviobsmer.bean.SamplingFilter; import fr.ifremer.suiviobsmer.entity.FishingZone; import fr.ifremer.suiviobsmer.entity.FishingZoneDAO; @@ -62,18 +62,18 @@ protected TopiaContext rootContext; - public ServiceReferentialImpl() throws SuiviObsmerException { - rootContext = SuiviObsmerContext.getTopiaRootContext(); + public ServiceReferentialImpl() throws WaoException { + rootContext = WaoContext.getTopiaRootContext(); } @Override - public List<String> getFacades(SamplingFilter filter) throws SuiviObsmerException { + public List<String> getFacades(SamplingFilter filter) throws WaoException { TopiaContext transaction = null; List<String> results = new ArrayList<String>(); try { transaction = rootContext.beginTransaction(); - FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO dao = WaoModelDAOHelper.getFishingZoneDAO(transaction); TopiaQuery query = dao.createQuery("F"); query = prepareQueryForFishingZoneFilter(query, filter); @@ -82,21 +82,21 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de charger la liste des facades", eee); + WaoContext.serviceException(transaction, "Impossible de charger la liste des facades", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public List<String> getSectors(SamplingFilter filter) throws SuiviObsmerException { + public List<String> getSectors(SamplingFilter filter) throws WaoException { TopiaContext transaction = null; List<String> results = new ArrayList<String>(); try { transaction = rootContext.beginTransaction(); - FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO dao = WaoModelDAOHelper.getFishingZoneDAO(transaction); TopiaQuery query = dao.createQuery("F"); query = prepareQueryForFishingZoneFilter(query, filter); @@ -109,9 +109,9 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de charger la liste des secteurs de pêche", eee); + WaoContext.serviceException(transaction, "Impossible de charger la liste des secteurs de pêche", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @@ -134,49 +134,49 @@ } @Override - public List<Profession> getProfessions() throws SuiviObsmerException { + public List<Profession> getProfessions() throws WaoException { TopiaContext transaction = null; List<Profession> results = new ArrayList<Profession>(); try { transaction = rootContext.beginTransaction(); - ProfessionDAO dao = SuiviObsmerModelDAOHelper.getProfessionDAO(transaction); + ProfessionDAO dao = WaoModelDAOHelper.getProfessionDAO(transaction); results = dao.findAll(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de charger la liste des métiers", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public List<FishingZone> getFishingZones() throws SuiviObsmerException { + public List<FishingZone> getFishingZones() throws WaoException { TopiaContext transaction = null; List<FishingZone> results = new ArrayList<FishingZone>(); try { transaction = rootContext.beginTransaction(); - FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO dao = WaoModelDAOHelper.getFishingZoneDAO(transaction); results = dao.findAll(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de charger la liste des zones de pêche", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public int importFishingZoneCsv(InputStream input) throws SuiviObsmerException { + public int importFishingZoneCsv(InputStream input) throws WaoException { TopiaContext transaction = null; int result = 0; try { @@ -185,7 +185,7 @@ CsvReader reader = new CsvReader(input, Charset.forName("UTF-8")); reader.readHeaders(); - FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO dao = WaoModelDAOHelper.getFishingZoneDAO(transaction); while(reader.readRecord()) { if (log.isTraceEnabled()) { @@ -209,12 +209,12 @@ transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Problème d'import du fichier CSV. Vérifiez l'en-tête du fichier : [ PECHE_DIVISION," + "PECHE_ZONE,PECHE_FACADE ]. Voir documentation pour plus de détails.", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceSamplingImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceSamplingImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceSamplingImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -24,11 +24,11 @@ import com.csvreader.CsvReader; import com.csvreader.CsvWriter; import fr.ifremer.suiviobsmer.io.ImportHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException.Type; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoBusinessException.Type; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoContext; import fr.ifremer.suiviobsmer.bean.FacadeRow; import fr.ifremer.suiviobsmer.bean.FacadeRowImpl; import fr.ifremer.suiviobsmer.bean.ImportResults; @@ -87,21 +87,21 @@ protected TopiaContext rootContext; - public ServiceSamplingImpl() throws SuiviObsmerException { - rootContext = SuiviObsmerContext.getTopiaRootContext(); + public ServiceSamplingImpl() throws WaoException { + rootContext = WaoContext.getTopiaRootContext(); } @Override - public void createUpdateSampleRow(SampleRow row, List<Boat> boats, SampleRowLog rowLog) throws SuiviObsmerException { + public void createUpdateSampleRow(SampleRow row, List<Boat> boats, SampleRowLog rowLog) throws WaoException { TopiaContext transaction = null; try { transaction = rootContext.beginTransaction(); - SampleRowLogDAO logDAO = SuiviObsmerModelDAOHelper.getSampleRowLogDAO(transaction); - SuiviObsmerContext.prepareTopiaId(SampleRowLog.class, rowLog); + SampleRowLogDAO logDAO = WaoModelDAOHelper.getSampleRowLogDAO(transaction); + WaoContext.prepareTopiaId(SampleRowLog.class, rowLog); logDAO.update(rowLog); - boolean newRow = SuiviObsmerContext.prepareTopiaId(SampleRow.class, row); + boolean newRow = WaoContext.prepareTopiaId(SampleRow.class, row); if (log.isDebugEnabled()) { log.debug("new sampleRow : " + newRow); @@ -120,7 +120,7 @@ if (!newRow) { // Prepare data for logging or deleting oldMonths TopiaContext transaction2 = rootContext.beginTransaction(); - SampleRowDAO oldDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction2); + SampleRowDAO oldDAO = WaoModelDAOHelper.getSampleRowDAO(transaction2); oldRow = oldDAO.findByTopiaId(row.getTopiaId()); oldCompany = oldRow.getCompany(); oldProfession = oldRow.getProfession(); @@ -156,13 +156,13 @@ rowLog.addChangePeriod(oldPeriod, newPeriod, pattern); // Save Profession - ProfessionDAO professionDAO = SuiviObsmerModelDAOHelper.getProfessionDAO(transaction); - SuiviObsmerContext.prepareTopiaId(Profession.class, row.getProfession()); + ProfessionDAO professionDAO = WaoModelDAOHelper.getProfessionDAO(transaction); + WaoContext.prepareTopiaId(Profession.class, row.getProfession()); rowLog.addChangeProfession(oldProfession, row.getProfession()); professionDAO.update(row.getProfession()); // Save sampleMonth - SampleMonthDAO monthDAO = SuiviObsmerModelDAOHelper.getSampleMonthDAO(transaction); + SampleMonthDAO monthDAO = WaoModelDAOHelper.getSampleMonthDAO(transaction); // Delete oldMonths List<SampleMonth> newMonths = row.getSampleMonth(); @@ -177,7 +177,7 @@ } // Create or update months for (SampleMonth month : newMonths) { - boolean monthCreated = SuiviObsmerContext.prepareTopiaId(SampleMonth.class, month); + boolean monthCreated = WaoContext.prepareTopiaId(SampleMonth.class, month); String date = dateFormat.format(month.getPeriodDate()); if (monthCreated) { // log create month @@ -196,7 +196,7 @@ // Remove no longer elligibleBoats row.removeNoLongerElligibleBoats(boats); // Save new elligibleBoats - ElligibleBoatDAO dao = SuiviObsmerModelDAOHelper.getElligibleBoatDAO(transaction); + ElligibleBoatDAO dao = WaoModelDAOHelper.getElligibleBoatDAO(transaction); for (Boat boat : boats) { if (!row.hasElligibleBoat(boat)) { ElligibleBoat elligibleBoat = dao.create(); @@ -230,7 +230,7 @@ } // Save sampleRow : create or update - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); if (log.isDebugEnabled()) { log.debug("update row : " + row); } @@ -244,17 +244,17 @@ transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de sauvegarder la ligne d'échantillon", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } protected void updateFishingZones(TopiaContext transaction, String zoneId, SampleRow row, boolean delete) throws TopiaException { // FIXME find a way to avoid saving links from FishingZone instead of SampleRow : // variable inverse="true" in hibernate mapping of FishingZone, how to set this variable to SampleRow instead - FishingZoneDAO fishingZoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO fishingZoneDAO = WaoModelDAOHelper.getFishingZoneDAO(transaction); FishingZone zoneFromDB = fishingZoneDAO.findByTopiaId(zoneId); if (delete) { zoneFromDB.removeSampleRow(row); @@ -265,25 +265,25 @@ } // @Override -// public List<SampleRowLog> getSampleRowLogs(SampleRow sampleRow) throws SuiviObsmerException { +// public List<SampleRowLog> getSampleRowLogs(SampleRow sampleRow) throws WaoException { // TopiaContext transaction = null; // List<SampleRowLog> results = new ArrayList<SampleRowLog>(); // try { // transaction = rootContext.beginTransaction(); // -// SampleRowLogDAO dao = SuiviObsmerModelDAOHelper.getSampleRowLogDAO(transaction); +// SampleRowLogDAO dao = WaoModelDAOHelper.getSampleRowLogDAO(transaction); // results = dao.createQuery().add(SampleRowLog.SAMPLE_ROW, sampleRow).addOrderDesc(TopiaEntity.TOPIA_CREATE_DATE).executeToEntityList(); // // transaction.closeContext(); // } catch (Exception eee) { -// SuiviObsmerContext.serviceException(transaction, +// WaoContext.serviceException(transaction, // "Impossible de récupérer l'historique de la ligne d'échantillonnage", eee); // } // return results; // } @Override - public FacadeRow getSampleRowsOrderedByFishingZone(PeriodDates period, Company company) throws SuiviObsmerException { + public FacadeRow getSampleRowsOrderedByFishingZone(PeriodDates period, Company company) throws WaoException { TopiaContext transaction = null; FacadeRow result = new FacadeRowImpl(); try { @@ -292,7 +292,7 @@ } transaction = rootContext.beginTransaction(); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); TopiaQuery query = dao.createQuery("S").addDistinct(). addFrom(FishingZone.class.getName() + " F"). @@ -326,22 +326,22 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer la liste des lignes du plan d'échantillonnage", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override - public List<String> getPrograms(Company company) throws SuiviObsmerException { + public List<String> getPrograms(Company company) throws WaoException { TopiaContext transaction = null; List<String> results = new ArrayList<String>(); try { transaction = rootContext.beginTransaction(); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); TopiaQuery query = dao.createQuery(); if (company != null) { @@ -352,22 +352,22 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de charger la liste des programmes", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public List<SampleRow> getSampleRowsByFilter(SamplingFilter filter) throws SuiviObsmerException { + public List<SampleRow> getSampleRowsByFilter(SamplingFilter filter) throws WaoException { TopiaContext transaction = null; List<SampleRow> results = new ArrayList<SampleRow>(); try { transaction = rootContext.beginTransaction(); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); TopiaQuery query = dao.createQuery("S").addDistinct().addOrder("S." + SampleRow.CODE); @@ -379,7 +379,7 @@ // if (finished) { // // Only rows which are not finished will be kept -// Date current = SuiviObsmerContext.getCurrentDate(); +// Date current = WaoContext.getCurrentDate(); // query.add(SampleRow.PERIOD_END, Op.GE, current); // } @@ -391,43 +391,43 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer la liste des lignes du plan d'échantillonnage", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public SampleRow getSampleRow(String sampleRowId) throws SuiviObsmerException { + public SampleRow getSampleRow(String sampleRowId) throws WaoException { TopiaContext transaction = null; SampleRow result = null; try { transaction = rootContext.beginTransaction(); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); result = dao.findByTopiaId(sampleRowId); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de charger la ligne d'échantillon ayant pour identifiant : " + sampleRowId, eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override - public void deleteSampleRow(SampleRow sampleRow) throws SuiviObsmerException { + public void deleteSampleRow(SampleRow sampleRow) throws WaoException { TopiaContext transaction = null; try { transaction = rootContext.beginTransaction(); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = dao.findByTopiaId(sampleRow.getTopiaId()); @@ -436,16 +436,16 @@ transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de supprimer la ligne d'échantillon : " + sampleRow.getCode(), eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } @Override - public String getNewSampleRowCode(Date beginDate) throws SuiviObsmerException { + public String getNewSampleRowCode(Date beginDate) throws WaoException { TopiaContext transaction = null; String result = null; if (beginDate == null) { @@ -458,7 +458,7 @@ begin.setTime(beginDate); int year = begin.get(Calendar.YEAR); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); TopiaQuery query = dao.createQuery().add(SampleRow.CODE, Op.LIKE, year + "_%"); String maxCode = query.executeToString("MAX(" + SampleRow.CODE + ")"); @@ -477,11 +477,11 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer un nouveau code pour une ligne d'échantillonnage", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @@ -522,7 +522,7 @@ } @Override - public InputStream exportSamplingPlanCsv(WaoUser user, PeriodDates period) throws SuiviObsmerException { + public InputStream exportSamplingPlanCsv(WaoUser user, PeriodDates period) throws WaoException { TopiaContext transaction = null; InputStream result = null; CsvWriter writer = null; @@ -549,7 +549,7 @@ // Get sampleRows from database filtered by company if needed // (only for user) and period - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); TopiaQuery query = dao.createQuery("S"); if (!user.getAdmin()) { @@ -642,7 +642,7 @@ } catch (Exception eee) { DateFormat dateFormat = SAMPLING.getDateFormat(); - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible d'exporter le plan d'échantillonnage sur la période du " + dateFormat.format(period.getFromDate()) + " au " + dateFormat.format(period.getThruDate()), eee); @@ -650,13 +650,13 @@ if (writer != null) { writer.close(); } - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override - public ImportResults importSamplingPlanCsv(InputStream input) throws SuiviObsmerException { + public ImportResults importSamplingPlanCsv(InputStream input) throws WaoException { TopiaContext transaction = null; ImportResults result = new ImportResultsImpl(); //int[] result = new int[3]; @@ -668,7 +668,7 @@ CsvReader reader = new CsvReader(input, Charset.forName("UTF-8")); reader.readHeaders(); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); //int nbImported = 0; //int nbRefused = 0; @@ -705,10 +705,10 @@ // Create link with company if set in file if (!StringUtils.isEmpty(companyName)) { - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); Company company = companyDAO.findByName(companyName); if (company == null) { - throw new SuiviObsmerBusinessException(Type.IMPORT_ERROR, this.getClass(), + throw new WaoBusinessException(Type.IMPORT_ERROR, this.getClass(), "Erreur à la ligne " + currRow + " [CODE = " + code + "] : " + "La société portant le nom '" + companyName + "' n'existe pas dans l'application"); } @@ -720,7 +720,7 @@ row.setProfession(profession); // Import zones and set them to the row - // throw SuiviObsmerException if FishingZone doesn't exist + // throw WaoException if FishingZone doesn't exist importFishingZones(transaction, districts, currRow, row); updateRow(transaction, row, reader); @@ -733,19 +733,19 @@ //transaction.closeContext(); } catch (NumberFormatException eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Erreur à la ligne " + currRow + " [CODE = " + row.getCode() + "] : " + "Le format de la durée moyenne des marées est incorrect, il doit être de la forme : 1.9 ", eee); } catch (ParseException eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Erreur à la ligne " + currRow + " [CODE = " + row.getCode() + "] : " + "Le format des dates est incorrect, il doit être de la forme : MM/AAAA", eee); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Erreur à la ligne " + currRow + " [CODE = " + row.getCode() + "]", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @@ -771,7 +771,7 @@ String libelle = reader.get(SAMPLING.METIER_LIBELLE.name()).trim(); String especes = reader.get(SAMPLING.METIER_ESPECES.name()).trim(); - ProfessionDAO dao = SuiviObsmerModelDAOHelper.getProfessionDAO(transaction); + ProfessionDAO dao = WaoModelDAOHelper.getProfessionDAO(transaction); Map<String, Object> existParams = new HashMap<String, Object>(); existParams.put(Profession.CODE_DCF5, codeDCF5); existParams.put(Profession.MESH_SIZE, maillage); @@ -801,12 +801,12 @@ * @param currRow Row number in the line for the SampleRow * @param row SampleRow linked with districts (from Csv file) * @throws TopiaException for dao errors - * @throws SuiviObsmerException if a FishingZone doesn't exist. + * @throws WaoException if a FishingZone doesn't exist. */ protected void importFishingZones(TopiaContext transaction, String districts, int currRow, SampleRow row) - throws TopiaException, SuiviObsmerException { + throws TopiaException, WaoException { - FishingZoneDAO dao = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO dao = WaoModelDAOHelper.getFishingZoneDAO(transaction); List<String> districtList = new ArrayList<String>(Arrays.asList(districts.split(FISHING_ZONE.getDistrictCodeSeparator()))); @@ -817,7 +817,7 @@ for (String districtCode : districtList) { FishingZone zone = dao.findByDistrictCode(districtCode.trim()); if (zone == null) { - throw new SuiviObsmerBusinessException(Type.IMPORT_ERROR, this.getClass(), + throw new WaoBusinessException(Type.IMPORT_ERROR, this.getClass(), "Erreur à la ligne " + currRow + " [CODE = " + row.getCode() + "] : " + "Cette ligne est lié à une zone inexistante : " + districtCode); } @@ -875,7 +875,7 @@ Integer monthValue = StringUtils.isEmpty(reader.get(i)) ? null : Integer.parseInt(reader.get(i)); if (monthValue != null && DateUtils.between(monthDate, sampleRow.getPeriodBegin(), sampleRow.getPeriodEnd())) { - SampleMonthDAO dao = SuiviObsmerModelDAOHelper.getSampleMonthDAO(transaction); + SampleMonthDAO dao = WaoModelDAOHelper.getSampleMonthDAO(transaction); SampleMonth month = sampleRow.getSampleMonth(monthDate); Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceSynthesisImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceSynthesisImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceSynthesisImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,9 +21,9 @@ package fr.ifremer.suiviobsmer.services; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; import fr.ifremer.suiviobsmer.bean.ContactAverageReactivityImpl; import fr.ifremer.suiviobsmer.bean.ContactAverageReactivity; import fr.ifremer.suiviobsmer.bean.BoardingResult; @@ -76,12 +76,12 @@ protected TopiaContext rootContext; - public ServiceSynthesisImpl() throws SuiviObsmerException { - rootContext = SuiviObsmerContext.getTopiaRootContext(); + public ServiceSynthesisImpl() throws WaoException { + rootContext = WaoContext.getTopiaRootContext(); } @Override - public List<SortedMap<Date, Integer>> getDataSampling(SamplingFilter filter) throws SuiviObsmerException { + public List<SortedMap<Date, Integer>> getDataSampling(SamplingFilter filter) throws WaoException { TopiaContext transaction = null; List<SortedMap<Date, Integer>> results = new ArrayList<SortedMap<Date, Integer>>(); try { @@ -106,7 +106,7 @@ serie2.put(month, 0); } - SampleMonthDAO dao = SuiviObsmerModelDAOHelper.getSampleMonthDAO(transaction); + SampleMonthDAO dao = WaoModelDAOHelper.getSampleMonthDAO(transaction); String periodDate = "M." + SampleMonth.PERIOD_DATE; TopiaQuery query = dao.createQuery("M"). setSelect(periodDate). @@ -138,10 +138,10 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer les données pour le graphique dynamique des efforts de marées", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @@ -158,11 +158,11 @@ * @return a BoardingResult which contains the number of boats for boardings * from 1 to {@link MAX_BOARDINGS}, the boat with the max boarding and its * value. - * @throws SuiviObsmerException + * @throws WaoException */ @Override public BoardingResult getBoardingBoats(Company company, Date fromDate) - throws SuiviObsmerException { + throws WaoException { TopiaContext transaction = null; Map<String, Integer> map = new LinkedHashMap<String, Integer>(); BoardingResult result = new BoardingResultImpl(); @@ -182,7 +182,7 @@ map.put(maxBoardingsKey, 0); ContactDAO dao = - SuiviObsmerModelDAOHelper.getContactDAO(transaction); + WaoModelDAOHelper.getContactDAO(transaction); // The number of boardings is the number of finished contacts // Use fromDate to filter contacts finished from this date // No need to use boat filter for this method @@ -240,17 +240,17 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer les données pour le graphique " + "dynamique des efforts de marées", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return result; } @Override - public Map<String, Double> getNonComplianceBoardingIndicator(Company company) throws SuiviObsmerException { + public Map<String, Double> getNonComplianceBoardingIndicator(Company company) throws WaoException { TopiaContext transaction = null; // Carefull with results, the company may not be present in the map : // only if there is no unfinished sampleRow or no contact done @@ -258,7 +258,7 @@ try { transaction = rootContext.beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); // Only for done contacts with no constraint TopiaQuery query = @@ -270,7 +270,7 @@ String companyName = companyProp + "." + Company.NAME; // Only for unfinished sampleRows - Date current = SuiviObsmerContext.getCurrentDate(); + Date current = WaoContext.getCurrentDate(); query.add(sampleRow + "." + SampleRow.PERIOD_END, Op.GE, current); if (company != null) { @@ -330,23 +330,23 @@ if (company != null) { msgEnd = " pour la société " + company.getName(); } - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer l'indicateur de non respect du " + "nombre d'observateurs embarqués" + msgEnd, eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public Collection<ContactStateStatistics> getContactStateStatistics(Company company, PeriodDates period) throws SuiviObsmerException { + public Collection<ContactStateStatistics> getContactStateStatistics(Company company, PeriodDates period) throws WaoException { TopiaContext transaction = null; Map<String, ContactStateStatistics> results = new HashMap<String, ContactStateStatistics>(); try { transaction = rootContext.beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); // Only for contacts not refused by the program String contact = "C"; @@ -410,17 +410,17 @@ if (company != null) { msgEnd = " pour la société " + company.getName(); } - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer les statistiques sur les états des " + "contacts " + msgEnd, eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results.values(); } @Override - public Collection<ContactAverageReactivity> getContactDataInputDateReactivity(Company company, PeriodDates period) throws SuiviObsmerException { + public Collection<ContactAverageReactivity> getContactDataInputDateReactivity(Company company, PeriodDates period) throws WaoException { TopiaContext transaction = null; // Carefull with results, the company may not be present in the map : // only if there is no unfinished sampleRow or no contact done @@ -429,7 +429,7 @@ try { transaction = rootContext.beginTransaction(); - ContactDAO dao = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO dao = WaoModelDAOHelper.getContactDAO(transaction); // String contact = "C"; // TopiaQuery query = dao.createQuery(contact); @@ -521,11 +521,11 @@ if (company != null) { msgEnd = " pour la société " + company.getName(); } - SuiviObsmerContext.serviceException(transaction, + WaoContext.serviceException(transaction, "Impossible de récupérer l'indicateur de réactivité sur " + "les dates de saisies dans Allegro" + msgEnd, eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results.values(); } Modified: trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceUserImpl.java =================================================================== --- trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceUserImpl.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/java/fr/ifremer/suiviobsmer/services/ServiceUserImpl.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,11 +21,11 @@ package fr.ifremer.suiviobsmer.services; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException.Type; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoBusinessException.Type; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoContext; import fr.ifremer.suiviobsmer.entity.Company; import fr.ifremer.suiviobsmer.entity.CompanyDAO; import fr.ifremer.suiviobsmer.entity.Contact; @@ -58,63 +58,63 @@ protected TopiaContext rootContext; - public ServiceUserImpl() throws SuiviObsmerException { - rootContext = SuiviObsmerContext.getTopiaRootContext(); + public ServiceUserImpl() throws WaoException { + rootContext = WaoContext.getTopiaRootContext(); } @Override - public WaoUser connect(String login, String password) throws SuiviObsmerException { + public WaoUser connect(String login, String password) throws WaoException { TopiaContext transaction = null; WaoUser user = null; try { transaction = rootContext.beginTransaction(); - WaoUserDAO dao = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); - String passwordEncoded = SuiviObsmerContext.encodeString(password); + String passwordEncoded = WaoContext.encodeString(password); user = dao.findByProperties(WaoUser.LOGIN, login, WaoUser.PASSWORD, passwordEncoded); if (user != null && user.getActive()) { // load company entity user.getCompany(); } else if (user != null && !user.getActive()) { - throw new SuiviObsmerBusinessException(Type.ILLEGAL_CONNECTION, this.getClass(), + throw new WaoBusinessException(Type.ILLEGAL_CONNECTION, this.getClass(), "Vous n'avez plus les droits nécessaires pour vous connecter. Veuillez contacter un administrateur."); } else { - throw new SuiviObsmerBusinessException(Type.BAD_CONNECTION, this.getClass(), + throw new WaoBusinessException(Type.BAD_CONNECTION, this.getClass(), "Identifiant ou mot de passe incorrects, veuillez réessayer."); } //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Une erreur est survenue lors de la demande de connexion", eee); + WaoContext.serviceException(transaction, "Une erreur est survenue lors de la demande de connexion", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return user; } @Override - public void forgetPassword(String login) throws SuiviObsmerException { + public void forgetPassword(String login) throws WaoException { TopiaContext transaction = null; try { if (!login.contains("@")) { - throw new SuiviObsmerBusinessException(Type.SYNTAX, this.getClass(), "Votre identifiant n'est pas un email valide, " + + throw new WaoBusinessException(Type.SYNTAX, this.getClass(), "Votre identifiant n'est pas un email valide, " + "veuillez contacter un administrateur pour qu'il puisse changer votre mot de passe."); } transaction = rootContext.beginTransaction(); - WaoUserDAO dao = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); WaoUser user = dao.findByLogin(login); if (user == null) { - throw new SuiviObsmerBusinessException(Type.NOT_EXISTS, this.getClass(), + throw new WaoBusinessException(Type.NOT_EXISTS, this.getClass(), "L'email '" + login + "' n'est pas référencé dans l'application."); } - String password = SuiviObsmerContext.createRandomString(8); - String passwordEncoded = SuiviObsmerContext.encodeString(password); + String password = WaoContext.createRandomString(8); + String passwordEncoded = WaoContext.encodeString(password); user.setPassword(passwordEncoded); String subject = "[WAO] Mot de passe oublié"; @@ -122,11 +122,11 @@ "\tUn nouveau mot de passe a été généré pour votre identifiant " + login + " :\n" + "\t\t * mot de passe = " + password + "\n\n" + "Vous pouvez modifier votre password en accédant à la page de gestion de votre profile utilisateur :\n\n" + - "\t\thttp://" + SuiviObsmerContext.getProperty(SuiviObsmerContext.PROP_SERVER) + "\n\n" + + "\t\thttp://" + WaoContext.getProperty(WaoContext.PROP_SERVER) + "\n\n" + "Cordialement,\n\n" + "L'Equipe WAO"; - SuiviObsmerContext.sendEmail(user.getLogin(), subject, msg); + WaoContext.sendEmail(user.getLogin(), subject, msg); if (log.isDebugEnabled()) { log.debug("send email to : " + user.getLogin()); } @@ -134,14 +134,14 @@ transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de créer ou de mettre à jour l'utilisateur", eee); + WaoContext.serviceException(transaction, "Impossible de créer ou de mettre à jour l'utilisateur", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } @Override - public void createUpdateUser(WaoUser user, boolean generatePassword) throws SuiviObsmerException { + public void createUpdateUser(WaoUser user, boolean generatePassword) throws WaoException { TopiaContext transaction = null; try { if (user == null) { @@ -150,15 +150,15 @@ transaction = rootContext.beginTransaction(); - WaoUserDAO dao = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); - boolean newUser = SuiviObsmerContext.prepareTopiaId(WaoUser.class, user); + boolean newUser = WaoContext.prepareTopiaId(WaoUser.class, user); // Check for a new user if login already exists if (newUser) { WaoUser existUser = dao.findByLogin(user.getLogin()); if (existUser != null) { - throw new SuiviObsmerBusinessException(Type.ALREADY_EXISTS, this.getClass(), + throw new WaoBusinessException(Type.ALREADY_EXISTS, this.getClass(), "Un utilisateur existe déjà avec ce login " + user.getLogin()); } } @@ -166,7 +166,7 @@ String password = user.getPassword(); if (generatePassword) { - password = SuiviObsmerContext.createRandomString(8); + password = WaoContext.createRandomString(8); user.setPasswordChanged(true); // if (log.isDebugEnabled()) { // log.debug("show generated password : " + password); @@ -174,7 +174,7 @@ } // For a password set manually by user or generated if (user.isPasswordChanged()) { - String passwordEncoded = SuiviObsmerContext.encodeString(password); + String passwordEncoded = WaoContext.encodeString(password); user.setPassword(passwordEncoded); } @@ -191,7 +191,7 @@ "\t\t * identifiant = " + user.getLogin() + "\n" + "\t\t * mot de passe = " + password + "\n\n" + "Vous pouvez modifier votre mot de passe en accédant à la page de gestion de votre profil utilisateur:\n\n" + - "\t\thttp://" + SuiviObsmerContext.getProperty(SuiviObsmerContext.PROP_SERVER) + "\n\n"; + "\t\thttp://" + WaoContext.getProperty(WaoContext.PROP_SERVER) + "\n\n"; } else { subject += "Modification de votre compte"; if (generatePassword) { @@ -206,7 +206,7 @@ msg += "Cordialement,\n\n" + "L'Equipe WAO"; - SuiviObsmerContext.sendEmail(user.getLogin(), subject, msg); + WaoContext.sendEmail(user.getLogin(), subject, msg); // if (log.isDebugEnabled()) { // log.debug("send email to : " + user.getLogin()); // } @@ -215,14 +215,14 @@ transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de créer ou de mettre à jour l'utilisateur", eee); + WaoContext.serviceException(transaction, "Impossible de créer ou de mettre à jour l'utilisateur", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } @Override - public void deleteUser(WaoUser user) throws SuiviObsmerException { + public void deleteUser(WaoUser user) throws WaoException { TopiaContext transaction = null; try { transaction = rootContext.beginTransaction(); @@ -232,40 +232,40 @@ String msgEnd = "Vous pouvez cependant le désactiver pour qu'il ne puisse plus se connecter."; if (user.getAdmin()) { - SampleRowLogDAO logDAO = SuiviObsmerModelDAOHelper.getSampleRowLogDAO(transaction); + SampleRowLogDAO logDAO = WaoModelDAOHelper.getSampleRowLogDAO(transaction); List<SampleRowLog> results = logDAO.findAllByAdmin(user); if (!results.isEmpty()) { - throw new SuiviObsmerBusinessException(Type.ALREADY_EXISTS, this.getClass(), + throw new WaoBusinessException(Type.ALREADY_EXISTS, this.getClass(), msgBegin + " car il a participé à la modification du plan d'échantillonnage. " + msgEnd); } } else { - ContactDAO contactDAO = SuiviObsmerModelDAOHelper.getContactDAO(transaction); + ContactDAO contactDAO = WaoModelDAOHelper.getContactDAO(transaction); List<Contact> results = contactDAO.findAllByObserver(user); if (!results.isEmpty()) { - throw new SuiviObsmerBusinessException(Type.ALREADY_EXISTS, this.getClass(), + throw new WaoBusinessException(Type.ALREADY_EXISTS, this.getClass(), msgBegin + " car il est lié à plusieurs contacts existants. " + msgEnd); } } - WaoUserDAO dao = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); dao.delete(user); transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de créer ou de mettre à jour l'utilisateur", eee); + WaoContext.serviceException(transaction, "Impossible de créer ou de mettre à jour l'utilisateur", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } @Override - public void createUpdateCompany(Company company) throws SuiviObsmerException { + public void createUpdateCompany(Company company) throws WaoException { TopiaContext transaction = null; try { if (company == null) { @@ -274,28 +274,28 @@ transaction = rootContext.beginTransaction(); - CompanyDAO dao = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO dao = WaoModelDAOHelper.getCompanyDAO(transaction); - SuiviObsmerContext.prepareTopiaId(Company.class, company); + WaoContext.prepareTopiaId(Company.class, company); dao.update(company); transaction.commitTransaction(); //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de créer ou de mettre à jour la société", eee); + WaoContext.serviceException(transaction, "Impossible de créer ou de mettre à jour la société", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } } @Override - public List<Company> getCompanies(boolean activeOnly) throws SuiviObsmerException { + public List<Company> getCompanies(boolean activeOnly) throws WaoException { TopiaContext transaction = null; List<Company> results = new ArrayList<Company>(); try { transaction = rootContext.beginTransaction(); - CompanyDAO dao = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO dao = WaoModelDAOHelper.getCompanyDAO(transaction); if (activeOnly) { results = dao.findAllByActive(activeOnly); @@ -305,21 +305,21 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de récupérer la liste des sociétés", eee); + WaoContext.serviceException(transaction, "Impossible de récupérer la liste des sociétés", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } @Override - public List<WaoUser> getObservers(boolean activeOnly) throws SuiviObsmerException { + public List<WaoUser> getObservers(boolean activeOnly) throws WaoException { TopiaContext transaction = null; List<WaoUser> results = new ArrayList<WaoUser>(); try { transaction = rootContext.beginTransaction(); - WaoUserDAO dao = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO dao = WaoModelDAOHelper.getWaoUserDAO(transaction); TopiaQuery query = dao.createQuery().add(WaoUser.ADMIN, Boolean.FALSE); if (activeOnly) { @@ -330,9 +330,9 @@ //transaction.closeContext(); } catch (Exception eee) { - SuiviObsmerContext.serviceException(transaction, "Impossible de récupérer la liste des observateurs", eee); + WaoContext.serviceException(transaction, "Impossible de récupérer la liste des observateurs", eee); } finally { - SuiviObsmerContext.closeTransaction(transaction); + WaoContext.closeTransaction(transaction); } return results; } Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityCalendarImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityCalendarImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityCalendarImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.ActivityCalendarImpl" table="activityCalendar" node="fr.ifremer.suiviobsmer.entity.ActivityCalendarImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.ActivityCalendar" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="year" type="int" access="field" column="year" node="year"/> + <property name="fiability" type="int" access="field" column="fiability" node="fiability"/> + <bag name="activityMonth" inverse="true" order-by="month" lazy="true" cascade="all,delete-orphan" node="activityMonth" embed-xml="false"> + <key column="activityCalendar"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.ActivityMonthImpl" node="topiaId" embed-xml="false"/> + </bag> + <many-to-one name="boat" class="fr.ifremer.suiviobsmer.entity.BoatImpl" column="boat" node="boat/@topiaId" embed-xml="false"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityMonthImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityMonthImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityMonthImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.ActivityMonthImpl" table="activityMonth" node="fr.ifremer.suiviobsmer.entity.ActivityMonthImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.ActivityMonth" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="harbourLibelle" type="text" access="field" column="harbourLibelle" node="harbourLibelle"/> + <property name="active" type="boolean" access="field" column="active" node="active"/> + <property name="nbBoardingPersons" type="java.lang.Integer" access="field" column="nbBoardingPersons" node="nbBoardingPersons"/> + <property name="nbSeaDays" type="java.lang.Integer" access="field" column="nbSeaDays" node="nbSeaDays"/> + <property name="nbFishingDays" type="java.lang.Integer" access="field" column="nbFishingDays" node="nbFishingDays"/> + <property name="month" type="int" access="field" column="month" node="month"/> + <property name="harbourCode" type="text" access="field" column="harbourCode" node="harbourCode"/> + <property name="harbourId" type="int" access="field" column="harbourId" node="harbourId"/> + <bag name="activityProfession" inverse="true" order-by="professionOrder" lazy="true" cascade="all,delete-orphan" node="activityProfession" embed-xml="false"> + <key column="activityMonth"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.ActivityProfessionImpl" node="topiaId" embed-xml="false"/> + </bag> + <many-to-one name="activityCalendar" class="fr.ifremer.suiviobsmer.entity.ActivityCalendarImpl" column="activityCalendar" node="activityCalendar/@topiaId" embed-xml="false"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityProfessionImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityProfessionImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityProfessionImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.ActivityProfessionImpl" table="activityProfession" node="fr.ifremer.suiviobsmer.entity.ActivityProfessionImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.ActivityProfession" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="code" type="text" access="field" column="code" node="code"/> + <property name="libelle" type="text" access="field" column="libelle" node="libelle"/> + <property name="id" type="int" access="field" column="id" node="id"/> + <property name="professionOrder" type="int" access="field" column="professionOrder" node="professionOrder"/> + <many-to-one name="activityMonth" class="fr.ifremer.suiviobsmer.entity.ActivityMonthImpl" column="activityMonth" node="activityMonth/@topiaId" embed-xml="false"/> + <bag name="activityZone" inverse="true" order-by="zoneId" lazy="true" cascade="all,delete-orphan" node="activityZone" embed-xml="false"> + <key column="activityProfession"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.ActivityZoneImpl" node="topiaId" embed-xml="false"/> + </bag> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityZoneImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityZoneImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ActivityZoneImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.ActivityZoneImpl" table="activityZone" node="fr.ifremer.suiviobsmer.entity.ActivityZoneImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.ActivityZone" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="zoneCode" type="text" access="field" column="zoneCode" node="zoneCode"/> + <property name="zoneLibelle" type="text" access="field" column="zoneLibelle" node="zoneLibelle"/> + <property name="zoneId" type="int" access="field" column="zoneId" node="zoneId"/> + <property name="gradiantCode" type="int" access="field" column="gradiantCode" node="gradiantCode"/> + <property name="gradiantLibelle" type="text" access="field" column="gradiantLibelle" node="gradiantLibelle"/> + <many-to-one name="activityProfession" class="fr.ifremer.suiviobsmer.entity.ActivityProfessionImpl" column="activityProfession" node="activityProfession/@topiaId" embed-xml="false"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/BoatImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/BoatImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/BoatImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.BoatImpl" table="boat" node="fr.ifremer.suiviobsmer.entity.BoatImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.Boat" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="immatriculation" type="int" access="field" column="immatriculation" node="immatriculation" index="boat_immatriculation_idx" unique="true"/> + <property name="name" type="text" access="field" column="name" node="name"/> + <property name="districtCode" type="text" access="field" column="districtCode" node="districtCode"/> + <property name="boatLength" type="int" access="field" column="boatLength" node="boatLength"/> + <property name="buildYear" type="int" access="field" column="buildYear" node="buildYear"/> + <property name="active" type="boolean" access="field" column="active" node="active"/> + <many-to-one name="shipOwner" class="fr.ifremer.suiviobsmer.entity.ShipOwnerImpl" column="shipOwner" lazy="false" node="shipOwner/@topiaId" embed-xml="false"/> + <bag name="companyBoatInfos" inverse="true" lazy="true" cascade="all,delete-orphan" node="companyBoatInfos" embed-xml="false"> + <key column="boat"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.BoatInfosImpl" node="topiaId" embed-xml="false"/> + </bag> + <bag name="activityCalendar" inverse="true" lazy="true" cascade="all,delete-orphan" node="activityCalendar" embed-xml="false"> + <key column="boat"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.ActivityCalendarImpl" node="topiaId" embed-xml="false"/> + </bag> + <bag name="elligibleBoat" inverse="true" order-by="companyActive" lazy="true" node="elligibleBoat" embed-xml="false"> + <key column="boat"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.ElligibleBoatImpl" node="topiaId" embed-xml="false"/> + </bag> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/BoatInfosImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.BoatInfosImpl" table="boatInfos" node="fr.ifremer.suiviobsmer.entity.BoatInfosImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.BoatInfos" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="contactFirstName" type="text" access="field" column="contactFirstName" node="contactFirstName"/> + <property name="contactLastName" type="text" access="field" column="contactLastName" node="contactLastName"/> + <property name="contactEmail" type="text" access="field" column="contactEmail" node="contactEmail"/> + <property name="contactPhoneNumber" type="text" access="field" column="contactPhoneNumber" node="contactPhoneNumber"/> + <property name="dup" type="java.lang.Integer" access="field" column="dup" node="dup"/> + <property name="comment" type="text" access="field" column="comment" node="comment"/> + <many-to-one name="company" class="fr.ifremer.suiviobsmer.entity.CompanyImpl" column="company" node="company/@topiaId" embed-xml="false" /> + <many-to-one name="boat" class="fr.ifremer.suiviobsmer.entity.BoatImpl" column="boat" node="boat/@topiaId" embed-xml="false" /> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/CompanyImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/CompanyImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/CompanyImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.CompanyImpl" table="company" node="fr.ifremer.suiviobsmer.entity.CompanyImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.Company" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="name" type="text" access="field" column="name" node="name"/> + <property name="phoneNumber" type="text" access="field" column="phoneNumber" node="phoneNumber"/> + <property name="address1" type="text" access="field" column="address1" node="address1"/> + <property name="address2" type="text" access="field" column="address2" node="address2"/> + <property name="active" type="boolean" access="field" column="active" node="active"/> + <property name="email" type="text" access="field" column="email" node="email"/> + <property name="city" type="text" access="field" column="city" node="city"/> + <property name="postalCode" type="int" access="field" column="postalCode" node="postalCode"/> + <bag name="waoUser" inverse="true" lazy="false" cascade="all,delete-orphan" node="waoUser" embed-xml="false"> + <key column="company"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.WaoUserImpl" node="topiaId" embed-xml="false"/> + </bag> + <bag name="boatBoatInfos" inverse="true" lazy="true" cascade="all,delete-orphan" node="boatBoatInfos" embed-xml="false"> + <key column="company"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.BoatInfosImpl" node="topiaId" embed-xml="false"/> + </bag> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ContactImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ContactImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ContactImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.ContactImpl" table="contact" node="fr.ifremer.suiviobsmer.entity.ContactImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.Contact" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="tideBeginDate" type="java.util.Date" access="field" column="tideBeginDate" node="tideBeginDate"/> + <property name="tideEndDate" type="java.util.Date" access="field" column="tideEndDate" node="tideEndDate"/> + <property name="nbObservants" type="int" access="field" column="nbObservants" node="nbObservants"/> + <property name="mammalsObservation" type="boolean" access="field" column="mammalsObservation" node="mammalsObservation"/> + <property name="mammalsCapture" type="boolean" access="field" column="mammalsCapture" node="mammalsCapture"/> + <property name="validationProgram" type="java.lang.Boolean" access="field" column="validationProgram" node="validationProgram"/> + <property name="validationCompany" type="java.lang.Boolean" access="field" column="validationCompany" node="validationCompany"/> + <property name="dataInputDate" type="java.util.Date" access="field" column="dataInputDate" node="dataInputDate"/> + <property name="comment" type="text" access="field" column="comment" node="comment"/> + <property name="state" type="text" access="field" column="state" node="state"/> + <property name="tideNbDays" type="int" access="field" column="tideNbDays" node="tideNbDays"/> + <many-to-one name="observer" class="fr.ifremer.suiviobsmer.entity.WaoUserImpl" column="observer" node="observer/@topiaId" embed-xml="false"/> + <many-to-one name="sampleRow" class="fr.ifremer.suiviobsmer.entity.SampleRowImpl" column="sampleRow" lazy="false" node="sampleRow/@topiaId" embed-xml="false"/> + <many-to-one name="boat" class="fr.ifremer.suiviobsmer.entity.BoatImpl" column="boat" lazy="false" node="boat/@topiaId" embed-xml="false"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ElligibleBoatImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ElligibleBoatImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ElligibleBoatImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.ElligibleBoatImpl" table="elligibleBoat" node="fr.ifremer.suiviobsmer.entity.ElligibleBoatImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.ElligibleBoat" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="globalActive" type="boolean" access="field" column="globalActive" node="globalActive"/> + <property name="companyActive" type="java.lang.Boolean" access="field" column="companyActive" node="companyActive"/> + <many-to-one name="boat" class="fr.ifremer.suiviobsmer.entity.BoatImpl" column="boat" lazy="false" node="boat/@topiaId" embed-xml="false"/> + <many-to-one name="sampleRow" class="fr.ifremer.suiviobsmer.entity.SampleRowImpl" column="sampleRow" node="sampleRow/@topiaId" embed-xml="false"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/FishingZoneImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/FishingZoneImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/FishingZoneImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.FishingZoneImpl" table="fishingZone" node="fr.ifremer.suiviobsmer.entity.FishingZoneImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.FishingZone" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="sectorName" type="text" access="field" column="sectorName" node="sectorName"/> + <property name="facadeName" type="text" access="field" column="facadeName" node="facadeName"/> + <property name="districtCode" type="text" access="field" column="districtCode" node="districtCode"/> + <bag name="sampleRow" table="fishingzone_samplerow" lazy="true" node="sampleRow" embed-xml="true"> + <key column="fishingZone"/> + <many-to-many class="fr.ifremer.suiviobsmer.entity.SampleRowImpl" column="sampleRow" order-by="code" node="topiaId"/> + </bag> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/NewsImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/NewsImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/NewsImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.NewsImpl" table="news" node="fr.ifremer.suiviobsmer.entity.NewsImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.News" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="title" type="text" access="field" column="title" node="title"/> + <property name="content" type="text" access="field" column="content" node="content"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ProfessionImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ProfessionImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ProfessionImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.ProfessionImpl" table="profession" node="fr.ifremer.suiviobsmer.entity.ProfessionImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.Profession" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="codeDCF5" type="text" access="field" column="codeDCF5" node="codeDCF5"/> + <property name="meshSize" type="text" access="field" column="meshSize" node="meshSize"/> + <property name="size" type="text" access="field" column="size" node="size"/> + <property name="other" type="text" access="field" column="other" node="other"/> + <property name="libelle" type="text" access="field" column="libelle" node="libelle"/> + <property name="species" type="text" access="field" column="species" node="species"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleMonthImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.SampleMonthImpl" table="sampleMonth" node="fr.ifremer.suiviobsmer.entity.SampleMonthImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.SampleMonth" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="realTidesValue" type="int" access="field" column="realTidesValue" node="realTidesValue"/> + <property name="expectedTidesValue" type="int" access="field" column="expectedTidesValue" node="expectedTidesValue"/> + <property name="periodDate" type="java.util.Date" access="field" column="periodDate" node="periodDate"/> + <many-to-one name="sampleRow" class="fr.ifremer.suiviobsmer.entity.SampleRowImpl" column="sampleRow" node="sampleRow/@topiaId" embed-xml="false"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleRowImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleRowImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleRowImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.SampleRowImpl" table="sampleRow" node="fr.ifremer.suiviobsmer.entity.SampleRowImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.SampleRow" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="nbObservants" type="int" access="field" column="nbObservants" node="nbObservants"/> + <property name="averageTideTime" type="double" access="field" column="averageTideTime" node="averageTideTime"/> + <property name="code" type="text" access="field" column="code" node="code" index="sampleRow_code_idx" unique="true"/> + <property name="fishingZonesInfos" type="text" access="field" column="fishingZonesInfos" node="fishingZonesInfos"/> + <property name="comment" type="text" access="field" column="comment" node="comment"/> + <property name="programName" type="text" access="field" column="programName" node="programName"/> + <property name="periodBegin" type="java.util.Date" access="field" column="periodBegin" node="periodBegin"/> + <property name="periodEnd" type="java.util.Date" access="field" column="periodEnd" node="periodEnd"/> + <many-to-one name="profession" class="fr.ifremer.suiviobsmer.entity.ProfessionImpl" column="profession" lazy="false" node="profession/@topiaId" embed-xml="false"/> + <bag name="sampleMonth" inverse="true" order-by="periodDate" lazy="false" cascade="all,delete-orphan" node="sampleMonth" embed-xml="false"> + <key column="sampleRow"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.SampleMonthImpl" node="topiaId" embed-xml="false"/> + </bag> + <many-to-one name="company" class="fr.ifremer.suiviobsmer.entity.CompanyImpl" column="company" lazy="false" node="company/@topiaId" embed-xml="false"/> + <bag name="sampleRowLog" inverse="true" order-by="topiaCreateDate desc" lazy="false" cascade="all,delete-orphan" node="sampleRowLog" embed-xml="false"> + <key column="sampleRow"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.SampleRowLogImpl" node="topiaId" embed-xml="false"/> + </bag> + <bag name="elligibleBoat" inverse="true" order-by="companyActive" lazy="false" cascade="all,delete-orphan" node="elligibleBoat" embed-xml="false"> + <key column="sampleRow"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.ElligibleBoatImpl" node="topiaId" embed-xml="false"/> + </bag> + <bag name="fishingZone" table="fishingzone_samplerow" inverse="true" lazy="false" node="fishingZone" embed-xml="true"> + <key column="sampleRow"/> + <many-to-many class="fr.ifremer.suiviobsmer.entity.FishingZoneImpl" column="fishingZone" order-by="facadeName,sectorName,districtCode" node="topiaId"/> + </bag> + <bag name="contact" inverse="true" lazy="true" node="contact" embed-xml="false"> + <key column="sampleRow"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.ContactImpl" node="topiaId" embed-xml="false"/> + </bag> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/SampleRowLogImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.SampleRowLogImpl" table="sampleRowLog" node="fr.ifremer.suiviobsmer.entity.SampleRowLogImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.SampleRowLog" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="logText" type="text" access="field" column="logText" node="logText"/> + <property name="comment" type="text" access="field" column="comment" node="comment"/> + <many-to-one name="sampleRow" class="fr.ifremer.suiviobsmer.entity.SampleRowImpl" column="sampleRow" node="sampleRow/@topiaId" embed-xml="false"/> + <many-to-one name="admin" class="fr.ifremer.suiviobsmer.entity.WaoUserImpl" column="admin" lazy="false" node="admin/@topiaId" embed-xml="false"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ShipOwnerImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ShipOwnerImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/ShipOwnerImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.ShipOwnerImpl" table="shipOwner" node="fr.ifremer.suiviobsmer.entity.ShipOwnerImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.ShipOwner" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="code" type="text" access="field" column="code" node="code" index="shipOwner_code_idx" unique="true"/> + <property name="firstName" type="text" access="field" column="firstName" node="firstName"/> + <property name="lastName" type="text" access="field" column="lastName" node="lastName"/> + </class> +</hibernate-mapping> Added: trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/WaoUserImpl.hbm.xml =================================================================== --- trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/WaoUserImpl.hbm.xml (rev 0) +++ trunk/suiviobsmer-business/src/main/resources/oldmappings/WaoModel/0.4/fr/ifremer/suiviobsmer/entity/WaoUserImpl.hbm.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> +<hibernate-mapping default-access="field" auto-import="true" package="fr.ifremer.suiviobsmer.entity"> + <class name="fr.ifremer.suiviobsmer.entity.WaoUserImpl" table="waoUser" node="fr.ifremer.suiviobsmer.entity.WaoUserImpl" abstract="false" proxy="fr.ifremer.suiviobsmer.entity.WaoUser" > + <id name="topiaId" type="string" length="255" node="@topiaId"/> + <version name="topiaVersion" type="long" node="@topiaVersion"/> + <property name="topiaCreateDate" type="timestamp" node="@topiaCreateDate"/> + <property name="firstName" type="text" access="field" column="firstName" node="firstName"/> + <property name="lastName" type="text" access="field" column="lastName" node="lastName"/> + <property name="phoneNumber" type="text" access="field" column="phoneNumber" node="phoneNumber"/> + <property name="login" type="text" access="field" column="login" node="login"/> + <property name="password" type="text" access="field" column="password" node="password"/> + <property name="active" type="boolean" access="field" column="active" node="active"/> + <property name="admin" type="boolean" access="field" column="admin" node="admin"/> + <many-to-one name="company" class="fr.ifremer.suiviobsmer.entity.CompanyImpl" column="company" node="company/@topiaId" embed-xml="false"/> + <bag name="contact" inverse="true" lazy="true" node="contact" embed-xml="false"> + <key column="observer"/> + <one-to-many class="fr.ifremer.suiviobsmer.entity.ContactImpl" node="topiaId" embed-xml="false"/> + </bag> + </class> +</hibernate-mapping> Deleted: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties =================================================================== --- trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties 2010-02-16 12:00:05 UTC (rev 354) @@ -1,32 +0,0 @@ -model.tagvalue.copyright=/* *##%\n Copyright (C) 2009 SuiviObsmer\n *##%*/ -model.tagvalue.java.lang.String=text -fr.ifremer.suiviobsmer.entity.Company.attribute.waoUser.tagvalue.lazy=false - -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleMonth.tagvalue.lazy=false -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleMonth.tagvalue.orderBy=periodDate -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.fishingZone.tagvalue.lazy=false -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.fishingZone.tagvalue.orderBy=facadeName,sectorName,districtCode -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.profession.tagvalue.lazy=false -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.company.tagvalue.lazy=false -#fr.ifremer.suiviobsmer.entity.SampleRow.attribute.pogram.tagvalue.lazy=false -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.elligibleBoat.tagvalue.lazy=false -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.elligibleBoat.tagvalue.orderBy=companyActive -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleRowLog.tagvalue.lazy=false -fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleRowLog.tagvalue.orderBy=topiaCreateDate desc -fr.ifremer.suiviobsmer.entity.SampleRowLog.attribute.admin.tagvalue.lazy=false - -fr.ifremer.suiviobsmer.entity.FishingZone.attribute.sampleRow.tagvalue.orderBy=code - -fr.ifremer.suiviobsmer.entity.Boat.attribute.shipOwner.tagvalue.lazy=false -fr.ifremer.suiviobsmer.entity.Boat.attribute.elligibleBoat.tagvalue.orderBy=companyActive - -fr.ifremer.suiviobsmer.entity.ElligibleBoat.attribute.boat.tagvalue.lazy=false - -fr.ifremer.suiviobsmer.entity.Contact.attribute.sampleRow.tagvalue.lazy=false -fr.ifremer.suiviobsmer.entity.Contact.attribute.boat.tagvalue.lazy=false - -#fr.ifremer.suiviobsmer.entity.Boat.attribute.elligibleBoat.tagvalue.lazy=false -#fr.ifremer.suiviobsmer.entity.ElligibleBoat.attribute.sampleRow.tagvalue.lazy=false -#fr.ifremer.suiviobsmer.entity.ElligibleBoat.attribute.company.tagvalue.lazy=false -#fr.ifremer.suiviobsmer.entity.SampleRow.attribute.program.tagvalue.lazy=false -#fr.ifremer.suiviobsmer.entity.SampleRow.attribute.company.tagvalue.lazy=false \ No newline at end of file Deleted: trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo =================================================================== (Binary files differ) Copied: trunk/suiviobsmer-business/src/main/xmi/wao.properties (from rev 350, trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.properties) =================================================================== --- trunk/suiviobsmer-business/src/main/xmi/wao.properties (rev 0) +++ trunk/suiviobsmer-business/src/main/xmi/wao.properties 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,32 @@ +model.tagvalue.copyright=/* *##%\n Copyright (C) 2009 Wao\n *##%*/ +model.tagvalue.java.lang.String=text +fr.ifremer.suiviobsmer.entity.Company.attribute.waoUser.tagvalue.lazy=false + +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleMonth.tagvalue.lazy=false +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleMonth.tagvalue.orderBy=periodDate +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.fishingZone.tagvalue.lazy=false +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.fishingZone.tagvalue.orderBy=facadeName,sectorName,districtCode +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.profession.tagvalue.lazy=false +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.company.tagvalue.lazy=false +#fr.ifremer.suiviobsmer.entity.SampleRow.attribute.pogram.tagvalue.lazy=false +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.elligibleBoat.tagvalue.lazy=false +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.elligibleBoat.tagvalue.orderBy=companyActive +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleRowLog.tagvalue.lazy=false +fr.ifremer.suiviobsmer.entity.SampleRow.attribute.sampleRowLog.tagvalue.orderBy=topiaCreateDate desc +fr.ifremer.suiviobsmer.entity.SampleRowLog.attribute.admin.tagvalue.lazy=false + +fr.ifremer.suiviobsmer.entity.FishingZone.attribute.sampleRow.tagvalue.orderBy=code + +fr.ifremer.suiviobsmer.entity.Boat.attribute.shipOwner.tagvalue.lazy=false +fr.ifremer.suiviobsmer.entity.Boat.attribute.elligibleBoat.tagvalue.orderBy=companyActive + +fr.ifremer.suiviobsmer.entity.ElligibleBoat.attribute.boat.tagvalue.lazy=false + +fr.ifremer.suiviobsmer.entity.Contact.attribute.sampleRow.tagvalue.lazy=false +fr.ifremer.suiviobsmer.entity.Contact.attribute.boat.tagvalue.lazy=false + +#fr.ifremer.suiviobsmer.entity.Boat.attribute.elligibleBoat.tagvalue.lazy=false +#fr.ifremer.suiviobsmer.entity.ElligibleBoat.attribute.sampleRow.tagvalue.lazy=false +#fr.ifremer.suiviobsmer.entity.ElligibleBoat.attribute.company.tagvalue.lazy=false +#fr.ifremer.suiviobsmer.entity.SampleRow.attribute.program.tagvalue.lazy=false +#fr.ifremer.suiviobsmer.entity.SampleRow.attribute.company.tagvalue.lazy=false \ No newline at end of file Copied: trunk/suiviobsmer-business/src/main/xmi/wao.zargo (from rev 351, trunk/suiviobsmer-business/src/main/xmi/suiviobsmer.zargo) =================================================================== (Binary files differ) Property changes on: trunk/suiviobsmer-business/src/main/xmi/wao.zargo ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: svn:mergeinfo + Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/ImportHelperTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/ImportHelperTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/ImportHelperTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -48,14 +48,14 @@ */ public class ImportHelperTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(ImportHelperTest.class); private CsvReader reader; public ImportHelperTest() { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @BeforeClass @@ -69,7 +69,7 @@ } @Before - public void setUp() throws SuiviObsmerException, IOException { + public void setUp() throws WaoException, IOException { runner.start(); InputStream input = getClass().getResourceAsStream("/import/misc.csv"); @@ -78,7 +78,7 @@ } @After - public void tearDown() throws SuiviObsmerException { + public void tearDown() throws WaoException { reader.close(); runner.stop(); @@ -122,7 +122,7 @@ @Test public void testFormatContactCode() { log.info("formatContactCode"); - Date createDate = SuiviObsmerContext.getCurrentDate(); + Date createDate = WaoContext.getCurrentDate(); Calendar calendar = new GregorianCalendar(Locale.FRENCH); calendar.setTime(createDate); calendar.set(Calendar.HOUR_OF_DAY, 10); @@ -142,7 +142,7 @@ public void testParseContactCreateDate() throws Exception { System.out.println("parseContactCreateDate"); String code = "101250718"; - Date createDate = SuiviObsmerContext.getCurrentDate(); + Date createDate = WaoContext.getCurrentDate(); Calendar calendar = new GregorianCalendar(Locale.FRENCH); calendar.setTime(createDate); calendar.set(Calendar.HOUR_OF_DAY, 10); Deleted: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobalTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobalTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobalTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,104 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer; - -import fr.ifremer.suiviobsmer.entity.Company; -import fr.ifremer.suiviobsmer.entity.WaoUser; -import fr.ifremer.suiviobsmer.services.ServiceUserImpl; -import fr.ifremer.suiviobsmer.services.ServiceUser; -import java.util.List; -import static org.junit.Assert.*; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * SuiviObsmerGlobalTest - * - * Created: 27 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class SuiviObsmerGlobalTest { - - private static SuiviObsmerRunner runner; - - private static final Logger log = LoggerFactory.getLogger(SuiviObsmerGlobalTest.class); - - public SuiviObsmerGlobalTest() { - runner = new SuiviObsmerRunnerTest(); - } - - @BeforeClass - public static void setUpClass() throws Exception { - - } - - @AfterClass - public static void tearDownClass() throws Exception { - - } - - @Before - public void setUp() throws SuiviObsmerException { - runner.start(); - } - - @After - public void tearDown() throws SuiviObsmerException { - runner.stop(); - } - - /** - * Test of initApplication method, of class SuiviObsmerGlobal. - */ - @Test - public void testCreateDefaultAdmin() throws Exception { - System.out.println("createDefaultAdmin"); - - SuiviObsmerGlobal.createDefaultAdmin(); - - ServiceUser serviceUser = new ServiceUserImpl(); - - List<Company> companies = serviceUser.getCompanies(false); - assertEquals(1, companies.size()); - - Company company = companies.get(0); - assertEquals("ADMIN", company.getName()); - - List<WaoUser> users = company.getWaoUser(); - assertEquals(1, users.size()); - - WaoUser user = users.get(0); - assertEquals("admin", user.getLogin()); - - } - -} Deleted: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,150 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer; - -import fr.ifremer.suiviobsmer.entity.Company; -import fr.ifremer.suiviobsmer.entity.CompanyImpl; -import fr.ifremer.suiviobsmer.entity.WaoUser; -import fr.ifremer.suiviobsmer.entity.WaoUserImpl; -import fr.ifremer.suiviobsmer.services.*; -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.Calendar; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.Properties; -import org.junit.Ignore; -import org.nuiton.topia.TopiaException; -import org.nuiton.util.ApplicationConfig; -import org.nuiton.util.Resource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * ContextUtilObsmerTest - * - * Created: 23 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ - at Ignore -public class SuiviObsmerRunnerTest implements SuiviObsmerRunner { - - private static final Logger log = LoggerFactory.getLogger(SuiviObsmerRunnerTest.class); - - private ApplicationConfig _configuration; - - @Override - public void start() throws SuiviObsmerException { - if (log.isDebugEnabled()) { - log.debug("TEST START : loadConfiguration"); - } - try { - Properties options = loadFileProperties("TopiaContextSuiviObsmer.properties"); - options.setProperty("topia.persistence.classes", - SuiviObsmerModelDAOHelper.getImplementationClassesAsString()); - - _configuration = new ApplicationConfig(); - _configuration.setOptions(options); - - SuiviObsmerContext.setRunner(this); - } catch (Exception eee) { - SuiviObsmerContext.serviceException(null, "Error during loadConfiguration from " + - "'TopiaContextSuiviObsmer.properties' file", eee); - } - } - - @Override - public void stop() throws SuiviObsmerException { - if (log.isDebugEnabled()) { - log.debug("TEST STOP : clearContext"); - } - try { - SuiviObsmerContext.getTopiaRootContext().clear(true); - } catch (TopiaException eee) { - SuiviObsmerContext.serviceException(null, "Error during clear database", eee); - } - } - - private static Properties loadFileProperties(String filename) - throws URISyntaxException, IOException { - Properties props = new Properties(); - URL url = Resource.getURL(filename); - if (log.isDebugEnabled()) { - log.debug(url.toString()); - } - props.load(url.openStream()); - return props; - } - - @Override - public Date getCurrentDate() { - Calendar calendar = new GregorianCalendar(2009, 9, 23); // 23/10/2009 - return calendar.getTime(); - } - - @Override - public ApplicationConfig getConfiguration() { - return _configuration; - } - - public void prepareData() throws SuiviObsmerException { - ServiceBoat serviceBoat = new ServiceBoatImpl(); - ServiceReferential serviceReferential = new ServiceReferentialImpl(); - ServiceUser serviceUser = new ServiceUserImpl(); - ServiceSampling serviceSampling = new ServiceSamplingImpl(); - ServiceContact serviceContact = new ServiceContactImpl(); - - Company company = new CompanyImpl(); - company.setName("TARTANPION"); - company.setActive(true); - serviceUser.createUpdateCompany(company); - - WaoUser observer = new WaoUserImpl(); - observer.setCompany(company); - observer.setFirstName("Jean"); - observer.setLastName("Michmuche"); - observer.setLogin("jmichmuche"); - observer.setActive(true); - serviceUser.createUpdateUser(observer, true); - - InputStream input = getClass().getResourceAsStream("/import/navires.csv"); - serviceBoat.importBoatCsv(input); - - input = getClass().getResourceAsStream("/import/zonesPeche.csv"); - serviceReferential.importFishingZoneCsv(input); - - input = getClass().getResourceAsStream("/import/echantillonnage.csv"); - serviceSampling.importSamplingPlanCsv(input); - - input = getClass().getResourceAsStream("/import/contacts.csv"); - // user import : no activation - serviceContact.importContactCsv(observer, input); - } - -} Deleted: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerUtilsTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerUtilsTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerUtilsTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,138 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Business - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer; - -import fr.ifremer.suiviobsmer.entity.Company; -import fr.ifremer.suiviobsmer.entity.CompanyImpl; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import static org.junit.Assert.*; - -/** - * SuiviObsmerUtilsTest - * - * Created: 27 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class SuiviObsmerUtilsTest { - - private static SuiviObsmerRunner runner; - - private static final Logger log = LoggerFactory.getLogger(SuiviObsmerUtilsTest.class); - - public SuiviObsmerUtilsTest() { - runner = new SuiviObsmerRunnerTest(); - } - - @BeforeClass - public static void setUpClass() throws Exception { - - } - - @AfterClass - public static void tearDownClass() throws Exception { - - } - - @Before - public void setUp() throws SuiviObsmerException { - runner.start(); - } - - @After - public void tearDown() throws SuiviObsmerException { - runner.stop(); - } - - /** - * Test of getTopiaRootContext method, of class SuiviObsmerUtils. - */ - //@Test - public void testGetTopiaRootContext() throws Exception { - System.out.println("getTopiaRootContext"); - } - - /** - * Test of loadConfiguration method, of class SuiviObsmerUtils. - */ - //@Test - public void testLoadConfiguration() throws Exception { - System.out.println("loadConfiguration"); - } - - /** - * Test of serviceException method, of class SuiviObsmerUtils. - */ - //@Test - public void testServiceException() throws Exception { - System.out.println("serviceException"); - } - - /** - * Test of createRandomString method, of class SuiviObsmerUtils. - */ - //@Test - public void testCreateRandomString() { - System.out.println("createRandomString"); - } - - /** - * Test of encodeString method, of class SuiviObsmerUtils. - */ - //@Test - public void testEncodeString() { - System.out.println("encodeString"); - } - - /** - * Test of convertId method, of class SuiviObsmerUtils. - */ - //@Test - public void testConvertId() { - System.out.println("convertId"); - } - - /** - * Test of prepareTopiaId method, of class SuiviObsmerUtils. - */ - @Test - public void testPrepareTopiaId() { - log.info("prepareTopiaId"); - - Company company = new CompanyImpl(); - - SuiviObsmerContext.prepareTopiaId(Company.class, company); - assertNotNull(company.getTopiaId()); - log.debug("topiaId for Company : " + company.getTopiaId()); - } - -} Copied: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoGlobalTest.java (from rev 350, trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerGlobalTest.java) =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoGlobalTest.java (rev 0) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoGlobalTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,104 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer; + +import fr.ifremer.suiviobsmer.entity.Company; +import fr.ifremer.suiviobsmer.entity.WaoUser; +import fr.ifremer.suiviobsmer.services.ServiceUserImpl; +import fr.ifremer.suiviobsmer.services.ServiceUser; +import java.util.List; +import static org.junit.Assert.*; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * WaoGlobalTest + * + * Created: 27 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class WaoGlobalTest { + + private static WaoRunner runner; + + private static final Logger log = LoggerFactory.getLogger(WaoGlobalTest.class); + + public WaoGlobalTest() { + runner = new WaoRunnerTest(); + } + + @BeforeClass + public static void setUpClass() throws Exception { + + } + + @AfterClass + public static void tearDownClass() throws Exception { + + } + + @Before + public void setUp() throws WaoException { + runner.start(); + } + + @After + public void tearDown() throws WaoException { + runner.stop(); + } + + /** + * Test of initApplication method, of class WaoGlobal. + */ + @Test + public void testCreateDefaultAdmin() throws Exception { + System.out.println("createDefaultAdmin"); + + WaoGlobal.createDefaultAdmin(); + + ServiceUser serviceUser = new ServiceUserImpl(); + + List<Company> companies = serviceUser.getCompanies(false); + assertEquals(1, companies.size()); + + Company company = companies.get(0); + assertEquals("ADMIN", company.getName()); + + List<WaoUser> users = company.getWaoUser(); + assertEquals(1, users.size()); + + WaoUser user = users.get(0); + assertEquals("admin", user.getLogin()); + + } + +} Property changes on: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoGlobalTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Revision Added: svn:mergeinfo + Copied: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoRunnerTest.java (from rev 350, trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerRunnerTest.java) =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoRunnerTest.java (rev 0) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoRunnerTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,150 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer; + +import fr.ifremer.suiviobsmer.entity.Company; +import fr.ifremer.suiviobsmer.entity.CompanyImpl; +import fr.ifremer.suiviobsmer.entity.WaoUser; +import fr.ifremer.suiviobsmer.entity.WaoUserImpl; +import fr.ifremer.suiviobsmer.services.*; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Properties; +import org.junit.Ignore; +import org.nuiton.topia.TopiaException; +import org.nuiton.util.ApplicationConfig; +import org.nuiton.util.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * WaoRunnerTest + * + * Created: 23 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ + at Ignore +public class WaoRunnerTest implements WaoRunner { + + private static final Logger log = LoggerFactory.getLogger(WaoRunnerTest.class); + + private ApplicationConfig _configuration; + + @Override + public void start() throws WaoException { + if (log.isDebugEnabled()) { + log.debug("TEST START : loadConfiguration"); + } + try { + Properties options = loadFileProperties("WaoTest.properties"); + options.setProperty("topia.persistence.classes", + WaoModelDAOHelper.getImplementationClassesAsString()); + + _configuration = new ApplicationConfig(); + _configuration.setOptions(options); + + WaoContext.setRunner(this); + } catch (Exception eee) { + WaoContext.serviceException(null, "Error during loadConfiguration from " + + "'WaoTest.properties' file", eee); + } + } + + @Override + public void stop() throws WaoException { + if (log.isDebugEnabled()) { + log.debug("TEST STOP : clearContext"); + } + try { + WaoContext.getTopiaRootContext().clear(true); + } catch (TopiaException eee) { + WaoContext.serviceException(null, "Error during clear database", eee); + } + } + + private static Properties loadFileProperties(String filename) + throws URISyntaxException, IOException { + Properties props = new Properties(); + URL url = Resource.getURL(filename); + if (log.isDebugEnabled()) { + log.debug(url.toString()); + } + props.load(url.openStream()); + return props; + } + + @Override + public Date getCurrentDate() { + Calendar calendar = new GregorianCalendar(2009, 9, 23); // 23/10/2009 + return calendar.getTime(); + } + + @Override + public ApplicationConfig getConfiguration() { + return _configuration; + } + + public void prepareData() throws WaoException { + ServiceBoat serviceBoat = new ServiceBoatImpl(); + ServiceReferential serviceReferential = new ServiceReferentialImpl(); + ServiceUser serviceUser = new ServiceUserImpl(); + ServiceSampling serviceSampling = new ServiceSamplingImpl(); + ServiceContact serviceContact = new ServiceContactImpl(); + + Company company = new CompanyImpl(); + company.setName("TARTANPION"); + company.setActive(true); + serviceUser.createUpdateCompany(company); + + WaoUser observer = new WaoUserImpl(); + observer.setCompany(company); + observer.setFirstName("Jean"); + observer.setLastName("Michmuche"); + observer.setLogin("jmichmuche"); + observer.setActive(true); + serviceUser.createUpdateUser(observer, true); + + InputStream input = getClass().getResourceAsStream("/import/navires.csv"); + serviceBoat.importBoatCsv(input); + + input = getClass().getResourceAsStream("/import/zonesPeche.csv"); + serviceReferential.importFishingZoneCsv(input); + + input = getClass().getResourceAsStream("/import/echantillonnage.csv"); + serviceSampling.importSamplingPlanCsv(input); + + input = getClass().getResourceAsStream("/import/contacts.csv"); + // user import : no activation + serviceContact.importContactCsv(observer, input); + } + +} Copied: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoUtilsTest.java (from rev 350, trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/SuiviObsmerUtilsTest.java) =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoUtilsTest.java (rev 0) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoUtilsTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,138 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer; + +import fr.ifremer.suiviobsmer.entity.Company; +import fr.ifremer.suiviobsmer.entity.CompanyImpl; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import static org.junit.Assert.*; + +/** + * WaoUtilsTest + * + * Created: 27 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class WaoUtilsTest { + + private static WaoRunner runner; + + private static final Logger log = LoggerFactory.getLogger(WaoUtilsTest.class); + + public WaoUtilsTest() { + runner = new WaoRunnerTest(); + } + + @BeforeClass + public static void setUpClass() throws Exception { + + } + + @AfterClass + public static void tearDownClass() throws Exception { + + } + + @Before + public void setUp() throws WaoException { + runner.start(); + } + + @After + public void tearDown() throws WaoException { + runner.stop(); + } + + /** + * Test of getTopiaRootContext method, of class WaoUtils. + */ + //@Test + public void testGetTopiaRootContext() throws Exception { + System.out.println("getTopiaRootContext"); + } + + /** + * Test of loadConfiguration method, of class WaoUtils. + */ + //@Test + public void testLoadConfiguration() throws Exception { + System.out.println("loadConfiguration"); + } + + /** + * Test of serviceException method, of class WaoUtils. + */ + //@Test + public void testServiceException() throws Exception { + System.out.println("serviceException"); + } + + /** + * Test of createRandomString method, of class WaoUtils. + */ + //@Test + public void testCreateRandomString() { + System.out.println("createRandomString"); + } + + /** + * Test of encodeString method, of class WaoUtils. + */ + //@Test + public void testEncodeString() { + System.out.println("encodeString"); + } + + /** + * Test of convertId method, of class WaoUtils. + */ + //@Test + public void testConvertId() { + System.out.println("convertId"); + } + + /** + * Test of prepareTopiaId method, of class WaoUtils. + */ + @Test + public void testPrepareTopiaId() { + log.info("prepareTopiaId"); + + Company company = new CompanyImpl(); + + WaoContext.prepareTopiaId(Company.class, company); + assertNotNull(company.getTopiaId()); + log.debug("topiaId for Company : " + company.getTopiaId()); + } + +} Property changes on: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/WaoUtilsTest.java ___________________________________________________________________ Added: svn:keywords + Author Date Revision Added: svn:mergeinfo + Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatImplTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,11 +21,11 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoRunner; import fr.ifremer.suiviobsmer.bean.ContactState; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerTest; +import fr.ifremer.suiviobsmer.WaoRunnerTest; import fr.ifremer.suiviobsmer.services.ServiceBoatImpl; import fr.ifremer.suiviobsmer.services.ServiceContactImpl; import fr.ifremer.suiviobsmer.services.ServiceSamplingImpl; @@ -61,7 +61,7 @@ */ public class BoatImplTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(BoatImplTest.class); @@ -70,7 +70,7 @@ @BeforeClass public static void setUpClass() throws Exception { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @AfterClass @@ -115,9 +115,9 @@ List<Boat> boats = serviceBoat.getBoatsByImmatriculations("174258"); Boat boat = boats.get(0); - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - FishingZoneDAO zoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO zoneDAO = WaoModelDAOHelper.getFishingZoneDAO(transaction); FishingZone zoneIId = zoneDAO.create(FishingZone.DISTRICT_CODE, "IId"); FishingZone zoneIV = zoneDAO.create(FishingZone.DISTRICT_CODE, "IV"); FishingZone zoneI = zoneDAO.create(FishingZone.DISTRICT_CODE, "I"); @@ -128,7 +128,7 @@ input = getClass().getResourceAsStream("/import/echantillonnage.csv"); serviceSampling.importSamplingPlanCsv(input); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = rowDAO.findByCode("2010_0001"); row.getCompany(); row.getProfession(); @@ -191,13 +191,13 @@ List<Boat> boats = serviceBoat.getBoatsByImmatriculations("174258"); Boat boat = boats.get(0); - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); Company company = companyDAO.create(Company.NAME, "TARTANPION"); Company company2 = companyDAO.create(Company.NAME, "BIS"); - WaoUserDAO userDAO = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO userDAO = WaoModelDAOHelper.getWaoUserDAO(transaction); WaoUser user = userDAO.create(WaoUser.FIRST_NAME,"Jean", WaoUser.LAST_NAME, "Michmuche", WaoUser.COMPANY, company); company.addWaoUser(user); @@ -205,7 +205,7 @@ WaoUser.COMPANY, company2); company2.addWaoUser(user2); -// BoatInfosDAO boatInfosDAO = SuiviObsmerModelDAOHelper.getBoatInfosDAO(transaction); +// BoatInfosDAO boatInfosDAO = WaoModelDAOHelper.getBoatInfosDAO(transaction); // BoatInfos boatInfos = boatInfosDAO.create(BoatInfos.BOAT, boat, BoatInfos.COMPANY, company); transaction.commitTransaction(); Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/BoatInfosImplTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,8 +21,8 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerTest; +import fr.ifremer.suiviobsmer.WaoRunner; +import fr.ifremer.suiviobsmer.WaoRunnerTest; import fr.ifremer.suiviobsmer.services.ServiceBoatImpl; import fr.ifremer.suiviobsmer.services.ServiceContactImpl; import org.junit.After; @@ -46,7 +46,7 @@ */ public class BoatInfosImplTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(BoatInfosImplTest.class); @@ -55,7 +55,7 @@ @BeforeClass public static void setUpClass() throws Exception { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @AfterClass Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/SampleRowImplTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/SampleRowImplTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/entity/SampleRowImplTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,11 +21,11 @@ package fr.ifremer.suiviobsmer.entity; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerTest; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoRunner; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoRunnerTest; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; @@ -54,7 +54,7 @@ */ public class SampleRowImplTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(SampleRowImplTest.class); @@ -63,7 +63,7 @@ @BeforeClass public static void setUpClass() throws Exception { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @AfterClass @@ -80,15 +80,15 @@ runner.stop(); } - private SampleRow prepareData() throws SuiviObsmerException, TopiaException { - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + private SampleRow prepareData() throws WaoException, TopiaException { + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = dao.create(); row.setCode("2010_1"); - SampleMonthDAO monthDAO = SuiviObsmerModelDAOHelper.getSampleMonthDAO(transaction); + SampleMonthDAO monthDAO = WaoModelDAOHelper.getSampleMonthDAO(transaction); SampleMonth month = monthDAO.create(SampleMonth.SAMPLE_ROW, row); Calendar calendar = new GregorianCalendar(2009, 3, 1); @@ -101,9 +101,9 @@ return myRow; } - private SampleRow getRowFromContext() throws SuiviObsmerException, TopiaException { - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + private SampleRow getRowFromContext() throws WaoException, TopiaException { + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow resultRow = dao.findByCode("2010_1"); transaction.closeContext(); return resultRow; Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ActivityCalendarImportTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ActivityCalendarImportTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ActivityCalendarImportTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,10 +21,10 @@ package fr.ifremer.suiviobsmer.services; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerTest; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoRunner; +import fr.ifremer.suiviobsmer.WaoRunnerTest; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; @@ -54,7 +54,7 @@ */ public class ActivityCalendarImportTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(ActivityCalendarImportTest.class); @@ -63,7 +63,7 @@ @BeforeClass public static void setUpClass() throws Exception { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @AfterClass @@ -71,12 +71,12 @@ } @Before - public void setUp() throws SuiviObsmerException { + public void setUp() throws WaoException { runner.start(); } @After - public void tearDown() throws SuiviObsmerException { + public void tearDown() throws WaoException { runner.stop(); } @@ -84,7 +84,7 @@ * Test of run method, of class ActivityCalendarImport. */ @Test - public void testRun() throws IOException, InterruptedException, SuiviObsmerException { + public void testRun() throws IOException, InterruptedException, WaoException { log.info("run"); ServiceBoat serviceBoat = new ServiceBoatImpl(); @@ -100,8 +100,8 @@ t.start(); t.join(); - String filename = SuiviObsmerContext.getProperty( - SuiviObsmerContext.PROP_FILENAME_LOG_ACTIVITY_IMPORT); + String filename = WaoContext.getProperty( + WaoContext.PROP_FILENAME_LOG_ACTIVITY_IMPORT); File file = new File(filename); Assert.assertTrue(file.exists()); Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceBoatImplTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceBoatImplTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceBoatImplTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,12 +21,12 @@ package fr.ifremer.suiviobsmer.services; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoRunner; +import fr.ifremer.suiviobsmer.WaoContext; import fr.ifremer.suiviobsmer.bean.BoatFilterImpl; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerTest; +import fr.ifremer.suiviobsmer.WaoRunnerTest; import fr.ifremer.suiviobsmer.bean.BoatFilter; import fr.ifremer.suiviobsmer.bean.CompanyBoatInfos; import fr.ifremer.suiviobsmer.bean.ContactState; @@ -71,7 +71,7 @@ */ public class ServiceBoatImplTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(ServiceBoatImplTest.class); @@ -82,7 +82,7 @@ @BeforeClass public static void setUpClass() throws Exception { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @AfterClass @@ -204,15 +204,15 @@ } private List<SampleRow> prepareSampleRows(Company company) - throws SuiviObsmerException, TopiaException { + throws WaoException, TopiaException { ServiceReferential serviceReferential = new ServiceReferentialImpl(); InputStream input = getClass().getResourceAsStream("/import/zonesPeche.csv"); serviceReferential.importFishingZoneCsv(input); - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); // Create a company - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); - SuiviObsmerContext.prepareTopiaId(Company.class, company); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); + WaoContext.prepareTopiaId(Company.class, company); companyDAO.update(company); companyDAO.create(Company.NAME, "BIS"); transaction.commitTransaction(); @@ -222,7 +222,7 @@ serviceSampling.importSamplingPlanCsv(input); // Get two SampleRows : 2009_3 & 2010_4 - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row1 = rowDAO.findByCode("2009_0003"); row1.getProfession(); SampleRow row2 = rowDAO.findByCode("2010_0004"); @@ -267,8 +267,8 @@ serviceUser.createUpdateUser(user, true); List<SampleRow> rows = prepareSampleRows(company); - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = rowDAO.findByCode("2010_0001"); row.getCompany(); row.getProfession(); @@ -355,14 +355,14 @@ log.info("getLastActivityCalendar"); /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - BoatDAO boatDAO = SuiviObsmerModelDAOHelper.getBoatDAO(transaction); + BoatDAO boatDAO = WaoModelDAOHelper.getBoatDAO(transaction); Boat boat = boatDAO.create( Boat.NAME, "TESTBOAT", Boat.IMMATRICULATION, 174592); - ActivityCalendarDAO dao = SuiviObsmerModelDAOHelper.getActivityCalendarDAO(transaction); + ActivityCalendarDAO dao = WaoModelDAOHelper.getActivityCalendarDAO(transaction); ActivityCalendar calendar1 = dao.create( ActivityCalendar.BOAT, boat, @@ -391,8 +391,8 @@ Assert.assertNotNull(result); Assert.assertEquals(2009, result.getYear()); - String filename = SuiviObsmerContext.getProperty( - SuiviObsmerContext.PROP_FILENAME_LOG_ACTIVITY_ACCESS); + String filename = WaoContext.getProperty( + WaoContext.PROP_FILENAME_LOG_ACTIVITY_ACCESS); File file = new File(filename); Assert.assertTrue(file.exists()); Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceReferentialImplTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceReferentialImplTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceReferentialImplTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,9 +21,9 @@ package fr.ifremer.suiviobsmer.services; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerTest; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoRunner; +import fr.ifremer.suiviobsmer.WaoRunnerTest; import fr.ifremer.suiviobsmer.bean.SamplingFilter; import fr.ifremer.suiviobsmer.bean.SamplingFilterImpl; import fr.ifremer.suiviobsmer.entity.FishingZone; @@ -44,7 +44,7 @@ */ public class ServiceReferentialImplTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(ServiceReferentialImplTest.class); @@ -55,7 +55,7 @@ @BeforeClass public static void setUpClass() throws Exception { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @AfterClass @@ -125,10 +125,10 @@ /** * Test of getFishingZones method, of class ServiceReferentialImpl. - * @throws SuiviObsmerException if error during import or getFishingZones + * @throws WaoException if error during import or getFishingZones */ @Test - public void testGetFishingZones() throws SuiviObsmerException { + public void testGetFishingZones() throws WaoException { log.info("getFishingZones"); InputStream input = getClass().getResourceAsStream("/import/zonesPeche.csv"); @@ -141,10 +141,10 @@ /** * Test of importFishingZoneCsv method, of class ServiceReferentialImpl. - * @throws SuiviObsmerException if import error + * @throws WaoException if import error */ @Test - public void testImportFishingZoneCsv() throws SuiviObsmerException { + public void testImportFishingZoneCsv() throws WaoException { log.info("importFishingZoneCsv"); InputStream input = getClass().getResourceAsStream("/import/zonesPeche.csv"); Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceSamplingImplTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceSamplingImplTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceSamplingImplTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Business + * Wao :: Business * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,14 +21,14 @@ package fr.ifremer.suiviobsmer.services; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoRunner; +import fr.ifremer.suiviobsmer.WaoContext; import fr.ifremer.suiviobsmer.bean.ImportResults; import fr.ifremer.suiviobsmer.bean.SamplingFilter; import fr.ifremer.suiviobsmer.bean.SamplingFilterImpl; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerTest; +import fr.ifremer.suiviobsmer.WaoRunnerTest; import fr.ifremer.suiviobsmer.bean.FacadeRow; import fr.ifremer.suiviobsmer.entity.Boat; import fr.ifremer.suiviobsmer.entity.Company; @@ -79,7 +79,7 @@ */ public class ServiceSamplingImplTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(ServiceSamplingImplTest.class); @@ -90,7 +90,7 @@ @BeforeClass public static void setUpClass() throws Exception { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @AfterClass @@ -113,7 +113,7 @@ log.info("createUpdateSampleRow"); /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); List<FishingZone> zones = prepareFishingZones(transaction); @@ -187,7 +187,7 @@ /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); List<FishingZone> zones = prepareFishingZones(transaction); @@ -201,7 +201,7 @@ Date dateEnd2 = DateUtils.createDate(1, 12, 2008); PeriodDates period2 = new PeriodDates(dateBegin2, dateEnd2); - SampleRowDAO dao = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO dao = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row1 = dao.create(); row1.setCode("2010_0001"); @@ -291,9 +291,9 @@ } - private List<FishingZone> prepareFishingZones(TopiaContext transaction) throws SuiviObsmerException, TopiaException { + private List<FishingZone> prepareFishingZones(TopiaContext transaction) throws WaoException, TopiaException { - FishingZoneDAO fishingZoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO fishingZoneDAO = WaoModelDAOHelper.getFishingZoneDAO(transaction); FishingZone fishingZone1 = fishingZoneDAO.create(); fishingZone1.setFacadeName("Atlantique"); @@ -318,18 +318,18 @@ public void testGetSampleRowsForUser() throws Exception { log.info("getSampleRowsForUser"); /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - FishingZoneDAO zoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO zoneDAO = WaoModelDAOHelper.getFishingZoneDAO(transaction); FishingZone zoneIId = zoneDAO.create(FishingZone.DISTRICT_CODE, "IId"); FishingZone zoneIV = zoneDAO.create(FishingZone.DISTRICT_CODE, "IV"); FishingZone zoneI = zoneDAO.create(FishingZone.DISTRICT_CODE, "I"); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); Company company = companyDAO.create(Company.NAME, "TARTANPION"); Calendar begin = new GregorianCalendar(2009,8,1); Calendar end = new GregorianCalendar(2010,11,31); - SampleRowDAO sampleRowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO sampleRowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = sampleRowDAO.create( SampleRow.CODE,"2010_178", SampleRow.COMPANY,company, @@ -383,9 +383,9 @@ /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - ProfessionDAO dao = SuiviObsmerModelDAOHelper.getProfessionDAO(transaction); + ProfessionDAO dao = WaoModelDAOHelper.getProfessionDAO(transaction); Profession profession = dao.create( Profession.CODE_DCF5, "OBR", @@ -413,14 +413,14 @@ log.info("deleteSampleRow"); /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - FishingZoneDAO zoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO zoneDAO = WaoModelDAOHelper.getFishingZoneDAO(transaction); FishingZone zoneIId = zoneDAO.create(FishingZone.DISTRICT_CODE, "IId"); FishingZone zoneIV = zoneDAO.create(FishingZone.DISTRICT_CODE, "IV"); FishingZone zoneI = zoneDAO.create(FishingZone.DISTRICT_CODE, "I"); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); companyDAO.create(Company.NAME, "TARTANPION"); companyDAO.create(Company.NAME, "BIS"); transaction.commitTransaction(); @@ -429,7 +429,7 @@ InputStream input = getClass().getResourceAsStream("/import/echantillonnage.csv"); service.importSamplingPlanCsv(input); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = rowDAO.findByCode("2010_0001"); row.getProfession(); row.getCompany(); @@ -444,30 +444,30 @@ /** EXEC METHOD **/ service.deleteSampleRow(row); - transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); - rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + transaction = WaoContext.getTopiaRootContext().beginTransaction(); + rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); row = rowDAO.findByCode("2010_0001"); assertNull(row); - ElligibleBoatDAO elligibleDAO = SuiviObsmerModelDAOHelper.getElligibleBoatDAO(transaction); + ElligibleBoatDAO elligibleDAO = WaoModelDAOHelper.getElligibleBoatDAO(transaction); List<ElligibleBoat> elligibles = elligibleDAO.findAll(); assertEquals(0, elligibles.size()); transaction.closeContext(); } @Test - public void testImportSamplingPlanCsv() throws SuiviObsmerException, TopiaException { + public void testImportSamplingPlanCsv() throws WaoException, TopiaException { log.info("importSamplingPlanCsv"); /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - FishingZoneDAO zoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO zoneDAO = WaoModelDAOHelper.getFishingZoneDAO(transaction); FishingZone zoneIId = zoneDAO.create(FishingZone.DISTRICT_CODE, "IId"); FishingZone zoneIV = zoneDAO.create(FishingZone.DISTRICT_CODE, "IV"); FishingZone zoneI = zoneDAO.create(FishingZone.DISTRICT_CODE, "I"); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); companyDAO.create(Company.NAME, "TARTANPION"); companyDAO.create(Company.NAME, "BIS"); transaction.commitTransaction(); @@ -483,14 +483,14 @@ assertEquals(1, result.getNbRowsRefused()); /** CHECK VALUES **/ - transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + transaction = WaoContext.getTopiaRootContext().beginTransaction(); - ProfessionDAO professionDAO = SuiviObsmerModelDAOHelper.getProfessionDAO(transaction); + ProfessionDAO professionDAO = WaoModelDAOHelper.getProfessionDAO(transaction); List<Profession> professions = professionDAO.findAll(); assertEquals(9, professions.size()); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row1 = rowDAO.findByCode("2010_0001"); assertNotNull(row1); @@ -518,14 +518,14 @@ @Test public void testGetPrograms() throws Exception { /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - FishingZoneDAO zoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO zoneDAO = WaoModelDAOHelper.getFishingZoneDAO(transaction); zoneDAO.create(FishingZone.DISTRICT_CODE, "IId"); zoneDAO.create(FishingZone.DISTRICT_CODE, "IV"); zoneDAO.create(FishingZone.DISTRICT_CODE, "I"); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); companyDAO.create(Company.NAME, "TARTANPION"); companyDAO.create(Company.NAME, "BIS"); transaction.commitTransaction(); @@ -545,14 +545,14 @@ log.info("getNewSampleRowCode"); /** PREPARE DATA **/ - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - FishingZoneDAO zoneDAO = SuiviObsmerModelDAOHelper.getFishingZoneDAO(transaction); + FishingZoneDAO zoneDAO = WaoModelDAOHelper.getFishingZoneDAO(transaction); FishingZone zoneIId = zoneDAO.create(FishingZone.DISTRICT_CODE, "IId"); FishingZone zoneIV = zoneDAO.create(FishingZone.DISTRICT_CODE, "IV"); FishingZone zoneI = zoneDAO.create(FishingZone.DISTRICT_CODE, "I"); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); companyDAO.create(Company.NAME, "TARTANPION"); companyDAO.create(Company.NAME, "BIS"); transaction.commitTransaction(); Modified: trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceSynthesisImplTest.java =================================================================== --- trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceSynthesisImplTest.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/java/fr/ifremer/suiviobsmer/services/ServiceSynthesisImplTest.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,10 +1,30 @@ +/* + * *##% + * Wao :: Business + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.services; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerModelDAOHelper; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerTest; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoModelDAOHelper; +import fr.ifremer.suiviobsmer.WaoRunner; +import fr.ifremer.suiviobsmer.WaoRunnerTest; import fr.ifremer.suiviobsmer.bean.BoardingResult; import fr.ifremer.suiviobsmer.bean.ContactAverageReactivity; import fr.ifremer.suiviobsmer.bean.ContactState; @@ -43,7 +63,7 @@ */ public class ServiceSynthesisImplTest { - private static SuiviObsmerRunner runner; + private static WaoRunner runner; private static final Logger log = LoggerFactory.getLogger(ServiceSynthesisImplTest.class); @@ -54,7 +74,7 @@ @BeforeClass public static void setUpClass() throws Exception { - runner = new SuiviObsmerRunnerTest(); + runner = new WaoRunnerTest(); } @AfterClass @@ -96,13 +116,13 @@ List<Boat> boats2 = serviceBoat.getBoatsByImmatriculations("177474"); Boat boat2 = boats2.get(0); - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); Company company = companyDAO.create(Company.NAME, "TARTANPION"); Company company2 = companyDAO.create(Company.NAME, "BIS"); - WaoUserDAO userDAO = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO userDAO = WaoModelDAOHelper.getWaoUserDAO(transaction); WaoUser user = userDAO.create(WaoUser.FIRST_NAME,"Jean", WaoUser.LAST_NAME, "Michmuche", WaoUser.COMPANY, company); company.addWaoUser(user); @@ -120,7 +140,7 @@ ServiceSampling serviceSampling = new ServiceSamplingImpl(); serviceSampling.importSamplingPlanCsv(input); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = rowDAO.findByCode("2010_0001"); transaction.closeContext(); @@ -184,13 +204,13 @@ List<Boat> boats2 = serviceBoat.getBoatsByImmatriculations("177474"); Boat boat2 = boats2.get(0); - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); Company company = companyDAO.create(Company.NAME, "TARTANPION"); Company company2 = companyDAO.create(Company.NAME, "BIS"); - WaoUserDAO userDAO = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO userDAO = WaoModelDAOHelper.getWaoUserDAO(transaction); WaoUser user = userDAO.create(WaoUser.FIRST_NAME,"Jean", WaoUser.LAST_NAME, "Michmuche", WaoUser.COMPANY, company); company.addWaoUser(user); @@ -208,7 +228,7 @@ ServiceSampling serviceSampling = new ServiceSamplingImpl(); serviceSampling.importSamplingPlanCsv(input); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = rowDAO.findByCode("2010_0001"); SampleRow row2 = rowDAO.findByCode("2009_0006"); @@ -291,13 +311,13 @@ List<Boat> boats2 = serviceBoat.getBoatsByImmatriculations("177474"); Boat boat2 = boats2.get(0); - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); Company company = companyDAO.create(Company.NAME, "TARTANPION"); Company company2 = companyDAO.create(Company.NAME, "BIS"); - WaoUserDAO userDAO = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO userDAO = WaoModelDAOHelper.getWaoUserDAO(transaction); WaoUser user = userDAO.create(WaoUser.FIRST_NAME,"Jean", WaoUser.LAST_NAME, "Michmuche", WaoUser.COMPANY, company); company.addWaoUser(user); @@ -315,7 +335,7 @@ ServiceSampling serviceSampling = new ServiceSamplingImpl(); serviceSampling.importSamplingPlanCsv(input); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = rowDAO.findByCode("2010_0001"); transaction.closeContext(); @@ -434,13 +454,13 @@ List<Boat> boats2 = serviceBoat.getBoatsByImmatriculations("177474"); Boat boat2 = boats2.get(0); - TopiaContext transaction = SuiviObsmerContext.getTopiaRootContext().beginTransaction(); + TopiaContext transaction = WaoContext.getTopiaRootContext().beginTransaction(); - CompanyDAO companyDAO = SuiviObsmerModelDAOHelper.getCompanyDAO(transaction); + CompanyDAO companyDAO = WaoModelDAOHelper.getCompanyDAO(transaction); Company company = companyDAO.create(Company.NAME, "TARTANPION"); Company company2 = companyDAO.create(Company.NAME, "BIS"); - WaoUserDAO userDAO = SuiviObsmerModelDAOHelper.getWaoUserDAO(transaction); + WaoUserDAO userDAO = WaoModelDAOHelper.getWaoUserDAO(transaction); WaoUser user = userDAO.create(WaoUser.FIRST_NAME,"Jean", WaoUser.LAST_NAME, "Michmuche", WaoUser.COMPANY, company); company.addWaoUser(user); @@ -458,7 +478,7 @@ ServiceSampling serviceSampling = new ServiceSamplingImpl(); serviceSampling.importSamplingPlanCsv(input); - SampleRowDAO rowDAO = SuiviObsmerModelDAOHelper.getSampleRowDAO(transaction); + SampleRowDAO rowDAO = WaoModelDAOHelper.getSampleRowDAO(transaction); SampleRow row = rowDAO.findByCode("2010_0001"); SampleRow row2 = rowDAO.findByCode("2009_0006"); Deleted: trunk/suiviobsmer-business/src/test/resources/TopiaContextSuiviObsmer.properties =================================================================== --- trunk/suiviobsmer-business/src/test/resources/TopiaContextSuiviObsmer.properties 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-business/src/test/resources/TopiaContextSuiviObsmer.properties 2010-02-16 12:00:05 UTC (rev 354) @@ -1,12 +0,0 @@ -# Propri\u00C3\u00A9t\u00C3\u00A9s par d\u00C3\u00A9faut pour une base de donn\u00C3\u00A9es de type H2 -hibernate.hbm2ddl.auto=update -hibernate.show_sql=false - -hibernate.dialect=org.hibernate.dialect.H2Dialect -hibernate.connection.username=sa -hibernate.connection.password= -hibernate.connection.driver_class=org.h2.Driver -hibernate.connection.url=jdbc:h2:file:target/db/h2data - -suiviobsmer.log.activityCalendar.import=target/log/activity.log -suiviobsmer.log.activityCalendar.access=target/log/activity-access.log \ No newline at end of file Copied: trunk/suiviobsmer-business/src/test/resources/WaoTest.properties (from rev 350, trunk/suiviobsmer-business/src/test/resources/TopiaContextSuiviObsmer.properties) =================================================================== --- trunk/suiviobsmer-business/src/test/resources/WaoTest.properties (rev 0) +++ trunk/suiviobsmer-business/src/test/resources/WaoTest.properties 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,11 @@ +hibernate.hbm2ddl.auto=update +hibernate.show_sql=false + +hibernate.dialect=org.hibernate.dialect.H2Dialect +hibernate.connection.username=sa +hibernate.connection.password= +hibernate.connection.driver_class=org.h2.Driver +hibernate.connection.url=jdbc:h2:file:target/db/h2data + +wao.log.activityCalendar.import=target/log/activity.log +wao.log.activityCalendar.access=target/log/activity-access.log \ No newline at end of file Property changes on: trunk/suiviobsmer-business/src/test/resources/WaoTest.properties ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/suiviobsmer-ui/pom.xml =================================================================== --- trunk/suiviobsmer-ui/pom.xml 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/pom.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -9,17 +9,18 @@ <parent> <groupId>fr.ifremer</groupId> - <artifactId>suiviobsmer</artifactId> - <version>1.0.0-SNAPSHOT</version> + <artifactId>wao</artifactId> + <version>1.0-SNAPSHOT</version> </parent> - <groupId>fr.ifremer.suiviobsmer</groupId> + <groupId>fr.ifremer.wao</groupId> <artifactId>suiviobsmer-ui</artifactId> <dependencies> + <!-- Wao business : services and entities --> <dependency> - <groupId>fr.ifremer.suiviobsmer</groupId> + <groupId>fr.ifremer.wao</groupId> <artifactId>suiviobsmer-business</artifactId> <version>${project.version}</version> </dependency> @@ -27,10 +28,12 @@ <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> </dependency> + <!-- Utils --> <dependency> <groupId>org.nuiton</groupId> <artifactId>nuiton-utils</artifactId> </dependency> + <!-- Tapestry framework + components --> <dependency> <groupId>org.apache.tapestry</groupId> <artifactId>tapestry-core</artifactId> @@ -47,14 +50,17 @@ <groupId>com.orientimport</groupId> <artifactId>t5-easy-fckeditor</artifactId> </dependency> + <!-- Graph library for synthesis --> <dependency> <groupId>jfree</groupId> <artifactId>jfreechart</artifactId> </dependency> + <!-- Tests --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> + <!-- Logging --> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> @@ -63,6 +69,7 @@ <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> </dependency> + <!-- Embedded war lib for Nuiton-utils WarLauncher --> <dependency> <groupId>org.jvnet.hudson.winstone</groupId> <artifactId>winstone</artifactId> @@ -75,8 +82,8 @@ <!-- *** Project Information ************************************* --> <!-- ************************************************************* --> - <name>SuiviObsmer :: Web Interface</name> - <description>Interface utilisateur du SuiviObsmer</description> + <name>Wao :: Web Interface</name> + <description>Interface utilisateur du Wao</description> <!-- ************************************************************* --> <!-- *** Build Settings ****************************************** --> @@ -89,7 +96,7 @@ <!-- ************************************************************* --> <build> <!-- call result war : suiviobsmer-xxx.war --> - <finalName>wao-${project.version}</finalName> + <!--<finalName>wao-${project.version}</finalName>--> <!-- Add main class into war to make it executable --> <plugins> @@ -123,6 +130,7 @@ <repositories> + <!-- Repository for fckeditor component needed for News page --> <repository> <id>m2-release-repository.orientimport.kenai.com</id> <name>Orient Import Oy Maven Release Repository</name> Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/AbstractFilteredPage.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,7 +21,7 @@ package fr.ifremer.suiviobsmer.ui.base; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.bean.BoatFilter; import fr.ifremer.suiviobsmer.entity.Company; import fr.ifremer.suiviobsmer.entity.SampleRow; @@ -141,9 +141,9 @@ * * @param companySelect if true, company select will be initialized * @param observerSelect if true, observer select will be initialized - * @throws SuiviObsmerException + * @throws WaoException */ - protected void initSelectFilters(boolean companySelect, boolean observerSelect, boolean programSelect) throws SuiviObsmerException { + protected void initSelectFilters(boolean companySelect, boolean observerSelect, boolean programSelect) throws WaoException { this.observerSelect = observerSelect; this.programSelect = programSelect; @@ -185,22 +185,22 @@ resetSampleRowSelect(); } - protected void resetCompanySelect() throws SuiviObsmerException { + protected void resetCompanySelect() throws WaoException { companySelectModel = null; getCompanySelectModel(); } - protected void resetFacadeSelect() throws SuiviObsmerException { + protected void resetFacadeSelect() throws WaoException { facadeSelectModel = null; getFacadeSelectModel(); } - protected void resetSectorSelect() throws SuiviObsmerException { + protected void resetSectorSelect() throws WaoException { sectorSelectModel = null; getSectorSelectModel(); } - protected void resetSampleRowSelect() throws SuiviObsmerException { + protected void resetSampleRowSelect() throws WaoException { sampleRowSelectModel = null; getSampleRowSelectModel(); } @@ -210,9 +210,9 @@ * filter. * * @return the SelectModel for facade names - * @throws SuiviObsmerException + * @throws WaoException */ - public SelectModel getFacadeSelectModel() throws SuiviObsmerException { + public SelectModel getFacadeSelectModel() throws WaoException { if (facadeSelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getFacades]"); @@ -231,9 +231,9 @@ * company set in filter. * * @return the SelectModel for sector names - * @throws SuiviObsmerException + * @throws WaoException */ - public SelectModel getSectorSelectModel() throws SuiviObsmerException { + public SelectModel getSectorSelectModel() throws WaoException { if (sectorSelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getSectors]"); @@ -253,9 +253,9 @@ * only one element in the select. * * @return the GenericSelectModel<SampleRow> for sampleRows - * @throws SuiviObsmerException + * @throws WaoException */ - public GenericSelectModel<SampleRow> getSampleRowSelectModel() throws SuiviObsmerException { + public GenericSelectModel<SampleRow> getSampleRowSelectModel() throws WaoException { if (sampleRowSelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getSampleRowsByFilter]"); @@ -279,9 +279,9 @@ * companies. This select model is only used by admin users. * * @return the GenericSelectModel<Company> for companies - * @throws SuiviObsmerException + * @throws WaoException */ - public GenericSelectModel<Company> getCompanySelectModel() throws SuiviObsmerException { + public GenericSelectModel<Company> getCompanySelectModel() throws WaoException { if (companySelectModel == null) { if (log.isDebugEnabled()) { log.debug("BUSINESS REQUEST [getCompanies]"); @@ -299,9 +299,9 @@ * companies. * * @return the GenericSelectModel<WaoUser> for observers - * @throws SuiviObsmerException + * @throws WaoException */ - public GenericSelectModel<WaoUser> getObserverSelectModel() throws SuiviObsmerException { + public GenericSelectModel<WaoUser> getObserverSelectModel() throws WaoException { if (observerSelectModel == null) { List<WaoUser> observers = new ArrayList<WaoUser>(); if (getFilter().getCompany() != null) { @@ -323,9 +323,9 @@ * filter. * * @return the SelectModel for program names - * @throws SuiviObsmerException + * @throws WaoException */ - public SelectModel getProgramSelectModel() throws SuiviObsmerException { + public SelectModel getProgramSelectModel() throws WaoException { if (programSelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getPrograms]"); @@ -339,7 +339,7 @@ return programSelectModel; } - protected abstract BoatFilter getFilter() throws SuiviObsmerException; + protected abstract BoatFilter getFilter() throws WaoException; /** * Used to show only active company and observers. @@ -348,7 +348,7 @@ */ protected abstract boolean isAvailableDataForFiltersOnly(); - public String[] onProvideCompletionsFromBoatName(String input) throws SuiviObsmerException { + public String[] onProvideCompletionsFromBoatName(String input) throws WaoException { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getBoatNamesStartWith]"); } @@ -360,9 +360,9 @@ * Called when search submit button is pressed. This method is useful to * refresh all filters data from selects. * - * @throws SuiviObsmerException + * @throws WaoException */ - public void onSelectedFromSearch() throws SuiviObsmerException { + public void onSelectedFromSearch() throws WaoException { if (log.isDebugEnabled()) { log.debug("REFRESH FILTERS DATA"); } @@ -389,10 +389,10 @@ * This method set the state to edited, you can use * {@link AbstractFilteredPage#isEdited() } method to test it. * - * @throws SuiviObsmerException + * @throws WaoException * @see AbstractFilteredPage#onSelectedFromRefreshByProgram() */ - public void onSelectedFromRefreshByCompany() throws SuiviObsmerException { + public void onSelectedFromRefreshByCompany() throws WaoException { // Reset programs (the behavior is needed even if programSelect is false) getFilter().setProgramName(null); onSelectedFromRefreshByProgram(); @@ -415,10 +415,10 @@ * This method set the state to edited, you can use * {@link AbstractFilteredPage#isEdited() } method to test it. * - * @throws SuiviObsmerException + * @throws WaoException * @see AbstractFilteredPage#onSelectedFromRefreshByFacade() */ - public void onSelectedFromRefreshByProgram() throws SuiviObsmerException { + public void onSelectedFromRefreshByProgram() throws WaoException { // Reset facades getFilter().setFacadeName(null); onSelectedFromRefreshByFacade(); @@ -431,10 +431,10 @@ * This method set the state to edited, you can use * {@link AbstractFilteredPage#isEdited() } method to test it. * - * @throws SuiviObsmerException + * @throws WaoException * @see AbstractFilteredPage#onSelectedFromRefreshBySector() */ - public void onSelectedFromRefreshByFacade() throws SuiviObsmerException { + public void onSelectedFromRefreshByFacade() throws WaoException { // Reset sectors getFilter().setSectorName(null); onSelectedFromRefreshBySector(); @@ -447,10 +447,10 @@ * This method set the state to edited, you can use * {@link AbstractFilteredPage#isEdited() } method to test it. * - * @throws SuiviObsmerException + * @throws WaoException * @see AbstractFilteredPage#onSelectedFromSearch() */ - public void onSelectedFromRefreshBySector() throws SuiviObsmerException { + public void onSelectedFromRefreshBySector() throws WaoException { // Update selected data onSelectedFromSearch(); // Reset sampleRows; Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/GenericSelectModel.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/GenericSelectModel.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/GenericSelectModel.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /** * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Deleted: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/SuiviObsmerPage.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/SuiviObsmerPage.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/SuiviObsmerPage.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,39 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Web Interface - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer.ui.base; - -/** - * SuiviObsmerPage - * - * Created: 3 déc. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public interface SuiviObsmerPage { - - boolean isOnlyForAdmin(); - -} Copied: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/WaoPage.java (from rev 350, trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/SuiviObsmerPage.java) =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/WaoPage.java (rev 0) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/WaoPage.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,39 @@ +/* + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer.ui.base; + +/** + * WaoPage + * + * Created: 3 déc. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public interface WaoPage { + + boolean isOnlyForAdmin(); + +} Property changes on: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/base/WaoPage.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/BooleanImage.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/BooleanImage.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/BooleanImage.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Chart.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Chart.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Chart.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,5 +1,5 @@ /* *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/FeedBack.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/FeedBack.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/FeedBack.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,5 +1,5 @@ /* *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Layout.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Layout.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/Layout.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,13 +21,13 @@ package fr.ifremer.suiviobsmer.ui.components; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException.Type; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoBusinessException.Type; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.entity.WaoUser; import fr.ifremer.suiviobsmer.services.ServiceUser; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import fr.ifremer.suiviobsmer.ui.pages.Index; import org.apache.commons.lang.StringUtils; import org.apache.tapestry5.BindingConstants; @@ -81,7 +81,7 @@ private FeedBack contentFeedback; @InjectContainer - private SuiviObsmerPage page; + private WaoPage page; @Inject private ServiceUser serviceUser; @@ -113,7 +113,7 @@ } public String getVersion() { - return SuiviObsmerContext.getProperty(SuiviObsmerContext.PROP_VERSION); + return WaoContext.getProperty(WaoContext.PROP_VERSION); } /** @@ -181,13 +181,13 @@ } @Log - Object onSuccessFromConnexionForm() throws SuiviObsmerException { + Object onSuccessFromConnexionForm() throws WaoException { try { // FIXME-FD20100120 Problem with NPE in Topia --> see Ano #243 on nuiton.org if (login != null && password != null) { currentUser = serviceUser.connect(login, password); } - } catch (SuiviObsmerBusinessException eee) { + } catch (WaoBusinessException eee) { if (eee.getType().equals(Type.BAD_CONNECTION)) { connexionFeedback.addError(eee.getMessage()); email = login; @@ -201,11 +201,11 @@ public boolean hasConnexionErrors() { return connexionFeedback.hasErrors(); } - void onSuccessFromForgetPassword() throws SuiviObsmerException { + void onSuccessFromForgetPassword() throws WaoException { try { serviceUser.forgetPassword(email); connexionFeedback.addInfo("Un email avec votre nouveau mot de passe vous a été envoyé."); - } catch (SuiviObsmerBusinessException eee) { + } catch (WaoBusinessException eee) { connexionFeedback.addError(eee.getMessage()); } } Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/SubmitContext.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/SubmitContext.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/components/SubmitContext.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/AbstractMappedGridDataSource.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/AbstractMappedGridDataSource.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/AbstractMappedGridDataSource.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,7 +1,27 @@ +/* + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.ui.data; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -48,7 +68,7 @@ if (log.isTraceEnabled()) { log.trace("Count : " + nbRows); } - } catch (SuiviObsmerException eee) { + } catch (WaoException eee) { throw new TapestryException("", eee); } } @@ -67,14 +87,14 @@ // FIXME manage sort columns in execute ???? seems obvious --> needed for Contacts, done for Boats //sortResults(sortConstraints); - } catch (SuiviObsmerException eee) { + } catch (WaoException eee) { throw new TapestryException("", eee); } } - protected abstract Map<K, E> execute(int startIndex, int endIndex, SortConstraint orderBy) throws SuiviObsmerException; + protected abstract Map<K, E> execute(int startIndex, int endIndex, SortConstraint orderBy) throws WaoException; - protected abstract int count() throws SuiviObsmerException; + protected abstract int count() throws WaoException; protected SortConstraint getSortConstraint(List<SortConstraint> sortConstraints) { for (SortConstraint constraint : sortConstraints) Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BoatDataSource.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BoatDataSource.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BoatDataSource.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,7 +1,27 @@ +/* + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.ui.data; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.bean.BoatFilter; import fr.ifremer.suiviobsmer.entity.Boat; import fr.ifremer.suiviobsmer.services.ServiceBoat; @@ -38,7 +58,7 @@ @Override - protected Map<Integer, Boat> execute(int startIndex, int endIndex, SortConstraint orderBy) throws SuiviObsmerException { + protected Map<Integer, Boat> execute(int startIndex, int endIndex, SortConstraint orderBy) throws WaoException { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getBoatsByFilter]"); } @@ -64,7 +84,7 @@ } @Override - protected int count() throws SuiviObsmerException { + protected int count() throws WaoException { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getNbBoatsByFilter]"); } Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BusinessUtils.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BusinessUtils.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/BusinessUtils.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ChartUtils.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ChartUtils.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ChartUtils.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ContactDataSource.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ContactDataSource.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ContactDataSource.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,7 +1,27 @@ +/* + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.ui.data; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.bean.ContactFilter; import fr.ifremer.suiviobsmer.entity.Contact; import fr.ifremer.suiviobsmer.services.ServiceContact; @@ -40,7 +60,7 @@ } @Override - protected Map<String, Contact> execute(int startIndex, int endIndex, SortConstraint orderBy) throws SuiviObsmerException { + protected Map<String, Contact> execute(int startIndex, int endIndex, SortConstraint orderBy) throws WaoException { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getContactsByFilter]"); } @@ -50,7 +70,7 @@ } @Override - protected int count() throws SuiviObsmerException { + protected int count() throws WaoException { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getNbContacts]"); } Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ExportStreamResponse.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ExportStreamResponse.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/ExportStreamResponse.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,7 +1,27 @@ +/* + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.ui.data; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; +import fr.ifremer.suiviobsmer.WaoContext; import java.util.Date; import org.apache.tapestry5.StreamResponse; import org.apache.tapestry5.services.Response; @@ -48,7 +68,7 @@ */ @Override public void prepareResponse(Response response) { - Date current = SuiviObsmerContext.getCurrentDate(); + Date current = WaoContext.getCurrentDate(); filename += "-" + DateUtils.formatDate(current, "dd-MM-yyyy") + ".csv"; response.setHeader("Content-Disposition", "attachment; filename=\"" + filename +"\""); Deleted: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SuiviObsmerPropertyChangeListener.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SuiviObsmerPropertyChangeListener.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SuiviObsmerPropertyChangeListener.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,81 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Web Interface - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer.ui.data; - -import java.beans.PropertyChangeEvent; -import java.beans.PropertyChangeListener; -import java.util.HashMap; -import java.util.Map; -import org.nuiton.topia.persistence.TopiaEntity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * BoatInfosPropertyChangeListener - * - * Created: 18 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class SuiviObsmerPropertyChangeListener implements PropertyChangeListener { - - private static final Logger log = LoggerFactory.getLogger(SuiviObsmerPropertyChangeListener.class); - - //private boolean changed; - - private Map<String, Object> data; - - @Override - public void propertyChange(PropertyChangeEvent evt) { - if (log.isDebugEnabled()) { - log.debug("property change : old = " + evt.getOldValue() + - " _ new = " + evt.getNewValue()); - } - TopiaEntity entity = (TopiaEntity)evt.getSource(); - getData().put(entity.getTopiaId(), entity); - } - - protected Map<String, Object> getData() { - if (data == null) { - data = new HashMap<String, Object>(); - } - return data; - } - - public boolean hasChanged(String topiaId) { - - if (log.isTraceEnabled()) { - log.trace("data size : " + getData().size()); - } - - return getData().containsKey(topiaId); - } - - public void reset() { - data = null; - } - -} Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SynthesisId.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SynthesisId.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SynthesisId.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,3 +1,23 @@ +/* + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ package fr.ifremer.suiviobsmer.ui.data; /** Copied: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/WaoPropertyChangeListener.java (from rev 350, trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/SuiviObsmerPropertyChangeListener.java) =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/WaoPropertyChangeListener.java (rev 0) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/WaoPropertyChangeListener.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,81 @@ +/* + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer.ui.data; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.util.HashMap; +import java.util.Map; +import org.nuiton.topia.persistence.TopiaEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * BoatInfosPropertyChangeListener + * + * Created: 18 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class WaoPropertyChangeListener implements PropertyChangeListener { + + private static final Logger log = LoggerFactory.getLogger(WaoPropertyChangeListener.class); + + //private boolean changed; + + private Map<String, Object> data; + + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (log.isDebugEnabled()) { + log.debug("property change : old = " + evt.getOldValue() + + " _ new = " + evt.getNewValue()); + } + TopiaEntity entity = (TopiaEntity)evt.getSource(); + getData().put(entity.getTopiaId(), entity); + } + + protected Map<String, Object> getData() { + if (data == null) { + data = new HashMap<String, Object>(); + } + return data; + } + + public boolean hasChanged(String topiaId) { + + if (log.isTraceEnabled()) { + log.trace("data size : " + getData().size()); + } + + return getData().containsKey(topiaId); + } + + public void reset() { + data = null; + } + +} Property changes on: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/data/WaoPropertyChangeListener.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/Confirm.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/Confirm.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/Confirm.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /** * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/PopupPageLink.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/PopupPageLink.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/PopupPageLink.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/ZoneUpdater.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/ZoneUpdater.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/mixins/ZoneUpdater.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /** * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Administration.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Administration.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Administration.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,8 +21,8 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.entity.Company; import fr.ifremer.suiviobsmer.entity.CompanyImpl; import fr.ifremer.suiviobsmer.entity.WaoUser; @@ -30,7 +30,7 @@ import fr.ifremer.suiviobsmer.services.ServiceReferential; import fr.ifremer.suiviobsmer.services.ServiceUser; import fr.ifremer.suiviobsmer.ui.base.GenericSelectModel; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import fr.ifremer.suiviobsmer.ui.components.Layout; import java.util.List; import org.apache.commons.lang.StringUtils; @@ -58,7 +58,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/administration.css") -public class Administration implements SuiviObsmerPage { +public class Administration implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -114,7 +114,7 @@ private boolean addNewUserSelected; private boolean deleteUserSelected; - void setupRender() throws SuiviObsmerException { + void setupRender() throws WaoException { companies = null; getCompanies(); user = null; @@ -146,14 +146,14 @@ try { int result = serviceReferential.importFishingZoneCsv(fishingZoneCsvFile.getStream()); layout.getFeedBack().addInfo(result + " zones de pêche importées"); - } catch (SuiviObsmerException eee) { + } catch (WaoException eee) { layout.getFeedBack().addError(eee.getMessage()); } } /**************************** FORMS ****************************************/ - public List<Company> getCompanies() throws SuiviObsmerException { + public List<Company> getCompanies() throws WaoException { if (companies == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getCompanies]"); @@ -163,14 +163,14 @@ return companies; } - public GenericSelectModel<Company> getCompaniesSelectModel() throws SuiviObsmerException { + public GenericSelectModel<Company> getCompaniesSelectModel() throws WaoException { if (companiesSelectModel == null) { companiesSelectModel = new GenericSelectModel<Company>(getCompanies(), Company.class, Company.NAME, "id", propertyAccess); } return companiesSelectModel; } - public Company getCompany() throws SuiviObsmerException { + public Company getCompany() throws WaoException { if (company == null) { if (companyId != null) { company = getCompaniesSelectModel().findObject(companyId); @@ -181,7 +181,7 @@ return company; } - public boolean isUsersAvailable() throws SuiviObsmerException { + public boolean isUsersAvailable() throws WaoException { return !StringUtils.isEmpty(getCompany().getId()) && getCompany().getActive(); } @@ -197,13 +197,13 @@ user = null; } - void onSuccessFromCompany() throws SuiviObsmerException { + void onSuccessFromCompany() throws WaoException { serviceUser.createUpdateCompany(company); companyId = company.getId(); } @Log - public GenericSelectModel<WaoUser> getUsersSelectModel() throws SuiviObsmerException { + public GenericSelectModel<WaoUser> getUsersSelectModel() throws WaoException { if (usersSelectModel == null) { List<WaoUser> users = getCompany().getWaoUser(); if (log.isDebugEnabled()) { @@ -215,7 +215,7 @@ } @Log - public WaoUser getUser() throws SuiviObsmerException { + public WaoUser getUser() throws WaoException { if (user == null) { if (userId != null) { if (log.isDebugEnabled()) { @@ -242,7 +242,7 @@ deleteUserSelected = true; } - void onSuccessFromUserActionsForm() throws SuiviObsmerException { + void onSuccessFromUserActionsForm() throws WaoException { if (addNewUserSelected) { userId = null; } else if (deleteUserSelected && userId != null) { @@ -252,14 +252,14 @@ user = null; userId = null; layout.getFeedBack().addInfo("Utilisateur supprimé avec succès !"); - } catch (SuiviObsmerBusinessException eee) { + } catch (WaoBusinessException eee) { layout.getFeedBack().addError(eee.getMessage()); } } } @Log - void onSuccessFromUser() throws SuiviObsmerException { + void onSuccessFromUser() throws WaoException { if (log.isDebugEnabled()) { log.debug("User : " + user); } @@ -272,7 +272,7 @@ // TODO return true if mail ok serviceUser.createUpdateUser(user, generatePassword); userId = user.getId(); - } catch (SuiviObsmerBusinessException eee) { + } catch (WaoBusinessException eee) { layout.getFeedBack().addError(eee.getMessage()); } } Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/BoatActivityCalendar.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/BoatActivityCalendar.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/BoatActivityCalendar.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,7 +21,7 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.entity.ActivityCalendar; import fr.ifremer.suiviobsmer.entity.ActivityMonth; import fr.ifremer.suiviobsmer.entity.ActivityProfession; @@ -29,7 +29,7 @@ import fr.ifremer.suiviobsmer.entity.Boat; import fr.ifremer.suiviobsmer.entity.WaoUser; import fr.ifremer.suiviobsmer.services.ServiceBoat; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import java.util.Collections; import java.util.List; import org.apache.commons.lang.StringUtils; @@ -54,7 +54,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/boats.css") -public class BoatActivityCalendar implements SuiviObsmerPage { +public class BoatActivityCalendar implements WaoPage { @Inject private Logger log; @@ -103,7 +103,7 @@ return Collections.singletonList(boat); } - public ActivityCalendar getActivityCalendar() throws SuiviObsmerException { + public ActivityCalendar getActivityCalendar() throws WaoException { if (activityCalendar == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getLastActivityCalendar]"); @@ -113,7 +113,7 @@ return activityCalendar; } - public ActivityMonth getActivityMonth() throws SuiviObsmerException { + public ActivityMonth getActivityMonth() throws WaoException { return getActivityCalendar().getActivityMonth(month); } @@ -137,7 +137,7 @@ return getProfessionIndexMax() != -1; } - public ActivityProfession getActivityProfession() throws SuiviObsmerException { + public ActivityProfession getActivityProfession() throws WaoException { if (getActivityMonth() == null) { return null; } @@ -147,7 +147,7 @@ return getActivityMonth().getActivityProfession().get(professionIndex); } - public int getZoneIndexMax() throws SuiviObsmerException { + public int getZoneIndexMax() throws WaoException { int result = 0; for (ActivityMonth activityMonth : activityCalendar.getActivityMonth()) { month = activityMonth.getMonth(); @@ -174,7 +174,7 @@ // return getZoneIndexMax() != -1; // } - public ActivityZone getActivityZone() throws SuiviObsmerException { + public ActivityZone getActivityZone() throws WaoException { ActivityProfession profession = getActivityProfession(); if (profession == null) { return null; Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Boats.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,8 +21,8 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.bean.BoatFilterImpl; import fr.ifremer.suiviobsmer.entity.Boat; import fr.ifremer.suiviobsmer.bean.BoatFilter; @@ -41,7 +41,7 @@ import fr.ifremer.suiviobsmer.ui.base.AbstractFilteredPage; import fr.ifremer.suiviobsmer.ui.data.BusinessUtils; import fr.ifremer.suiviobsmer.ui.base.GenericSelectModel; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import fr.ifremer.suiviobsmer.ui.components.FeedBack; import fr.ifremer.suiviobsmer.ui.components.Layout; import fr.ifremer.suiviobsmer.ui.data.BoatDataSource; @@ -88,7 +88,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/boats.css") -public class Boats extends AbstractFilteredPage implements SuiviObsmerPage { +public class Boats extends AbstractFilteredPage implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -135,7 +135,7 @@ @InjectComponent private FeedBack filterFeedback; - void setupRender() throws SuiviObsmerException { + void setupRender() throws WaoException { sampleRow = null; getSampleRow(); // Profession select reset @@ -186,7 +186,7 @@ // Suppress persitant list of boats boats = null; layout.getFeedBack().addInfo(result[0] + " navires importés dont " + result[1] + " nouveaux"); - } catch (SuiviObsmerException eee) { + } catch (WaoException eee) { layout.getFeedBack().addError(eee.getMessage()); } } @@ -248,7 +248,7 @@ } @Log - void onSuccessFromImportActivityCalendarsForm() throws SuiviObsmerException, IOException { + void onSuccessFromImportActivityCalendarsForm() throws WaoException, IOException { InputStream input = activityCalendarsCsvFile.getStream(); if (log.isDebugEnabled()) { log.debug("Content type : " + activityCalendarsCsvFile.getContentType()); @@ -329,11 +329,11 @@ * Filters to apply on boats list. Method used by AbstractFilteredPage superclass. * * @return the current BoatFilter to apply - * @throws SuiviObsmerException + * @throws WaoException * @see AbstractFilteredPage */ @Override - public BoatFilter getFilter() throws SuiviObsmerException { + public BoatFilter getFilter() throws WaoException { if (boatFilter == null) { if (log.isDebugEnabled()) { log.debug("Create filter"); @@ -355,9 +355,9 @@ * When the sampleRow is not null, the filters are disabled to optimize searching boats for this row. * * @return the sampleRow from business - * @throws SuiviObsmerException + * @throws WaoException */ - public SampleRow getSampleRow() throws SuiviObsmerException { + public SampleRow getSampleRow() throws WaoException { if (sampleRow == null && !StringUtils.isEmpty(sampleRowContextId)) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getSampleRow]"); @@ -367,11 +367,11 @@ return sampleRow; } - public boolean isSampleRowExists() throws SuiviObsmerException { + public boolean isSampleRowExists() throws WaoException { return getSampleRow() != null; } - public GenericSelectModel<Profession> getProfessionSelectModel() throws SuiviObsmerException { + public GenericSelectModel<Profession> getProfessionSelectModel() throws WaoException { if (professionSelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getProfessions]"); @@ -414,11 +414,11 @@ * EVENT_SELECTED :: search sumit button for filtersForm. Get profession from selectModel to add it in filters. * Other filters are managed by AbstractFilteredPage superclass. * - * @throws SuiviObsmerException for business errors + * @throws WaoException for business errors * @see AbstractFilteredPage#onSelectedFromSearch() */ @Override - public void onSelectedFromSearch() throws SuiviObsmerException { + public void onSelectedFromSearch() throws WaoException { super.onSelectedFromSearch(); if (log.isDebugEnabled()) { log.debug("FILTER : facadeName=" + boatFilter.getFacadeName()); @@ -438,9 +438,9 @@ * EVENT_SUCCESS :: for filtersForm. Reset persitant data to have new data using filters selected. * * @return the filtersZone if it's a refresh data for select, or the page otherwise - * @throws SuiviObsmerException for business errors + * @throws WaoException for business errors */ - Object onSuccessFromFiltersForm() throws SuiviObsmerException { + Object onSuccessFromFiltersForm() throws WaoException { if (isEdited()) { return filtersZone.getBody(); } @@ -475,10 +475,10 @@ * BoatDataSource uses serviceBoat to retrieve boats with filters. * * @return the BoatDataSource which contains the boats map - * @throws SuiviObsmerException + * @throws WaoException * @see BoatDataSource */ - public BoatDataSource getBoats() throws SuiviObsmerException { + public BoatDataSource getBoats() throws WaoException { if (boats == null) { boats = new BoatDataSource(getFilter(), serviceBoat); } @@ -508,7 +508,7 @@ return new SimpleDateFormat("dd/MM/yyyy"); } - public boolean canCreateNewContactFromList() throws SuiviObsmerException { + public boolean canCreateNewContactFromList() throws WaoException { if (!user.getAdmin() && isSampleRowExists()) { return boat.canCreateContact(user.getCompany()); } @@ -526,7 +526,7 @@ log.debug("Filter sampleRow : " + getFilter().getSampleRow()); } result = serviceBoat.exportBoatCsv(getFilter()); - } catch (SuiviObsmerException eee) { + } catch (WaoException eee) { throw new IOException(eee); } return result; @@ -534,7 +534,7 @@ }; } - Block onActionFromShowBoatInfos(Integer boatImma) throws SuiviObsmerException { + Block onActionFromShowBoatInfos(Integer boatImma) throws WaoException { boatSelectedImmatriculation = boatImma; // Suppress persistant boat informations companyBoatInfos = null; @@ -585,12 +585,12 @@ private Company company; /*@Persist - private SuiviObsmerPropertyChangeListener propertyChange;*/ + private WaoPropertyChangeListener propertyChange;*/ /** /////////////////////// GLOBAL TO THE BLOCK /////////////////////// **/ public boolean isActivityCalendarImportRun() { - return SuiviObsmerContext.isActivityCalendarImportRun(); + return WaoContext.isActivityCalendarImportRun(); } public Block getActiveBoatInfosBlock() { @@ -600,7 +600,7 @@ return displayBoatInfos; } - public CompanyBoatInfos getCompanyBoatInfos() throws SuiviObsmerException { + public CompanyBoatInfos getCompanyBoatInfos() throws WaoException { if (companyBoatInfos == null && boatSelectedImmatriculation != null && getCompany() != null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getElligibleBoats]"); @@ -615,9 +615,9 @@ * will be used for this model. * * @return the GenericSelectModel<Company> - * @throws SuiviObsmerException + * @throws WaoException */ - public GenericSelectModel<Company> getCompanies() throws SuiviObsmerException { + public GenericSelectModel<Company> getCompanies() throws WaoException { if (companies == null) { if (log.isDebugEnabled()) { log.debug("BUSINESS REQUEST [getCompanies]"); @@ -633,9 +633,9 @@ * selected one otherwise. * * @return the current Company - * @throws SuiviObsmerException + * @throws WaoException */ - public Company getCompany() throws SuiviObsmerException { + public Company getCompany() throws WaoException { if (company == null) { if (StringUtils.isNotEmpty(companySelectedId)) { company = getCompanies().findObject(companySelectedId); @@ -650,9 +650,9 @@ * Used to get the selected boat. * * @return the selected boat from the grid - * @throws SuiviObsmerException + * @throws WaoException */ - public Boat getBoatSelected() throws SuiviObsmerException { + public Boat getBoatSelected() throws WaoException { if (log.isDebugEnabled()) { log.debug("selected imma : " + boatSelectedImmatriculation); log.debug("exist boat ? : " + getBoats().contains(boatSelectedImmatriculation)); @@ -684,7 +684,7 @@ this.boardingFromDate = boardingFromDate; } - public BoatInfos getBoatInfos() throws SuiviObsmerException { + public BoatInfos getBoatInfos() throws WaoException { if (getCompanyBoatInfos() == null) { return null; } @@ -695,10 +695,10 @@ * Get CSS style class to apply on lastContact depends on its state. * * @return the CSS style to apply on contact block - * @throws SuiviObsmerException + * @throws WaoException * @see BusinessUtils#getContactStyle(Contact, boolean) */ - public String getlastContactStyle() throws SuiviObsmerException { + public String getlastContactStyle() throws WaoException { Contact contact = getCompanyBoatInfos().getLastContact(); return BusinessUtils.getContactStyle(contact, user.getAdmin()); } @@ -713,7 +713,7 @@ return BooleanUtils.isFalse(elligibleBoat.getCompanyActive()); } - public boolean canCreateNewContactFromElligibleBoat() throws SuiviObsmerException { + public boolean canCreateNewContactFromElligibleBoat() throws WaoException { if (!user.getAdmin() && !isElligibleBoatCompanyActiveFalse()) { Boat currentBoat = getBoatInfos().getBoat(); return currentBoat.canCreateContact(user.getCompany()); @@ -728,19 +728,19 @@ /** /////////////////////// ACTIONS //////////////////////////////////// **/ - void onSuccess() throws SuiviObsmerException { + void onSuccess() throws WaoException { if (getBoatInfos() != null) { boatSelectedImmatriculation = getBoatInfos().getBoat().getImmatriculation(); } } - Block onSuccessFromCompanySelectForm() throws SuiviObsmerException { + Block onSuccessFromCompanySelectForm() throws WaoException { companyBoatInfos = null; getCompanyBoatInfos(); return boatInfosZone.getBody(); } - Block onActionFromEditBoatInfos() throws SuiviObsmerException { + Block onActionFromEditBoatInfos() throws WaoException { boatInfosEditable = true; // WARNING :: Reset sampleRow select for edition mode, no limit for // showing sampleRows instead of filters @@ -750,7 +750,7 @@ return boatInfosZone.getBody(); } - Block onActionFromCancelEditBoatInfos() throws SuiviObsmerException { + Block onActionFromCancelEditBoatInfos() throws WaoException { /*if (propertyChange.isChanged()) { if (log.isDebugEnabled()) { log.debug("Change property"); @@ -764,7 +764,7 @@ return boatInfosZone.getBody(); } - void onSelectedFromAddBoatInfosSampleRow() throws SuiviObsmerException { + void onSelectedFromAddBoatInfosSampleRow() throws WaoException { // We stay in edition mode boatInfosEditable = true; if (StringUtils.isNotEmpty(boatInfosSampleRowId)) { @@ -773,17 +773,17 @@ } } - void onSelectedFromRemoveBoatInfosSampleRow(String sampleRowCode) throws SuiviObsmerException { + void onSelectedFromRemoveBoatInfosSampleRow(String sampleRowCode) throws WaoException { boatInfosEditable = true; companyBoatInfos.removeElligibleBoat(sampleRowCode); } - void onSelectedFromActiveBoatInfosSampleRow(String sampleRowCode) throws SuiviObsmerException { + void onSelectedFromActiveBoatInfosSampleRow(String sampleRowCode) throws WaoException { boatInfosEditable = true; companyBoatInfos.activeElligibleBoat(sampleRowCode); } - Block onSuccessFromBoatInfosForm() throws SuiviObsmerException { + Block onSuccessFromBoatInfosForm() throws WaoException { if (!boatInfosEditable) { // Save data serviceBoat.createUpdateCompanyBoatInfos(companyBoatInfos); @@ -792,7 +792,7 @@ return boatInfosZone.getBody(); } - Block onSuccessFromCalculateBoardings() throws SuiviObsmerException { + Block onSuccessFromCalculateBoardings() throws WaoException { //boatSelectedImmatriculation = getBoatInfos().getBoat().getImmatriculation(); return boatInfosZone.getBody(); } @@ -802,7 +802,7 @@ @InjectPage private Contacts contacts; - Object onActionFromAddNewContactFromBoat(int boatImmatriculation) throws SuiviObsmerException { + Object onActionFromAddNewContactFromBoat(int boatImmatriculation) throws WaoException { // Get selected sampleRow sampleRow = getSampleRow(); // Get boat from list @@ -811,7 +811,7 @@ return contacts; } - Object onActionFromAddNewContactFromSampleRow(String sampleRowCode) throws SuiviObsmerException { + Object onActionFromAddNewContactFromSampleRow(String sampleRowCode) throws WaoException { // Get sampleRow from elligibleBoat list ElligibleBoat elligible = getCompanyBoatInfos().getElligibleBoat(sampleRowCode); sampleRow = elligible.getSampleRow(); @@ -824,11 +824,11 @@ @InjectPage private BoatActivityCalendar calendarPage; - public boolean hasActivityCalendar() throws SuiviObsmerException { + public boolean hasActivityCalendar() throws WaoException { return getBoatSelected().sizeActivityCalendar() != 0; } - Object onActionFromShowLastActivityCalendar() throws SuiviObsmerException { + Object onActionFromShowLastActivityCalendar() throws WaoException { calendarPage.setBoat(getBoatSelected()); return calendarPage; } Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Contacts.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,9 +21,9 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.bean.BoatFilter; import fr.ifremer.suiviobsmer.bean.ContactFilter; import fr.ifremer.suiviobsmer.bean.ContactFilterImpl; @@ -40,7 +40,7 @@ import fr.ifremer.suiviobsmer.ui.data.ContactDataSource; import fr.ifremer.suiviobsmer.ui.data.BusinessUtils; import fr.ifremer.suiviobsmer.ui.base.GenericSelectModel; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import fr.ifremer.suiviobsmer.ui.components.Layout; import fr.ifremer.suiviobsmer.ui.data.ExportStreamResponse; import fr.ifremer.suiviobsmer.ui.services.ContactModelFactory; @@ -84,7 +84,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/contacts.css") -public class Contacts extends AbstractFilteredPage implements SuiviObsmerPage { +public class Contacts extends AbstractFilteredPage implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -114,7 +114,7 @@ // private String contactEditedId; @Log - void setupRender() throws SuiviObsmerException { + void setupRender() throws WaoException { // if (contactEdited == null) { if (log.isDebugEnabled()) { log.debug("RESET DATA"); @@ -142,7 +142,7 @@ @Property private ContactState stateFilter; - public ContactFilter getContactFilter() throws SuiviObsmerException { + public ContactFilter getContactFilter() throws WaoException { if (contactFilter == null) { if (log.isDebugEnabled()) { log.debug("Init contactFilter"); @@ -161,7 +161,7 @@ } @Override - protected BoatFilter getFilter() throws SuiviObsmerException { + protected BoatFilter getFilter() throws WaoException { return getContactFilter(); } @@ -184,7 +184,7 @@ } @Log - Object onSuccessFromFiltersForm() throws SuiviObsmerException { + Object onSuccessFromFiltersForm() throws WaoException { if (isEdited()) { return filtersZone.getBody(); } @@ -203,7 +203,7 @@ private UploadedFile contactsCsvFile; @Log - void onSuccessFromImportContacts() throws SuiviObsmerException { + void onSuccessFromImportContacts() throws WaoException { //importBoatsForm.clearErrors(); try { ImportResults result = serviceContact.importContactCsv(user, contactsCsvFile.getStream()); @@ -214,7 +214,7 @@ for (String error : result.getErrors()) { layout.getFeedBack().addInfo(error); } - } catch (SuiviObsmerBusinessException eee) { + } catch (WaoBusinessException eee) { layout.getFeedBack().addError(eee.getMessage()); } //return importBoatsForm.getHasErrors() ? importBoatsForm : this; @@ -228,7 +228,7 @@ InputStream result = null; try { result = serviceContact.exportContactCsv(getContactFilter()); - } catch (SuiviObsmerException eee) { + } catch (WaoException eee) { throw new IOException(eee); } return result; @@ -269,7 +269,7 @@ private boolean even = true; - public ContactDataSource getContacts() throws SuiviObsmerException { + public ContactDataSource getContacts() throws WaoException { if (contacts == null) { if (log.isInfoEnabled()) { log.info("Create DataSource"); @@ -279,7 +279,7 @@ return contacts; } -// public Map<String, Contact> getContacts() throws SuiviObsmerException { +// public Map<String, Contact> getContacts() throws WaoException { // if (contacts == null) { // if (log.isInfoEnabled()) { // log.info("BUSINESS REQUEST [getContactsByFilter]"); @@ -340,7 +340,7 @@ return BusinessUtils.getTooltipBoat(contact.getBoat()); } - public String getTooltipExportFrom() throws SuiviObsmerException { + public String getTooltipExportFrom() throws WaoException { if (getContactFilter().getFromDate() != null) { return "depuis le " + getDateFormat().format(getContactFilter().getFromDate()); } @@ -388,7 +388,7 @@ @Persist private String oldComment; - public void prepareContactEdited(String contactId) throws SuiviObsmerException { + public void prepareContactEdited(String contactId) throws WaoException { if (contactEdited == null) { contactEdited = getContacts().get(contactId); } @@ -420,7 +420,7 @@ return contact.getValidationProgram() != null; } - void onSelectedFromAcceptContact(String contactId) throws SuiviObsmerException { + void onSelectedFromAcceptContact(String contactId) throws WaoException { //contact = getContacts().get(contactId); prepareContactEdited(contactId); if (user.getAdmin()) { @@ -432,7 +432,7 @@ } } - void onSelectedFromRefuseContact(String contactId) throws SuiviObsmerException { + void onSelectedFromRefuseContact(String contactId) throws WaoException { //contact = getContacts().get(contactId); prepareContactEdited(contactId); if (user.getAdmin()) { @@ -444,7 +444,7 @@ } } - void onSelectedFromUnvalidateContact(String contactId) throws SuiviObsmerException { + void onSelectedFromUnvalidateContact(String contactId) throws WaoException { //contact = getContacts().get(contactId); prepareContactEdited(contactId); if (user.getAdmin()) { @@ -463,7 +463,7 @@ } } - void onSelectedFromEditContact(String contactId) throws SuiviObsmerException { + void onSelectedFromEditContact(String contactId) throws WaoException { //contact = getContacts().get(contactId); prepareContactEdited(contactId); contactUserId = contactEdited.getObserver().getTopiaId(); @@ -473,13 +473,13 @@ edited = true; } - void onSelectedFromDeleteContact(String contactId) throws SuiviObsmerException { + void onSelectedFromDeleteContact(String contactId) throws WaoException { //contact = getContacts().get(contactId); prepareContactEdited(contactId); deleted = true; } - void onSelectedFromSaveContact(String contactId) throws SuiviObsmerException { + void onSelectedFromSaveContact(String contactId) throws WaoException { //contact = getContacts().get(contactId); prepareContactEdited(contactId); contactEdited.setState(contactState.toString()); @@ -491,13 +491,13 @@ } } - void onSelectedFromCancelEditContact() throws SuiviObsmerException { + void onSelectedFromCancelEditContact() throws WaoException { contactEdited = null; edited = true; } // @Log -// void onSelectedFromSaveComment(String contactId) throws SuiviObsmerException { +// void onSelectedFromSaveComment(String contactId) throws WaoException { // contact = getContacts().get(contactId); // if (log.isInfoEnabled()) { // log.info("Comment : " + contact.getComment()); @@ -556,7 +556,7 @@ contactsForm.recordError(endDate, "La date de fin de la marée ne peut pas être antérieure à celle de début"); } - Date current = SuiviObsmerContext.getCurrentDate(); + Date current = WaoContext.getCurrentDate(); if (end != null && end.after(current)) { contactsForm.recordError(endDate, "La date de fin de la marée ne peut pas être postérieure à la date du jour"); @@ -610,7 +610,7 @@ contactSelectedId = contactEdited.getTopiaId(); oldComment = null; contactEdited = null; - } catch (SuiviObsmerException eee) { + } catch (WaoException eee) { layout.getFeedBack().addError(eee.getMessage()); } } @@ -630,7 +630,7 @@ //return gridZone; } - public void createNewContact(Boat boat, SampleRow sampleRow) throws SuiviObsmerException { + public void createNewContact(Boat boat, SampleRow sampleRow) throws WaoException { contact = serviceContact.getNewContact(user, sampleRow, boat); serviceContact.saveContact(contact, Boolean.FALSE); contactSelectedId = contact.getTopiaId(); Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/ExceptionReport.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/ExceptionReport.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/ExceptionReport.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,8 +21,8 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import fr.ifremer.suiviobsmer.ui.components.Layout; import org.apache.tapestry5.annotations.InjectComponent; import org.apache.tapestry5.annotations.Property; @@ -41,7 +41,7 @@ * Mise a jour: $Date$ * par : $Author$ */ -public class ExceptionReport implements ExceptionReporter, SuiviObsmerPage { +public class ExceptionReport implements ExceptionReporter, WaoPage { @InjectComponent private Layout layout; @@ -54,7 +54,7 @@ @Override public void reportException(Throwable eee) { - this.exception = getSuiviObsmerException(eee); + this.exception = getWaoException(eee); if (exception != null) { layout.getFeedBack().addError(exception.getMessage()); this.exception = exception.getCause(); @@ -65,14 +65,14 @@ layout.getFeedBack().addError("Erreur : " + this.exception.getClass().getSimpleName() + " : " + this.exception.getMessage()); } - protected Throwable getSuiviObsmerException(Throwable eee) { + protected Throwable getWaoException(Throwable eee) { if (eee == null) { return eee; } - if (eee instanceof SuiviObsmerException) { + if (eee instanceof WaoException) { return eee; } - return getSuiviObsmerException(eee.getCause()); + return getWaoException(eee.getCause()); } @Override Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Index.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Index.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Index.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,12 +21,12 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.entity.News; import fr.ifremer.suiviobsmer.entity.NewsImpl; import fr.ifremer.suiviobsmer.entity.WaoUser; import fr.ifremer.suiviobsmer.services.ServiceNews; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -54,7 +54,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/news.css") -public class Index implements SuiviObsmerPage { +public class Index implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -92,7 +92,7 @@ @Log - void setupRender() throws SuiviObsmerException { + void setupRender() throws WaoException { if (editedId == null || !"NEW".equals(editedId)) { newsList = null; getNewsList(); @@ -109,7 +109,7 @@ // return editedId; // } - public List<News> getNewsList() throws SuiviObsmerException { + public List<News> getNewsList() throws WaoException { if (newsList == null) { newsList = serviceNews.getNews(); } @@ -131,7 +131,7 @@ return dateFormat; } - void onActionFromAddNews() throws SuiviObsmerException { + void onActionFromAddNews() throws WaoException { news = new NewsImpl(); // Create a new list with the new news in first position List<News> list = new ArrayList<News>(); @@ -141,12 +141,12 @@ editedId = "NEW"; } - void onActionFromEditNews(int rowIndex) throws SuiviObsmerException { + void onActionFromEditNews(int rowIndex) throws WaoException { news = getNewsList().get(rowIndex); this.editedId = news.getTopiaId(); } - void onActionFromDeleteNews(int rowIndex) throws SuiviObsmerException { + void onActionFromDeleteNews(int rowIndex) throws WaoException { news = getNewsList().get(rowIndex); serviceNews.saveNews(news, true); //newsList = null; @@ -155,11 +155,11 @@ void onActionFromCancelEdit() { } - void onSelectedFromSaveNews(int rowIndex) throws SuiviObsmerException { + void onSelectedFromSaveNews(int rowIndex) throws WaoException { news = getNewsList().get(rowIndex); } - void onSuccessFromNewsForm() throws SuiviObsmerException { + void onSuccessFromNewsForm() throws WaoException { serviceNews.saveNews(news, false); //this.editedId = null; if (log.isDebugEnabled()) { Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowForm.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,9 +21,9 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerContext; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoContext; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.entity.Boat; import fr.ifremer.suiviobsmer.entity.Company; import fr.ifremer.suiviobsmer.entity.FishingZone; @@ -39,8 +39,8 @@ import fr.ifremer.suiviobsmer.services.ServiceSampling; import fr.ifremer.suiviobsmer.services.ServiceUser; import fr.ifremer.suiviobsmer.ui.base.GenericSelectModel; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; -import fr.ifremer.suiviobsmer.ui.data.SuiviObsmerPropertyChangeListener; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; +import fr.ifremer.suiviobsmer.ui.data.WaoPropertyChangeListener; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -80,7 +80,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/sampling.css") -public class SampleRowForm implements SuiviObsmerPage { +public class SampleRowForm implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -121,7 +121,7 @@ return sampleRowId; } - void setupRender() throws SuiviObsmerException { + void setupRender() throws WaoException { // Reset data sampleRow = null; getSampleRow(); @@ -180,9 +180,9 @@ * Get SelectModel for profession input Select. The select contains all existing professions. * * @return a GenericSelectModel<Profession> - * @throws SuiviObsmerException + * @throws WaoException */ - public GenericSelectModel<Profession> getProfessionSelectModel() throws SuiviObsmerException { + public GenericSelectModel<Profession> getProfessionSelectModel() throws WaoException { if (professionSelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getProfessions]"); @@ -206,9 +206,9 @@ /** * Action on submit : addNewProfession. Used to set a new profession from the selected one. * - * @throws SuiviObsmerException + * @throws WaoException */ - void onSelectedFromAddNewProfession() throws SuiviObsmerException { + void onSelectedFromAddNewProfession() throws WaoException { Profession profession = new ProfessionImpl(); if (!StringUtils.isEmpty(professionId)) { Profession professionSelected = getProfessionSelectModel().findObject(professionId); @@ -247,9 +247,9 @@ * Get the select model for FishingZone. The select contains all existing fishingZones. * * @return a GenericSelectModel<FishingZone> - * @throws SuiviObsmerException + * @throws WaoException */ - public GenericSelectModel<FishingZone> getFishingZoneSelectModel() throws SuiviObsmerException { + public GenericSelectModel<FishingZone> getFishingZoneSelectModel() throws WaoException { if (fishingZoneSelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getFishingZones]"); @@ -265,18 +265,18 @@ * Get the list of FishingZones from the SampleRow. * * @return a List of FishingZone linked with the SampleRow - * @throws SuiviObsmerException + * @throws WaoException */ - public List<FishingZone> getFishingZones() throws SuiviObsmerException { + public List<FishingZone> getFishingZones() throws WaoException { return getSampleRow().getFishingZone(); } /** * Action on submit : addFishingZone. Used to add the selected fishingZone to the SampleRow. * - * @throws SuiviObsmerException + * @throws WaoException */ - void onSelectedFromAddFishingZone() throws SuiviObsmerException { + void onSelectedFromAddFishingZone() throws WaoException { fishingZone = getFishingZoneSelectModel().findObject(fishingZoneId); if (!getFishingZones().contains(fishingZone)) { if (log.isDebugEnabled()) { @@ -291,9 +291,9 @@ * Action on submit : removeFishingZone. Used to remove the fishingZone from the SampleRow. * * @param index of the FishingZone in the list (from loop component) - * @throws SuiviObsmerException + * @throws WaoException */ - void onSelectedFromRemoveFishingZone(int index) throws SuiviObsmerException { + void onSelectedFromRemoveFishingZone(int index) throws WaoException { if (log.isDebugEnabled()) { log.debug("Remove fishingZone at position : " + index); } @@ -340,7 +340,7 @@ private boolean periodChanged; - public SelectModel getProgramSelectModel() throws SuiviObsmerException { + public SelectModel getProgramSelectModel() throws WaoException { if (programSelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getPrograms]"); @@ -354,7 +354,7 @@ return programSelectModel; } -// public List<Date> getMonths() throws SuiviObsmerException { +// public List<Date> getMonths() throws WaoException { // if (months == null) { // if (log.isDebugEnabled()) { // log.debug("Reset months list"); @@ -366,11 +366,11 @@ // return months; // } -// public Program getProgram() throws SuiviObsmerException { +// public Program getProgram() throws WaoException { // return getSampleRow().getProgram(); // } - public PeriodDates getPeriod() throws SuiviObsmerException { + public PeriodDates getPeriod() throws WaoException { if (period == null) { Date begin = getSampleRow().getPeriodBegin(); Date end = getSampleRow().getPeriodEnd(); @@ -379,7 +379,7 @@ return period; } - public List<SampleMonth> getSampleMonths() throws SuiviObsmerException { + public List<SampleMonth> getSampleMonths() throws WaoException { if (sampleMonths == null) { sampleMonths = new ArrayList<SampleMonth>(); for (Date currMonth : getPeriod().getMonths()) { @@ -405,7 +405,7 @@ public String getMonthStyle() { String style = " "; - Date current = SuiviObsmerContext.getCurrentDate(); + Date current = WaoContext.getCurrentDate(); if (sampleMonth.isCurrentMonth()) { style += "selected"; } else if (current.after(sampleMonth.getPeriodDate())) { @@ -417,10 +417,10 @@ /** * Search a program from the list. * The program will be set from the one selected. If no selection, a new one will be set. - * @throws SuiviObsmerException + * @throws WaoException */ // @Log -// void onSelectedFromSearchProgram() throws SuiviObsmerException { +// void onSelectedFromSearchProgram() throws WaoException { // if (!StringUtils.isEmpty(programId)) { // programName = null; //// period = null; @@ -436,10 +436,10 @@ * Refresh months from program period. * If the programName is not empty, a new program will be set. * The period dates will be saved in program (validation will be done in onSuccess). - * @throws SuiviObsmerException + * @throws WaoException */ @Log - void onSelectedFromRefreshMonths() throws SuiviObsmerException { + void onSelectedFromRefreshMonths() throws WaoException { getSampleRow().setPeriod(period); periodChanged = true; // Reset sampleMonths for new period @@ -448,7 +448,7 @@ saveProgram(); } - protected void saveProgram() throws SuiviObsmerException { + protected void saveProgram() throws WaoException { // Save programName if (StringUtils.isNotEmpty(programName)) { getSampleRow().setProgramName(programName); @@ -462,7 +462,7 @@ } @Log - void onSelectedFromDeleteMonth(int index) throws SuiviObsmerException { + void onSelectedFromDeleteMonth(int index) throws WaoException { getSampleMonths().remove(index); edited = true; } @@ -498,16 +498,16 @@ private boolean cancel; @Persist - private SuiviObsmerPropertyChangeListener propertyChange; + private WaoPropertyChangeListener propertyChange; - public SampleRow getSampleRow() throws SuiviObsmerException { + public SampleRow getSampleRow() throws WaoException { if (sampleRow == null) { if (!StringUtils.isEmpty(sampleRowId)) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getSampleRow]"); } sampleRow = serviceSampling.getSampleRow(sampleRowId); - propertyChange = new SuiviObsmerPropertyChangeListener(); + propertyChange = new WaoPropertyChangeListener(); for (SampleMonth month : sampleRow.getSampleMonth()) { month.addPropertyChangeListener(SampleMonth.EXPECTED_TIDES_VALUE, propertyChange); } @@ -518,7 +518,7 @@ return sampleRow; } - public SampleRowLog getSampleRowLog() throws SuiviObsmerException { + public SampleRowLog getSampleRowLog() throws WaoException { if (sampleRowLog == null) { sampleRowLog = new SampleRowLogImpl(); sampleRowLog.setSampleRow(getSampleRow()); @@ -537,7 +537,7 @@ return sampleRowModel; } - public GenericSelectModel<Company> getCompanySelectModel() throws SuiviObsmerException { + public GenericSelectModel<Company> getCompanySelectModel() throws WaoException { if (companySelectModel == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getCompanies]"); @@ -549,7 +549,7 @@ return companySelectModel; } - public boolean isCreateMode() throws SuiviObsmerException { + public boolean isCreateMode() throws WaoException { return StringUtils.isEmpty(getSampleRow().getTopiaId()); } @@ -557,12 +557,12 @@ cancel = true; } - void onSelectedFromSaveData() throws SuiviObsmerException { + void onSelectedFromSaveData() throws WaoException { saveProgram(); } @Log - void onValidateFormFromSampleRowForm() throws SuiviObsmerException { + void onValidateFormFromSampleRowForm() throws WaoException { sampleRowForm.clearErrors(); try { // Only for save or periodChanged (refreshMonth) @@ -641,7 +641,7 @@ getSampleRow().setCode(rowCode); } } - } catch (SuiviObsmerBusinessException eee) { + } catch (WaoBusinessException eee) { sampleRowForm.recordError(eee.getMessage()); log.error("BUSINESS ERROR : " + eee.getType() + " depuis " + eee.getServiceName() + " : " + eee.getMessage()); @@ -653,7 +653,7 @@ } @Log - Object onSuccessFromSampleRowForm() throws SuiviObsmerException { + Object onSuccessFromSampleRowForm() throws WaoException { if (cancel) { return this; } Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowHistoric.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowHistoric.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SampleRowHistoric.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,11 +21,11 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.entity.SampleRow; import fr.ifremer.suiviobsmer.entity.SampleRowLog; import fr.ifremer.suiviobsmer.services.ServiceSampling; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Locale; @@ -47,7 +47,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/sampling.css") -public class SampleRowHistoric implements SuiviObsmerPage { +public class SampleRowHistoric implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -76,12 +76,12 @@ return sampleRowId; } - void setupRender() throws SuiviObsmerException { + void setupRender() throws WaoException { sampleRow = null; getSampleRow(); } - public SampleRow getSampleRow() throws SuiviObsmerException { + public SampleRow getSampleRow() throws WaoException { if (sampleRow == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getSampleRow]"); Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/SamplingPlan.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -22,8 +22,8 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.bean.FacadeRow; import fr.ifremer.suiviobsmer.bean.ImportResults; import fr.ifremer.suiviobsmer.entity.Company; @@ -32,7 +32,7 @@ import fr.ifremer.suiviobsmer.entity.SampleRow; import fr.ifremer.suiviobsmer.entity.WaoUser; import fr.ifremer.suiviobsmer.services.ServiceSampling; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import fr.ifremer.suiviobsmer.ui.components.Layout; import fr.ifremer.suiviobsmer.ui.data.ExportStreamResponse; import java.io.IOException; @@ -66,7 +66,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/sampling.css") -public class SamplingPlan implements SuiviObsmerPage { +public class SamplingPlan implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -111,7 +111,7 @@ private UploadedFile samplingPlanCsvFile; @Log - void onSuccessFromImportSamplingPlan() throws SuiviObsmerException { + void onSuccessFromImportSamplingPlan() throws WaoException { try { ImportResults result = serviceSampling.importSamplingPlanCsv(samplingPlanCsvFile.getStream()); layout.getFeedBack().addInfo(result.getNbRowsImported() + " lignes du plan importés, " + @@ -119,7 +119,7 @@ for (String error : result.getErrors()) { layout.getFeedBack().addInfo(error); } - } catch (SuiviObsmerBusinessException eee) { + } catch (WaoBusinessException eee) { layout.getFeedBack().addError(eee.getMessage()); } } @@ -134,7 +134,7 @@ InputStream result = null; try { result = serviceSampling.exportSamplingPlanCsv(user, getPeriod()); - } catch (SuiviObsmerException eee) { + } catch (WaoException eee) { throw new IOException(eee); } return result; @@ -196,9 +196,9 @@ /** * Return List of SampleRow from suiviobsmer-business * @return List of SampleRow - * @throws SuiviObsmerException + * @throws WaoException */ - public List<SampleRow> getData() throws SuiviObsmerException { + public List<SampleRow> getData() throws WaoException { if (data == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getSampleRowsOrderedByFishingZone]"); @@ -374,15 +374,15 @@ /** * Used to filter period using dates from the program selected in table. * @param rowIndex index of the row in the table - * @throws SuiviObsmerException for a data problem + * @throws WaoException for a data problem */ - void onActionFromFilterPeriodDates(int rowIndex) throws SuiviObsmerException { + void onActionFromFilterPeriodDates(int rowIndex) throws WaoException { row = getData().get(rowIndex); period.setFromDate(row.getPeriodBegin()); period.setThruDate(row.getPeriodEnd()); } - void onActionFromDeleteSampleRow(int rowIndex) throws SuiviObsmerException { + void onActionFromDeleteSampleRow(int rowIndex) throws WaoException { row = getData().get(rowIndex); serviceSampling.deleteSampleRow(row); } Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Synthesis.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Synthesis.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/Synthesis.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,7 +21,7 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.bean.BoardingResult; import fr.ifremer.suiviobsmer.bean.BoatFilter; import fr.ifremer.suiviobsmer.bean.BoatFilterImpl; @@ -32,7 +32,7 @@ import fr.ifremer.suiviobsmer.entity.WaoUser; import fr.ifremer.suiviobsmer.services.ServiceSynthesis; import fr.ifremer.suiviobsmer.ui.base.AbstractFilteredPage; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import fr.ifremer.suiviobsmer.ui.data.BusinessUtils; import fr.ifremer.suiviobsmer.ui.data.ChartUtils; import fr.ifremer.suiviobsmer.ui.data.ChartUtils.ChartType; @@ -74,7 +74,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/synthesis.css") -public class Synthesis extends AbstractFilteredPage implements SuiviObsmerPage { +public class Synthesis extends AbstractFilteredPage implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -100,7 +100,7 @@ @InjectComponent private Zone delegator; - public Block getActiveBlock() throws SuiviObsmerException { + public Block getActiveBlock() throws WaoException { if (activeSynthesis == null) { // Initialize default synthesis by Data Sampling activeSynthesis = SynthesisId.GRAPH_SAMPLING; @@ -160,12 +160,12 @@ private boolean reset; - private void initSamplingBlock() throws SuiviObsmerException { + private void initSamplingBlock() throws WaoException { initSelectFilters(true, false, true); } @Override - public BoatFilter getFilter() throws SuiviObsmerException { + public BoatFilter getFilter() throws WaoException { if (dataSamplingFilter == null) { dataSamplingFilter = new BoatFilterImpl(); if (!user.getAdmin()) { @@ -175,7 +175,7 @@ return dataSamplingFilter; } - public PeriodDates getPeriod() throws SuiviObsmerException { + public PeriodDates getPeriod() throws WaoException { if (getFilter().getPeriod() == null) { PeriodDates period = PeriodDates.createMonthsPeriodFromToday(-12); if (log.isDebugEnabled()) { @@ -191,7 +191,7 @@ return false; } - public JFreeChart getDataSamplingChart() throws SuiviObsmerException { + public JFreeChart getDataSamplingChart() throws WaoException { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getDataSampling]"); } @@ -238,7 +238,7 @@ @Property private String companyIdForBoarding; - private void initBoardingBlock() throws SuiviObsmerException { + private void initBoardingBlock() throws WaoException { resetCompanySelect(); // Set the companyIdForBoarding is only necessary for an admin which // have access to a select with all active companies (from Filters : @@ -251,7 +251,7 @@ } } - public JFreeChart getBoardingBoatsChart() throws SuiviObsmerException { + public JFreeChart getBoardingBoatsChart() throws WaoException { Map<String, Map<?, Integer>> data = new HashMap<String, Map<?, Integer>>(); data.put("Navires", getBoardingResult().getData()); @@ -267,7 +267,7 @@ "Nb embarquements", ChartType.BAR, data); } - public BoardingResult getBoardingResult() throws SuiviObsmerException { + public BoardingResult getBoardingResult() throws WaoException { if (boardingResult == null) { if (log.isInfoEnabled()) { log.info("BUSINESS REQUEST [getBoardingBoats]"); @@ -295,7 +295,7 @@ } @Log - void onSuccessFromFilterCompanyForBoarding() throws SuiviObsmerException { + void onSuccessFromFilterCompanyForBoarding() throws WaoException { companyForBoarding = getCompanySelectModel().findObject(companyIdForBoarding); } @@ -312,10 +312,10 @@ * only one row, if the current user is an observer. * * @return a Map with companies and there values for nonComplianceBoarding - * @throws SuiviObsmerException + * @throws WaoException */ public Map<String, Double> getNonComplianceBoarding() - throws SuiviObsmerException { + throws WaoException { if (nonComplianceBoarding == null) { Company company = !user.getAdmin() ? user.getCompany() : null; nonComplianceBoarding = @@ -329,9 +329,9 @@ * observer user. * * @return the value of the indicator - * @throws SuiviObsmerException + * @throws WaoException */ - public Double getNonComplianceBoardingValue() throws SuiviObsmerException { + public Double getNonComplianceBoardingValue() throws WaoException { return getNonComplianceBoarding().get(user.getCompany().getName()); } @@ -362,10 +362,10 @@ * only one result if the current user is an observer. * * @return all contactStateStatistics depends on company and selected period - * @throws SuiviObsmerException + * @throws WaoException */ public Collection<ContactStateStatistics> getContactStateStatistics() - throws SuiviObsmerException { + throws WaoException { if (contactStateStatistics == null) { Company company = !user.getAdmin() ? user.getCompany() : null; contactStateStatistics = @@ -416,7 +416,7 @@ private ContactAverageReactivity allegroReactivityEntry; public Collection<ContactAverageReactivity> getAllegroReactivity() - throws SuiviObsmerException { + throws WaoException { if (allegroReactivity == null) { Company company = !user.getAdmin() ? user.getCompany() : null; allegroReactivity = @@ -432,13 +432,13 @@ return periodForAllegroReactivity; } - public Double getAllegroReactivityValue() throws SuiviObsmerException { + public Double getAllegroReactivityValue() throws WaoException { ContactAverageReactivity entry = (ContactAverageReactivity) CollectionUtils.get(getAllegroReactivity(), 0); return entry.getResult(); } - public String getAllegroReactivityStyle() throws SuiviObsmerException { + public String getAllegroReactivityStyle() throws WaoException { double value = user.getAdmin() ? allegroReactivityEntry.getResult() : getAllegroReactivityValue(); if (value >= 15.) { Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/UserProfile.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/UserProfile.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/pages/UserProfile.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -21,11 +21,11 @@ package fr.ifremer.suiviobsmer.ui.pages; -import fr.ifremer.suiviobsmer.SuiviObsmerBusinessException; -import fr.ifremer.suiviobsmer.SuiviObsmerException; +import fr.ifremer.suiviobsmer.WaoBusinessException; +import fr.ifremer.suiviobsmer.WaoException; import fr.ifremer.suiviobsmer.entity.WaoUser; import fr.ifremer.suiviobsmer.services.ServiceUser; -import fr.ifremer.suiviobsmer.ui.base.SuiviObsmerPage; +import fr.ifremer.suiviobsmer.ui.base.WaoPage; import fr.ifremer.suiviobsmer.ui.components.Layout; import org.apache.commons.lang.StringUtils; import org.apache.tapestry5.annotations.IncludeStylesheet; @@ -48,7 +48,7 @@ * par : $Author$ */ @IncludeStylesheet("context:css/userProfile.css") -public class UserProfile implements SuiviObsmerPage { +public class UserProfile implements WaoPage { @Override public boolean isOnlyForAdmin() { @@ -85,7 +85,7 @@ return userEditable; } - void onSuccessFromUserForm() throws SuiviObsmerException { + void onSuccessFromUserForm() throws WaoException { if (password != null && !password.equals(password2)) { userForm.recordError("Les deux password ne sont pas identiques, vérifiez la saisie !"); @@ -97,7 +97,7 @@ } serviceUser.createUpdateUser(userEditable, false); layout.getFeedBack().addInfo("Modifications enregistrées avec succès !"); - } catch (SuiviObsmerBusinessException eee) { + } catch (WaoBusinessException eee) { userForm.recordError(eee.getMessage()); // if (log.isErrorEnabled()) { // log.error("Error during user save", eee); Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/AppModule.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/AppModule.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/AppModule.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,5 +1,5 @@ /* *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify @@ -58,8 +58,8 @@ binder.bind(ServiceContact.class, ServiceContactImpl.class); binder.bind(ContactModelFactory.class); binder.bind(ServiceSynthesis.class, ServiceSynthesisImpl.class); -// binder.bind(SuiviObsmerModelDAOHelper.getContractClass(User.class), -// SuiviObsmerModelDAOHelper.getImplementationClass(User.class)); +// binder.bind(WaoModelDAOHelper.getContractClass(User.class), +// WaoModelDAOHelper.getImplementationClass(User.class)); } public static void contributeApplicationDefaults( @@ -125,15 +125,15 @@ * @return */ @EagerLoad - public RegistryShutdownListener buildSuiviObsmerShutdown( + public RegistryShutdownListener buildWaoShutdown( @InjectService("RegistryShutdownHub") RegistryShutdownHub hub) { - RegistryShutdownListener listener = new SuiviObsmerManager(); + RegistryShutdownListener listener = new WaoManager(); hub.addRegistryShutdownListener(listener); return listener; } public static void contributeRegistryStartup(OrderedConfiguration<Runnable> configuration) { - configuration.add("SuiviObsmerStartup", new SuiviObsmerManager()); + configuration.add("WaoStartup", new WaoManager()); } /** Modified: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/ContactModelFactory.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/ContactModelFactory.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/ContactModelFactory.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,6 +1,6 @@ /* * *##% - * SuiviObsmer :: Web Interface + * Wao :: Web Interface * Copyright (C) 2009 - 2010 Ifremer * * This program is free software: you can redistribute it and/or modify Deleted: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/SuiviObsmerManager.java =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/SuiviObsmerManager.java 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/SuiviObsmerManager.java 2010-02-16 12:00:05 UTC (rev 354) @@ -1,79 +0,0 @@ -/* - * *##% - * SuiviObsmer :: Web Interface - * Copyright (C) 2009 - 2010 Ifremer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * ##%* - */ - -package fr.ifremer.suiviobsmer.ui.services; - -import fr.ifremer.suiviobsmer.SuiviObsmerException; -import fr.ifremer.suiviobsmer.SuiviObsmerRunner; -import fr.ifremer.suiviobsmer.SuiviObsmerRunnerImpl; -import org.apache.tapestry5.ioc.services.RegistryShutdownListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * SuiviObsmerManager - * - * Created: 24 nov. 2009 - * - * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ - */ -public class SuiviObsmerManager implements Runnable, RegistryShutdownListener { - - private static final Logger log = LoggerFactory.getLogger(SuiviObsmerManager.class); - - private SuiviObsmerRunner runner; - - @Override - public void run() { - runner = new SuiviObsmerRunnerImpl(); - try { - if (log.isInfoEnabled()) { - log.info("Start SuiviObsmer"); - } - runner.start(); - } catch (SuiviObsmerException eee) { - if (log.isErrorEnabled()) { - log.error("Error on start", eee); - } - } - } - - @Override - public void registryDidShutdown() { - // No problem with reinstanciate the runner, all context is in SuiviObsmerContext which is static - runner = new SuiviObsmerRunnerImpl(); - try { - if (log.isInfoEnabled()) { - log.info("Stop SuiviObsmer"); - } - runner.stop(); - } catch (SuiviObsmerException eee) { - if (log.isErrorEnabled()) { - log.error("Error on stop", eee); - } - } - } - -} Copied: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/WaoManager.java (from rev 350, trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/SuiviObsmerManager.java) =================================================================== --- trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/WaoManager.java (rev 0) +++ trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/WaoManager.java 2010-02-16 12:00:05 UTC (rev 354) @@ -0,0 +1,79 @@ +/* + * *##% + * Wao :: Web Interface + * Copyright (C) 2009 - 2010 Ifremer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * ##%* + */ + +package fr.ifremer.suiviobsmer.ui.services; + +import fr.ifremer.suiviobsmer.WaoException; +import fr.ifremer.suiviobsmer.WaoRunner; +import fr.ifremer.suiviobsmer.WaoRunnerImpl; +import org.apache.tapestry5.ioc.services.RegistryShutdownListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * WaoManager + * + * Created: 24 nov. 2009 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class WaoManager implements Runnable, RegistryShutdownListener { + + private static final Logger log = LoggerFactory.getLogger(WaoManager.class); + + private WaoRunner runner; + + @Override + public void run() { + runner = new WaoRunnerImpl(); + try { + if (log.isInfoEnabled()) { + log.info("Start Wao"); + } + runner.start(); + } catch (WaoException eee) { + if (log.isErrorEnabled()) { + log.error("Error on start", eee); + } + } + } + + @Override + public void registryDidShutdown() { + // No problem with reinstanciate the runner, all context is in WaoContext which is static + runner = new WaoRunnerImpl(); + try { + if (log.isInfoEnabled()) { + log.info("Stop Wao"); + } + runner.stop(); + } catch (WaoException eee) { + if (log.isErrorEnabled()) { + log.error("Error on stop", eee); + } + } + } + +} Property changes on: trunk/suiviobsmer-ui/src/main/java/fr/ifremer/suiviobsmer/ui/services/WaoManager.java ___________________________________________________________________ Added: svn:mergeinfo + Modified: trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/components/Layout.tml =================================================================== --- trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/components/Layout.tml 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/resources/fr/ifremer/suiviobsmer/ui/components/Layout.tml 2010-02-16 12:00:05 UTC (rev 354) @@ -116,7 +116,7 @@ <p><t:label for="password" /> : </p> <p><input t:type="passwordfield" t:id="password" t:value="password" /></p> <div class="fright" id="so-connexion-form-buttons"> - <input class="ico accept" t:type="submit" value="Connexion" title="Connexion à l'application SuiviObsmer" /> + <input class="ico accept" t:type="submit" value="Connexion" title="Connexion à l'application Wao" /> </div> </div> <div class="fright" id="so-connexion-logo"> Modified: trunk/suiviobsmer-ui/src/main/resources/log4j.properties =================================================================== --- trunk/suiviobsmer-ui/src/main/resources/log4j.properties 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/resources/log4j.properties 2010-02-16 12:00:05 UTC (rev 354) @@ -21,5 +21,5 @@ log4j.logger.org.apache.tapestry5.TapestryFilter=INFO log4j.logger.fr.ifremer.suiviobsmer=DEBUG -log4j.logger.org.nuiton.util=DEBUG +log4j.logger.org.nuiton.util=INFO log4j.logger.org.nuiton.topia=INFO Modified: trunk/suiviobsmer-ui/src/main/webapp/WEB-INF/web.xml =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/WEB-INF/web.xml 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/webapp/WEB-INF/web.xml 2010-02-16 12:00:05 UTC (rev 354) @@ -19,7 +19,7 @@ PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> - <display-name>SuiviObsmer</display-name> + <display-name>Wao</display-name> <context-param> <!-- The only significant configuration for Tapestry 5, this informs Tapestry of where to look for pages, components and mixins. --> Modified: trunk/suiviobsmer-ui/src/main/webapp/css/common.css =================================================================== --- trunk/suiviobsmer-ui/src/main/webapp/css/common.css 2010-02-16 10:56:02 UTC (rev 353) +++ trunk/suiviobsmer-ui/src/main/webapp/css/common.css 2010-02-16 12:00:05 UTC (rev 354) @@ -3,7 +3,7 @@ Created on : 9 nov. 2009, 10:33:06 Author : fdesbois Description: - Common style cheets for SuiviObsmer + Common style cheets for Wao */ * {
participants (1)
-
fdesbois@users.labs.libre-entreprise.org