Wao-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
March 2014
- 3 participants
- 90 discussions
See <http://ci.codelutin.com/jenkins/job/wao-ci/58/changes>
Changes:
[Tony CHEMIT] refs #4483 (make SamplePlan fully serializable + use it in jsp)
------------------------------------------
[...truncated 103 lines...]
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.BoatImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.ContactImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.IndicatorImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.ContactStateMotifImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.TerrestrialLocationImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.BoatGroupImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.CompanyImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.IndicatorLevelImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.FishingZoneImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.SampleMonthImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.FleetImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.UserProfileImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.TargetSpeciesDCFImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.ObsDebCodeImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.SampleRowLogImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.NewsImpl], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.WaoUserTopiaDao], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.TerrestrialDivisionTopiaDao], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.SampleRowTopiaDao], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.ContactTopiaDao], already found in class-path.
INFO [pool-1-thread-1 for channel] (ObjectModelTransformerToJava.java:998) isInClassPath - Will not generate [fr.ifremer.wao.entity.TerrestrialLocationTopiaDao], already found in class-path.
[INFO] Add compile source root : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] Add resource root :Resource {targetPath: null, filtering: false, FileSet {directory: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…,> PatternSet [includes: {}, excludes: {**/*.java}]}}
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (parseOthersAndGen) @ wao-persistence ---
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…,> includes:[**/*.java]
[INFO] 148 file(s) to process (among 148 files)
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/src/mai…,> includes:[**/*.java]
[INFO] 58 file(s) to process (among 58 files)
[INFO] Parsing is done. [treated file(s) : 12/206](total time:13.654s) ( ~ 66.284ms / file)
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-persistence >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ wao-persistence ---
[INFO] config - basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] import getter java.getter in 376190ns
[INFO] Copying wao-persistence.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] Copying wao-persistence.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-persistence <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-persistence ---
[INFO] config - src basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/src/mai…>
[INFO] config - out basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] prepare bundle for locale fr_FR
[INFO] merge bundle fr_FR to out
[WARNING] bundle fr_FR contains 1/139 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO] copy bundle fr_FR to src
[INFO] prepare bundle for locale en_GB
[INFO] merge bundle en_GB to out
[WARNING] bundle en_GB contains 4/140 empty entries! (use -Di18n.showEmpty to see these entries)
[INFO] copy bundle en_GB to src
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ wao-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 6 resources
[INFO] Copying 28 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ wao-persistence ---
[INFO] Compiling 206 source files to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/src/mai…>:[75,27] equals(java.lang.Object,java.lang.Object) in org.apache.commons.lang3.ObjectUtils has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ wao-persistence ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO] Executed tasks
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ wao-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ wao-persistence ---
[INFO] Compiling 1 source file to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ wao-persistence ---
[INFO] Surefire report directory: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running fr.ifremer.wao.entity.SampleRowLogImplTest
2014/03/27 01:26:17 DEBUG (SampleRowLogImplTest.java:78) testNewSampleRowLog Le nombre d'observateurs est de 0
Le durée moyenne d'une marée est de 0.0
La ligne est sur la période du 03/2011 au 06/2011
Le métier de la ligne est null
2014/03/27 01:26:17 DEBUG (SampleRowLogImplTest.java:94) testCompareSampleRowToItself
2014/03/27 01:26:17 DEBUG (SampleRowLogImplTest.java:118) testModifySampleRow La durée moyenne d'une marée est passé de 0.0 jours à 1.0
La ligne est désormais associée au programme programName
La date de fin est passée de 06/2011 à 07/2011
Les zones de pêches suivantes ont été ajoutées : null - null - IV
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.148 sec - in fr.ifremer.wao.entity.SampleRowLogImplTest
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[JENKINS] Recording test results
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ wao-persistence ---
[INFO] Building jar: <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-persistence/target/…>
[INFO]
[INFO] --- maven-site-plugin:3.3:attach-descriptor (attach-descriptor) @ wao-persistence ---
[JENKINS] Archiving disabled
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Wao :: Services 4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ wao-services ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ wao-services ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (parseOthersAndGen) @ wao-services ---
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…,> includes:[**/*.java]
[INFO] 69 file(s) to process (among 69 files)
[INFO] Parsing is done. [treated file(s) : 18/69](total time:204.078ms) ( ~ 2.958ms / file)
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ wao-services ---
[INFO] config - basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/gen…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] import getter java.getter in 129476ns
[INFO] Copying wao-services.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/gen…>
[INFO] Copying wao-services.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/gen…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services ---
[INFO] config - src basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/r…>
[INFO] config - out basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/gen…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] prepare bundle for locale fr_FR
[INFO] merge bundle fr_FR to out
[INFO] copy bundle fr_FR to src
[INFO] prepare bundle for locale en_GB
[INFO] merge bundle en_GB to out
[INFO] copy bundle en_GB to src
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ wao-services ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ wao-services ---
[INFO] Compiling 69 source files to <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/target/cla…>
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>:[173,46] findByEntityClassFqn(java.lang.String) in fr.ifremer.wao.entity.GeneratedReferentialMetaTopiaDao has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>:[180,68] TOPIA_ID in org.nuiton.topia.persistence.TopiaEntity has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>: Recompile with -Xlint:unchecked for details.
[INFO] 4 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>:[418,63] cannot find symbol
symbol: method getI18nKey()
location: class fr.ifremer.wao.entity.SamplingStrategy
[INFO] 1 error
[INFO] -------------------------------------------------------------
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[JENKINS] Archiving disabled
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Wao ............................................... SUCCESS [ 2.354 s]
[INFO] Wao :: Persistence ................................ SUCCESS [ 21.105 s]
[INFO] Wao :: Services ................................... FAILURE [ 1.089 s]
[INFO] Wao :: Web ........................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.735 s
[INFO] Finished at: 2014-03-27T13:26:19+01:00
[INFO] Final Memory: 46M/809M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project wao-services: Compilation failure
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>:[418,63] cannot find symbol
[ERROR] symbol: method getI18nKey()
[ERROR] location: class fr.ifremer.wao.entity.SamplingStrategy
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project wao-services: Compilation failure
<http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>:[418,63] cannot find symbol
symbol: method getI18nKey()
location: class fr.ifremer.wao.entity.SamplingStrategy
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
<http://ci.codelutin.com/jenkins/job/wao-ci/ws/trunk/wao-services/src/main/j…>:[418,63] cannot find symbol
symbol: method getI18nKey()
location: class fr.ifremer.wao.entity.SamplingStrategy
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 30 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :wao-services
Sending e-mails to: wao-commits(a)list.forge.codelutin.com chemit+codelutin-ci(a)codelutin.com
channel stopped
1
1
Build failed in Jenkins: wao-ci » Wao :: Services #58
by admin+ci-codelutin.com@codelutin.com 27 Mar '14
by admin+ci-codelutin.com@codelutin.com 27 Mar '14
27 Mar '14
See <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/58/chang…>
Changes:
[Tony CHEMIT] refs #4483 (make SamplePlan fully serializable + use it in jsp)
------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Wao :: Services 4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ wao-services ---
[INFO] Deleting <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/target>
[INFO]
[INFO] --- maven-enforcer-plugin:1.3.1:enforce (check-project-files) @ wao-services ---
[INFO]
[INFO] --- i18n-maven-plugin:3.0:parserJava (parseOthersAndGen) @ wao-services ---
[INFO] start entry basedir:<http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/src/m…,> includes:[**/*.java]
[INFO] 69 file(s) to process (among 69 files)
[INFO] Parsing is done. [treated file(s) : 18/69](total time:204.078ms) ( ~ 2.958ms / file)
[INFO]
[INFO] >>> i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services >>>
[INFO]
[INFO] --- i18n-maven-plugin:3.0:get (get) @ wao-services ---
[INFO] config - basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/targe…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] import getter java.getter in 129476ns
[INFO] Copying wao-services.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/targe…>
[INFO] Copying wao-services.properties to <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/targe…>
[INFO]
[INFO] <<< i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services <<<
[INFO]
[INFO] --- i18n-maven-plugin:3.0:gen (parseOthersAndGen) @ wao-services ---
[INFO] config - src basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/src/m…>
[INFO] config - out basedir : <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/targe…>
[INFO] config - locales : [fr_FR, en_GB]
[INFO] prepare bundle for locale fr_FR
[INFO] merge bundle fr_FR to out
[INFO] copy bundle fr_FR to src
[INFO] prepare bundle for locale en_GB
[INFO] merge bundle en_GB to out
[INFO] copy bundle en_GB to src
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ wao-services ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ wao-services ---
[INFO] Compiling 69 source files to <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/targe…>
[INFO] -------------------------------------------------------------
[WARNING] COMPILATION WARNING :
[INFO] -------------------------------------------------------------
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/src/m…>:[173,46] findByEntityClassFqn(java.lang.String) in fr.ifremer.wao.entity.GeneratedReferentialMetaTopiaDao has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/src/m…>:[180,68] TOPIA_ID in org.nuiton.topia.persistence.TopiaEntity has been deprecated
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/src/m…>: Some input files use unchecked or unsafe operations.
[WARNING] <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/src/m…>: Recompile with -Xlint:unchecked for details.
[INFO] 4 warnings
[INFO] -------------------------------------------------------------
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.codelutin.com/jenkins/job/wao-ci/fr.ifremer$wao-services/ws/src/m…>:[418,63] cannot find symbol
symbol: method getI18nKey()
location: class fr.ifremer.wao.entity.SamplingStrategy
[INFO] 1 error
[INFO] -------------------------------------------------------------
[JENKINS] Archiving disabled
1
1
r1766 - in trunk: wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/webapp/WEB-INF/content/obsmer
by tchemit@users.forge.codelutin.com 27 Mar '14
by tchemit@users.forge.codelutin.com 27 Mar '14
27 Mar '14
Author: tchemit
Date: 2014-03-27 13:39:43 +0100 (Thu, 27 Mar 2014)
New Revision: 1766
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1766
Log:
refs #4483 (done for me)
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-27 12:38:49 UTC (rev 1765)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-27 12:39:43 UTC (rev 1766)
@@ -47,44 +47,37 @@
protected Collection<ObsMerSamplingPlanFacadePart> facades;
/**
- * Statistics of total tides over the plan by month.
+ * Total tides over the plan by month.
*/
- protected Map<Date, ObsMerSamplingPlanStatistics> statisticsMap;
+ protected Map<Date, ObsMerSamplingPlanStatistics> totalsPerMonth;
/**
+ * High total over the hole plan.
+ */
+ protected ObsMerSamplingPlanStatistics highTotals;
+
+ /**
* Total of observation times in days expected.
- * FIXME Voir si on doit garder un *D*ouble
+ *
+ * <strong>Note:</strong> can be null.
*/
protected Double observationTimesInDaysTotalExpected;
/**
* Total of observation times in days real.
- * FIXME Voir si on doit garder un *L*ong
+ *
+ * <strong>Note:</strong> can be null.
*/
protected Long observationTimesInDaysTotalReal;
/**
* Total of observation times in days estimated.
- * FIXME Voir si on doit garder un *L*ong
+ *
+ * <strong>Note:</strong> can be null.
*/
protected Long observationTimesInDaysTotalEstimated;
/**
- * ?
- */
- protected int highTotalExpected;
-
- /**
- * ?
- */
- protected int highTotalReal;
-
- /**
- * ?
- */
- protected int highTotalEstimated;
-
- /**
* List of month used by sample rows.
*/
protected List<Date> months;
@@ -93,22 +86,18 @@
public ObsMerSamplingPlan(List<Date> months,
Collection<ObsMerSamplingPlanFacadePart> facadeParts,
- Map<Date, ObsMerSamplingPlanStatistics> statisticsMap,
- int highTotalExpected,
- int highTotalReal,
- int highTotalEstimated,
+ Map<Date, ObsMerSamplingPlanStatistics> totalsPerMonth,
+ ObsMerSamplingPlanStatistics highTotals,
Double observationTimesInDaysTotalExpected,
Long observationTimesInDaysTotalReal,
Long observationTimesInDaysTotalEstimated,
SampleRowsFilterValues filterValues) {
this.months = months;
this.facades = facadeParts;
- this.statisticsMap = statisticsMap;
+ this.totalsPerMonth = totalsPerMonth;
+ this.highTotals = highTotals;
this.observationTimesInDaysTotalExpected = observationTimesInDaysTotalExpected;
this.observationTimesInDaysTotalReal = observationTimesInDaysTotalReal;
- this.highTotalExpected = highTotalExpected;
- this.highTotalReal = highTotalReal;
- this.highTotalEstimated = highTotalEstimated;
this.observationTimesInDaysTotalEstimated = observationTimesInDaysTotalEstimated;
this.filterValues = filterValues;
}
@@ -134,46 +123,40 @@
return observationTimesInDaysTotalEstimated;
}
- public Integer getTotalExpectedForMonth(Date month) {
- Integer result = statisticsMap.get(month).getNbTidesExpected();
+ public Integer getTotalExpected(Date month) {
+ Integer result = totalsPerMonth.get(month).getNbTidesExpected();
return result;
}
- public Integer getTotalRealForMonth(Date month) {
- Integer result = statisticsMap.get(month).getNbTidesReal();
+ public Integer getTotalReal(Date month) {
+ Integer result = totalsPerMonth.get(month).getNbTidesReal();
return result;
}
- public Integer getTotalEstimatedForMonth(Date month) {
- Integer result = statisticsMap.get(month).getNbTidesEstimated();
+ public Integer getTotalEstimated(Date month) {
+ Integer result = totalsPerMonth.get(month).getNbTidesEstimated();
return result;
}
- //TODO Move this in UI?
- public String getRatioForMonth(Date month) {
- String result = statisticsMap.get(month).getRatioForMonth();
+ public String getTotalRatio(Date month) {
+ String result = totalsPerMonth.get(month).getRatio("-");
return result;
}
public Integer getHighTotalExpected() {
- return highTotalExpected;
+ return highTotals.getNbTidesExpected();
}
public Integer getHighTotalReal() {
- return highTotalReal;
+ return highTotals.getNbTidesReal();
}
public Integer getHighTotalEstimated() {
- return highTotalEstimated;
+ return highTotals.getNbTidesEstimated();
}
- //TODO Move this in UI?
public String getHighTotalRatio() {
- String ratio = "";
- if (highTotalExpected > 0) {
- double percent = ((double) highTotalReal / highTotalExpected);
- ratio = NumberFormat.getPercentInstance().format(percent);
- }
+ String ratio = highTotals.getRatio("");
return ratio;
}
@@ -261,38 +244,28 @@
protected Map<Date, ObsMerSamplingPlanStatistics> nbTidesPerMonth;
/**
- * Total of expected tides.
+ * Total of tides.
*/
- protected int totalTidesExpected;
+ protected ObsMerSamplingPlanStatistics totalTides;
/**
- * Total of real tides.
- */
- protected int totalTidesReal;
-
- /**
- * Total of estimated tides.
- */
- protected int totalTidesEstimated;
-
- /**
* Expected Times of observation days.
* <p/>
- * FIXME Voir si on doit garder un *D*ouble
+ * <strong>Note:</strong> can be null.
*/
protected Double observationTimesInDaysExpected;
/**
* Real times of observation in days.
* <p/>
- * FIXME Voir si on doit garder un *L*long
+ * <strong>Note:</strong> can be null.
*/
protected Long observationTimesInDaysReal;
/**
* Estimated times of observation in days.
* <p/>
- * FIXME Voir si on doit garder un *L*long
+ * <strong>Note:</strong> can be null.
*/
protected Long observationTimesInDaysEstimated;
@@ -357,6 +330,9 @@
this.nbTidesPerMonth = nbTidesPerMonth;
// compute total tides
+ int totalTidesExpected = 0;
+ int totalTidesEstimated = 0;
+ int totalTidesReal = 0;
for (ObsMerSamplingPlanStatistics obsMerSamplingPlanStatistics : nbTidesPerMonth.values()) {
Integer totalExpected = obsMerSamplingPlanStatistics.getNbTidesExpected();
if (totalExpected != null) {
@@ -372,6 +348,8 @@
}
}
+ totalTides = new ObsMerSamplingPlanStatistics(totalTidesExpected, totalTidesReal, totalTidesEstimated);
+
fishingZones = "";
for (FishingZone zone : sampleRow.getFishingZone()) {
fishingZones += zone.getDistrictCode() + ", ";
@@ -415,7 +393,7 @@
}
}
professionDescriptionWithoutDCF5 = sampleRow.getProfessionDescriptionWithoutDCF5();
- samplingStrategy = sampleRow.getSamplingStrategy().getI18nKey();
+ samplingStrategy = "";//TODO sampleRow.getSamplingStrategy().getI18nKey();
sampleRowId = sampleRow.getTopiaId();
}
@@ -512,15 +490,15 @@
}
public int getTotalTidesExpected() {
- return totalTidesExpected;
+ return totalTides.getNbTidesExpected();
}
public int getTotalTidesReal() {
- return totalTidesReal;
+ return totalTides.getNbTidesReal();
}
public int getTotalTidesEstimated() {
- return totalTidesEstimated;
+ return totalTides.getNbTidesEstimated();
}
public String getProfessionDescriptionWithoutDCF5() {
@@ -543,13 +521,7 @@
}
public String getTotalPercentage() {
- String result;
- if (totalTidesExpected > 0) {
- double percentage = (double) totalTidesReal / (double) totalTidesExpected;
- result = NumberFormat.getPercentInstance().format(percentage);
- } else {
- result = "- %";
- }
+ String result = totalTides.getRatio("-");
return result;
}
@@ -621,9 +593,8 @@
return nbTidesEstimated;
}
- //FIXME Move this in ui ?
- public String getRatioForMonth() {
- String ratio = "-";
+ public String getRatio(String defaultValue) {
+ String ratio = defaultValue;
if (nbTidesExpected != null && nbTidesExpected > 0 &&
nbTidesReal != null && nbTidesReal > 0) {
double percent = ((double) nbTidesReal / nbTidesExpected);
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-27 12:38:49 UTC (rev 1765)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-27 12:39:43 UTC (rev 1766)
@@ -218,12 +218,12 @@
statisticsMap.put(month, planStatistics);
}
+ ObsMerSamplingPlan.ObsMerSamplingPlanStatistics highTotals = new ObsMerSamplingPlan.ObsMerSamplingPlanStatistics(highTotalExpected, highTotalReal, highTotalEstimated);
+
ObsMerSamplingPlan result = new ObsMerSamplingPlan(months,
sortedFacades,
statisticsMap,
- highTotalExpected,
- highTotalReal,
- highTotalEstimated,
+ highTotals,
observationTimesInDaysTotalExpected.toDouble(),
observationTimesInDaysTotalReal.toLong(),
observationTimesInDaysTotalEstimated.toLong(),
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-27 12:38:49 UTC (rev 1765)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-27 12:39:43 UTC (rev 1766)
@@ -284,7 +284,7 @@
<td><s:property value="nbObservants" /></td>
<td>
<s:if test="appliedCoverageRate">
- <s:property value="appliedCoverageRate" /> %
+ <s:property value="appliedCoverageRate" />%
</s:if>
</td>
<td><s:property value="comment" /></td>
@@ -367,13 +367,13 @@
<!-- Months columns -->
<s:iterator value="samplingPlan.months" var="month">
<td<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> class="current-month"</s:if>>
- <s:property value="samplingPlan.getTotalExpectedForMonth(#month)"/>
+ <s:property value="samplingPlan.getTotalExpected(#month)"/>
<span class="display-tides-real">
<span>
- <em>(<s:property value="samplingPlan.getTotalRealForMonth(#month)"/>)</em>
+ <em>(<s:property value="samplingPlan.getTotalReal(#month)"/>)</em>
</span>
<br/>
- <s:property value="samplingPlan.getRatioForMonth(#month)"/>
+ <s:property value="samplingPlan.getTotalRatio(#month)"/>
</span>
</td>
</s:iterator>
1
0
Author: tchemit
Date: 2014-03-27 13:38:49 +0100 (Thu, 27 Mar 2014)
New Revision: 1765
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1765
Log:
fix dependencies
Modified:
trunk/wao-services/pom.xml
Modified: trunk/wao-services/pom.xml
===================================================================
--- trunk/wao-services/pom.xml 2014-03-27 12:02:46 UTC (rev 1764)
+++ trunk/wao-services/pom.xml 2014-03-27 12:38:49 UTC (rev 1765)
@@ -62,6 +62,11 @@
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
1
0
r1764 - in trunk: wao-services/src/main/java/fr/ifremer/wao/services/service wao-services/src/test/java/fr/ifremer/wao/services/service wao-web/src/main/webapp/WEB-INF/content/obsmer
by tchemit@users.forge.codelutin.com 27 Mar '14
by tchemit@users.forge.codelutin.com 27 Mar '14
27 Mar '14
Author: tchemit
Date: 2014-03-27 13:02:46 +0100 (Thu, 27 Mar 2014)
New Revision: 1764
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1764
Log:
refs #4483 (make SamplePlan fully serializable + use it in jsp)
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanServiceTest.java
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-27 10:36:13 UTC (rev 1763)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-27 12:02:46 UTC (rev 1764)
@@ -22,16 +22,18 @@
*/
import fr.ifremer.wao.WaoUtils;
+import fr.ifremer.wao.entity.DCF5Code;
import fr.ifremer.wao.entity.FishingZone;
import fr.ifremer.wao.entity.SampleRow;
-import fr.ifremer.wao.entity.SampleRows;
+import fr.ifremer.wao.entity.TerrestrialLocation;
+import org.apache.commons.collections4.CollectionUtils;
import java.io.Serializable;
import java.text.NumberFormat;
-import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -45,7 +47,7 @@
protected Collection<ObsMerSamplingPlanFacadePart> facades;
/**
- * Statistics over the plan by month.
+ * Statistics of total tides over the plan by month.
*/
protected Map<Date, ObsMerSamplingPlanStatistics> statisticsMap;
@@ -69,21 +71,18 @@
/**
* ?
- * FIXME Voir si on doit garder un *I*integer
*/
- protected Integer highTotalExpected;
+ protected int highTotalExpected;
/**
* ?
- * FIXME Voir si on doit garder un *I*integer
*/
- protected Integer highTotalReal;
+ protected int highTotalReal;
/**
* ?
- * FIXME Voir si on doit garder un *I*integer
*/
- protected Integer highTotalEstimated;
+ protected int highTotalEstimated;
/**
* List of month used by sample rows.
@@ -95,9 +94,9 @@
public ObsMerSamplingPlan(List<Date> months,
Collection<ObsMerSamplingPlanFacadePart> facadeParts,
Map<Date, ObsMerSamplingPlanStatistics> statisticsMap,
- Integer highTotalExpected,
- Integer highTotalReal,
- Integer highTotalEstimated,
+ int highTotalExpected,
+ int highTotalReal,
+ int highTotalEstimated,
Double observationTimesInDaysTotalExpected,
Long observationTimesInDaysTotalReal,
Long observationTimesInDaysTotalEstimated,
@@ -114,19 +113,6 @@
this.filterValues = filterValues;
}
- //FIXME Remove this
- public List<SampleRow> getRows() {
- List<SampleRow> result = new ArrayList<>();
- for (ObsMerSamplingPlanFacadePart facade : facades) {
- for (ObsMerSamplingPlanSectorPart sectors : facade) {
- for (ObsMerSamplingPlanSampleRowPart row : sectors) {
- result.add(row.getSampleRow());
- }
- }
- }
- return result;
- }
-
@Override
public Iterator<ObsMerSamplingPlanFacadePart> iterator() {
return facades.iterator();
@@ -149,17 +135,17 @@
}
public Integer getTotalExpectedForMonth(Date month) {
- Integer result = statisticsMap.get(month).getTotalExpected();
+ Integer result = statisticsMap.get(month).getNbTidesExpected();
return result;
}
public Integer getTotalRealForMonth(Date month) {
- Integer result = statisticsMap.get(month).getTotalReal();
+ Integer result = statisticsMap.get(month).getNbTidesReal();
return result;
}
public Integer getTotalEstimatedForMonth(Date month) {
- Integer result = statisticsMap.get(month).getTotalEstimated();
+ Integer result = statisticsMap.get(month).getNbTidesEstimated();
return result;
}
@@ -270,9 +256,9 @@
private static final long serialVersionUID = 1L;
/**
- * Boxed sample row.
+ * Nb tides by month.
*/
- protected SampleRow sampleRow;
+ protected Map<Date, ObsMerSamplingPlanStatistics> nbTidesPerMonth;
/**
* Total of expected tides.
@@ -310,27 +296,221 @@
*/
protected Long observationTimesInDaysEstimated;
+ protected String fishingZones;
- public ObsMerSamplingPlanSampleRowPart(SampleRow sampleRow,
- int totalTidesExpected,
- int totalTidesReal,
- int totalTidesEstimated,
+ protected int nbObservants;
+
+ protected double averageTideTime;
+
+ protected String code;
+
+ protected String fishingZonesInfos;
+
+ protected String comment;
+
+ protected String programName;
+
+ protected Date periodBegin;
+
+ protected Date periodEnd;
+
+ protected String terrestrialLocationInfos;
+
+ protected Date expectedDate;
+
+ protected String groupName;
+
+ protected Double appliedCoverageRate;
+
+ protected int averageObservationsCount;
+
+ protected String professionMeshSize;
+
+ protected String professionSize;
+
+ protected String professionOther;
+
+ protected String professionLibelle;
+
+ protected String professionSpecies;
+
+ protected String companyName;
+
+ protected String samplingStrategy;
+
+ protected String professionDescriptionWithoutDCF5;
+
+ protected Map<String, String> dcf5CodesAndDescriptions;
+
+ protected Map<String, String> terrestrialLocationNamesAndDescriptions;
+
+ protected String sampleRowId;
+
+ public ObsMerSamplingPlanSampleRowPart(Map<Date, ObsMerSamplingPlanStatistics> nbTidesPerMonth,
+ SampleRow sampleRow,
Double observationTimesInDaysExpected,
Long observationTimesInDaysReal,
Long observationTimesInDaysEstimated) {
- this.sampleRow = sampleRow;
- this.totalTidesExpected = totalTidesExpected;
- this.totalTidesReal = totalTidesReal;
- this.totalTidesEstimated = totalTidesEstimated;
this.observationTimesInDaysExpected = observationTimesInDaysExpected;
this.observationTimesInDaysReal = observationTimesInDaysReal;
this.observationTimesInDaysEstimated = observationTimesInDaysEstimated;
+
+ this.nbTidesPerMonth = nbTidesPerMonth;
+ // compute total tides
+ for (ObsMerSamplingPlanStatistics obsMerSamplingPlanStatistics : nbTidesPerMonth.values()) {
+ Integer totalExpected = obsMerSamplingPlanStatistics.getNbTidesExpected();
+ if (totalExpected != null) {
+ totalTidesExpected += totalExpected;
+ }
+ Integer totalEstimated = obsMerSamplingPlanStatistics.getNbTidesEstimated();
+ if (totalEstimated != null) {
+ totalTidesEstimated += totalEstimated;
+ }
+ Integer totalReal = obsMerSamplingPlanStatistics.getNbTidesReal();
+ if (totalReal != null) {
+ totalTidesReal += totalReal;
+ }
+ }
+
+ fishingZones = "";
+ for (FishingZone zone : sampleRow.getFishingZone()) {
+ fishingZones += zone.getDistrictCode() + ", ";
+ }
+ fishingZones = fishingZones.substring(0, fishingZones.length() - 2);
+ nbObservants = sampleRow.getNbObservants();
+ averageTideTime = sampleRow.getAverageTideTime();
+ fishingZonesInfos = sampleRow.getFishingZonesInfos();
+ comment = sampleRow.getComment();
+ programName = sampleRow.getProgramName();
+ periodBegin = sampleRow.getPeriodBegin();
+ periodEnd = sampleRow.getPeriodEnd();
+ terrestrialLocationInfos = sampleRow.getTerrestrialLocationInfos();
+ expectedDate = sampleRow.getExpectedDate();
+ groupName = sampleRow.getGroupName();
+ appliedCoverageRate = sampleRow.getAppliedCoverageRate();
+ averageObservationsCount = sampleRow.getAverageObservationsCount();
+ companyName = sampleRow.getCompany().getName();
+ code = sampleRow.getCode();
+ professionMeshSize = sampleRow.getProfession().getMeshSize();
+ professionSize = sampleRow.getProfession().getSize();
+ professionOther = sampleRow.getProfession().getOther();
+ professionLibelle = sampleRow.getProfession().getLibelle();
+ professionSpecies = sampleRow.getProfession().getSpecies();
+ dcf5CodesAndDescriptions = new LinkedHashMap<>();
+ for (DCF5Code dcf5Code : sampleRow.getdCF5Code()) {
+ String key = dcf5Code.getCode();
+ String description = dcf5Code.getFishingGearCode() + " - " + dcf5Code.getFishingGearDCF().getI18nKey();
+ if (dcf5Code.getTargetSpeciesCode() != null) {
+ description += " ; " + dcf5Code.getTargetSpeciesCode() + " - " + dcf5Code.getTargetSpeciesDCF().getI18nKey();
+ }
+ dcf5CodesAndDescriptions.put(key, description);
+ }
+ terrestrialLocationNamesAndDescriptions = new LinkedHashMap<>();
+
+ if (CollectionUtils.isNotEmpty(sampleRow.getTerrestrialLocations())) {
+ for (TerrestrialLocation terrestrialLocation : sampleRow.getTerrestrialLocations()) {
+ String key = terrestrialLocation.getDistrictName();
+ String description = terrestrialLocation.getDescription();
+ dcf5CodesAndDescriptions.put(key, description);
+ }
+ }
+ professionDescriptionWithoutDCF5 = sampleRow.getProfessionDescriptionWithoutDCF5();
+ samplingStrategy = sampleRow.getSamplingStrategy().getI18nKey();
+ sampleRowId = sampleRow.getTopiaId();
}
- public SampleRow getSampleRow() {
- return sampleRow;
+ public String getSamplingStrategy() {
+ return samplingStrategy;
}
+ public String getSampleRowId() {
+ return sampleRowId;
+ }
+
+ public int getNbObservants() {
+ return nbObservants;
+ }
+
+ public double getAverageTideTime() {
+ return averageTideTime;
+ }
+
+ public String getCode() {
+ return code;
+ }
+
+ public String getFishingZonesInfos() {
+ return fishingZonesInfos;
+ }
+
+ public String getTerrestrialLocationInfos() {
+ return terrestrialLocationInfos;
+ }
+
+ public String getProfessionSize() {
+ return professionSize;
+ }
+
+ public Map<String, String> getDcf5CodesAndDescriptions() {
+ return dcf5CodesAndDescriptions;
+ }
+
+ public Map<String, String> getTerrestrialLocationNamesAndDescriptions() {
+ return terrestrialLocationNamesAndDescriptions;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public String getProgramName() {
+ return programName;
+ }
+
+ public Date getPeriodBegin() {
+ return periodBegin;
+ }
+
+ public Date getPeriodEnd() {
+ return periodEnd;
+ }
+
+ public Date getExpectedDate() {
+ return expectedDate;
+ }
+
+ public String getGroupName() {
+ return groupName;
+ }
+
+ public Double getAppliedCoverageRate() {
+ return appliedCoverageRate;
+ }
+
+ public int getAverageObservationsCount() {
+ return averageObservationsCount;
+ }
+
+ public String getProfessionMeshSize() {
+ return professionMeshSize;
+ }
+
+ public String getProfessionOther() {
+ return professionOther;
+ }
+
+ public String getProfessionLibelle() {
+ return professionLibelle;
+ }
+
+ public String getProfessionSpecies() {
+ return professionSpecies;
+ }
+
+ public String getCompanyName() {
+ return companyName;
+ }
+
public int getTotalTidesExpected() {
return totalTidesExpected;
}
@@ -343,25 +523,28 @@
return totalTidesEstimated;
}
+ public String getProfessionDescriptionWithoutDCF5() {
+ return professionDescriptionWithoutDCF5;
+ }
+
public Integer getNbTidesExpected(Date month) {
- Integer result = SampleRows.getExpectedTidesValue(sampleRow, month);
+ Integer result = nbTidesPerMonth.get(month).getNbTidesExpected();
return result;
}
public Integer getNbTidesReal(Date month) {
- Integer result = SampleRows.getRealTidesValue(sampleRow, month);
+ Integer result = nbTidesPerMonth.get(month).getNbTidesReal();
return result;
}
public Integer getNbTidesEstimated(Date month) {
- Integer result = SampleRows.getEstimatedTidesValue(sampleRow, month);
+ Integer result = nbTidesPerMonth.get(month).getNbTidesEstimated();
return result;
}
- //FIXME Move this in ui ?
public String getTotalPercentage() {
String result;
- if (sampleRow.getTotalTidesExpected() > 0) {
+ if (totalTidesExpected > 0) {
double percentage = (double) totalTidesReal / (double) totalTidesExpected;
result = NumberFormat.getPercentInstance().format(percentage);
} else {
@@ -371,11 +554,7 @@
}
public String getFishingZones() {
- String result = "";
- for (FishingZone zone : sampleRow.getFishingZone()) {
- result += zone.getDistrictCode() + ", ";
- }
- return result.substring(0, result.length() - 2);
+ return fishingZones;
}
public Double getObservationTimesInDaysExpected() {
@@ -408,52 +587,46 @@
private static final long serialVersionUID = 1L;
/**
- * Total of expected tides.
- * <p/>
- * FIXME Voir si on doit garder un *I*nteger
+ * Number of expected tides.
*/
- protected Integer totalExpected;
+ protected Integer nbTidesExpected;
/**
- * Total of real tides.
- * <p/>
- * FIXME Voir si on doit garder un *I*nteger
+ * Number of real tides.
*/
- protected Integer totalReal;
+ protected Integer nbTidesReal;
/**
- * Total of estimated tides.
- * <p/>
- * FIXME Voir si on doit garder un *I*nteger
+ * Number of estimated tides.
*/
- protected Integer totalEstimated;
+ protected Integer nbTidesEstimated;
- public ObsMerSamplingPlanStatistics(Integer totalExpected,
- Integer totalReal,
- Integer totalEstimated) {
- this.totalExpected = totalExpected;
- this.totalReal = totalReal;
- this.totalEstimated = totalEstimated;
+ public ObsMerSamplingPlanStatistics(Integer nbTidesExpected,
+ Integer nbTidesReal,
+ Integer nbTidesEstimated) {
+ this.nbTidesExpected = nbTidesExpected;
+ this.nbTidesReal = nbTidesReal;
+ this.nbTidesEstimated = nbTidesEstimated;
}
- public Integer getTotalExpected() {
- return totalExpected;
+ public Integer getNbTidesExpected() {
+ return nbTidesExpected;
}
- public Integer getTotalReal() {
- return totalReal;
+ public Integer getNbTidesReal() {
+ return nbTidesReal;
}
- public Integer getTotalEstimated() {
- return totalEstimated;
+ public Integer getNbTidesEstimated() {
+ return nbTidesEstimated;
}
//FIXME Move this in ui ?
public String getRatioForMonth() {
String ratio = "-";
- if (totalExpected != null && totalExpected > 0 &&
- totalReal != null && totalReal > 0) {
- double percent = ((double) totalReal / totalExpected);
+ if (nbTidesExpected != null && nbTidesExpected > 0 &&
+ nbTidesReal != null && nbTidesReal > 0) {
+ double percent = ((double) nbTidesReal / nbTidesExpected);
ratio = NumberFormat.getPercentInstance().format(percent);
}
return ratio;
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-27 10:36:13 UTC (rev 1763)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-27 12:02:46 UTC (rev 1764)
@@ -74,21 +74,21 @@
*
* @see ObsMerSamplingPlan#highTotalExpected
*/
- protected MutableInt highTotalExpected;
+ protected int highTotalExpected;
/**
* To compute the high total real.
*
* @see ObsMerSamplingPlan#highTotalReal
*/
- protected MutableInt highTotalReal;
+ protected int highTotalReal;
/**
* To compute the high total estimated.
*
* @see ObsMerSamplingPlan#highTotalEstimated
*/
- protected MutableInt highTotalEstimated;
+ protected int highTotalEstimated;
/**
* To compute the total of expected observation times in days.
@@ -114,21 +114,21 @@
/**
* To compute by month the total of expected tides.
*
- * @see ObsMerSamplingPlan.ObsMerSamplingPlanStatistics#totalExpected
+ * @see ObsMerSamplingPlan.ObsMerSamplingPlanStatistics#nbTidesExpected
*/
protected Map<Date, MutableInt> totalExpectedForMonths;
/**
* To compute by month the total of expected tides.
*
- * @see ObsMerSamplingPlan.ObsMerSamplingPlanStatistics#totalEstimated
+ * @see ObsMerSamplingPlan.ObsMerSamplingPlanStatistics#nbTidesEstimated
*/
protected Map<Date, MutableInt> totalEstimatedForMonths;
/**
* To compute by month the total of real tides.
*
- * @see ObsMerSamplingPlan.ObsMerSamplingPlanStatistics#totalReal
+ * @see ObsMerSamplingPlan.ObsMerSamplingPlanStatistics#nbTidesReal
*/
protected Map<Date, MutableInt> totalRealForMonths;
@@ -136,9 +136,6 @@
this.sampleRowsFilter = sampleRowsFilter;
this.sampleRowsFilterValues = new SampleRowsFilterValues();
this.facadeMap = new TreeMap<>();
- this.highTotalExpected = new MutableInt();
- this.highTotalReal = new MutableInt();
- this.highTotalEstimated = new MutableInt();
this.observationTimesInDaysTotalExpected = new MutableDouble();
this.observationTimesInDaysTotalReal = new MutableLong();
this.observationTimesInDaysTotalEstimated = new MutableLong();
@@ -149,12 +146,6 @@
PeriodDates periodDates = new PeriodDates(sampleRowsFilter.getPeriodFrom(),
sampleRowsFilter.getPeriodTo());
this.months = periodDates.getMonths();
-
- for (Date month : months) {
- totalExpectedForMonths.put(month, new MutableInt());
- totalRealForMonths.put(month, new MutableInt());
- totalEstimatedForMonths.put(month, new MutableInt());
- }
}
public ObsMerSamplingPlanBuilder addSampleRow(SampleRow sampleRow,
@@ -177,18 +168,12 @@
// get sector context
ServiceContext sectorPart = facadeContext.getOrAddSectorContext(sectors);
- // compute nb expected tides for sample row
- int totalTidesExpected = getNbTidesExpected(sampleRow);
- // compute nb real tides for sample row
- int totalTidesReal = getNbTidesReal(sampleRow);
- // compute nb estimated tides for sample row
- int totalTidesEstimated = getNbTidesEstimated(sampleRow);
+ // compute nb tides per month
+ Map<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> nbTidesPerMonth = computeNbTidesPerMonth(sampleRow);
// add sample row
sectorPart.addSampleRow(sampleRow,
- totalTidesExpected,
- totalTidesReal,
- totalTidesEstimated,
+ nbTidesPerMonth,
observationTimesInDaysExpected,
observationTimesInDaysReal,
observationTimesInDaysEstimated);
@@ -236,9 +221,9 @@
ObsMerSamplingPlan result = new ObsMerSamplingPlan(months,
sortedFacades,
statisticsMap,
- highTotalExpected.toInteger(),
- highTotalReal.toInteger(),
- highTotalEstimated.toInteger(),
+ highTotalExpected,
+ highTotalReal,
+ highTotalEstimated,
observationTimesInDaysTotalExpected.toDouble(),
observationTimesInDaysTotalReal.toLong(),
observationTimesInDaysTotalEstimated.toLong(),
@@ -246,42 +231,42 @@
return result;
}
- protected int getNbTidesExpected(SampleRow sampleRow) {
- int result = 0;
+ protected Map<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> computeNbTidesPerMonth(SampleRow sampleRow) {
+ Map<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> result = new TreeMap<>();
for (Date month : months) {
- Integer tidesValue = SampleRows.getExpectedTidesValue(sampleRow, month);
- if (tidesValue != null) {
- result += tidesValue;
- totalExpectedForMonths.get(month).add(tidesValue);
+ Integer expectedTidesValue = SampleRows.getExpectedTidesValue(sampleRow, month);
+ if (expectedTidesValue != null) {
+ MutableInt mutableInt = totalExpectedForMonths.get(month);
+ if (mutableInt == null) {
+ totalExpectedForMonths.put(month, mutableInt = new MutableInt());
+ }
+ mutableInt.add(expectedTidesValue);
+ highTotalExpected += expectedTidesValue;
}
- }
- highTotalExpected.add(result);
- return result;
- }
-
- protected int getNbTidesReal(SampleRow sampleRow) {
- int result = 0;
- for (Date month : months) {
- Integer tidesValue = SampleRows.getRealTidesValue(sampleRow, month);
- if (tidesValue != null) {
- result += tidesValue;
- totalRealForMonths.get(month).add(tidesValue);
+ Integer realTidesValue = SampleRows.getRealTidesValue(sampleRow, month);
+ if (realTidesValue != null) {
+ MutableInt mutableInt = totalRealForMonths.get(month);
+ if (mutableInt == null) {
+ totalRealForMonths.put(month, mutableInt = new MutableInt());
+ }
+ mutableInt.add(realTidesValue);
+ highTotalReal += realTidesValue;
}
- }
- highTotalReal.add(result);
- return result;
- }
- protected int getNbTidesEstimated(SampleRow sampleRow) {
- int result = 0;
- for (Date month : months) {
- Integer tidesValue = SampleRows.getEstimatedTidesValue(sampleRow, month);
- if (tidesValue != null) {
- result += tidesValue;
- totalEstimatedForMonths.get(month).add(tidesValue);
+ Integer estimatedTidesValue = SampleRows.getEstimatedTidesValue(sampleRow, month);
+ if (estimatedTidesValue != null) {
+ MutableInt mutableInt = totalEstimatedForMonths.get(month);
+ if (mutableInt == null) {
+ totalEstimatedForMonths.put(month, mutableInt = new MutableInt());
+ }
+ mutableInt.add(estimatedTidesValue);
+ highTotalEstimated += estimatedTidesValue;
}
+ result.put(month, new ObsMerSamplingPlan.ObsMerSamplingPlanStatistics(expectedTidesValue,
+ realTidesValue,
+ estimatedTidesValue));
+
}
- highTotalEstimated.add(result);
return result;
}
@@ -335,22 +320,18 @@
protected ServiceContext(String sectors) {
this.sectors = sectors;
- rows = new ArrayList<>();
+ this.rows = new ArrayList<>();
}
protected ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart addSampleRow(SampleRow row,
- int totalTidesExpected,
- int totalTidesReal,
- int totalTidesEstimated,
+ Map<Date, ObsMerSamplingPlan.ObsMerSamplingPlanStatistics> nbTidesPerMonth,
Double observationTimesInDaysExpected,
Long observationTimesInDaysReal,
Long observationTimesInDaysEstimated) {
ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart rowPart =
- new ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart(row,
- totalTidesExpected,
- totalTidesReal,
- totalTidesEstimated,
+ new ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart(nbTidesPerMonth,
+ row,
observationTimesInDaysExpected,
observationTimesInDaysReal,
observationTimesInDaysEstimated);
@@ -363,7 +344,7 @@
Collection<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart> sortedRows = Ordering.natural().onResultOf(new Function<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart, String>() {
public String apply(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart input) {
- return input.getSampleRow().getCode();
+ return input.getCode();
}
}).immutableSortedCopy(rows);
ObsMerSamplingPlan.ObsMerSamplingPlanSectorPart result =
Modified: trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanServiceTest.java
===================================================================
--- trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanServiceTest.java 2014-03-27 10:36:13 UTC (rev 1763)
+++ trunk/wao-services/src/test/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanServiceTest.java 2014-03-27 12:02:46 UTC (rev 1764)
@@ -23,7 +23,6 @@
import com.google.common.collect.ImmutableSet;
import fr.ifremer.wao.SampleRowsFilter;
-import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.services.AbstractWaoServiceTest;
import fr.ifremer.wao.services.ObsMerFixtures;
import org.apache.commons.io.IOUtils;
@@ -36,8 +35,11 @@
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.List;
+import static fr.ifremer.wao.services.service.ObsMerSamplingPlan.*;
+
public class ObsMerSamplingPlanServiceTest extends AbstractWaoServiceTest {
private static final Log log = LogFactory.getLog(ObsMerSamplingPlanServiceTest.class);
@@ -83,25 +85,37 @@
serviceContext.setDate(DateUtil.createDate(15, 5, 2010));
SampleRowsFilter filter = service.newSampleRowsFilter(fixtures.admin());
- List<SampleRow> samplingPlan = service.getSamplingPlan(filter).getRows();
- Assert.assertEquals(12, samplingPlan.size());
+ ObsMerSamplingPlan samplingPlan = service.getSamplingPlan(filter);
+ assertSamplePlanRowsNumber(12, samplingPlan);
filter = service.newSampleRowsFilter(fixtures.admin());
filter.setFishingGearDcfIds(ImmutableSet.of(fixtures.ptb().getTopiaId()));
- samplingPlan = service.getSamplingPlan(filter).getRows();
- Assert.assertEquals(3, samplingPlan.size());
+ samplingPlan = service.getSamplingPlan(filter);
+ assertSamplePlanRowsNumber(3, samplingPlan);
filter = service.newSampleRowsFilter(fixtures.admin());
filter.setTargetSpeciesDcfIds(ImmutableSet.of(fixtures.def().getTopiaId()));
- samplingPlan = service.getSamplingPlan(filter).getRows();
- Assert.assertEquals(4, samplingPlan.size());
+ samplingPlan = service.getSamplingPlan(filter);
+ assertSamplePlanRowsNumber(4, samplingPlan );
filter = service.newSampleRowsFilter(fixtures.admin());
filter.setFishingGearDcfIds(ImmutableSet.of(fixtures.ptb().getTopiaId()));
filter.setTargetSpeciesDcfIds(ImmutableSet.of(fixtures.def().getTopiaId()));
- samplingPlan = service.getSamplingPlan(filter).getRows();
- Assert.assertEquals(1, samplingPlan.size());
+ samplingPlan = service.getSamplingPlan(filter);
+ assertSamplePlanRowsNumber(1, samplingPlan );
+ }
+ protected void assertSamplePlanRowsNumber(int expectedRowsSize, ObsMerSamplingPlan samplingPlan) {
+ int actualRowsSize = 0;
+ for (ObsMerSamplingPlanFacadePart facade : samplingPlan) {
+ for (ObsMerSamplingPlanSectorPart sectors : facade) {
+
+ for (ObsMerSamplingPlanSampleRowPart row : sectors) {
+ actualRowsSize++;
+ }
+ }
+ }
+ Assert.assertEquals(expectedRowsSize, actualRowsSize);
}
@Test
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-27 10:36:13 UTC (rev 1763)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-27 12:02:46 UTC (rev 1764)
@@ -215,80 +215,79 @@
</tr>
<%--Iterate on SampleRows --%>
<s:iterator value="samplingPlanSector" var="samplingPlanRow">
-<s:set var="sampleRow" value="%{#samplingPlanRow.sampleRow}"/>
- <tr<s:if test="sampleRowToHighlightId.equals(#sampleRow.topiaId)"> class="highlight"</s:if>>
+ <tr<s:if test="sampleRowToHighlightId.equals(topiaId)"> class="highlight"</s:if>>
<th>
- <s:property value="#sampleRow.code" />
+ <s:property value="code" />
</th>
- <td><s:property value="#sampleRow.programName" /></td>
+ <td><s:property value="programName" /></td>
<s:if test="fullView">
- <td class="only-visible-fullview"><s:property value="#sampleRow.company.name" /></td>
+ <td class="only-visible-fullview"><s:property value="companyName" /></td>
</s:if>
- <td class="only-visible-fullview"><s:property value="#samplingPlanRow.fishingZones" /></td>
+ <td class="only-visible-fullview"><s:property value="fishingZones" /></td>
<s:if test="fullView">
- <td class="only-visible-fullview"><s:property value="#sampleRow.fishingZonesInfos" /></td>
+ <td class="only-visible-fullview"><s:property value="fishingZonesInfos" /></td>
<td class="only-visible-fullview">
- <s:iterator value="%{#sampleRow.getdCF5Code()}" var="dcf5code">
+ <s:iterator value="dcf5CodesAndDescriptions">
<span>
- <s:property value="code"/>
+ <s:property value="key"/>
</span>
</s:iterator>
</td>
- <td class="only-visible-fullview"><s:property value="#sampleRow.profession.meshSize" /></td>
- <td class="only-visible-fullview"><s:property value="#sampleRow.profession.size" /></td>
- <td class="only-visible-fullview"><s:property value="#sampleRow.profession.other" /></td>
- <td class="only-visible-fullview"><s:property value="#sampleRow.profession.libelle" /></td>
- <td class="only-visible-fullview"><s:property value="#sampleRow.profession.species" /></td>
- <td class="only-visible-fullview"><s:property value="%{formatMonth(#sampleRow.periodBegin)}" /></td>
- <td class="only-visible-fullview"><s:property value="%{formatMonth(#sampleRow.periodEnd)}" /></td>
+ <td class="only-visible-fullview"><s:property value="professionMeshSize" /></td>
+ <td class="only-visible-fullview"><s:property value="professionSize" /></td>
+ <td class="only-visible-fullview"><s:property value="professionOther" /></td>
+ <td class="only-visible-fullview"><s:property value="professionLibelle" /></td>
+ <td class="only-visible-fullview"><s:property value="professionSpecies" /></td>
+ <td class="only-visible-fullview"><s:property value="%{formatMonth(periodBegin)}" /></td>
+ <td class="only-visible-fullview"><s:property value="%{formatMonth(periodEnd)}" /></td>
</s:if>
<s:else>
<td class="only-visible-compactview">
- <s:iterator value="%{#sampleRow.getdCF5Code()}" var="dcf5code">
- <span>
- <s:property value="code"/>
- </span>
+ <s:iterator value="dcf5CodesAndDescriptions">
+ <span>
+ <s:property value="key"/>
+ </span>
</s:iterator>
- <s:property value="#sampleRow.professionDescriptionWithoutDCF5" />
+ <s:property value="professionDescriptionWithoutDCF5" />
</td>
<td class="only-visible-compactview">
- <s:property value="#row.profession.libelle" />
+ <s:property value="professionLibelle" />
</td>
</s:else>
<!-- Months columns -->
<s:iterator value="samplingPlan.months" var="month">
<td<s:if test="@fr.ifremer.wao.WaoUtils@isCurrentMonth(#month)"> class="current-month"</s:if>>
- <s:property value="%{#samplingPlanRow.getNbTidesExpected(#month)}"/>
- <span<s:if test="#samplingPlanRow.hasNbTidesReal(#month) && !#authenticatedWaoUser.guest"> class="display-tides-real"</s:if>>
- <em>(<s:property value="%{#samplingPlanRow.getNbTidesReal(#month)}"/>)
+ <s:property value="%{getNbTidesExpected(#month)}"/>
+ <span<s:if test="hasNbTidesReal(#month) && !#authenticatedWaoUser.guest"> class="display-tides-real"</s:if>>
+ <em>(<s:property value="%{getNbTidesReal(#month)}"/>)
</em>
</span>
</td>
</s:iterator>
<td>
<span>
- <s:property value="#samplingPlanRow.totalTidesExpected" />
+ <s:property value="totalTidesExpected" />
<s:if test="!authenticatedWaoUser.guest">
- <em>(<s:property value="#samplingPlanRow.totalTidesReal" />)</em>
+ <em>(<s:property value="totalTidesReal" />)</em>
<br/>
- <strong><s:property value="#samplingPlanRow.totalPercentage" /></strong>
+ <strong><s:property value="totalPercentage" /></strong>
</s:if>
</span>
</td>
<td>
- <s:property value="#samplingPlanRow.observationTimesInDaysExpected" /> <s:text name="wao.ui.misc.day"/>
+ <s:property value="observationTimesInDaysExpected" /> <s:text name="wao.ui.misc.day"/>
<span>
- <em>(<s:property value="#samplingPlanRow.observationTimesInDaysReal" /> <s:text name="wao.ui.misc.day"/>)</em>
+ <em>(<s:property value="observationTimesInDaysReal" /> <s:text name="wao.ui.misc.day"/>)</em>
</span>
</td>
- <td><s:property value="#sampleRow.averageTideTime" /></td>
- <td><s:property value="#sampleRow.nbObservants" /></td>
+ <td><s:property value="averageTideTime" /></td>
+ <td><s:property value="nbObservants" /></td>
<td>
- <s:if test="sampleRow.appliedCoverageRate">
- <s:property value="#sampleRow.appliedCoverageRate" /> %
+ <s:if test="appliedCoverageRate">
+ <s:property value="appliedCoverageRate" /> %
</s:if>
</td>
- <td><s:property value="#sampleRow.comment" /></td>
+ <td><s:property value="comment" /></td>
<td class="actions">
<div class="dropdown">
@@ -300,7 +299,7 @@
<s:if test="authenticatedWaoUser.authorizedToEditSamplingPlan">
<li>
<s:url action="edit-sample-row!input" id="editSampleRowUrl">
- <s:param name="sampleRowId" value="sampleRow.topiaId" />
+ <s:param name="sampleRowId" value="sampleRowId" />
</s:url>
<s:a href="%{editSampleRowUrl}">
<i class="icon-edit"></i> <s:text name="wao.ui.action.edit" />
@@ -308,7 +307,7 @@
</li>
<li>
<s:url action="delete-sample-row" id="deleteSampleRowUrl">
- <s:param name="companyId" value="sampleRow.topiaId" />
+ <s:param name="companyId" value="sampleRowId" />
</s:url>
<s:a href="%{deleteSampleRowUrl}">
<i class="icon-trash"></i> <s:text name="wao.ui.action.delete" />
@@ -317,7 +316,7 @@
</s:if>
<li>
<s:url action="sample-row-log" id="sampleRowLogUrl">
- <s:param name="sampleRowId" value="sampleRow.topiaId" />
+ <s:param name="sampleRowId" value="sampleRowId" />
</s:url>
<s:a href="%{sampleRowLogUrl}">
<i class="icon-time"></i> <s:text name="wao.ui.action.viewSampleRowLog" />
@@ -325,7 +324,7 @@
</li>
<li>
<s:url action="boats" id="viewElligibleBoatsUrl">
- <s:param name="sampleRowIds" value="sampleRow.topiaId" />
+ <s:param name="sampleRowIds" value="sampleRowId" />
</s:url>
<s:a href="%{viewElligibleBoatsUrl}">
<s:text name="wao.ui.action.viewElligibleBoats" />
@@ -333,7 +332,7 @@
</li>
<li>
<s:url action="contacts" id="viewAssociatedContactsUrl">
- <s:param name="sampleRowIds" value="sampleRow.topiaId" />
+ <s:param name="sampleRowIds" value="sampleRowId" />
</s:url>
<s:a href="%{viewAssociatedContactsUrl}">
<s:text name="wao.ui.action.viewAssociatedContacts" />
@@ -342,7 +341,7 @@
<s:if test="authenticatedWaoUser.authorizedToCreateContact">
<li>
<s:url action="contacts" id="createAssociatedContactUrl">
- <s:param name="sampleRowIds" value="sampleRow.topiaId" />
+ <s:param name="sampleRowIds" value="sampleRowId" />
</s:url>
<s:a href="%{createAssociatedContactUrl}">
<i class="icon-add"></i> <s:text name="wao.ui.action.createAssociatedContact" />
1
0
27 Mar '14
Author: bleny
Date: 2014-03-27 11:36:13 +0100 (Thu, 27 Mar 2014)
New Revision: 1763
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1763
Log:
refs #4483 translate dcfs code labels in ui
Added:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoCacheElement.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/LocalizedSampleRowsFilterValues.java
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SampleRowsFilterValuesJsonAction.java
trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
trunk/wao-web/src/main/webapp/css/wao.css
trunk/wao-web/src/main/webapp/js/wao.js
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java 2014-03-27 10:36:13 UTC (rev 1763)
@@ -79,6 +79,6 @@
@Override
public String getI18nKey() {
- return "fr.ifr.mer.wao.entity.TargetSpeciesDCF." + getCode();
+ return "fr.ifremer.wao.entity.TargetSpeciesDCF." + getCode();
}
}
Modified: trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties
===================================================================
--- trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-persistence/src/main/resources/i18n/wao-persistence_en_GB.properties 2014-03-27 10:36:13 UTC (rev 1763)
@@ -67,6 +67,7 @@
fr.ifremer.wao.entity.FishingGearDCF.FWR=Barriers, fences, weirs, etc.
fr.ifremer.wao.entity.FishingGearDCF.FYK=Fyke nets
fr.ifremer.wao.entity.FishingGearDCF.GEN=Gillnets and entangling nets (not specified)
+fr.ifremer.wao.entity.FishingGearDCF.GES=
fr.ifremer.wao.entity.FishingGearDCF.GN=Gillnets (not specified)
fr.ifremer.wao.entity.FishingGearDCF.GNC=Encircling gillnets
fr.ifremer.wao.entity.FishingGearDCF.GND=Driftnets
Added: trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoCacheElement.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoCacheElement.java (rev 0)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/WaoCacheElement.java 2014-03-27 10:36:13 UTC (rev 1763)
@@ -0,0 +1,7 @@
+package fr.ifremer.wao.services;
+
+import java.io.Serializable;
+
+public interface WaoCacheElement extends Serializable {
+
+}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-27 10:36:13 UTC (rev 1763)
@@ -5,6 +5,7 @@
import fr.ifremer.wao.entity.SampleRow;
import fr.ifremer.wao.entity.SamplingStrategy;
import fr.ifremer.wao.entity.TerrestrialLocation;
+import org.apache.commons.lang3.tuple.Pair;
import java.io.Serializable;
import java.util.HashMap;
@@ -33,11 +34,11 @@
protected Map<String, String> terrestrialDistricts = new HashMap<>();
- /** Values are the i18n keys. */
- protected Map<String, String> fishingGearDcfs = new HashMap<>();
+ /** Values are the code and the label i18n key. */
+ protected Map<String, Pair<String, String>> fishingGearDcfs = new HashMap<>();
- /** Values are the i18n keys. */
- protected Map<String, String> targetSpeciesDcfs = new HashMap<>();
+ /** Values are the code and the label i18n key. */
+ protected Map<String, Pair<String, String>> targetSpeciesDcfs = new HashMap<>();
public void addSampleRow(SampleRow sampleRow) {
for (FishingZone fishingZone : sampleRow.getFishingZone()) {
@@ -53,9 +54,15 @@
terrestrialDistricts.put(terrestrialDistrict.getTopiaId(), terrestrialDistrict.getDescription());
}
for (DCF5Code dcf5Code : sampleRow.getdCF5Code()) {
- fishingGearDcfs.put(dcf5Code.getFishingGearDCF().getTopiaId(), dcf5Code.getFishingGearDCF().getI18nKey());
+ fishingGearDcfs.put(
+ dcf5Code.getFishingGearDCF().getTopiaId(),
+ Pair.of(dcf5Code.getFishingGearDCF().getCode(),
+ dcf5Code.getFishingGearDCF().getI18nKey()));
if (dcf5Code.getTargetSpeciesDCF() != null) {
- targetSpeciesDcfs.put(dcf5Code.getTargetSpeciesDCF().getTopiaId(), dcf5Code.getTargetSpeciesDCF().getI18nKey());
+ targetSpeciesDcfs.put(
+ dcf5Code.getTargetSpeciesDCF().getTopiaId(),
+ Pair.of(dcf5Code.getTargetSpeciesDCF().getCode(),
+ dcf5Code.getTargetSpeciesDCF().getI18nKey()));
}
}
}
@@ -88,12 +95,11 @@
return terrestrialDistricts;
}
- public Map<String, String> getFishingGearDcfs() {
+ public Map<String, Pair<String, String>> getFishingGearDcfs() {
return fishingGearDcfs;
}
- public Map<String, String> getTargetSpeciesDcfs() {
+ public Map<String, Pair<String, String>> getTargetSpeciesDcfs() {
return targetSpeciesDcfs;
}
-
}
Added: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/LocalizedSampleRowsFilterValues.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/LocalizedSampleRowsFilterValues.java (rev 0)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/LocalizedSampleRowsFilterValues.java 2014-03-27 10:36:13 UTC (rev 1763)
@@ -0,0 +1,82 @@
+package fr.ifremer.wao.web.action.obsmer;
+
+import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.SamplingStrategy;
+import fr.ifremer.wao.services.WaoCacheElement;
+import fr.ifremer.wao.services.service.SampleRowsFilterValues;
+import org.apache.commons.lang3.tuple.Pair;
+import org.nuiton.i18n.I18n;
+
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+
+public class LocalizedSampleRowsFilterValues implements WaoCacheElement {
+
+ protected Locale locale;
+
+ protected SampleRowsFilterValues decorated;
+
+ public LocalizedSampleRowsFilterValues(Locale locale, SampleRowsFilterValues decorated) {
+ this.locale = locale;
+ this.decorated = decorated;
+ }
+
+ public void addSampleRow(SampleRow sampleRow) {
+ decorated.addSampleRow(sampleRow);
+ }
+
+ public Set<String> getSampleRowCodes() {
+ return decorated.getSampleRowCodes();
+ }
+
+ public Set<SamplingStrategy> getSamplingStrategies() {
+ return decorated.getSamplingStrategies();
+ }
+
+ public Set<String> getFishingZoneSectorNames() {
+ return decorated.getFishingZoneSectorNames();
+ }
+
+ public Set<String> getProgramNames() {
+ return decorated.getProgramNames();
+ }
+
+ public Set<String> getFishingZoneFacadeNames() {
+ return decorated.getFishingZoneFacadeNames();
+ }
+
+ public Map<String, String> getCompanies() {
+ return decorated.getCompanies();
+ }
+
+ public Map<String, String> getTerrestrialDistricts() {
+ return decorated.getTerrestrialDistricts();
+ }
+
+ public Map<String, String> getFishingGearDcfs() {
+ Map<String, String> translated = new HashMap<>();
+ for (Map.Entry<String, Pair<String, String>> entry :
+ decorated.getFishingGearDcfs().entrySet()) {
+ String topiaId = entry.getKey();
+ String code = entry.getValue().getLeft();
+ String i18nKey = entry.getValue().getRight();
+ translated.put(topiaId, code + " " + I18n.l(locale, i18nKey));
+ }
+ return translated;
+ }
+
+ public Map<String, String> getTargetSpeciesDcfs() {
+ Map<String, String> translated = new HashMap<>();
+ for (Map.Entry<String, Pair<String, String>> entry :
+ decorated.getTargetSpeciesDcfs().entrySet()) {
+ String topiaId = entry.getKey();
+ String code = entry.getValue().getLeft();
+ String i18nKey = entry.getValue().getRight();
+ translated.put(topiaId, code + " " + I18n.l(locale, i18nKey));
+ }
+ return translated;
+ }
+
+}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SampleRowsFilterValuesJsonAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SampleRowsFilterValuesJsonAction.java 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SampleRowsFilterValuesJsonAction.java 2014-03-27 10:36:13 UTC (rev 1763)
@@ -15,7 +15,7 @@
protected transient SampleRowsFilter filter;
- protected SampleRowsFilterValues filterValues;
+ protected LocalizedSampleRowsFilterValues filterValues;
public void setService(ObsMerSamplingPlanService service) {
this.service = service;
@@ -40,12 +40,14 @@
ObsMerSamplingPlan samplingPlan = service.getSamplingPlan(filter);
- filterValues = samplingPlan.getFilterValues();
+ SampleRowsFilterValues filterValues = samplingPlan.getFilterValues();
+ this.filterValues = new LocalizedSampleRowsFilterValues(getLocale(), filterValues);
+
return SUCCESS;
}
- public SampleRowsFilterValues getFilterValues() {
+ public LocalizedSampleRowsFilterValues getFilterValues() {
return filterValues;
}
Modified: trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java
===================================================================
--- trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-web/src/main/java/fr/ifremer/wao/web/action/obsmer/SamplingPlanAction.java 2014-03-27 10:36:13 UTC (rev 1763)
@@ -71,4 +71,11 @@
return getSession().getSampleRowToHighlightId();
}
+ public LocalizedSampleRowsFilterValues getFilterValues() {
+ LocalizedSampleRowsFilterValues filterValues =
+ new LocalizedSampleRowsFilterValues(
+ getLocale(),
+ getSamplingPlan().getFilterValues());
+ return filterValues;
+ }
}
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-27 10:36:13 UTC (rev 1763)
@@ -34,7 +34,7 @@
$(document).ready(function () {
- var sampleRowsFilterController = new SampleRowsFilterController(SAMPLE_ROWS_FILTER_VALUES_JSON_URL);
+ var sampleRowsFilterController = new SampleRowsFilterController(SAMPLE_ROWS_FILTER_VALUES_JSON_URL, $('#sampling-plan-filters-form'));
sampleRowsFilterController.init();
});
@@ -43,6 +43,8 @@
</head>
+ <content tag="mainClass">large</content>
+
<h1>
<s:text name="wao.ui.page.SamplingPlan.title" />
</h1>
@@ -54,81 +56,86 @@
</s:a>
</s:if>
- <s:form method="GET">
+ <s:form method="GET" id="sampling-plan-filters-form" cssClass="filters-form">
- <s:textfield name="filter.periodFrom"
- label="%{getText('wao.ui.form.periodFrom')}"
- placeholder="04/2014"
- cssClass="input-small" />
+ <fieldset>
- <s:textfield name="filter.periodTo"
- label="%{getText('wao.ui.form.period.to')}"
- placeholder="03/2015"
- cssClass="input-small" />
+ <s:textfield name="filter.periodFrom"
+ label="%{getText('wao.ui.form.periodFrom')}"
+ placeholder="04/2014"
+ cssClass="input-small" />
+ <s:textfield name="filter.periodTo"
+ label="%{getText('wao.ui.form.period.to')}"
+ placeholder="03/2015"
+ cssClass="input-small" />
+
+ </fieldset>
+
+ <fieldset>
+
<s:select name="filter.companyIds"
label="%{getText('wao.ui.entity.Company')}"
- list="samplingPlan.filterValues.companies"
+ list="filterValues.companies"
multiple="true"
- dataBinding="companies"
- cssClass="input-xlarge" />
+ dataBinding="companies" />
<s:select name="filter.programNames"
label="%{getText('wao.ui.field.SampleRow.programName')}"
- list="samplingPlan.filterValues.programNames"
+ list="filterValues.programNames"
multiple="true"
- dataBinding="programNames"
- cssClass="input-xlarge" />
+ dataBinding="programNames" />
<s:select name="filter.fishingZoneFacadeNames"
label="%{getText('wao.ui.field.FishingZone.facadeName')}"
- list="samplingPlan.filterValues.fishingZoneFacadeNames"
+ list="filterValues.fishingZoneFacadeNames"
multiple="true"
- dataBinding="fishingZoneFacadeNames"
- cssClass="input-xlarge" />
+ dataBinding="fishingZoneFacadeNames" />
<s:select name="filter.fishingZoneSectorNames"
label="%{getText('wao.ui.field.FishingZone.sectorName')}"
- list="samplingPlan.filterValues.fishingZoneSectorNames"
+ list="filterValues.fishingZoneSectorNames"
multiple="true"
- dataBinding="fishingZoneSectorNames"
- cssClass="input-xlarge" />
+ dataBinding="fishingZoneSectorNames" />
<s:select name="filter.sampleRowCodes"
label="%{getText('wao.ui.field.SampleRow.code')}"
- list="samplingPlan.filterValues.sampleRowCodes"
+ list="filterValues.sampleRowCodes"
multiple="true"
- dataBinding="sampleRowCodes"
- cssClass="input-xlarge" />
+ dataBinding="sampleRowCodes" />
<s:select name="filter.fishingGearDcfIds"
label="%{getText('wao.ui.entity.fishingGearDCF')}"
- list="samplingPlan.filterValues.fishingGearDcfs"
+ list="filterValues.fishingGearDcfs"
value="%getText(#value)"
multiple="true"
- dataBinding="fishingGearDcfs"
- cssClass="input-xlarge" />
+ dataBinding="fishingGearDcfs" />
<s:select name="filter.targetSpeciesDcfIds"
label="%{getText('wao.ui.entity.targetSpeciesDCF')}"
- list="samplingPlan.filterValues.targetSpeciesDcfs"
+ list="filterValues.targetSpeciesDcfs"
multiple="true"
- dataBinding="targetSpeciesDcfs"
- cssClass="input-xlarge" />
+ dataBinding="targetSpeciesDcfs" />
- <s:url action="sampling-plan" id="samplingPlanUrl" />
- <s:a href="%{samplingPlanUrl}" cssClass="btn">
- <i class="icon-reset"></i> <s:text name="wao.ui.action.reset" />
- </s:a>
+ </fieldset>
- <s:submit type="button" cssClass="btn">
- <i class="icon-filter"></i> <s:text name="wao.ui.action.filter" />
- </s:submit>
+ <div class="form-actions" style="clear: both;">
- <s:submit action="export-sampling-plan" type="button" cssClass="btn">
- <i class="icon-download"></i> <s:text name="wao.ui.action.csvExport" />
- </s:submit>
+ <s:url action="sampling-plan" id="samplingPlanUrl" />
+ <s:a href="%{samplingPlanUrl}" cssClass="btn">
+ <i class="icon-reset"></i> <s:text name="wao.ui.action.reset" />
+ </s:a>
+ <s:submit type="button" cssClass="btn">
+ <i class="icon-filter"></i> <s:text name="wao.ui.action.filter" />
+ </s:submit>
+
+ <s:submit action="export-sampling-plan" type="button" cssClass="btn">
+ <i class="icon-download"></i> <s:text name="wao.ui.action.csvExport" />
+ </s:submit>
+
+ </div>
+
</s:form>
<s:set var="estimatedTides" value="true"/>
Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-03-27 10:36:13 UTC (rev 1763)
@@ -28,7 +28,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><decorator:title default="Wao"/> - Wao</title>
- <sj:head locale="fr" jqueryui="true" />
+ <sj:head locale="fr" loadFromGoogle="true" jqueryui="true" />
<sb:head />
<script type="text/javascript" src="<s:url value='/js/moment-js-2.5.1/moment-with-langs.js' />"></script>
<script type="text/javascript" src="<s:url value='/js/select2-3.4.5/select2.min.js' />"></script>
@@ -48,13 +48,13 @@
<div class="navbar-inner">
<a class="brand" href="#">Wao <s:property value="getText(obsProgram)" /></a>
<ul class="nav">
- <li class="active">
+ <li>
<s:url namespace="/%{obsProgram.name().toLowerCase()}" action="news" id="newsUrl" />
<s:a href="%{newsUrl}">
<i class="icon-home"></i> <s:text name="wao.ui.page.Index.title" />
</s:a>
</li>
- <li>
+ <li class="active">
<s:url namespace="/%{obsProgram.name().toLowerCase()}" action="sampling-plan" id="samplingPlanUrl" />
<s:a href="%{samplingPlanUrl}">
<i class="icon-tasks"></i> <s:text name="wao.ui.page.SamplingPlan.title" />
@@ -163,7 +163,7 @@
</div>
</div>
- <main>
+ <main class="<decorator:getProperty property="page.mainClass"/>">
<s:actionerror theme="bootstrap" />
<s:actionmessage theme="bootstrap" />
<s:fielderror theme="bootstrap" />
Modified: trunk/wao-web/src/main/webapp/css/wao.css
===================================================================
--- trunk/wao-web/src/main/webapp/css/wao.css 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-web/src/main/webapp/css/wao.css 2014-03-27 10:36:13 UTC (rev 1763)
@@ -53,6 +53,13 @@
margin-right: auto;
}
+main.large {
+ width: 100%;
+ max-width: 100%;
+ margin-left: 10px;
+ margin-right: 10px;
+}
+
/**
* Le style général des formulaires
*/
@@ -111,9 +118,25 @@
}
/**
- * Styles spécifiques pour certainse pages de l'appli
+ * Les filtres
*/
+form.filters-form {
+ width: auto;
+ margin-left: auto;
+ margin-right: auto;
+}
+
+form.filters-form .control-group {
+ float: left;
+ margin-left: 5px;
+ margin-right: 5px;
+}
+
+/**
+ * Styles spécifiques pour certaines pages de l'appli
+ */
+
#expectedObservationsByMonthsTable th {
white-space: nowrap;
}
Modified: trunk/wao-web/src/main/webapp/js/wao.js
===================================================================
--- trunk/wao-web/src/main/webapp/js/wao.js 2014-03-26 17:16:44 UTC (rev 1762)
+++ trunk/wao-web/src/main/webapp/js/wao.js 2014-03-27 10:36:13 UTC (rev 1763)
@@ -40,15 +40,18 @@
};
-var SampleRowsFilterView = function (sampleRowsFilterModel) {
+var SampleRowsFilterView = function (sampleRowsFilterModel, $filtersForm) {
var self = this;
this.model = sampleRowsFilterModel;
+ this.$filtersForm = $filtersForm;
+ this.$selects = $filtersForm.find('select');
+ this.$inputs = $filtersForm.find('input[type=text]');
this.getFilter = function () {
var filter = {};
- $('select').each(function (index, select) {
+ this.$selects.each(function (index, select) {
var $select = $(select);
var parameterName = $select.prop('name');
var parameterValues = [];
@@ -57,7 +60,7 @@
});
filter[parameterName] = parameterValues;
});
- $('input[type=text]').each(function (index, input) {
+ this.$inputs.each(function (index, input) {
var $input = $(input);
var parameterName = $(input).prop('name');
var parameterValue = $(input).prop('value');
@@ -70,7 +73,7 @@
// store options selected by user to re-select them after update
var filter = this.getFilter();
var filterValues = this.model.filterValues;
- $('select').each(function (index, select) {
+ this.$selects.each(function (index, select) {
var $select = $(select).empty();
var name = $select.prop('name');
// FIXME brendan 26/03/14 should be data-binding but freemarker break the template :-(
@@ -88,6 +91,7 @@
$select.find('option[value="' + selectedOption + '"]').prop('selected', 'selected');
});
});
+ this.$filtersForm.effect( "highlight", "slow" );
}
$(this.model).on('updated', function () {
@@ -96,12 +100,12 @@
};
-var SampleRowsFilterController = function (filterValuesUrl) {
+var SampleRowsFilterController = function (filterValuesUrl, $filtersForm) {
var self = this;
this.model = new SampleRowsFilterModel(filterValuesUrl);
- this.view = new SampleRowsFilterView(this.model);
+ this.view = new SampleRowsFilterView(this.model, $filtersForm);
this.onFilterChange = function () {
var filter = this.view.getFilter();
@@ -109,10 +113,10 @@
};
this.init = function () {
- $('input').change(function () {
+ this.view.$selects.blur(function () {
self.onFilterChange();
});
- $('select').change(function () {
+ this.view.$inputs.blur(function () {
self.onFilterChange();
});
}
@@ -121,6 +125,6 @@
$(document).ready(function () {
- $('select').select2();
+ // $('select').select2();
});
\ No newline at end of file
1
0
r1762 - trunk/wao-services/src/main/java/fr/ifremer/wao/services/service
by tchemit@users.forge.codelutin.com 26 Mar '14
by tchemit@users.forge.codelutin.com 26 Mar '14
26 Mar '14
Author: tchemit
Date: 2014-03-26 18:16:44 +0100 (Wed, 26 Mar 2014)
New Revision: 1762
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1762
Log:
use I18nAble in FilterValues
Modified:
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-26 17:14:02 UTC (rev 1761)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/SampleRowsFilterValues.java 2014-03-26 17:16:44 UTC (rev 1762)
@@ -53,11 +53,9 @@
terrestrialDistricts.put(terrestrialDistrict.getTopiaId(), terrestrialDistrict.getDescription());
}
for (DCF5Code dcf5Code : sampleRow.getdCF5Code()) {
- String i18nKey = "fr.ifremer.wao.entity.FishingGearDCF." + dcf5Code.getFishingGearDCF().getCode();
- fishingGearDcfs.put(dcf5Code.getFishingGearDCF().getTopiaId(), i18nKey);
+ fishingGearDcfs.put(dcf5Code.getFishingGearDCF().getTopiaId(), dcf5Code.getFishingGearDCF().getI18nKey());
if (dcf5Code.getTargetSpeciesDCF() != null) {
- i18nKey = "fr.ifremer.wao.entity.TargetSpeciesDCF." + dcf5Code.getTargetSpeciesDCF().getCode();
- targetSpeciesDcfs.put(dcf5Code.getTargetSpeciesDCF().getTopiaId(), i18nKey);
+ targetSpeciesDcfs.put(dcf5Code.getTargetSpeciesDCF().getTopiaId(), dcf5Code.getTargetSpeciesDCF().getI18nKey());
}
}
}
1
0
r1761 - trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer
by tchemit@users.forge.codelutin.com 26 Mar '14
by tchemit@users.forge.codelutin.com 26 Mar '14
26 Mar '14
Author: tchemit
Date: 2014-03-26 18:14:02 +0100 (Wed, 26 Mar 2014)
New Revision: 1761
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1761
Log:
refs-40 #4483 (fix full-view compact-view)
Modified:
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-26 17:12:39 UTC (rev 1760)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-26 17:14:02 UTC (rev 1761)
@@ -163,7 +163,7 @@
<td><s:text name="wao.ui.entity.FishingZone"/></td>
<s:if test="fullView">
<td class="only-visible-fullview"><s:text name="wao.ui.samplingPlan.fishingZoneInfo"/></td>
- <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td>
+ <td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dcf5Code"/></td>
<td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.meshSize"/></td>
<td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.size"/></td>
<td class="only-visible-fullview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.other"/></td>
@@ -173,8 +173,8 @@
<td class="only-visible-fullview"><s:text name="wao.ui.field.SampleRow.periodEnd"/></td>
</s:if>
<s:else>
- <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dCF5Code"/></td>
- <td><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.libelle"/></td>
+ <td class="only-visible-compactview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.dcf5Code"/></td>
+ <td class="only-visible-compactview"><s:text name="wao.ui.misc.METIER"/> <br/> <s:text name="wao.ui.field.SampleRow.libelle"/></td>
</s:else>
<!-- Months columns -->
@@ -216,12 +216,14 @@
<td><s:property value="#sampleRow.programName" /></td>
<s:if test="fullView">
<td class="only-visible-fullview"><s:property value="#sampleRow.company.name" /></td>
+</s:if>
<td class="only-visible-fullview"><s:property value="#samplingPlanRow.fishingZones" /></td>
+<s:if test="fullView">
<td class="only-visible-fullview"><s:property value="#sampleRow.fishingZonesInfos" /></td>
<td class="only-visible-fullview">
- <s:iterator value="sampleRow.dcf5code" var="dcf5code">
+ <s:iterator value="%{#sampleRow.getdCF5Code()}" var="dcf5code">
<span>
- <s:property />
+ <s:property value="code"/>
</span>
</s:iterator>
</td>
@@ -234,15 +236,17 @@
<td class="only-visible-fullview"><s:property value="%{formatMonth(#sampleRow.periodEnd)}" /></td>
</s:if>
<s:else>
- <td><s:property value="#samplingPlanRow.fishingZones" /></td>
- <td>
- <s:iterator value="sampleRow.dcf5code" var="dcf5code">
+ <td class="only-visible-compactview">
+ <s:iterator value="%{#sampleRow.getdCF5Code()}" var="dcf5code">
<span>
- <s:property />
+ <s:property value="code"/>
</span>
</s:iterator>
<s:property value="#sampleRow.professionDescriptionWithoutDCF5" />
</td>
+ <td class="only-visible-compactview">
+ <s:property value="#row.profession.libelle" />
+ </td>
</s:else>
<!-- Months columns -->
<s:iterator value="samplingPlan.months" var="month">
1
0
r1760 - in trunk/wao-persistence/src/main: java/fr/ifremer/wao/entity xmi
by tchemit@users.forge.codelutin.com 26 Mar '14
by tchemit@users.forge.codelutin.com 26 Mar '14
26 Mar '14
Author: tchemit
Date: 2014-03-26 18:12:39 +0100 (Wed, 26 Mar 2014)
New Revision: 1760
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1760
Log:
I18nAble
Added:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/I18nAble.java
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
trunk/wao-persistence/src/main/xmi/wao-model.zargo
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java 2014-03-26 15:36:29 UTC (rev 1759)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/FishingGearDCFImpl.java 2014-03-26 17:12:39 UTC (rev 1760)
@@ -25,11 +25,81 @@
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import static org.nuiton.i18n.I18n.n;
+
/**
* @author bleny
*/
public class FishingGearDCFImpl extends FishingGearDCFAbstract {
+ static {
+ //To detect all i18n keys
+ n("fr.ifremer.wao.entity.FishingGearDCF.");
+ n("fr.ifremer.wao.entity.FishingGearDCF.DRB");
+ n("fr.ifremer.wao.entity.FishingGearDCF.DRH");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FAR");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FCN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FG");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FIX");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FPN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FPO");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FSN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FWR");
+ n("fr.ifremer.wao.entity.FishingGearDCF.FYK");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GEN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GES");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GNC");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GND");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GNF");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GNS");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GT");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GTN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.GTR");
+ n("fr.ifremer.wao.entity.FishingGearDCF.HAR");
+ n("fr.ifremer.wao.entity.FishingGearDCF.HMD");
+ n("fr.ifremer.wao.entity.FishingGearDCF.HMP");
+ n("fr.ifremer.wao.entity.FishingGearDCF.HMX");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LA");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LHM");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LHP");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LL");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LLD");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LLS");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LNB");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LNP");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LNS");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LTL");
+ n("fr.ifremer.wao.entity.FishingGearDCF.LX");
+ n("fr.ifremer.wao.entity.FishingGearDCF.MIS");
+ n("fr.ifremer.wao.entity.FishingGearDCF.NK");
+ n("fr.ifremer.wao.entity.FishingGearDCF.OT");
+ n("fr.ifremer.wao.entity.FishingGearDCF.OTB");
+ n("fr.ifremer.wao.entity.FishingGearDCF.OTM");
+ n("fr.ifremer.wao.entity.FishingGearDCF.OTT");
+ n("fr.ifremer.wao.entity.FishingGearDCF.PS");
+ n("fr.ifremer.wao.entity.FishingGearDCF.PS1");
+ n("fr.ifremer.wao.entity.FishingGearDCF.PS2");
+ n("fr.ifremer.wao.entity.FishingGearDCF.PT");
+ n("fr.ifremer.wao.entity.FishingGearDCF.PTB");
+ n("fr.ifremer.wao.entity.FishingGearDCF.PTM");
+ n("fr.ifremer.wao.entity.FishingGearDCF.RG");
+ n("fr.ifremer.wao.entity.FishingGearDCF.SB");
+ n("fr.ifremer.wao.entity.FishingGearDCF.SDN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.SPR");
+ n("fr.ifremer.wao.entity.FishingGearDCF.SSC");
+ n("fr.ifremer.wao.entity.FishingGearDCF.SV");
+ n("fr.ifremer.wao.entity.FishingGearDCF.SW");
+ n("fr.ifremer.wao.entity.FishingGearDCF.TB");
+ n("fr.ifremer.wao.entity.FishingGearDCF.TBB");
+ n("fr.ifremer.wao.entity.FishingGearDCF.TBN");
+ n("fr.ifremer.wao.entity.FishingGearDCF.TBS");
+ n("fr.ifremer.wao.entity.FishingGearDCF.TM");
+ n("fr.ifremer.wao.entity.FishingGearDCF.TMS");
+ n("fr.ifremer.wao.entity.FishingGearDCF.TX");
+ }
+
public FishingGearDCFImpl() {
super();
}
@@ -54,4 +124,9 @@
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
+
+ @Override
+ public String getI18nKey() {
+ return "fr.ifremer.wao.entity.FishingGearDCF." + getCode();
+ }
}
Added: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/I18nAble.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/I18nAble.java (rev 0)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/I18nAble.java 2014-03-26 17:12:39 UTC (rev 1760)
@@ -0,0 +1,12 @@
+package fr.ifremer.wao.entity;
+
+/**
+ * Created on 3/26/14.
+ *
+ * @author Tony Chemit <chemit(a)codelutin.com>
+ * @since 4.0
+ */
+public interface I18nAble {
+
+ String getI18nKey();
+}
Property changes on: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/I18nAble.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java 2014-03-26 15:36:29 UTC (rev 1759)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/TargetSpeciesDCFImpl.java 2014-03-26 17:12:39 UTC (rev 1760)
@@ -25,11 +25,33 @@
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import static org.nuiton.i18n.I18n.n;
+
/**
* @author bleny
*/
public class TargetSpeciesDCFImpl extends TargetSpeciesDCFAbstract {
+ {
+ //To detect all i18n keys
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.ALG");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.ANA");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.CAT");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.CRU");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.CRW");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.CSJ");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.DEF");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.DWS");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.FIF");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.FIN");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.LPF");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.MOL");
+ n("fr.ifremer.wao.entity.TargetSpeciesDCF.SPF");
+ n("fr.ifremer.wao.entity.TerrestrialDivision");
+ n("fr.ifremer.wao.entity.TerrestrialLocation");
+ }
+
public TargetSpeciesDCFImpl() {
super();
}
@@ -54,4 +76,9 @@
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
+
+ @Override
+ public String getI18nKey() {
+ return "fr.ifr.mer.wao.entity.TargetSpeciesDCF." + getCode();
+ }
}
Modified: trunk/wao-persistence/src/main/xmi/wao-model.zargo
===================================================================
(Binary files differ)
1
0
r1759 - in trunk: wao-persistence/src/main/java/fr/ifremer/wao/entity wao-services/src/main/java/fr/ifremer/wao/services/service wao-web/src/main/webapp/WEB-INF/content/obsmer
by tchemit@users.forge.codelutin.com 26 Mar '14
by tchemit@users.forge.codelutin.com 26 Mar '14
26 Mar '14
Author: tchemit
Date: 2014-03-26 16:36:29 +0100 (Wed, 26 Mar 2014)
New Revision: 1759
Url: http://forge.codelutin.com/projects/wao/repository/revisions/1759
Log:
refs-60 #4483 fix total values + sampleRowsFilter query
Modified:
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java
trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRows.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java 2014-03-26 15:09:58 UTC (rev 1758)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRowTopiaDao.java 2014-03-26 15:36:29 UTC (rev 1759)
@@ -95,7 +95,7 @@
query.addWhereClause("sr." + SampleRow.PROPERTY_EXPECTED_DATE + " <= :periodTo", ImmutableMap.of("periodTo", (Object) filter.getPeriodTo()));
} else {
Date periodToMonth = DateUtils.truncate(filter.getPeriodTo(), Calendar.MONTH);
- query.addWhereClause("sr." + SampleRow.PROPERTY_PERIOD_END + " <= :periodToMonth", ImmutableMap.of("periodToMonth", (Object) periodToMonth));
+ query.addWhereClause("sr." + SampleRow.PROPERTY_PERIOD_BEGIN + " <= :periodToMonth", ImmutableMap.of("periodToMonth", (Object) periodToMonth));
}
}
Modified: trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRows.java
===================================================================
--- trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRows.java 2014-03-26 15:09:58 UTC (rev 1758)
+++ trunk/wao-persistence/src/main/java/fr/ifremer/wao/entity/SampleRows.java 2014-03-26 15:36:29 UTC (rev 1759)
@@ -23,6 +23,8 @@
import com.google.common.base.Function;
+import java.util.Date;
+
public class SampleRows {
public static Function<SampleRow, String> getCode() {
@@ -36,4 +38,34 @@
return input.getCode();
}
}
+
+ public static Integer getExpectedTidesValue(SampleRow sampleRow, Date month) {
+ Integer result = null;
+ SampleMonth sampleMonth = sampleRow.getSampleMonth(month);
+ if (sampleMonth != null) {
+ int tidesValue = sampleMonth.getExpectedTidesValue();
+ result = tidesValue;
+ }
+ return result;
+ }
+
+ public static Integer getRealTidesValue(SampleRow sampleRow, Date month) {
+ Integer result = null;
+ SampleMonth sampleMonth = sampleRow.getSampleMonth(month);
+ if (sampleMonth != null) {
+ int tidesValue = sampleMonth.getRealTidesValue();
+ result = tidesValue;
+ }
+ return result;
+ }
+
+ public static Integer getEstimatedTidesValue(SampleRow sampleRow, Date month) {
+ Integer result = null;
+ SampleMonth sampleMonth = sampleRow.getSampleMonth(month);
+ if (sampleMonth != null) {
+ int tidesValue = sampleMonth.getEstimatedTidesValue();
+ result = tidesValue;
+ }
+ return result;
+ }
}
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-26 15:09:58 UTC (rev 1758)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlan.java 2014-03-26 15:36:29 UTC (rev 1759)
@@ -23,8 +23,8 @@
import fr.ifremer.wao.WaoUtils;
import fr.ifremer.wao.entity.FishingZone;
-import fr.ifremer.wao.entity.SampleMonth;
import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.SampleRows;
import java.io.Serializable;
import java.text.NumberFormat;
@@ -275,6 +275,21 @@
protected SampleRow sampleRow;
/**
+ * Total of expected tides.
+ */
+ protected int totalTidesExpected;
+
+ /**
+ * Total of real tides.
+ */
+ protected int totalTidesReal;
+
+ /**
+ * Total of estimated tides.
+ */
+ protected int totalTidesEstimated;
+
+ /**
* Expected Times of observation days.
* <p/>
* FIXME Voir si on doit garder un *D*ouble
@@ -297,10 +312,16 @@
public ObsMerSamplingPlanSampleRowPart(SampleRow sampleRow,
+ int totalTidesExpected,
+ int totalTidesReal,
+ int totalTidesEstimated,
Double observationTimesInDaysExpected,
Long observationTimesInDaysReal,
Long observationTimesInDaysEstimated) {
this.sampleRow = sampleRow;
+ this.totalTidesExpected = totalTidesExpected;
+ this.totalTidesReal = totalTidesReal;
+ this.totalTidesEstimated = totalTidesEstimated;
this.observationTimesInDaysExpected = observationTimesInDaysExpected;
this.observationTimesInDaysReal = observationTimesInDaysReal;
this.observationTimesInDaysEstimated = observationTimesInDaysEstimated;
@@ -310,30 +331,30 @@
return sampleRow;
}
+ public int getTotalTidesExpected() {
+ return totalTidesExpected;
+ }
+
+ public int getTotalTidesReal() {
+ return totalTidesReal;
+ }
+
+ public int getTotalTidesEstimated() {
+ return totalTidesEstimated;
+ }
+
public Integer getNbTidesExpected(Date month) {
- Integer result = null;
- SampleMonth sampleMonth = sampleRow.getSampleMonth(month);
- if (sampleMonth != null) {
- result = sampleMonth.getExpectedTidesValue();
- }
+ Integer result = SampleRows.getExpectedTidesValue(sampleRow, month);
return result;
}
public Integer getNbTidesReal(Date month) {
- Integer result = null;
- SampleMonth sampleMonth = sampleRow.getSampleMonth(month);
- if (sampleMonth != null) {
- result = sampleMonth.getRealTidesValue();
- }
+ Integer result = SampleRows.getRealTidesValue(sampleRow, month);
return result;
}
public Integer getNbTidesEstimated(Date month) {
- Integer result = null;
- SampleMonth sampleMonth = sampleRow.getSampleMonth(month);
- if (sampleMonth != null) {
- result = sampleMonth.getEstimatedTidesValue();
- }
+ Integer result = SampleRows.getEstimatedTidesValue(sampleRow, month);
return result;
}
@@ -341,7 +362,7 @@
public String getTotalPercentage() {
String result;
if (sampleRow.getTotalTidesExpected() > 0) {
- double percentage = (double) sampleRow.getTotalTidesReal() / (double) sampleRow.getTotalTidesExpected();
+ double percentage = (double) totalTidesReal / (double) totalTidesExpected;
result = NumberFormat.getPercentInstance().format(percentage);
} else {
result = "- %";
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-26 15:09:58 UTC (rev 1758)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanBuilder.java 2014-03-26 15:36:29 UTC (rev 1759)
@@ -25,6 +25,7 @@
import com.google.common.collect.Ordering;
import fr.ifremer.wao.SampleRowsFilter;
import fr.ifremer.wao.entity.SampleRow;
+import fr.ifremer.wao.entity.SampleRows;
import org.apache.commons.lang3.mutable.MutableDouble;
import org.apache.commons.lang3.mutable.MutableInt;
import org.apache.commons.lang3.mutable.MutableLong;
@@ -148,6 +149,12 @@
PeriodDates periodDates = new PeriodDates(sampleRowsFilter.getPeriodFrom(),
sampleRowsFilter.getPeriodTo());
this.months = periodDates.getMonths();
+
+ for (Date month : months) {
+ totalExpectedForMonths.put(month, new MutableInt());
+ totalRealForMonths.put(month, new MutableInt());
+ totalEstimatedForMonths.put(month, new MutableInt());
+ }
}
public ObsMerSamplingPlanBuilder addSampleRow(SampleRow sampleRow,
@@ -170,16 +177,22 @@
// get sector context
ServiceContext sectorPart = facadeContext.getOrAddSectorContext(sectors);
+ // compute nb expected tides for sample row
+ int totalTidesExpected = getNbTidesExpected(sampleRow);
+ // compute nb real tides for sample row
+ int totalTidesReal = getNbTidesReal(sampleRow);
+ // compute nb estimated tides for sample row
+ int totalTidesEstimated = getNbTidesEstimated(sampleRow);
+
// add sample row
- ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart =
- sectorPart.addSampleRow(sampleRow,
- observationTimesInDaysExpected,
- observationTimesInDaysReal,
- observationTimesInDaysEstimated);
+ sectorPart.addSampleRow(sampleRow,
+ totalTidesExpected,
+ totalTidesReal,
+ totalTidesEstimated,
+ observationTimesInDaysExpected,
+ observationTimesInDaysReal,
+ observationTimesInDaysEstimated);
- // update totals
- updateTotals(sampleRowPart);
-
// Sum total observation times in days
observationTimesInDaysTotalExpected.add(observationTimesInDaysExpected);
observationTimesInDaysTotalReal.add(observationTimesInDaysReal);
@@ -233,45 +246,43 @@
return result;
}
- protected void updateTotals(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart) {
+ protected int getNbTidesExpected(SampleRow sampleRow) {
+ int result = 0;
for (Date month : months) {
-
- Integer expected = sampleRowPart.getNbTidesExpected(month);
- Integer real = sampleRowPart.getNbTidesReal(month);
- Integer estimated = sampleRowPart.getNbTidesEstimated(month);
-
- if (expected != null) {
-
- MutableInt total = totalExpectedForMonths.get(month);
- if (total == null) {
- total = new MutableInt();
- totalExpectedForMonths.put(month, total);
- }
- total.add(expected);
- highTotalExpected.add(total);
+ Integer tidesValue = SampleRows.getExpectedTidesValue(sampleRow, month);
+ if (tidesValue != null) {
+ result += tidesValue;
+ totalExpectedForMonths.get(month).add(tidesValue);
}
+ }
+ highTotalExpected.add(result);
+ return result;
+ }
- if (estimated != null) {
-
- MutableInt total = totalEstimatedForMonths.get(month);
- if (total == null) {
- total = new MutableInt();
- totalEstimatedForMonths.put(month, total);
- }
- total.add(expected);
- highTotalEstimated.add(total);
+ protected int getNbTidesReal(SampleRow sampleRow) {
+ int result = 0;
+ for (Date month : months) {
+ Integer tidesValue = SampleRows.getRealTidesValue(sampleRow, month);
+ if (tidesValue != null) {
+ result += tidesValue;
+ totalRealForMonths.get(month).add(tidesValue);
}
+ }
+ highTotalReal.add(result);
+ return result;
+ }
- if (real != null) {
- MutableInt total = totalRealForMonths.get(month);
- if (total == null) {
- total = new MutableInt();
- totalRealForMonths.put(month, total);
- }
- total.add(real);
- highTotalReal.add(total);
+ protected int getNbTidesEstimated(SampleRow sampleRow) {
+ int result = 0;
+ for (Date month : months) {
+ Integer tidesValue = SampleRows.getEstimatedTidesValue(sampleRow, month);
+ if (tidesValue != null) {
+ result += tidesValue;
+ totalEstimatedForMonths.get(month).add(tidesValue);
}
}
+ highTotalEstimated.add(result);
+ return result;
}
protected static class FacadeContext {
@@ -328,12 +339,18 @@
}
protected ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart addSampleRow(SampleRow row,
+ int totalTidesExpected,
+ int totalTidesReal,
+ int totalTidesEstimated,
Double observationTimesInDaysExpected,
Long observationTimesInDaysReal,
Long observationTimesInDaysEstimated) {
ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart rowPart =
new ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart(row,
+ totalTidesExpected,
+ totalTidesReal,
+ totalTidesEstimated,
observationTimesInDaysExpected,
observationTimesInDaysReal,
observationTimesInDaysEstimated);
Modified: trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java
===================================================================
--- trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-26 15:09:58 UTC (rev 1758)
+++ trunk/wao-services/src/main/java/fr/ifremer/wao/services/service/ObsMerSamplingPlanService.java 2014-03-26 15:36:29 UTC (rev 1759)
@@ -21,12 +21,14 @@
* #L%
*/
+import com.google.common.base.Charsets;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Maps;
+import com.google.common.collect.Range;
import com.google.common.collect.Sets;
import fr.ifremer.wao.ContactsFilter;
import fr.ifremer.wao.SampleRowsFilter;
@@ -79,7 +81,6 @@
import org.nuiton.util.DateUtil;
import java.io.InputStream;
-import java.nio.charset.Charset;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
@@ -375,13 +376,36 @@
SampleRowTopiaDao dao = getSampleRowDao();
+ // recuperation des lignes du plan
List<SampleRow> sampleRows = dao.findAll(sampleRowsFilter);
+
+ // creation du plan d'echantillonnage
ObsMerSamplingPlanBuilder builder = new ObsMerSamplingPlanBuilder(sampleRowsFilter);
+
+ Date periodFrom = sampleRowsFilter.getPeriodFrom();
+ Date periodTo = sampleRowsFilter.getPeriodTo();
+
for (SampleRow sampleRow : sampleRows) {
- Double observationTimesInDaysExpected = getObservationTimesInDayExpected(sampleRow);
- Pair<Long, Long> realAndEstimated = getObservationTimesInDayRealAndEstimated(sampleRowsFilter, sampleRow);
+
+ // calcul effort plannifie
+ Double observationTimesInDaysExpected =
+ getObservationTimesInDayExpected(periodFrom,
+ periodTo,
+ sampleRow);
+
+ // calcul effort réalisé et estimé
+ SampleRowsFilter sampleRowsFilter1 = new SampleRowsFilter();
+ sampleRowsFilter1.setObsProgram(sampleRowsFilter.getObsProgram());
+ sampleRowsFilter1.setPeriodFrom(periodFrom);
+ sampleRowsFilter1.setPeriodTo(periodTo);
+ sampleRowsFilter1.setSampleRowIds(ImmutableSet.of(sampleRow.getTopiaId()));
+
+ Pair<Long, Long> realAndEstimated =
+ getSampleRowObservationTimesInDayRealAndEstimated(sampleRowsFilter1);
Long observationTimesInDaysReal = realAndEstimated.getLeft();
Long observationTimesInDaysEstimated = realAndEstimated.getRight();
+
+ // ajout de la ligne au build de plan
builder.addSampleRow(sampleRow,
observationTimesInDaysExpected,
observationTimesInDaysReal,
@@ -555,9 +579,9 @@
try {
- String csvContent = export.toString(Charset.forName("UTF-8"));
+ String csvContent = export.toString(Charsets.UTF_8);
- InputStream csvInputStream = IOUtils.toInputStream(csvContent, "UTF-8");
+ InputStream csvInputStream = IOUtils.toInputStream(csvContent, Charsets.UTF_8);
return csvInputStream;
@@ -567,7 +591,21 @@
}
- protected double getObservationTimesInDayExpected(SampleRow sampleRow) {
+ /**
+ * Récupérer l'effort d'observation en nombre de jours plannifié poru
+ * le sample row donné pendant la période donnée.
+ *
+ * @param periodFrom début de période où rechercher les contacts
+ * @param periodTo fin de période où rechercher les contacts
+ * @param sampleRow la ligne à filtrer
+ * @return l'effort plannifié calculé
+ */
+ public double getObservationTimesInDayExpected(Date periodFrom,
+ Date periodTo,
+ SampleRow sampleRow) {
+
+ Range<Date> period = Range.closed(periodFrom, periodTo);
+
double expected;
// On prend le nombre d'observation prévue pour cette ligne du plan
@@ -575,7 +613,11 @@
// chaque mois.
int expectedObservationCount = 0;
for (SampleMonth sampleMonth : sampleRow.getSampleMonth()) {
- expectedObservationCount += sampleMonth.getExpectedTidesValue();
+ Date periodDate = sampleMonth.getPeriodDate();
+
+ if (period.contains(periodDate)) {
+ expectedObservationCount += sampleMonth.getExpectedTidesValue();
+ }
}
// le prévisionnel est égal au nombre d'observations attendues ×
// le nombre de jours moyen d'une observation
@@ -583,20 +625,26 @@
return expected;
}
- protected Pair<Long, Long> getObservationTimesInDayRealAndEstimated(SampleRowsFilter sampleRowFilter,
- SampleRow sampleRow) {
+ /**
+ * Récupérer l'effort d'observation en nombre de jours réalisé (partie gauche) et estimé (partie droite)
+ * pour le filtre d'échantillonnage donné.
+ *
+ * @param sampleRowsFilter la filtre du plan d'échantillonnage
+ * @return la paire (effort réalisé - effort estimé) calculée
+ */
+ public Pair<Long, Long> getSampleRowObservationTimesInDayRealAndEstimated(SampleRowsFilter sampleRowsFilter) {
// D'abord, on a besoin de récupérer toutes les observations réalisées
// pour cette ligne du plan
ContactsFilter contactFilter = new ContactsFilter();
- sampleRowFilter.setSampleRowIds(ImmutableSet.of(sampleRow.getTopiaId()));
contactFilter.setFilterOnObservationBeginDate(true);
- contactFilter.setPeriodFrom(sampleRowFilter.getPeriodFrom());
- contactFilter.setPeriodTo(sampleRowFilter.getPeriodTo());
+ contactFilter.setPeriodFrom(sampleRowsFilter.getPeriodFrom());
+ contactFilter.setPeriodTo(sampleRowsFilter.getPeriodTo());
+ contactFilter.setSampleRowFilter(sampleRowsFilter);
- contactFilter.setSampleRowFilter(sampleRowFilter);
+
contactFilter.setContactStates(ImmutableSet.of(ContactState.OBSERVATION_DONE));
// on exclue les contacts qui sont invalidés par le programme
contactFilter.setProgramAcceptations(Sets.newHashSet(true, null));
@@ -627,9 +675,6 @@
// estimated observation
estimated += contactInDays;
}
-
- sampleRowFilter.setSampleRowIds(null);
-
return Pair.of(real, estimated);
}
Modified: trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp
===================================================================
--- trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-26 15:09:58 UTC (rev 1758)
+++ trunk/wao-web/src/main/webapp/WEB-INF/content/obsmer/sampling-plan.jsp 2014-03-26 15:36:29 UTC (rev 1759)
@@ -256,9 +256,9 @@
</s:iterator>
<td>
<span>
- <s:property value="#sampleRow.totalTidesExpected" />
+ <s:property value="#samplingPlanRow.totalTidesExpected" />
<s:if test="!authenticatedWaoUser.guest">
- <em>(<s:property value="#sampleRow.totalTidesReal" />)</em>
+ <em>(<s:property value="#samplingPlanRow.totalTidesReal" />)</em>
<br/>
<strong><s:property value="#samplingPlanRow.totalPercentage" /></strong>
</s:if>
@@ -368,7 +368,7 @@
</td>
</s:iterator>
<td>
- <s:property value="#samplingPlan.highTotalExpected" />
+ <s:property value="samplingPlan.highTotalExpected" />
<s:if test="!authenticatedWaoUser.guest">
<em>(<s:property value="samplingPlan.highTotalReal" />)</em>
<strong><s:property value="samplingPlan.highTotalRatio" /></strong>
1
0