Tutti-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
March 2013
- 5 participants
- 242 discussions
See <http://ci.nuiton.org/jenkins/job/tutti/543/changes>
Changes:
[Tony Chemit] refs #1863: [BENTHOS] - Gestion de la saisie du benthos
- impact sur service de persistence
- debut de reusinage des APi d'ui
------------------------------------------
[...truncated 14 lines...]
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUI.jaxx
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUI.jaxx
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/CreateSpeciesBatchUIHandler.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIHandler.java
A tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/CreateSpeciesMelagAction.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/RenameSpeciesBatchAction.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchTableModel.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
A tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategory.java
A tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/SampleCategoryType.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
U tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
A tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/TableViewMode.java
U tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
U tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BatchPersistenceServiceWriteTest.java
U tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
U tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BatchPersistenceService.java
U tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BatchPersistenceServiceImpl.java
U tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
U tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
At revision 662
Parsing POMs
[trunk] $ /opt/jdk/bin/java -Xmx256m -XX:-UseGCOverheadLimit -cp /var/local/jenkins/data/plugins/maven-plugin/WEB-INF/lib/maven3-agent-1.2.jar:/opt/maven3/boot/plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main /opt/maven3 /opt/repo/apache-tomcat-7.0.34/webapps/jenkins/WEB-INF/lib/remoting-2.22.jar /var/local/jenkins/data/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-1.2.jar 46301
<===[JENKINS REMOTING CAPACITY]===> channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
[INFO] Error stacktraces are turned on.
Executing Maven: -B -f <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/pom.xml> -U -e clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Tutti
[INFO] Tutti :: Persistence
[INFO] Tutti :: Service
[INFO] Tutti :: UI
Projects to build: [MavenProject: fr.ifremer:tutti:1.2-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-service:1.2-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-service/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-ui-swing:1.2-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-ui-swing/pom.xml]>
projectStarted fr.ifremer:tutti:1.2-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutti 1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
mojoStarted org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tutti ---
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/target>
mojoSucceeded org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
mojoStarted org.apache.maven.plugins:maven-enforcer-plugin:1.2(check-project-files)
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (check-project-files) @ tutti ---
mojoSucceeded org.apache.maven.plugins:maven-enforcer-plugin:1.2(check-project-files)
mojoStarted org.apache.maven.plugins:maven-antrun-plugin:1.7(generate-surefire-workdir)
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ tutti ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/target/surefire-workdir>
[INFO] Executed tasks
mojoSucceeded org.apache.maven.plugins:maven-antrun-plugin:1.7(generate-surefire-workdir)
mojoStarted org.apache.maven.plugins:maven-site-plugin:3.2(attach-descriptor)
[INFO]
[INFO] --- maven-site-plugin:3.2:attach-descriptor (attach-descriptor) @ tutti ---
mojoSucceeded org.apache.maven.plugins:maven-site-plugin:3.2(attach-descriptor)
mojoStarted org.apache.maven.plugins:maven-install-plugin:2.4(default-install)
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ tutti ---
[INFO] Installing <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/pom.xml> to /var/local/maven/data/repository/fr/ifremer/tutti/1.2-SNAPSHOT/tutti-1.2-SNAPSHOT.pom
[INFO] Installing <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/target/tutti-1.2-SNAPSHOT-s…> to /var/local/maven/data/repository/fr/ifremer/tutti/1.2-SNAPSHOT/tutti-1.2-SNAPSHOT-site_fr.xml
mojoSucceeded org.apache.maven.plugins:maven-install-plugin:2.4(default-install)
projectSucceeded fr.ifremer:tutti:1.2-SNAPSHOT
projectStarted fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutti :: Persistence 1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
mojoStarted org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tutti-persistence ---
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target>
mojoSucceeded org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
mojoStarted org.apache.maven.plugins:maven-enforcer-plugin:1.2(check-project-files)
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (check-project-files) @ tutti-persistence ---
mojoSucceeded org.apache.maven.plugins:maven-enforcer-plugin:1.2(check-project-files)
mojoStarted org.nuiton.eugene:eugene-maven-plugin:2.6.1(default)
[INFO]
[INFO] --- eugene-maven-plugin:2.6.1:generate (default) @ tutti-persistence ---
[INFO] Process phase [zargo] for one entry.
[INFO] Expanding 1 xmi file(s) from <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/src/main/…>
[INFO] Will generate <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…>
[INFO] Copy file <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/src/main/…> to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…>
[INFO] Generate one file in 348.113ms.
[INFO] Process phase [xmi] for one entry.
[INFO] Processing XSL tranformation on <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…> for 1 file(s).
[INFO] Will generate <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…>
[INFO] Copy file <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…> to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…>
[INFO] Generate one file in 8.289s.
[INFO] Process phase [model] for one entry.
WARN [pool-1-thread-1] (ObjectModelReader.java:580) getObjectElements - Invalid stereotype [fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.hydrologyPmfmId.stereotype] : Element 'hydrologyPmfmId' of type 'attribute' on classifier 'fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol' is null.
INFO [pool-1-thread-1] (ObjectModelReader.java:273) loadModelProperties - 19 tag values were succesfull imported from <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…>
[INFO] Apply generator JavaInterfaceTransformer
[INFO] Apply generator SimpleJavaBeanTransformer
INFO [pool-1-thread-1] (ObjectModelTransformerToJava.java:911) isInClassPath - Will not generate [fr.ifremer.tutti.persistence.entities.data.Program], already found in class-path.
[INFO] Apply generator JavaEnumerationTransformer
INFO [pool-1-thread-1] (ObjectModelTransformerToJava.java:911) isInClassPath - Will not generate [fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum], already found in class-path.
INFO [pool-1-thread-1] (ObjectModelTransformerToJava.java:911) isInClassPath - Will not generate [fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum], already found in class-path.
[INFO] No file generated.
[INFO] Add compile source root : <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…>
[INFO] Add resource root :Resource {targetPath: null, filtering: false, FileSet {directory: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…,> PatternSet [includes: {}, excludes: {**/*.java}]}}
mojoSucceeded org.nuiton.eugene:eugene-maven-plugin:2.6.1(default)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserJava (scan-sources) @ tutti-persistence ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(get)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:get (get) @ tutti-persistence ---
[INFO] Copying tutti-persistence.properties to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…>
[INFO] Copying tutti-persistence.properties to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/ge…>
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(get)
forkedProjectSucceeded fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:gen (scan-sources) @ tutti-persistence ---
[WARNING] bundle en_GB contains 27/27 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
mojoStarted org.apache.maven.plugins:maven-resources-plugin:2.6(default-resources)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tutti-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 8 resources
[INFO] Copying 0 resource
mojoSucceeded org.apache.maven.plugins:maven-resources-plugin:2.6(default-resources)
mojoStarted org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-compile)
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ tutti-persistence ---
[INFO] Compiling 88 source files to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/cl…>
mojoSucceeded org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-compile)
mojoStarted org.apache.maven.plugins:maven-antrun-plugin:1.7(generate-surefire-workdir)
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ tutti-persistence ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/su…>
[INFO] Executed tasks
mojoSucceeded org.apache.maven.plugins:maven-antrun-plugin:1.7(generate-surefire-workdir)
mojoStarted org.apache.maven.plugins:maven-resources-plugin:2.6(default-testResources)
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ tutti-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
mojoSucceeded org.apache.maven.plugins:maven-resources-plugin:2.6(default-testResources)
mojoStarted org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-testCompile)
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ tutti-persistence ---
[INFO] Compiling 29 source files to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/target/te…>
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/src/test/…>:[858,15] error: no suitable method found for getSpeciesBatch(String,BatchContainer<SpeciesBatch>)
[INFO] 1 error
[INFO] -------------------------------------------------------------
mojoFailed org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-testCompile)
projectFailed fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT
sessionEnded
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Tutti ............................................. SUCCESS [52.011s]
[INFO] Tutti :: Persistence .............................. FAILURE [57.872s]
[INFO] Tutti :: Service .................................. SKIPPED
[INFO] Tutti :: UI ....................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:56.455s
[INFO] Finished at: Thu Mar 21 00:34:21 CET 2013
[INFO] Final Memory: 29M/84M
[INFO] ------------------------------------------------------------------------
Projects to build: [MavenProject: fr.ifremer:tutti:1.2-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-service:1.2-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-service/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-ui-swing:1.2-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-ui-swing/pom.xml]>
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-service/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-service/builds/2013-03-21_00-32-00/archive/fr.ifremer.tutti/tutti-service/1.2-SNAPSHOT/tutti-service-1.2-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-ui-swing/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-ui-swing/builds/2013-03-21_00-32-01/archive/fr.ifremer.tutti/tutti-ui-swing/1.2-SNAPSHOT/tutti-ui-swing-1.2-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer$tutti/builds/2013-03-21_00-32-00/archive/fr.ifremer/tutti/1.2-SNAPSHOT/tutti-1.2-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/target/tutti-1.2-SNAPSHOT-s…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer$tutti/builds/2013-03-21_00-32-00/archive/fr.ifremer/tutti/1.2-SNAPSHOT/tutti-1.2-SNAPSHOT-site_fr.xml
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-persistence/builds/2013-03-21_00-32-00/archive/fr.ifremer.tutti/tutti-persistence/1.2-SNAPSHOT/tutti-persistence-1.2-SNAPSHOT.pom
Waiting for Jenkins to finish collecting data
mavenExecutionResult exceptions not empty
message : Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project tutti-persistence: Compilation failure
bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/src/test/…>:[858,15] error: no suitable method found for getSpeciesBatch(String,BatchContainer<SpeciesBatch>)
cause : Compilation failure
bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/src/test/…>:[858,15] error: no suitable method found for getSpeciesBatch(String,BatchContainer<SpeciesBatch>)
Stack trace :
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:testCompile (default-testCompile) on project tutti-persistence: Compilation failure
bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/src/test/…>:[858,15] error: no suitable method found for getSpeciesBatch(String,BatchContainer<SpeciesBatch>)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
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:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
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:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:329)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:158)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:326)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.maven.plugin.CompilationFailureException: Compilation failure
bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk/tutti-persistence/src/test/…>:[858,15] error: no suitable method found for getSpeciesBatch(String,BatchContainer<SpeciesBatch>)
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:729)
at org.apache.maven.plugin.TestCompilerMojo.execute(TestCompilerMojo.java:161)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
... 27 more
Sending e-mails to: tutti-commits(a)list.forge.codelutin.com chemit(a)codelutin.com
channel stopped
1
20
26 Mar '13
See <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/555/>
------------------------------------------
projectStarted fr.ifremer.tutti:tutti-ui-swing:1.2-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutti :: UI 1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ma…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 44.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ma… (2 KB at 39.1 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.…
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.15-…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.… (808 B at 10.8 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.15-… (808 B at 10.2 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/nuiton-valid…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/nuiton-…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/nuiton-… (2 KB at 65.2 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/nuiton-valid… (2 KB at 53.7 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/nuiton-valid…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/nuiton-valid… (8 KB at 229.9 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ru…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 36.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ru… (2 KB at 29.8 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 51.9 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co… (2 KB at 40.0 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-wi…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 45.2 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-wi… (2 KB at 40.1 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 57.6 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va… (2 KB at 52.0 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/nuiton-valid…
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/nuiton-valid…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/nuiton-valid… (96 KB at 1487.3 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/nuiton-valid… (73 KB at 1009.9 KB/sec)
mojoStarted org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tutti-ui-swing ---
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
mojoSucceeded org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
mojoStarted org.apache.maven.plugins:maven-enforcer-plugin:1.2(check-project-files)
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (check-project-files) @ tutti-ui-swing ---
mojoSucceeded org.apache.maven.plugins:maven-enforcer-plugin:1.2(check-project-files)
mojoStarted org.nuiton.jaxx:jaxx-maven-plugin:2.5.15-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.15-SNAPSHOT:generate (default) @ tutti-ui-swing ---
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 45.3 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co… (2 KB at 41.3 KB/sec)
[INFO] use project compile scope class-path
[INFO] Detects 34 modified jaxx file(s).
[ERROR] JAXX detects 2 errors :
<http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:84
: Invalid XML: The markup in the document following the root element must be well-formed.
<http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:96
: Invalid XML: The markup in the document following the root element must be well-formed.
mojoFailed org.nuiton.jaxx:jaxx-maven-plugin:2.5.15-SNAPSHOT(default)
projectFailed fr.ifremer.tutti:tutti-ui-swing:1.2-SNAPSHOT
1
8
r684 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches: . species species/split
by kmorin@users.forge.codelutin.com 26 Mar '13
by kmorin@users.forge.codelutin.com 26 Mar '13
26 Mar '13
Author: kmorin
Date: 2013-03-26 18:14:14 +0100 (Tue, 26 Mar 2013)
New Revision: 684
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/684
Log:
refs #1868 [CAPTURE] - Import/Export PUPITRI
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SplitSpeciesBatchRowModel.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java 2013-03-26 17:02:29 UTC (rev 683)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java 2013-03-26 17:14:14 UTC (rev 684)
@@ -42,7 +42,7 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SplitSpeciesBatchRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
import org.apache.commons.logging.Log;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-26 17:02:29 UTC (rev 683)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-26 17:14:14 UTC (rev 684)
@@ -48,8 +48,8 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchUI;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SplitSpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SplitSpeciesBatchRowModel.java 2013-03-26 17:02:29 UTC (rev 683)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SplitSpeciesBatchRowModel.java 2013-03-26 17:14:14 UTC (rev 684)
@@ -1,102 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategory;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.io.Serializable;
-
-/**
- * A row in the {@link SplitSpeciesBatchUIModel}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public class SplitSpeciesBatchRowModel
- extends AbstractTuttiBeanUIModel<SplitSpeciesBatchRowModel, SplitSpeciesBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_CATEGORY_VALUE = "categoryValue";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- /**
- * Delegate sample category which contains category value + weight.
- *
- * @since 0.3
- */
- protected final SampleCategory<Serializable> category = SampleCategory.newSample(null);
-
- public SplitSpeciesBatchRowModel() {
- super(SplitSpeciesBatchRowModel.class, null, null);
- }
-
- public SampleCategoryEnum getCategoryType() {
- return category.getCategoryType();
- }
-
- public void setCategoryType(SampleCategoryEnum categoryType) {
- category.setCategoryType(categoryType);
- }
-
- public Serializable getCategoryValue() {
- return category.getCategoryValue();
- }
-
- public void setCategoryValue(Serializable categoryValue) {
- Object oldValue = getCategoryValue();
- category.setCategoryValue(categoryValue);
- firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
- }
-
- public void setCategoryValue(CaracteristicQualitativeValue categoryValue) {
- Object oldValue = getCategoryValue();
- category.setCategoryValue(categoryValue);
- firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
- }
-
- public void setCategoryValue(Float categoryValue) {
- Object oldValue = getCategoryValue();
- category.setCategoryValue(categoryValue);
- firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
- }
-
- public Float getWeight() {
- return category.getCategoryWeight();
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- category.setCategoryWeight(weight);
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
-}
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java 2013-03-26 17:14:14 UTC (rev 684)
@@ -0,0 +1,102 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.species.split;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id: SplitSpeciesBatchRowModel.java 682 2013-03-26 16:47:05Z kmorin $
+ * $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-ui-swing/src/main/java… $
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategory;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.io.Serializable;
+
+/**
+ * A row in the {@link SplitSpeciesBatchUIModel}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class SplitSpeciesBatchRowModel
+ extends AbstractTuttiBeanUIModel<SplitSpeciesBatchRowModel, SplitSpeciesBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_CATEGORY_VALUE = "categoryValue";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ /**
+ * Delegate sample category which contains category value + weight.
+ *
+ * @since 0.3
+ */
+ protected final SampleCategory<Serializable> category = SampleCategory.newSample(null);
+
+ public SplitSpeciesBatchRowModel() {
+ super(SplitSpeciesBatchRowModel.class, null, null);
+ }
+
+ public SampleCategoryEnum getCategoryType() {
+ return category.getCategoryType();
+ }
+
+ public void setCategoryType(SampleCategoryEnum categoryType) {
+ category.setCategoryType(categoryType);
+ }
+
+ public Serializable getCategoryValue() {
+ return category.getCategoryValue();
+ }
+
+ public void setCategoryValue(Serializable categoryValue) {
+ Object oldValue = getCategoryValue();
+ category.setCategoryValue(categoryValue);
+ firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
+ }
+
+ public void setCategoryValue(CaracteristicQualitativeValue categoryValue) {
+ Object oldValue = getCategoryValue();
+ category.setCategoryValue(categoryValue);
+ firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
+ }
+
+ public void setCategoryValue(Float categoryValue) {
+ Object oldValue = getCategoryValue();
+ category.setCategoryValue(categoryValue);
+ firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
+ }
+
+ public Float getWeight() {
+ return category.getCategoryWeight();
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ category.setCategoryWeight(weight);
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java 2013-03-26 17:02:29 UTC (rev 683)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java 2013-03-26 17:14:14 UTC (rev 684)
@@ -24,7 +24,6 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java 2013-03-26 17:02:29 UTC (rev 683)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java 2013-03-26 17:14:14 UTC (rev 684)
@@ -24,7 +24,6 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SplitSpeciesBatchRowModel;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
@@ -33,7 +32,6 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategory;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java 2013-03-26 17:02:29 UTC (rev 683)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java 2013-03-26 17:14:14 UTC (rev 684)
@@ -24,7 +24,6 @@
* #L%
*/
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
1
0
26 Mar '13
Author: tchemit
Date: 2013-03-26 18:02:29 +0100 (Tue, 26 Mar 2013)
New Revision: 683
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/683
Log:
fixes #2213: [TRAIT] - Saisie du navire : on r?\195?\169cup?\195?\168re celui de la campagne
fixes #2199: [CAMPAGNE] - Saisie de l'ann?\195?\169e
fixes #2201: [CAMPAGNE] - Ports de d?\195?\169part et de retour
fixes #2222: Uniformiser la notion de Location
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Program.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java
trunk/tutti-persistence/src/main/resources/applicationContext-service-tutti.xml
trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseResource.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BatchPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceReadTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties
trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -37,14 +37,12 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
@@ -79,27 +77,38 @@
/**
* @return all available zones (used by a {@link Program}.
* @see Program#getZone()
- * @see Program#setZone(Zone)
+ * @see Program#setZone(TuttiLocation)
* @since 0.3
*/
- List<Zone> getAllProgramZone();
+ List<TuttiLocation> getAllProgramZone();
/**
* @return all countries (used by a {@link Cruise}).
* @see {@link Cruise#getCountry()}
- * @see {@link Cruise#setCountry(Country)}
+ * @see {@link Cruise#setCountry(TuttiLocation)}
* @since 0.1
*/
- List<Country> getAllCountry();
+ List<TuttiLocation> getAllCountry();
/**
+ * @return all harbours (used by a {@link Cruise}).
+ * @see {@link Cruise#getDepartureLocation()}
+ * @see {@link Cruise#setDepartureLocation(TuttiLocation)}
+ * @see {@link Cruise#getReturnLocation()}
+ * @see {@link Cruise#setReturnLocation(TuttiLocation)}
+ * @since 1.2
+ */
+
+ List<TuttiLocation> getAllHarbour();
+
+ /**
* Get the list of location of type strata that match the given zone id.
*
* @param zoneId id of the parent zone (can not be null)
* @return the stratas with given zone id as location parent
* @since 1.0
*/
- List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId);
+ List<TuttiLocation> getAllFishingOperationStrata(String zoneId);
/**
* Get the list of location of type substra that match the given zone id or
@@ -110,8 +119,7 @@
* @return the list of localite with given zone id as location parent / or strata
* @since 1.0
*/
- List<FishingOperationLocation> getAllFishingOperationSubStrata(String zoneId,
- String strataId);
+ List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId, String strataId);
/**
* Get the list of location of type substra that match the given zone id or
@@ -124,14 +132,12 @@
* @return the list of localite with given zone id as location parent / or strata or substrata
* @since 1.0
*/
- List<FishingOperationLocation> getAllFishingOperationLocation(String zoneId,
- String strataId,
- String subStrataId);
+ List<TuttiLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId);
/**
* @return all scientific vessels (used by a {@link Cruise}).
* @see Cruise#getVessel()
- * @see Cruise#setVessel(List)
+ * @see Cruise#setVessel(Vessel)
* @since 0.3
*/
List<Vessel> getAllScientificVessel();
@@ -139,7 +145,7 @@
/**
* @return all commercial vessels (used by a {@link Cruise}).
* @see Cruise#getVessel()
- * @see Cruise#setVessel(List)
+ * @see Cruise#setVessel(Vessel)
* @since 0.3
*/
List<Vessel> getAllFishingVessel();
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -41,14 +41,12 @@
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import fr.ifremer.tutti.persistence.service.AccidentalBatchPersistenceService;
import fr.ifremer.tutti.persistence.service.AttachmentPersistenceService;
import fr.ifremer.tutti.persistence.service.BatchPersistenceService;
@@ -164,31 +162,36 @@
//------------------------------------------------------------------------//
@Override
- public List<Zone> getAllProgramZone() {
+ public List<TuttiLocation> getAllProgramZone() {
return referentialService.getAllProgramZone();
}
@Override
- public List<Country> getAllCountry() {
+ public List<TuttiLocation> getAllCountry() {
return referentialService.getAllCountry();
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
+ public List<TuttiLocation> getAllHarbour() {
+ return referentialService.getAllHarbour();
+ }
+
+ @Override
+ public List<TuttiLocation> getAllFishingOperationStrata(String zoneId) {
return referentialService.getAllFishingOperationStrata(zoneId);
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationSubStrata(String zoneId,
- String strataId) {
+ public List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId,
+ String strataId) {
return referentialService.getAllFishingOperationSubStrata(zoneId,
strataId);
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationLocation(String zoneId,
- String strataId,
- String subStrataId) {
+ public List<TuttiLocation> getAllFishingOperationLocation(String zoneId,
+ String strataId,
+ String subStrataId) {
return referentialService.getAllFishingOperationLocation(zoneId,
strataId,
subStrataId);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -37,14 +37,12 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import java.io.File;
import java.io.IOException;
@@ -69,31 +67,36 @@
}
@Override
- public List<Zone> getAllProgramZone() {
+ public List<TuttiLocation> getAllProgramZone() {
throw new RuntimeException("method not implemented");
}
@Override
- public List<Country> getAllCountry() {
+ public List<TuttiLocation> getAllCountry() {
throw new RuntimeException("method not implemented");
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
+ public List<TuttiLocation> getAllHarbour() {
throw new RuntimeException("method not implemented");
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationSubStrata(String zoneId, String strataId) {
+ public List<TuttiLocation> getAllFishingOperationStrata(String zoneId) {
throw new RuntimeException("method not implemented");
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId) {
+ public List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId, String strataId) {
throw new RuntimeException("method not implemented");
}
@Override
+ public List<TuttiLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId) {
+ throw new RuntimeException("method not implemented");
+ }
+
+ @Override
public List<Vessel> getAllScientificVessel() {
throw new RuntimeException("method not implemented");
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -45,10 +45,12 @@
protected String id;
+ @Override
public String getId() {
return id;
}
+ @Override
public void setId(String id) {
this.id = id;
}
@@ -83,7 +85,7 @@
@Override
public int hashCode() {
- return id != null ? id.hashCode() : 0;
+ return id == null ? 0 : id.hashCode();
}
@Override
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Program.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Program.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Program.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
public class Program extends AbstractTuttiDataEntity {
@@ -40,7 +40,7 @@
protected String description;
- protected Zone zone;
+ protected TuttiLocation zone;
public String getName() {
return name;
@@ -58,11 +58,11 @@
this.description = description;
}
- public Zone getZone() {
+ public TuttiLocation getZone() {
return zone;
}
- public void setZone(Zone zone) {
+ public void setZone(TuttiLocation zone) {
this.zone = zone;
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -44,18 +44,20 @@
import fr.ifremer.adagio.core.dao.referential.gear.GearDao;
import fr.ifremer.adagio.core.dao.referential.location.Location;
import fr.ifremer.adagio.core.dao.referential.location.LocationDao;
+import fr.ifremer.adagio.core.dao.referential.location.LocationImpl;
import fr.ifremer.adagio.core.dao.referential.pmfm.Pmfm;
import fr.ifremer.adagio.core.dao.referential.pmfm.PmfmDao;
import fr.ifremer.adagio.core.dao.referential.pmfm.PmfmImpl;
import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueDao;
import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueImpl;
import fr.ifremer.adagio.core.dao.referential.vessel.VesselDao;
+import fr.ifremer.adagio.core.dao.referential.vessel.VesselImpl;
import fr.ifremer.adagio.core.dao.technical.synchronization.SynchronizationStatus;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -66,7 +68,6 @@
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
-import java.sql.Timestamp;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collections;
@@ -150,7 +151,7 @@
Object[] source = queryUnique(
"cruise",
"cruiseId", IntegerType.INSTANCE, Integer.valueOf(id),
- "countryLocationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_COUNTRY,
+// "locationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_HARBOUR,
"pmfmIdSurveyPart", IntegerType.INSTANCE, enumeration.PMFM_ID_SURVEY_PART);
if (source == null) {
@@ -159,41 +160,34 @@
Cruise result = new Cruise();
result.setId(id);
- String programCode = (String) source[0];
- Program program = programService.getProgram(programCode);
- result.setProgram(program);
+ int index = 0;
- result.setYear((Integer) source[1]);
- result.setName((String) source[2]);
+ // departureLocation
+ Integer departureLocationId = (Integer) source[index++];
+ TuttiLocation departureLocation = referentialService.getLocation(String.valueOf(departureLocationId));
+ result.setDepartureLocation(departureLocation);
- String countryId = String.valueOf(source[3]);
- String countryLabel = (String) source[4];
- String countryName = (String) source[5];
- Country c = new Country();
- c.setId(countryId);
- c.setName(countryName);
- c.setLabel(countryLabel);
- result.setCountry(c);
+ // returnLocation
+ Integer returnLocationId = (Integer) source[index++];
+ TuttiLocation returnLocation = referentialService.getLocation(String.valueOf(returnLocationId));
+ result.setReturnLocation(returnLocation);
- Timestamp beginDate = (Timestamp) source[6];
- if (beginDate != null && result.getYear() != null) {
- long mili = dateOfYearWithOneMiliSecondInMili(result.getYear());
- // Comparison with getTime() is need, to keep millisecond precision
- if (beginDate.getTime() == mili) {
- // if BeginDate is fake : set to null (see createCruise for details)
- result.setBeginDate(null);
- } else {
- result.setBeginDate(new Date(beginDate.getTime()));
- }
- }
+ // program
+ String programCode = (String) source[index++];
+ Program program = programService.getProgram(programCode);
+ result.setProgram(program);
- result.setEndDate((Date) source[7]);
+ // name
+ result.setName((String) source[index++]);
- String vesselCode = (String) source[8];
+ result.setBeginDate((Date) source[index++]);
+ result.setEndDate((Date) source[index++]);
+
+ String vesselCode = (String) source[index++];
Vessel vessel = referentialService.getVessel(vesselCode);
result.setVessel(vessel);
- Integer managerId = (Integer) source[9];
+ Integer managerId = (Integer) source[index++];
if (managerId != null && managerId.equals(enumeration.PERSON_ID_UNKNOWN_RECORDER_PERSON)) {
result.setHeadOfMission(null);
} else {
@@ -201,9 +195,9 @@
result.setHeadOfMission(Lists.newArrayList(manager));
}
- result.setComment((String) source[10]);
+ result.setComment((String) source[index++]);
- String miscData = (String) source[11];
+ String miscData = (String) source[index++];
if (miscData != null && miscData.length() > 0) {
// // Retrieve secondary vessels :
// int vesselTagIndex = miscData.indexOf(CRUISE_MISC_DATA_VESSELS_TAG);
@@ -237,7 +231,6 @@
int sortManagersIndex = miscData.indexOf(CRUISE_MISC_DATA_SORT_MANAGERS_TAG);
if (sortManagersIndex != -1) {
String sortManagersStr = miscData.substring(sortManagersIndex + CRUISE_MISC_DATA_SORT_MANAGERS_TAG.length()).trim();
- miscData = miscData.substring(0, sortManagersIndex);
if (!sortManagersStr.isEmpty()) {
String[] managersArray = sortManagersStr.split(",");
List<Person> persons = new ArrayList<Person>();
@@ -251,7 +244,7 @@
}
// load surverPart
- result.setSurveyPart((String) source[12]);
+ result.setSurveyPart((String) source[index++]);
// get secondary gears from fishingOperation (first load from Allegro DB only)
if (result.getGear() == null) {
@@ -288,6 +281,12 @@
public Cruise createCruise(Cruise bean) {
Preconditions.checkNotNull(bean);
Preconditions.checkArgument(bean.getId() == null, "Cruise 'id' must be null to call createCruise().");
+ Preconditions.checkNotNull(bean.getProgram());
+ Preconditions.checkNotNull(bean.getBeginDate());
+ Preconditions.checkNotNull(bean.getEndDate());
+ Preconditions.checkNotNull(bean.getDepartureLocation());
+ Preconditions.checkNotNull(bean.getReturnLocation());
+ Preconditions.checkNotNull(bean.getVessel());
ScientificCruise scientificCruise = ScientificCruise.Factory.newInstance();
cruiseToEntity(bean, scientificCruise);
@@ -301,6 +300,12 @@
public Cruise saveCruise(Cruise bean) {
Preconditions.checkNotNull(bean);
Preconditions.checkNotNull(bean.getId(), "Cruise 'id' must not be null or empty to be saved.");
+ Preconditions.checkNotNull(bean.getProgram());
+ Preconditions.checkNotNull(bean.getBeginDate());
+ Preconditions.checkNotNull(bean.getEndDate());
+ Preconditions.checkNotNull(bean.getDepartureLocation());
+ Preconditions.checkNotNull(bean.getReturnLocation());
+ Preconditions.checkNotNull(bean.getVessel());
ScientificCruise scientificCruise = scientificCruiseDao.load(Integer.valueOf(bean.getId()));
if (scientificCruise == null) {
@@ -338,11 +343,7 @@
target.setName(source.getName());
// Program
- if (source.getProgram() == null || source.getProgram().getId() == null) {
- target.setProgram(null);
- } else if (source.getName() != null && source.getProgram().getId() != null) {
- target.setProgram(load(ProgramImpl.class, source.getProgram().getId()));
- }
+ target.setProgram(load(ProgramImpl.class, source.getProgram().getId()));
// Sort Room Managers
if (source.getHeadOfSortRoom() == null || source.getHeadOfSortRoom().size() == 0) {
@@ -376,34 +377,13 @@
}
// Vessel
- if (source.getVessel() == null) {
- target.setProgram(null);
- } else {
- target.setVessel(vesselDao.load(source.getVessel().getId()));
- }
+ target.setVessel(load(VesselImpl.class, source.getVessel().getId()));
- // Year
- if (source.getYear() == null && source.getBeginDate() == null) {
- target.setDepartureDateTime(null);
- } else if (source.getYear() != null && source.getBeginDate() == null) {
- // Set year into departure date time only if no departure date time has been set
- // Add one millisecond to retrieve a 'year saved but no departure date'
- target.setDepartureDateTime(dateOfYearWithOneMiliSecond(source.getYear()));
- }
-
// BeginDate
- if (source.getYear() == null && source.getBeginDate() == null) {
- target.setDepartureDateTime(null);
- } else if (source.getBeginDate() != null) {
- target.setDepartureDateTime(dateWithNoSecondAndMiliSecond(source.getBeginDate()));
- }
+ target.setDepartureDateTime(dateWithNoSecondAndMiliSecond(source.getBeginDate()));
// EndDate
- if (source.getEndDate() == null) {
- target.setReturnDateTime(null);
- } else if (source.getEndDate() != null) {
- target.setReturnDateTime(dateWithNoSecondAndMiliSecond(source.getEndDate()));
- }
+ target.setReturnDateTime(dateWithNoSecondAndMiliSecond(source.getEndDate()));
// Comment
target.setComments(source.getComment());
@@ -447,20 +427,13 @@
fishingTrip.setSynchronizationStatus(target.getSynchronizationStatus());
fishingTrip.setQualityFlag(qualityFlagNotQualified);
- if (fishingTrip.getReturnDateTime() == null && fishingTrip.getDepartureDateTime() != null) {
- // = departureDateTime + 1ms
- fishingTrip.setReturnDateTime(dateWithOneMiliSecond(fishingTrip.getDepartureDateTime()));
- }
+ // DepartureLocation
+ Location departureLocation = load(LocationImpl.class, Integer.valueOf(source.getDepartureLocation().getId()));
+ fishingTrip.setDepartureLocation(departureLocation);
- // Country
- if (source.getCountry() == null || source.getCountry().getId() == null) {
- fishingTrip.setDepartureLocation(null);
- fishingTrip.setReturnLocation(null);
- } else if (source.getCountry() != null && source.getCountry().getId() != null) {
- Location locationCountry = locationDao.load(Integer.valueOf(source.getCountry().getId()));
- fishingTrip.setDepartureLocation(locationCountry);
- fishingTrip.setReturnLocation(locationCountry);
- }
+ // ReturnLocation
+ Location returnLocation = load(LocationImpl.class, Integer.valueOf(source.getReturnLocation().getId()));
+ fishingTrip.setReturnLocation(returnLocation);
setSurveyMeasurement(fishingTrip, enumeration.PMFM_ID_SURVEY_PART, null, source.getSurveyPart(), null);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -63,8 +63,8 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicType;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
@@ -306,21 +306,21 @@
// Strata :
Integer strataId = (Integer) source[colIndex++];
if (strataId != null) {
- FishingOperationLocation strata = referentialService.getFishingOperationLocation(strataId.toString());
+ TuttiLocation strata = referentialService.getLocation(strataId.toString());
result.setStrata(strata);
}
// Sub Strata :
Integer subStrataId = (Integer) source[colIndex++];
if (subStrataId != null) {
- FishingOperationLocation subStrata = referentialService.getFishingOperationLocation(subStrataId.toString());
+ TuttiLocation subStrata = referentialService.getLocation(subStrataId.toString());
result.setSubStrata(subStrata);
}
// Localite :
Integer localiteId = (Integer) source[colIndex++];
if (localiteId != null) {
- FishingOperationLocation localite = referentialService.getFishingOperationLocation(localiteId.toString());
+ TuttiLocation localite = referentialService.getLocation(localiteId.toString());
result.setLocation(localite);
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -32,7 +32,7 @@
import fr.ifremer.adagio.core.dao.referential.location.LocationDao;
import fr.ifremer.adagio.core.dao.referential.taxon.TaxonGroupTypeImpl;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.type.IntegerType;
@@ -140,7 +140,7 @@
Preconditions.checkNotNull(bean.getDescription());
if (log.isDebugEnabled()) {
- log.debug("Create program with name: " + bean.getName());
+ log.debug("Save program with name: " + bean.getName());
}
fr.ifremer.adagio.core.dao.administration.programStrategy.Program program = programDao.load(bean.getId());
if (program == null) {
@@ -162,7 +162,7 @@
result.setName((String) source[1]);
result.setDescription((String) source[2]);
if (source[3] != null) {
- Zone zone = new Zone();
+ TuttiLocation zone = new TuttiLocation();
zone.setId(String.valueOf(source[3]));
zone.setLabel((String) source[4]);
zone.setName((String) source[5]);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceService.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -28,14 +28,12 @@
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;
@@ -58,28 +56,40 @@
/**
* @return all available zones (used by a {@link Program}.
* @see Program#getZone()
- * @see Program#setZone(Zone)
+ * @see Program#setZone(TuttiLocation)
* @since 0.3
*/
@Cacheable(value = "programZones")
- List<Zone> getAllProgramZone();
+ List<TuttiLocation> getAllProgramZone();
/**
* @return all countries (used by a {@link Cruise}).
* @see {@link Cruise#getCountry()}
- * @see {@link Cruise#setCountry(Country)}
+ * @see {@link Cruise#setCountry(TuttiLocation)}
* @since 0.1
*/
- List<Country> getAllCountry();
+ @Cacheable(value = "countries")
+ List<TuttiLocation> getAllCountry();
/**
+ * @return all harbours (used by a {@link Cruise}).
+ * @see {@link Cruise#getDepartureLocation()}
+ * @see {@link Cruise#setDepartureLocation(TuttiLocation)}
+ * @see {@link Cruise#getReturnLocation()}
+ * @see {@link Cruise#setReturnLocation(TuttiLocation)}
+ * @since 1.2
+ */
+ @Cacheable(value = "harbours")
+ List<TuttiLocation> getAllHarbour();
+
+ /**
* Get the list of location of type strata that match the given zone id.
*
* @param zoneId id of the parent zone (can not be null)
* @return the stratas with given zone id as location parent
* @since 1.0
*/
- List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId);
+ List<TuttiLocation> getAllFishingOperationStrata(String zoneId);
/**
* Get the list of location of type substra that match the given zone id or
@@ -90,7 +100,7 @@
* @return the list of localite with given zone id as location parent / or strata
* @since 1.0
*/
- List<FishingOperationLocation> getAllFishingOperationSubStrata(String zoneId, String strataId);
+ List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId, String strataId);
/**
* Get the list of location of type substra that match the given zone id or
@@ -103,21 +113,12 @@
* @return the list of localite with given zone id as location parent / or strata or substrata
* @since 1.0
*/
- List<FishingOperationLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId);
+ List<TuttiLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId);
/**
- * Get a location by id (location could be of any type : strata, substrata, localite, etc.).
- *
- * @param id the id of locations to load
- * @return the locations with given ids
- * @since 1.0
- */
- FishingOperationLocation getFishingOperationLocation(String id);
-
- /**
* @return all scientific vessels (used by a {@link Cruise}).
* @see Cruise#getVessel()
- * @see Cruise#setVessel(List)
+ * @see Cruise#setVessel(Vessel)
* @since 0.3
*/
List<Vessel> getAllScientificVessel();
@@ -125,7 +126,7 @@
/**
* @return all commercial vessels (used by a {@link Cruise}).
* @see Cruise#getVessel()
- * @see Cruise#setVessel(List)
+ * @see Cruise#setVessel(Vessel)
* @since 0.3
*/
@Cacheable(value = "fishingVessels")
@@ -154,6 +155,15 @@
List<Species> getAllSpecies();
/**
+ * Get a location by id .
+ *
+ * @param id the id of location to load
+ * @return the location for the given id, or {@code null} if not found
+ * @since 1.0
+ */
+ TuttiLocation getLocation(String id);
+
+ /**
* Obtain a species given his referenceTaxonId.
*
* @param referenceTaxonId id of the reference taxon of the species to load
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -39,15 +39,13 @@
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicType;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.persistence.entities.referential.Status;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Query;
@@ -109,48 +107,57 @@
//------------------------------------------------------------------------//
@Override
- public List<Zone> getAllProgramZone() {
+ public List<TuttiLocation> getAllProgramZone() {
Iterator<Object[]> list = queryListWithStatus(
- "allProgramZones",
+ "allLocationsByLevelAndClassificiation",
"locationClassificationId", IntegerType.INSTANCE, enumeration.LOCATION_CLASSIFICATION_ID_SECTOR,
"locationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_PROGRAM);
- List<Zone> result = Lists.newArrayList();
+ List<TuttiLocation> result = Lists.newArrayList();
while (list.hasNext()) {
Object[] source = list.next();
- Zone target = new Zone();
- target.setId(String.valueOf(source[0]));
- target.setLabel((String) source[1]);
- target.setName((String) source[2]);
- setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], target);
+ TuttiLocation target = loadLocation(source);
result.add(target);
}
return Collections.unmodifiableList(result);
}
@Override
- public List<Country> getAllCountry() {
+ public List<TuttiLocation> getAllCountry() {
Iterator<Object[]> list = queryListWithStatus(
- "allCountries",
+ "allLocationsByLevelAndClassificiation",
+ "locationClassificationId", IntegerType.INSTANCE, enumeration.LOCATION_CLASSIFICATION_ID_TERRITORIAL,
"locationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_COUNTRY);
- List<Country> result = Lists.newArrayList();
+ List<TuttiLocation> result = Lists.newArrayList();
while (list.hasNext()) {
Object[] source = list.next();
- Country target = new Country();
- target.setId(String.valueOf(source[0]));
- target.setLabel((String) source[1]);
- target.setName((String) source[2]);
- setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], target);
+ TuttiLocation target = loadLocation(source);
result.add(target);
}
return Collections.unmodifiableList(result);
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
+ public List<TuttiLocation> getAllHarbour() {
+ Iterator<Object[]> list = queryListWithStatus(
+ "allLocationsByLevelAndClassificiation",
+ "locationClassificationId", IntegerType.INSTANCE, enumeration.LOCATION_CLASSIFICATION_ID_TERRITORIAL,
+ "locationLevelId", IntegerType.INSTANCE, enumeration.LOCATION_LEVEL_ID_HARBOUR);
+
+ List<TuttiLocation> result = Lists.newArrayList();
+ while (list.hasNext()) {
+ Object[] source = list.next();
+ TuttiLocation target = loadLocation(source);
+ result.add(target);
+ }
+ return Collections.unmodifiableList(result);
+ }
+
+ @Override
+ public List<TuttiLocation> getAllFishingOperationStrata(String zoneId) {
Preconditions.checkNotNull(zoneId);
- List<FishingOperationLocation> result = getFishingOperationLocationsByParent(
+ List<TuttiLocation> result = getFishingOperationLocationsByParent(
enumeration.LOCATION_LEVEL_ID_STRATA,
Integer.valueOf(zoneId),
enumeration.LOCATION_LEVEL_ID_PROGRAM);
@@ -158,8 +165,8 @@
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationSubStrata(String zoneId,
- String strataId) {
+ public List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId,
+ String strataId) {
String parentId;
Integer parentLocationLevelId;
@@ -178,7 +185,7 @@
}
Preconditions.checkNotNull(parentId);
- List<FishingOperationLocation> result = getFishingOperationLocationsByParent(
+ List<TuttiLocation> result = getFishingOperationLocationsByParent(
enumeration.LOCATION_LEVEL_ID_SUB_STRATA,
Integer.valueOf(parentId),
parentLocationLevelId);
@@ -186,9 +193,9 @@
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationLocation(String zoneId,
- String strataId,
- String subStrataId) {
+ public List<TuttiLocation> getAllFishingOperationLocation(String zoneId,
+ String strataId,
+ String subStrataId) {
String parentId;
Integer parentLocationLevelId;
@@ -213,7 +220,7 @@
}
Preconditions.checkNotNull(parentId);
- List<FishingOperationLocation> result = getFishingOperationLocationsByParent(
+ List<TuttiLocation> result = getFishingOperationLocationsByParent(
enumeration.LOCATION_LEVEL_ID_LOCALITE,
Integer.valueOf(parentId),
parentLocationLevelId);
@@ -221,22 +228,15 @@
}
@Override
- public FishingOperationLocation getFishingOperationLocation(String id) {
+ public TuttiLocation getLocation(String id) {
Object[] source = queryUnique(
- "fishingOperationLocationById",
+ "locationById",
"locationId", IntegerType.INSTANCE, Integer.valueOf(id)
);
if (source == null) {
return null;
}
- FishingOperationLocation target = new FishingOperationLocation();
- target.setId(String.valueOf(source[0]));
- target.setLabel((String) source[1]);
- target.setName((String) source[2]);
- target.setLocationLevel((Integer) source[3]);
-
- setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[4], target);
-
+ TuttiLocation target = loadLocation(source);
return target;
}
@@ -704,7 +704,7 @@
return result;
}
- protected List<FishingOperationLocation> getFishingOperationLocationsByParent(Integer locationLevelId, Integer parentId, Integer parentLocationLevelId) {
+ protected List<TuttiLocation> getFishingOperationLocationsByParent(Integer locationLevelId, Integer parentId, Integer parentLocationLevelId) {
Iterator<Object[]> sources = queryListWithStatus(
"allFishingOperationLocationByParent",
"parentId", IntegerType.INSTANCE, parentId,
@@ -712,17 +712,10 @@
"locationClassificationId", IntegerType.INSTANCE, enumeration.LOCATION_CLASSIFICATION_ID_SECTOR,
"locationLevelId", IntegerType.INSTANCE, locationLevelId
);
- List<FishingOperationLocation> result = Lists.newArrayList();
+ List<TuttiLocation> result = Lists.newArrayList();
while (sources.hasNext()) {
Object[] source = sources.next();
- FishingOperationLocation target = new FishingOperationLocation();
- target.setId(String.valueOf(source[0]));
- target.setLabel((String) source[1]);
- target.setName((String) source[2]);
-// target.setDescription((String)source[3]);
- target.setLocationLevel((Integer) source[3]);
-
- setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[4], target);
+ TuttiLocation target = loadLocation(source);
result.add(target);
}
return result;
@@ -821,6 +814,15 @@
return result;
}
+ protected TuttiLocation loadLocation(Object[] source) {
+ TuttiLocation target = new TuttiLocation();
+ target.setId(String.valueOf(source[0]));
+ target.setLabel((String) source[1]);
+ target.setName((String) source[2]);
+ setStatus((fr.ifremer.adagio.core.dao.referential.Status) source[3], target);
+ return target;
+ }
+
protected Iterator<Object[]> queryListWithStatus(String queryName,
Object... params) {
Query query = createQuery(queryName, params);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -53,6 +53,9 @@
@Value("${GearClassificationId.FAO}")
public final Integer GEAR_CLASSIFICIATION_ID_FISHING = null;
+ @Value("${LocationClassificationId.TERRITORIAL}")
+ public final Integer LOCATION_CLASSIFICATION_ID_TERRITORIAL = null;
+
@Value("${LocationClassificationId.SECTOR}")
public final Integer LOCATION_CLASSIFICATION_ID_SECTOR = null;
@@ -62,6 +65,9 @@
@Value("${LocationLevelId.PAYS_ISO3}")
public final Integer LOCATION_LEVEL_ID_COUNTRY = null;
+ @Value("${LocationLevelId.PORT}")
+ public final Integer LOCATION_LEVEL_ID_HARBOUR= null;
+
@Value("${LocationLevelId.LOCALITE}")
public final Integer LOCATION_LEVEL_ID_LOCALITE = null;
Modified: trunk/tutti-persistence/src/main/resources/applicationContext-service-tutti.xml
===================================================================
--- trunk/tutti-persistence/src/main/resources/applicationContext-service-tutti.xml 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/resources/applicationContext-service-tutti.xml 2013-03-26 17:02:29 UTC (rev 683)
@@ -76,6 +76,18 @@
<property name="maxElementsInMemory" value="1"/>
<property name="maxElementsOnDisk" value="1"/>
</bean>
+
+ <bean id="countriesCache" parent="tuttiAbstractEternalCache">
+ <property name="cacheName" value="countries" />
+ <property name="maxElementsInMemory" value="1"/>
+ <property name="maxElementsOnDisk" value="1"/>
+ </bean>
+
+ <bean id="harboursCache" parent="tuttiAbstractEternalCache">
+ <property name="cacheName" value="harbours" />
+ <property name="maxElementsInMemory" value="1"/>
+ <property name="maxElementsOnDisk" value="1"/>
+ </bean>
<bean id="tuttiPmfmsCache" parent="tuttiAbstractEternalCache">
<property name="cacheName" value="pmfms" />
Modified: trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml
===================================================================
--- trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/main/resources/queries-override.hbm.xml 2013-03-26 17:02:29 UTC (rev 683)
@@ -59,7 +59,7 @@
</query>
<!-- [DAT-02] Get all cruises for a given program (to list with no detail) -->
- <query name="allCruises">
+ <query cacheable="true" name="allCruises">
<![CDATA[
SELECT
c.id,
@@ -76,7 +76,7 @@
</query>
<!-- [DAT-03] Get a detail program -->
- <query name="program">
+ <query cacheable="true" name="program">
<![CDATA[
SELECT
p.code,
@@ -104,15 +104,13 @@
</query>
<!-- [DAT-04] Get a detail cruise -->
- <query name="cruise">
+ <query cacheable="true" name="cruise">
<![CDATA[
SELECT
+ ft.departureLocation.id as departureLocationId,
+ ft.returnLocation.id as returnLocationId,
sc.program.code AS programCode,
- year(sc.departureDateTime) AS year,
sc.name AS name,
- lh.locationHierarchyPk.parent.id AS countryId,
- lh.locationHierarchyPk.parent.label AS countryLabel,
- lh.locationHierarchyPk.parent.name AS countryName,
sc.departureDateTime AS departureDateTime,
sc.returnDateTime AS returnDateTime,
sc.vessel.code AS vesselCode,
@@ -126,19 +124,15 @@
FROM
ScientificCruiseImpl sc
LEFT OUTER JOIN sc.fishingTrips ft
- LEFT OUTER JOIN sc.managerPerson mp,
- LocationHierarchyImpl lh
+ LEFT OUTER JOIN sc.managerPerson mp
WHERE
sc.id = :cruiseId
- AND lh.locationHierarchyPk.parent.locationLevel.id = :countryLocationLevelId
- AND lh.locationHierarchyPk.location.id = ft.departureLocation.id
]]>
<query-param name="cruiseId" type="java.lang.Integer"/>
<query-param name="pmfmIdSurveyPart" type="java.lang.Integer"/>
- <query-param name="countryLocationLevelId" type="java.lang.Integer"/>
</query>
- <query name="allCruiseGears">
+ <query cacheable="true" name="allCruiseGears">
<![CDATA[
SELECT
gpf.gear.id AS gearId,
@@ -163,7 +157,7 @@
<query-param name="pmfmIdTrawlNet" type="java.lang.Integer"/>
</query>
- <query name="allCruiseSecondaryVessels">
+ <query cacheable="true" name="allCruiseSecondaryVessels">
<![CDATA[
SELECT
va.operationVesselAssociationPk.vessel.code AS associatedVesselCode
@@ -180,7 +174,7 @@
<query-param name="cruiseId" type="java.lang.Integer"/>
</query>
- <query name="allFishingOperations">
+ <query cacheable="true" name="allFishingOperations">
<![CDATA[
SELECT
o.id AS id,
@@ -204,7 +198,7 @@
<query-param name="pmfmIdMultirigAggregation" type="java.lang.Integer"/>
</query>
- <query name="fishingOperation">
+ <query cacheable="true" name="fishingOperation">
<![CDATA[
SELECT
o.name AS name,
@@ -237,7 +231,7 @@
<query-param name="locationLevelIdLocalite" type="java.lang.Integer"/>
</query>
- <query name="fishingOperationRankOrder">
+ <query cacheable="true" name="fishingOperationRankOrder">
<![CDATA[
SELECT
count(o1.id) + 1 as fishingOperationRankOrder
@@ -254,7 +248,7 @@
- <query name="fishingOperationVesselUseFeatures">
+ <query cacheable="true" name="fishingOperationVesselUseFeatures">
<![CDATA[
SELECT
vum.pmfm.id as pmfmId,
@@ -270,7 +264,7 @@
<query-param name="fishingOperationId" type="java.lang.Integer"/>
</query>
- <query name="fishingOperationGearUseFeatures">
+ <query cacheable="true" name="fishingOperationGearUseFeatures">
<![CDATA[
SELECT
gum.pmfm.id as pmfmId,
@@ -286,7 +280,7 @@
<query-param name="fishingOperationId" type="java.lang.Integer"/>
</query>
- <query name="updateFishingOperationCatchBatch">
+ <query cacheable="true" name="updateFishingOperationCatchBatch">
<![CDATA[
UPDATE FishingOperationImpl o
SET o.catchBatch.id=:catchBatchId
@@ -297,7 +291,7 @@
<query-param name="catchBatchId" type="java.lang.Integer"/>
</query>
- <query name="catchBatch">
+ <query cacheable="true" name="catchBatch">
<![CDATA[
SELECT
cb.id AS catchBatchId,
@@ -328,7 +322,7 @@
<query-param name="pmfmIdSortingType" type="java.lang.Integer"/>
</query>
- <query name="allSpeciesBatchFrequency">
+ <query cacheable="true" name="allSpeciesBatchFrequency">
<![CDATA[
SELECT
b.id as batchId,
@@ -355,7 +349,7 @@
<query-param name="parentBatchId" type="java.lang.Integer"/>
</query>
- <query name="allAttachment">
+ <query cacheable="true" name="allAttachment">
<![CDATA[
SELECT
m.objectType.code as attachmentObjectType,
@@ -375,7 +369,7 @@
<query-param name="pmfmId" type="java.lang.Integer"/>
</query>
- <query name="attachment">
+ <query cacheable="true" name="attachment">
<![CDATA[
SELECT
m.objectType.code as attachmentObjectType,
@@ -468,18 +462,14 @@
<query-param name="statusTemporaryCode" type="java.lang.String"/>
</query>
- <!-- ===================================================================== -->
- <!-- === Requete sur référentiels [REF-XXX] === -->
- <!-- ===================================================================== -->
-
- <!-- [REF-01] Get all program zones -->
- <query cacheable="true" name="allProgramZones">
+ <!-- [REF-T04] Get all locations by level and classification -->
+ <query cacheable="true" name="allLocationsByLevelAndClassificiation">
<![CDATA[
SELECT
- l.id,
- l.label,
- l.name,
- l.status
+ l.id as locationId,
+ l.label as locationLabel,
+ l.name as locationName,
+ l.status as status
FROM LocationImpl l
WHERE
l.locationLevel.id = :locationLevelId
@@ -492,24 +482,26 @@
<query-param name="statusTemporaryCode" type="java.lang.String"/>
</query>
- <!-- [REF-02] Get all countries -->
- <query cacheable="true" name="allCountries">
+ <!-- [REF-T05] Get a location by his id -->
+ <query cacheable="true" name="locationById">
<![CDATA[
SELECT
- l.id,
- l.label,
- l.name,
- l.status
- FROM LocationImpl l
+ l.id as locationId,
+ l.label as locationLabel,
+ l.name as locationName,
+ l.status as status
+ FROM
+ LocationImpl l
WHERE
- l.locationLevel.id = :locationLevelId
- AND l.status.code IN (:statusValidCode, :statusTemporaryCode)
+ l.id = :locationId
]]>
- <query-param name="locationLevelId" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
+ <query-param name="locationId" type="java.lang.Integer"/>
</query>
+ <!-- ===================================================================== -->
+ <!-- === Requete sur référentiels [REF-XXX] === -->
+ <!-- ===================================================================== -->
+
<!-- [REF-03] Get all fishing operation strata / substrata / localite -->
<query cacheable="true" name="allFishingOperationLocationByParent">
<![CDATA[
@@ -517,7 +509,6 @@
l.id as locationId,
l.label as locationLabel,
l.name as locationName,
- l.locationLevel.id as locationLevelId,
l.status as status
FROM
LocationImpl l,
@@ -537,43 +528,6 @@
<query-param name="statusValidCode" type="java.lang.String"/>
<query-param name="statusTemporaryCode" type="java.lang.String"/>
</query>
-
- <query cacheable="true" name="allFishingOperationLocation">
- <![CDATA[
- SELECT
- l.id as locationId,
- l.label as locationLabel,
- l.name as locationName,
- l.locationLevel.id as locationLevelId,
- l.status as status
- FROM
- LocationImpl l
- WHERE
- l.status.code IN (:statusValidCode, :statusTemporaryCode)
- AND l.locationLevel.id = :locationLevelId
- AND l.locationClassification.id = :locationClassificationId
- ]]>
- <query-param name="locationLevelId" type="java.lang.Integer"/>
- <query-param name="locationClassificationId" type="java.lang.Integer"/>
- <query-param name="statusValidCode" type="java.lang.String"/>
- <query-param name="statusTemporaryCode" type="java.lang.String"/>
- </query>
-
- <query cacheable="true" name="fishingOperationLocationById">
- <![CDATA[
- SELECT
- l.id as locationId,
- l.label as locationLabel,
- l.name as locationName,
- l.locationLevel.id as locationLevelId,
- l.status as status
- FROM
- LocationImpl l
- WHERE
- l.id = :locationId
- ]]>
- <query-param name="locationId" type="java.lang.Integer"/>
- </query>
<!-- [REF-04] et [REF-05] Get all vessel for a given vesselType -->
<query cacheable="true" name="allVessels">
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -90,6 +90,10 @@
return 240;
}
+ public int refNbHarbour() {
+ return 1896;
+ }
+
public int refNbProgramZone() {
return 16;
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseResource.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseResource.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseResource.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -42,6 +42,7 @@
import org.junit.runner.Description;
import org.junit.runner.notification.Failure;
import org.junit.runners.model.Statement;
+import org.nuiton.util.FileUtil;
import org.nuiton.util.config.ApplicationConfig;
import java.io.BufferedReader;
@@ -171,7 +172,7 @@
fixtures = new DatabaseFixtures();
- resourceDirectory = getTestSpecificDirectory(testClass, "");
+ resourceDirectory = FileUtil.getTestSpecificDirectory(testClass, "", null, BUILD_TIMESTAMP);
RessourceClassLoader loader =
new RessourceClassLoader(testClass.getClassLoader());
@@ -349,31 +350,6 @@
return createEmptyDb(externalDbFile, dbName, p);
}
- public static File getTestSpecificDirectory(Class<?> testClass,
- String name) throws IOException {
- // Trying to look for the temporary folder to store data for the test
- String tempDirPath = System.getProperty("java.io.tmpdir");
- if (tempDirPath == null) {
- // can this really occur ?
- tempDirPath = "";
- if (log.isWarnEnabled()) {
- log.warn("'\"java.io.tmpdir\" not defined");
- }
- }
- File tempDirFile = new File(tempDirPath);
-
- // create the directory to store database data
- String dataBasePath = testClass.getName()
- + File.separator // a directory with the test class name
- + name // a sub-directory with the method name
- + '_'
- + BUILD_TIMESTAMP; // and a timestamp
- File databaseFile = new File(tempDirFile, dataBasePath);
- FileUtils.forceMkdir(databaseFile);
-
- return databaseFile;
- }
-
public Connection createEmptyDb(File directory,
String dbName) throws SQLException, IOException {
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BatchPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BatchPersistenceServiceWriteTest.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BatchPersistenceServiceWriteTest.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -39,6 +39,7 @@
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicType;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
@@ -125,9 +126,14 @@
cruise.setId(null);
Calendar calendar = new GregorianCalendar();
cruise.setBeginDate(calendar.getTime());
- cruise.setYear(calendar.get(Calendar.YEAR));
calendar.add(Calendar.MONTH, 1); // add one month
cruise.setEndDate(calendar.getTime());
+ List<TuttiLocation> allHarbour = referentialService.getAllHarbour();
+ Assert.assertNotNull(allHarbour);
+ Assert.assertTrue(allHarbour.size() > 1);
+ cruise.setDepartureLocation(allHarbour.get(0));
+ cruise.setReturnLocation(allHarbour.get(1));
+
cruise = cruiseService.createCruise(cruise);
// Create a first operation, with no cacth batch : to test CatchBatch insert/update :
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceWriteTest.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceWriteTest.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -27,12 +27,13 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.DatabaseResource;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
@@ -90,21 +91,14 @@
Calendar calendar = new GregorianCalendar();
cruise.setBeginDate(calendar.getTime());
- cruise.setYear(calendar.get(Calendar.YEAR));
-
calendar.add(Calendar.MONTH, 1); // add one month
cruise.setEndDate(calendar.getTime());
- Country country = null;
- List<Country> countries = referentialService.getAllCountry();
- for (Country aCountry : countries) {
- if (aCountry.getLabel() != null && aCountry.getLabel().equals("FRA")) {
- country = aCountry;
- break;
- }
- }
- assertNotNull("Could not load FRA country", country);
- cruise.setCountry(country);
+ List<TuttiLocation> allHarbour = referentialService.getAllHarbour();
+ Assert.assertNotNull(allHarbour);
+ Assert.assertTrue(allHarbour.size() > 1);
+ cruise.setDepartureLocation(allHarbour.get(0));
+ cruise.setReturnLocation(allHarbour.get(1));
List<Gear> gears = referentialService.getAllFishingGear();
cruise.setGear(gears);
@@ -128,6 +122,10 @@
assertNotNull(createdCruise.getId());
assertEquals(cruise.getName(), createdCruise.getName());
assertEquals(cruise.getSurveyPart(), createdCruise.getSurveyPart());
+ assertNotNull(createdCruise.getDepartureLocation());
+ assertEquals(cruise.getDepartureLocation(), createdCruise.getDepartureLocation());
+ assertNotNull(createdCruise.getReturnLocation());
+ assertEquals(cruise.getReturnLocation(), createdCruise.getReturnLocation());
if (log.isInfoEnabled()) {
log.info("Created cruise: " + createdCruise.getId());
@@ -144,14 +142,16 @@
calendar.set(Calendar.MILLISECOND, 0);
assertEquals(calendar.getTime(), reloadedCruise.getEndDate());
assertEquals(cruise.getMultirigNumber(), reloadedCruise.getMultirigNumber());
+ assertEquals(cruise.getDepartureLocation(), reloadedCruise.getDepartureLocation());
+ assertEquals(cruise.getReturnLocation(), reloadedCruise.getReturnLocation());
// -----------------------------------------------------------------------------
// 2. Test with only mandatory properties
// -----------------------------------------------------------------------------
createdCruise.setId(null);
createdCruise.setHeadOfMission(null);
- createdCruise.setBeginDate(null);
- createdCruise.setEndDate(null);
+// createdCruise.setBeginDate(cruise.getBeginDate());
+// createdCruise.setEndDate(cruise.getEndDate());
createdCruise.setComment(null);
createdCruise.setMultirigNumber(null);
@@ -163,20 +163,34 @@
assertNotNull(createdCruise);
assertNotNull(createdCruise.getId());
assertEquals(cruise.getName(), createdCruise.getName());
+ assertNotNull(createdCruise.getDepartureLocation());
+ assertEquals(cruise.getDepartureLocation(), createdCruise.getDepartureLocation());
+ assertNotNull(createdCruise.getReturnLocation());
+ assertEquals(cruise.getReturnLocation(), createdCruise.getReturnLocation());
// Reload to compare
reloadedCruise = service.getCruise(createdCruise.getId());
- assertEquals(createdCruise.getBeginDate(), reloadedCruise.getBeginDate());
- assertEquals(createdCruise.getEndDate(), reloadedCruise.getEndDate());
+ calendar.setTime(createdCruise.getBeginDate());
+ calendar.set(Calendar.SECOND, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ assertEquals(calendar.getTime(), reloadedCruise.getBeginDate());
+ calendar.setTime(createdCruise.getEndDate());
+ calendar.set(Calendar.SECOND, 0);
+ calendar.set(Calendar.MILLISECOND, 0);
+ assertEquals(calendar.getTime(), reloadedCruise.getEndDate());
+
+// assertEquals(createdCruise.getBeginDate(), reloadedCruise.getBeginDate());
+// assertEquals(createdCruise.getEndDate(), reloadedCruise.getEndDate());
assertEquals(createdCruise.getComment(), reloadedCruise.getComment());
assertEquals(createdCruise.getSurveyPart(), reloadedCruise.getSurveyPart());
+ assertEquals(cruise.getDepartureLocation(), reloadedCruise.getDepartureLocation());
+ assertEquals(cruise.getReturnLocation(), reloadedCruise.getReturnLocation());
// assertEquals(createdCruise.getMultirigNumber(), reloadedCruise.getMultirigNumber());
assertEquals(1, reloadedCruise.getMultirigNumber(), 0);
assertNull(reloadedCruise.getHeadOfMission());
assertNotNull(reloadedCruise.getVessel());
assertEquals(createdCruise.getVessel(), reloadedCruise.getVessel());
- assertEquals(cruise.getCountry().getId(), reloadedCruise.getCountry().getId());
assertNotNull(reloadedCruise.getVessel());
assertNotNull(reloadedCruise.getGear());
assertEquals(gears.size(), reloadedCruise.getGear().size());
@@ -193,10 +207,13 @@
Calendar calendar = new GregorianCalendar();
cruise.setBeginDate(calendar.getTime());
- cruise.setYear(calendar.get(Calendar.YEAR));
-
calendar.add(Calendar.MONTH, 1); // add one month
cruise.setEndDate(calendar.getTime());
+ List<TuttiLocation> allHarbour = referentialService.getAllHarbour();
+ Assert.assertNotNull(allHarbour);
+ Assert.assertTrue(allHarbour.size() > 1);
+ cruise.setDepartureLocation(allHarbour.get(0));
+ cruise.setReturnLocation(allHarbour.get(1));
cruise = service.createCruise(cruise);
@@ -207,6 +224,8 @@
// Name :
cruise.setName("Unit-test-" + System.currentTimeMillis());
cruise.setSurveyPart("SurveryPart" + cruise.getName());
+ cruise.setDepartureLocation(allHarbour.get(1));
+ cruise.setReturnLocation(allHarbour.get(0));
// Remove gear, then add another gear
Gear previousGear = cruise.getGear(0);
@@ -231,6 +250,8 @@
assertEquals(cruise.getSurveyPart(), reloadedCruise.getSurveyPart());
assertNotNull(reloadedCruise.getGear());
assertEquals(cruise.getGear().size(), reloadedCruise.getGear().size());
- assertEquals(cruise.getGear(0).getId(), reloadedCruise.getGear(0).getId());
+ assertEquals(cruise.getGear(0), reloadedCruise.getGear(0));
+ assertEquals(cruise.getDepartureLocation(), reloadedCruise.getDepartureLocation());
+ assertEquals(cruise.getReturnLocation(), reloadedCruise.getReturnLocation());
}
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceWriteTest.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceWriteTest.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -31,9 +31,10 @@
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicType;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import org.junit.Assert;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Ignore;
@@ -88,9 +89,17 @@
cruise = cruiseService.getCruise(dbResource.getFixtures().cruiseId());
cruise.setId(null);
cruise.setName("Unit-test-" + System.currentTimeMillis());
- cruise.setBeginDate(new Date());
- cruise.setEndDate(null);
+ Calendar calendar = new GregorianCalendar();
+ cruise.setBeginDate(calendar.getTime());
+
+ calendar.add(Calendar.MONTH, 1); // add one month
+ cruise.setEndDate(calendar.getTime());
cruise.setMultirigNumber(2);
+ List<TuttiLocation> allHarbour = referentialService.getAllHarbour();
+ Assert.assertNotNull(allHarbour);
+ Assert.assertTrue(allHarbour.size() > 1);
+ cruise.setDepartureLocation(allHarbour.get(0));
+ cruise.setReturnLocation(allHarbour.get(1));
// Keep only one gear in the cruise : (need for case n°4)
List<Gear> cruiseGears = cruise.getGear();
@@ -223,13 +232,13 @@
fishingOperation.setVesselUseFeatures(environmentCaracteristics);
fishingOperation.setGearUseFeatures(gearShootingCaracteristics);
- FishingOperationLocation strata = new FishingOperationLocation();
+ TuttiLocation strata = new TuttiLocation();
strata.setId(dbResource.getFixtures().strataId());
fishingOperation.setStrata(strata);
- FishingOperationLocation subStrata = new FishingOperationLocation();
+ TuttiLocation subStrata = new TuttiLocation();
subStrata.setId(dbResource.getFixtures().subStrataId());
fishingOperation.setSubStrata(subStrata);
- FishingOperationLocation localite = new FishingOperationLocation();
+ TuttiLocation localite = new TuttiLocation();
localite.setId(dbResource.getFixtures().localite());
fishingOperation.setLocation(localite);
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceReadTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceReadTest.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceReadTest.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -71,8 +71,10 @@
Assert.assertNotNull(actual.getId());
Assert.assertNotNull(actual.getName());
Assert.assertNotNull(actual.getDescription());
- //comment, because in test database, "CAM-CGFS" could have a location that is not a zone
- //Assert.assertNotNull(actual.getZone());
+ //FIXME-TC Change to NotNull when CGFS data will be ok
+ //FIXME-TC See http://forge.codelutin.com/issues/2221
+// Assert.assertNotNull(actual.getZone());
+ Assert.assertNull(actual.getZone());
Assert.assertEquals(programCode, actual.getId());
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceWriteTest.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceWriteTest.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -26,7 +26,7 @@
import fr.ifremer.tutti.persistence.DatabaseResource;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
@@ -35,6 +35,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
/**
@@ -61,7 +62,7 @@
@Test
public void createAndSaveProgram(/*Program bean*/) {
- List<Zone> zones = referentialService.getAllProgramZone();
+ List<TuttiLocation> zones = referentialService.getAllProgramZone();
assertNotNull(zones);
assertTrue(zones.size() > 0);
@@ -79,18 +80,21 @@
Program createdProgram = service.createProgram(program);
assertNotNull(createdProgram);
assertNotNull(createdProgram.getId());
- assertNotNull(createdProgram.getComment());
+ assertNull(createdProgram.getComment());
+ assertNotNull(createdProgram.getDescription());
+ assertNotNull(createdProgram.getZone());
assertEquals(program.getName(), createdProgram.getName());
assertEquals(program.getDescription(), createdProgram.getDescription());
// Reload program and compare
Program reloadedProgram = service.getProgram(createdProgram.getId());
assertNotNull(reloadedProgram);
- assertEquals(createdProgram.getId(), reloadedProgram.getId());
+ assertEquals(createdProgram, reloadedProgram);
+ assertNull(reloadedProgram.getComment());
assertEquals(program.getName(), reloadedProgram.getName());
assertEquals(program.getDescription(), reloadedProgram.getDescription());
assertNotNull(program.getZone());
- assertEquals(program.getZone().getId(), reloadedProgram.getZone().getId());
+ assertEquals(program.getZone(), reloadedProgram.getZone());
// Modify program
program.setId(createdProgram.getId());
@@ -109,8 +113,9 @@
assertEquals(program.getId(), reloadedProgram.getId());
assertEquals(program.getName(), reloadedProgram.getName());
assertEquals(program.getDescription(), reloadedProgram.getDescription());
+ assertNull(reloadedProgram.getComment());
assertNotNull(program.getZone());
- assertEquals(program.getZone().getId(), reloadedProgram.getZone().getId());
+ assertEquals(program.getZone(), reloadedProgram.getZone());
}
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -31,14 +31,12 @@
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Assert;
@@ -90,17 +88,23 @@
@Test
public void getAllProgramZone() {
- List<Zone> result = service.getAllProgramZone();
+ List<TuttiLocation> result = service.getAllProgramZone();
assertResultList(result, fixtures.refNbProgramZone());
}
@Test
public void getAllCountry() {
- List<Country> result = service.getAllCountry();
+ List<TuttiLocation> result = service.getAllCountry();
assertResultList(result, fixtures.refNbCountry());
}
@Test
+ public void getAllHarbour() {
+ List<TuttiLocation> result = service.getAllHarbour();
+ assertResultList(result, fixtures.refNbHarbour());
+ }
+
+ @Test
public void getAllObjectType() {
List<ObjectType> result = service.getAllObjectType();
assertResultList(result, fixtures.refNbObjectType());
@@ -108,14 +112,14 @@
@Test
public void getObjectType() {
- ObjectType result = service.getObjectType(fixtures.objectTypeCode());
+ ObjectType result = service.getObjectType(fixtures.objectTypeCode());
Assert.assertNotNull(result);
}
@Test
public void getAllFishingOperationStrata(/*String zoneId*/) {
String zoneId = dbResource.getFixtures().zoneId();
- List<FishingOperationLocation> result =
+ List<TuttiLocation> result =
service.getAllFishingOperationStrata(zoneId);
assertResultList(result, fixtures.refNbStrata());
}
@@ -123,7 +127,7 @@
@Test
public void getAllFishingOperationSubStrata(/*String zoneId, String strataId*/) {
String zoneId = dbResource.getFixtures().zoneId();
- List<FishingOperationLocation> result =
+ List<TuttiLocation> result =
service.getAllFishingOperationSubStrata(zoneId, null);
assertResultList(result, 76);
@@ -136,7 +140,7 @@
@Test
public void getAllFishingOperationLocation(/*String zoneId, String strataId, String subStrataId*/) {
String zoneId = dbResource.getFixtures().zoneId();
- List<FishingOperationLocation> result =
+ List<TuttiLocation> result =
service.getAllFishingOperationLocation(zoneId, null, null);
assertResultList(result, fixtures.refNbLocalite());
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -33,13 +33,11 @@
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import org.nuiton.util.decorator.Decorator;
import org.nuiton.util.decorator.DecoratorProvider;
@@ -91,14 +89,12 @@
@Override
protected void loadDecorators() {
- registerTuttiDecorator(Zone.class, "${label}$s#${name}$s", SEPARATOR, " - ");
+ registerTuttiDecorator(TuttiLocation.class, "${label}$s#${name}$s", SEPARATOR, " - ");
registerTuttiDecorator(Cruise.class, "${name}$s", SEPARATOR, " - ");
registerTuttiDecorator(TuttiProtocol.class, "${name}$s", SEPARATOR, " - ");
registerTuttiDecorator(FishingOperation.class, "${stationNumber}$s#${fishingOperationNumber}$s#${multirigAggregation}$s#${gearShootingStartDate}$td/%4$tm/%4$tY", SEPARATOR, " - ");
- registerTuttiDecorator(Country.class, "${label}$s#${name}$s", SEPARATOR, " - ");
registerTuttiDecorator(Gear.class, "${label}$s#${name}$s", SEPARATOR, " - ");
registerTuttiDecorator(Person.class, "${firstName}$s#${lastName}$s#${department}$s", SEPARATOR, " ");
- registerTuttiDecorator(FishingOperationLocation.class, "${label}$s#${name}$s", SEPARATOR, " - ");
registerTuttiDecorator(Caracteristic.class, "${parameterName}$s#${matrixName}$s#${fractionName}$s#${methodName}$s", SEPARATOR, " - ");
registerTuttiDecorator(Caracteristic.class, CARACTERISTIC_PARAMETER_ONLY, "${parameterName}$s", SEPARATOR, " - ");
// registerMultiJXPathDecorator(Caracteristic.class, CARACTERISTIC_WITH_UNIT, "${parameterName}$s#${matrixName}$s#${fractionName}$s#${methodName}$s (${unit}$s)", SEPARATOR, " - ");
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -44,14 +44,12 @@
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.apache.commons.io.IOUtils;
@@ -330,16 +328,21 @@
}
@Override
- public List<Zone> getAllProgramZone() {
+ public List<TuttiLocation> getAllProgramZone() {
return driver.getAllProgramZone();
}
@Override
- public List<Country> getAllCountry() {
+ public List<TuttiLocation> getAllCountry() {
return driver.getAllCountry();
}
@Override
+ public List<TuttiLocation> getAllHarbour() {
+ return driver.getAllHarbour();
+ }
+
+ @Override
public List<Gear> getAllScientificGear() {
return driver.getAllScientificGear();
}
@@ -360,17 +363,17 @@
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationStrata(String zoneId) {
+ public List<TuttiLocation> getAllFishingOperationStrata(String zoneId) {
return driver.getAllFishingOperationStrata(zoneId);
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationSubStrata(String zoneId, String strataId) {
+ public List<TuttiLocation> getAllFishingOperationSubStrata(String zoneId, String strataId) {
return driver.getAllFishingOperationSubStrata(zoneId, strataId);
}
@Override
- public List<FishingOperationLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId) {
+ public List<TuttiLocation> getAllFishingOperationLocation(String zoneId, String strataId, String subStrataId) {
return driver.getAllFishingOperationLocation(zoneId, strataId, subStrataId);
}
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-03-26 17:02:29 UTC (rev 683)
@@ -1,35 +1,12 @@
-###
-# #%L
-# Tutti :: UI
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2012 - 2013 Ifremer
-# %%
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this program. If not, see
-# <http://www.gnu.org/licenses/gpl-3.0.html>.
-# #L%
-###
#Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo
-#Mon Mar 25 16:24:40 CET 2013
-tutti.createBenthosBatch.action.addSpecies.help=
-tutti.createBenthosBatch.action.cancel.help=
-tutti.createBenthosBatch.action.save.help=
-tutti.createBenthosBatch.field.batchWeight.help=
-tutti.createBenthosBatch.field.sortedUnsortedCategory.help=
-tutti.createBenthosBatch.field.species.help=
-tutti.createBenthosBatch.help=
+#Tue Mar 26 16:11:47 CET 2013
+tutti.createBenthosBatch.action.addSpecies.help=createBenthosBatch.html\#actions
+tutti.createBenthosBatch.action.cancel.help=createBenthosBatch.html\#actions
+tutti.createBenthosBatch.action.save.help=createBenthosBatch.html\#actions
+tutti.createBenthosBatch.field.batchWeight.help=createBenthosBatch.html\#fields
+tutti.createBenthosBatch.field.sortedUnsortedCategory.help=createBenthosBatch.html\#fields
+tutti.createBenthosBatch.field.species.help=createBenthosBatch.html\#fields
+tutti.createBenthosBatch.help=createBenthosBatch.html
tutti.createSpeciesBatch.action.addSpecies.help=createSpeciesBatch.html\#actions
tutti.createSpeciesBatch.action.cancel.help=createSpeciesBatch.html\#actions
tutti.createSpeciesBatch.action.save.help=createSpeciesBatch.html\#actions
@@ -45,31 +22,31 @@
tutti.dbManager.action.openDb.help=dbManager.html\#actions
tutti.dbManager.action.upgradeDb.help=dbManager.html\#actions
tutti.dbManager.help=dbManager.html
-tutti.editBenthosBatch.action.createBatch.help=
-tutti.editBenthosBatch.action.removeBatch.help=
-tutti.editBenthosBatch.action.renameBatch.help=
-tutti.editBenthosBatch.action.splitBatch.help=
-tutti.editBenthosBatch.field.benthosTotalInertWeight.help=
-tutti.editBenthosBatch.field.benthosTotalLivingNotItemizedWeight.help=
-tutti.editBenthosBatch.field.benthosTotalSampleSortedWeight.help=
-tutti.editBenthosBatch.field.benthosTotalSortedWeight.help=
-tutti.editBenthosBatch.field.benthosTotalUnsortedWeight.help=
-tutti.editBenthosBatch.field.benthosTotalWeight.help=
-tutti.editBenthosBatch.filterBatch.help=
+tutti.editBenthosBatch.action.createBatch.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.action.removeBatch.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.action.renameBatch.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.action.splitBatch.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalInertWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalLivingNotItemizedWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalSampleSortedWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalSortedWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalUnsortedWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.filterBatch.help=editBenthosBatch.html\#fields
tutti.editBenthosBatch.help=editBenthosBatch.html
-tutti.editBenthosFrequencies.action.cancel.help=
-tutti.editBenthosFrequencies.action.generate.help=
-tutti.editBenthosFrequencies.action.save.help=
-tutti.editBenthosFrequencies.field.lengthStepCaracteristic.help=
-tutti.editBenthosFrequencies.field.maxStep.help=
-tutti.editBenthosFrequencies.field.minStep.help=
-tutti.editBenthosFrequencies.field.mode.autoGen.help=
-tutti.editBenthosFrequencies.field.mode.rafale.help=
-tutti.editBenthosFrequencies.field.mode.simple.help=
-tutti.editBenthosFrequencies.field.mode.simpleCounting.help=
-tutti.editBenthosFrequencies.field.rafaleStep.help=
-tutti.editBenthosFrequencies.field.simpleCounting.help=
-tutti.editBenthosFrequencies.field.step.help=
+tutti.editBenthosFrequencies.action.cancel.help=editBenthosFrequencies.html\#actions
+tutti.editBenthosFrequencies.action.generate.help=editBenthosFrequencies.html\#actions
+tutti.editBenthosFrequencies.action.save.help=editBenthosFrequencies.html\#actions
+tutti.editBenthosFrequencies.field.lengthStepCaracteristic.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.maxStep.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.minStep.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.mode.autoGen.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.mode.rafale.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.mode.simple.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.mode.simpleCounting.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.rafaleStep.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.simpleCounting.help=editBenthosFrequencies.html\#fields
+tutti.editBenthosFrequencies.field.step.help=editBenthosFrequencies.html\#fields
tutti.editCatchBatch.action.cancelEditCatchBatch.help=editCatchBatch.html\#actions
tutti.editCatchBatch.action.computeWeights.help=editCatchBatch.html\#actions
tutti.editCatchBatch.action.importPupitri.help=editCatchBatch.html\#actions
@@ -96,6 +73,7 @@
tutti.editCruise.field.beginDate.help=editCruise.html\#fields
tutti.editCruise.field.comment.help=editCruise.html\#fields
tutti.editCruise.field.country.help=editCruise.html\#fields
+tutti.editCruise.field.departureLocation.help=editCruise.html\#fields
tutti.editCruise.field.endDate.help=editCruise.html\#fields
tutti.editCruise.field.gear.help=editCruise.html\#fields
tutti.editCruise.field.headOfMission.help=editCruise.html\#fields
@@ -103,6 +81,7 @@
tutti.editCruise.field.multirigNumber.help=editCruise.html\#fields
tutti.editCruise.field.name.help=editCruise.html\#fields
tutti.editCruise.field.program.help=editCruise.html\#fields
+tutti.editCruise.field.returnLocation.help=editCruise.html\#fields
tutti.editCruise.field.surveyPart.help=editCruise.html\#fields
tutti.editCruise.field.vessel.help=editCruise.html\#fields
tutti.editCruise.field.year.help=editCruise.html\#fields
@@ -144,22 +123,22 @@
tutti.editProgram.field.name.help=editProgram.html\#fields
tutti.editProgram.field.zone.help=editProgram.html\#fields
tutti.editProgram.help=editProgram.html
-tutti.editProtocol.action.addBenthosProtocol.help=
+tutti.editProtocol.action.addBenthosProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.addSpeciesProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.closeEditProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolAllCaracteristic.help=editProtocol.html\#actions
-tutti.editProtocol.action.exportProtocolBenthos.help=
+tutti.editProtocol.action.exportProtocolBenthos.help=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolCaracteristic.tip=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolSpecies.help=editProtocol.html\#actions
-tutti.editProtocol.action.importProtocolBenthos.help=
+tutti.editProtocol.action.importProtocolBenthos.help=editProtocol.html\#actions
tutti.editProtocol.action.importProtocolCaracteristic.help=editProtocol.html\#actions
tutti.editProtocol.action.importProtocolSpecies.help=editProtocol.html\#actions
-tutti.editProtocol.action.removeBenthosProtocol.help=
+tutti.editProtocol.action.removeBenthosProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.removeSpeciesProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.saveProtocol.help=editProtocol.html\#actions
-tutti.editProtocol.action.selectOtherBenthos.help=
+tutti.editProtocol.action.selectOtherBenthos.help=editProtocol.html\#actions
tutti.editProtocol.action.selectOtherSpecies.help=editProtocol.html\#actions
-tutti.editProtocol.field.benthos.help=
+tutti.editProtocol.field.benthos.help=editProtocol.html\#fields
tutti.editProtocol.field.comment.help=editProtocol.html\#fields
tutti.editProtocol.field.gearUseFeature.help=editProtocol.html\#fields
tutti.editProtocol.field.lengthClasses.help=editProtocol.html\#fields
@@ -243,13 +222,13 @@
tutti.selectCruise.field.program.help=selectCruise.html\#fields
tutti.selectCruise.field.protocol.help=selectCruise.html\#fields
tutti.selectCruise.help=selectCruise.html
-tutti.splitBenthosBatch.action.cancel.help=
-tutti.splitBenthosBatch.action.save.help=
-tutti.splitBenthosBatch.field.batchWeightField.help=
-tutti.splitBenthosBatch.field.categoryField.help=
-tutti.splitBenthosBatch.field.sampleWeightField.help=
-tutti.splitBenthosBatch.field.speciesField.help=
-tutti.splitBenthosBatch.help=
+tutti.splitBenthosBatch.action.cancel.help=splitBenthosBatch.html\#actions
+tutti.splitBenthosBatch.action.save.help=splitBenthosBatch.html\#actions
+tutti.splitBenthosBatch.field.batchWeightField.help=splitBenthosBatch.html\#fields
+tutti.splitBenthosBatch.field.categoryField.help=splitBenthosBatch.html\#fields
+tutti.splitBenthosBatch.field.sampleWeightField.help=splitBenthosBatch.html\#fields
+tutti.splitBenthosBatch.field.speciesField.help=splitBenthosBatch.html\#fields
+tutti.splitBenthosBatch.help=splitBenthosBatch.html
tutti.splitSpeciesBatch.action.cancel.help=splitSpeciesBatch.html\#actions
tutti.splitSpeciesBatch.action.save.help=splitSpeciesBatch.html\#actions
tutti.splitSpeciesBatch.field.batchWeightField.help=splitSpeciesBatch.html\#fields
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-03-26 17:02:29 UTC (rev 683)
@@ -1,28 +1,5 @@
-###
-# #%L
-# Tutti :: UI
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2012 - 2013 Ifremer
-# %%
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this program. If not, see
-# <http://www.gnu.org/licenses/gpl-3.0.html>.
-# #L%
-###
#Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo
-#Mon Mar 25 16:24:40 CET 2013
+#Tue Mar 26 16:11:47 CET 2013
tutti.createBenthosBatch.action.addSpecies.help=createBenthosBatch.html\#actions
tutti.createBenthosBatch.action.cancel.help=createBenthosBatch.html\#actions
tutti.createBenthosBatch.action.save.help=createBenthosBatch.html\#actions
@@ -51,12 +28,12 @@
tutti.editBenthosBatch.action.removeSubBatch.help=editBenthosBatch.html\#actions
tutti.editBenthosBatch.action.renameBatch.help=editBenthosBatch.html\#actions
tutti.editBenthosBatch.action.splitBatch.help=editBenthosBatch.html\#actions
-tutti.editBenthosBatch.field.benthosTotalInertWeight.help=
-tutti.editBenthosBatch.field.benthosTotalLivingNotItemizedWeight.help=
-tutti.editBenthosBatch.field.benthosTotalSampleSortedWeight.help=
-tutti.editBenthosBatch.field.benthosTotalSortedWeight.help=
-tutti.editBenthosBatch.field.benthosTotalUnsortedWeight.help=
-tutti.editBenthosBatch.field.benthosTotalWeight.help=
+tutti.editBenthosBatch.field.benthosTotalInertWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalLivingNotItemizedWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalSampleSortedWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalSortedWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalUnsortedWeight.help=editBenthosBatch.html\#fields
+tutti.editBenthosBatch.field.benthosTotalWeight.help=editBenthosBatch.html\#fields
tutti.editBenthosBatch.field.speciesTotalInertWeight.help=editBenthosBatch.html\#fields
tutti.editBenthosBatch.field.speciesTotalLivingNotItemizedWeight.help=editBenthosBatch.html\#fields
tutti.editBenthosBatch.field.speciesTotalSampleSortedWeight.help=editBenthosBatch.html\#fields
@@ -105,6 +82,7 @@
tutti.editCruise.field.beginDate.help=editCruise.html\#fields
tutti.editCruise.field.comment.help=editCruise.html\#fields
tutti.editCruise.field.country.help=editCruise.html\#fields
+tutti.editCruise.field.departureLocation.help=editCruise.html\#fields
tutti.editCruise.field.endDate.help=editCruise.html\#fields
tutti.editCruise.field.gear.help=editCruise.html\#fields
tutti.editCruise.field.headOfMission.help=editCruise.html\#fields
@@ -112,6 +90,7 @@
tutti.editCruise.field.multirigNumber.help=editCruise.html\#fields
tutti.editCruise.field.name.help=editCruise.html\#fields
tutti.editCruise.field.program.help=editCruise.html\#fields
+tutti.editCruise.field.returnLocation.help=editCruise.html\#fields
tutti.editCruise.field.surveyPart.help=editCruise.html\#fields
tutti.editCruise.field.vessel.help=editCruise.html\#fields
tutti.editCruise.field.year.help=editCruise.html\#fields
@@ -153,22 +132,22 @@
tutti.editProgram.field.name.help=editProgram.html\#fields
tutti.editProgram.field.zone.help=editProgram.html\#fields
tutti.editProgram.help=editProgram.html
-tutti.editProtocol.action.addBenthosProtocol.help=
+tutti.editProtocol.action.addBenthosProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.addSpeciesProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.closeEditProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolAllCaracteristic.help=editProtocol.html\#actions
-tutti.editProtocol.action.exportProtocolBenthos.help=
+tutti.editProtocol.action.exportProtocolBenthos.help=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolCaracteristic.tip=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolSpecies.help=editProtocol.html\#actions
-tutti.editProtocol.action.importProtocolBenthos.help=
+tutti.editProtocol.action.importProtocolBenthos.help=editProtocol.html\#actions
tutti.editProtocol.action.importProtocolCaracteristic.help=editProtocol.html\#actions
tutti.editProtocol.action.importProtocolSpecies.help=editProtocol.html\#actions
-tutti.editProtocol.action.removeBenthosProtocol.help=
+tutti.editProtocol.action.removeBenthosProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.removeSpeciesProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.saveProtocol.help=editProtocol.html\#actions
-tutti.editProtocol.action.selectOtherBenthos.help=
+tutti.editProtocol.action.selectOtherBenthos.help=editProtocol.html\#actions
tutti.editProtocol.action.selectOtherSpecies.help=editProtocol.html\#actions
-tutti.editProtocol.field.benthos.help=
+tutti.editProtocol.field.benthos.help=editProtocol.html\#fields
tutti.editProtocol.field.comment.help=editProtocol.html\#fields
tutti.editProtocol.field.gearUseFeature.help=editProtocol.html\#fields
tutti.editProtocol.field.lengthClasses.help=editProtocol.html\#fields
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -158,6 +158,7 @@
}
public List<Caracteristic> getCaracteristics() {
+ checkOpened();
if (caracteristics == null) {
if (log.isInfoEnabled()) {
log.info("Loading allCaracteristic");
@@ -168,6 +169,7 @@
}
public List<Caracteristic> getLengthStepCaracteristics() {
+ checkOpened();
if (lengthStepCaracteristics == null) {
if (uiContext.isProtocolFilled()) {
@@ -196,6 +198,7 @@
}
public List<Species> getReferentSpeciesWithSurveyCode() {
+ checkOpened();
if (referentSpeciesWithSurveyCode == null) {
if (uiContext.isProtocolFilled()) {
@@ -233,6 +236,7 @@
}
public List<Species> getReferentBenthosWithSurveyCode() {
+ checkOpened();
if (referentBenthosWithSurveyCode == null) {
if (uiContext.isProtocolFilled()) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.css 2013-03-26 17:02:29 UTC (rev 683)
@@ -63,24 +63,9 @@
#nameField {
text: {model.getName()};
- _validatorLabel : {_("tutti.editCruise.field.name")};
+ _validatorLabel: {_("tutti.editCruise.field.name")};
}
-#yearLabel {
- text: "tutti.editCruise.field.year";
- labelFor: {yearField};
- toolTipText: "tutti.editCruise.field.year.tip";
- _help: {"tutti.editCruise.field.year.help"};
-}
-
-#yearField {
- property: year;
- model: {model.getYear()};
- useFloat: false;
- numberPattern: {INT_4_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editCruise.field.year")};
-}
-
#surveyPartLabel {
text: "tutti.editCruise.field.surveyPart";
labelFor: {surveyPartField};
@@ -90,22 +75,35 @@
#surveyPartField {
text: {model.getSurveyPart()};
- _validatorLabel : {_("tutti.editCruise.field.surveyPart")};
+ _validatorLabel: {_("tutti.editCruise.field.surveyPart")};
}
-#countryLabel {
- text: "tutti.editCruise.field.country";
- labelFor: {countryComboBox};
- toolTipText: "tutti.editCruise.field.country.tip";
- _help: {"tutti.editCruise.field.country.help"};
+#departureLocationLabel {
+ text: "tutti.editCruise.field.departureLocation";
+ labelFor: {departureLocationComboBox};
+ toolTipText: "tutti.editCruise.field.departureLocation.tip";
+ _help: {"tutti.editCruise.field.departureLocation.help"};
}
-#countryComboBox {
- property: country;
- selectedItem: {model.getCountry()};
- _validatorLabel : {_("tutti.editCruise.field.country")};
+#departureLocationComboBox {
+ property: departureLocation;
+ selectedItem: {model.getDepartureLocation()};
+ _validatorLabel: {_("tutti.editCruise.field.departureLocation")};
}
+#returnLocationLabel {
+ text: "tutti.editCruise.field.returnLocation";
+ labelFor: {returnLocationComboBox};
+ toolTipText: "tutti.editCruise.field.returnLocation.tip";
+ _help: {"tutti.editCruise.field.returnLocation.help"};
+}
+
+#returnLocationComboBox {
+ property: returnLocation;
+ selectedItem: {model.getReturnLocation()};
+ _validatorLabel: {_("tutti.editCruise.field.returnLocation")};
+}
+
#programLabel {
text: "tutti.editCruise.field.program";
labelFor: {programComboBox};
@@ -116,7 +114,7 @@
#programComboBox {
property: program;
selectedItem: {model.getProgram()};
- _validatorLabel : {_("tutti.editCruise.field.program")};
+ _validatorLabel: {_("tutti.editCruise.field.program")};
}
#beginDateLabel {
@@ -128,7 +126,7 @@
#beginDateField {
date: {model.getBeginDate()};
- _validatorLabel : {_("tutti.editCruise.field.beginDate")};
+ _validatorLabel: {_("tutti.editCruise.field.beginDate")};
}
#endDateLabel {
@@ -140,7 +138,7 @@
#endDateField {
date: {model.getEndDate()};
- _validatorLabel : {_("tutti.editCruise.field.endDate")};
+ _validatorLabel: {_("tutti.editCruise.field.endDate")};
}
#multirigNumberLabel {
@@ -155,7 +153,7 @@
model: {model.getMultirigNumber()};
useFloat: false;
numberPattern: {INT_1_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editCruise.field.multirigNumber")};
+ _validatorLabel: {_("tutti.editCruise.field.multirigNumber")};
}
#filterVesselLabel {
@@ -190,19 +188,25 @@
buttonGroup: "filterVesselType";
}
+#vesselLabel {
+ text: "tutti.editCruise.field.vessel";
+ labelFor: {vesselComboBox};
+ toolTipText: "tutti.editCruise.field.vessel.tip";
+ _help: {"tutti.editCruise.field.vessel.help"};
+}
+
#vesselComboBox {
- border: {BorderFactory.createTitledBorder(_("tutti.editCruise.field.vessel"))};
property: vessel;
selectedItem: {model.getVessel()};
toolTipText: "tutti.editCruise.field.vessel.tip";
- _validatorLabel : {_("tutti.editCruise.field.vessel")};
+ _validatorLabel: {_("tutti.editCruise.field.vessel")};
_help: {"tutti.editCruise.field.vessel.help"};
}
#gearList {
property: gear;
border: {BorderFactory.createTitledBorder(_("tutti.editCruise.field.gear"))};
- _validatorLabel : {_("tutti.editCruise.field.gear")};
+ _validatorLabel: {_("tutti.editCruise.field.gear")};
toolTipText: "tutti.editCruise.field.gear.tip";
_help: {"tutti.editCruise.field.gear.help"};
}
@@ -210,7 +214,7 @@
#headOfMissionList {
property: headOfMission;
border: {BorderFactory.createTitledBorder(_("tutti.editCruise.field.headOfMission"))};
- _validatorLabel : {_("tutti.editCruise.field.headOfMission")};
+ _validatorLabel: {_("tutti.editCruise.field.headOfMission")};
toolTipText: "tutti.editCruise.field.headOfMission.tip";
_help: {"tutti.editCruise.field.headOfMission.help"};
}
@@ -218,7 +222,7 @@
#headOfSortRoomList {
property: headOfSortRoom;
border: {BorderFactory.createTitledBorder(_("tutti.editCruise.field.headOfSortRoom"))};
- _validatorLabel : {_("tutti.editCruise.field.headOfSortRoom")};
+ _validatorLabel: {_("tutti.editCruise.field.headOfSortRoom")};
toolTipText: "tutti.editCruise.field.headOfSortRoom.tip";
_help: {"tutti.editCruise.field.headOfSortRoom.help"};
}
@@ -231,7 +235,7 @@
#commentField {
text: {model.getComment()};
- _validatorLabel : {_("tutti.editCruise.field.comment")};
+ _validatorLabel: {_("tutti.editCruise.field.comment")};
}
#saveButton {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUI.jaxx 2013-03-26 17:02:29 UTC (rev 683)
@@ -26,32 +26,25 @@
<import>
fr.ifremer.tutti.persistence.entities.data.Program
- fr.ifremer.tutti.persistence.entities.referential.Country
+ fr.ifremer.tutti.persistence.entities.referential.TuttiLocation
fr.ifremer.tutti.persistence.entities.referential.Gear
fr.ifremer.tutti.persistence.entities.referential.Person
fr.ifremer.tutti.persistence.entities.referential.Vessel
- fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.util.TuttiUI
fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment
jaxx.runtime.swing.editor.NumberEditor
jaxx.runtime.swing.editor.bean.BeanFilterableComboBox
- jaxx.runtime.swing.editor.bean.BeanListHeader
jaxx.runtime.swing.editor.bean.BeanDoubleList
org.jdesktop.swingx.JXDatePicker
- javax.swing.DefaultListModel
javax.swing.JSeparator
- javax.swing.ListSelectionModel
javax.swing.SwingConstants
- java.awt.Dimension
-
static org.nuiton.i18n.I18n._
- static jaxx.runtime.SwingUtil.getStringValue
</import>
<script><![CDATA[
@@ -77,11 +70,11 @@
<BeanValidator id='validator' bean='model'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='program' component='programComboBox'/>
- <field name='year' component='yearField'/>
<field name='surveyPart' component='surveyPartField'/>
<field name='name' component='nameField'/>
<field name='multirigNumber' component='multirigNumberField'/>
- <field name='country' component='countryComboBox'/>
+ <field name='departureLocation' component='departureLocationComboBox'/>
+ <field name='returnLocation' component='returnLocationComboBox'/>
<field name='beginDate' component='beginDateField'/>
<field name='endDate' component='endDateField'/>
<field name='vessel' component='vesselComboBox'/>
@@ -101,36 +94,68 @@
<Table fill='both' constraints='BorderLayout.CENTER'>
- <!-- cruise program / year / program part / name -->
+ <!-- cruise program / survey part -->
<row>
<cell anchor='west'>
<JLabel id='programLabel'/>
</cell>
- <cell weightx='1'>
+ <cell weightx='0.3'>
<BeanFilterableComboBox id='programComboBox' constructorParams='this'
genericType='Program'/>
</cell>
- <cell anchor='west'>
- <JLabel id='yearLabel'/>
- </cell>
- <cell weightx='1'>
- <NumberEditor id='yearField' constructorParams='this'/>
- </cell>
<cell>
<JLabel id='surveyPartLabel'/>
</cell>
- <cell weightx='1'>
+ <cell weightx='0.3'>
<JTextField id='surveyPartField'
onKeyReleased='handler.setText(event, "surveyPart")'/>
</cell>
</row>
- <!-- cruise name -->
+ <!-- departure harbour / begin date -->
<row>
+ <cell anchor='west'>
+ <JLabel id='departureLocationLabel'/>
+ </cell>
<cell>
+ <BeanFilterableComboBox id='departureLocationComboBox'
+ constructorParams='this'
+ genericType='TuttiLocation'/>
+ </cell>
+ <cell>
+ <JLabel id='beginDateLabel'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='beginDateField'
+ onActionPerformed='handler.setDate(event, "beginDate")'/>
+ </cell>
+ </row>
+
+ <!-- landing harbour / end date -->
+ <row>
+ <cell anchor='west'>
+ <JLabel id='returnLocationLabel'/>
+ </cell>
+ <cell>
+ <BeanFilterableComboBox id='returnLocationComboBox'
+ constructorParams='this'
+ genericType='TuttiLocation'/>
+ </cell>
+ <cell>
+ <JLabel id='endDateLabel'/>
+ </cell>
+ <cell>
+ <JXDatePicker id='endDateField'
+ onActionPerformed='handler.setDate(event, "endDate")'/>
+ </cell>
+ </row>
+
+ <!-- cruise name / multirigNumber -->
+ <row>
+ <cell>
<JLabel id='nameLabel'/>
</cell>
- <cell weightx='0.3'>
+ <cell>
<JTextField id='nameField'
onKeyReleased='handler.setText(event, "name")'/>
</cell>
@@ -138,47 +163,29 @@
<JButton id='generateNameButton'
onActionPerformed='handler.generateCampaignName()'/>
</cell>
- <cell>
- <JLabel id='multirigNumberLabel'/>
- </cell>
- <cell weightx='0.3'>
- <NumberEditor id='multirigNumberField' constructorParams='this'/>
- </cell>
</row>
- <!-- cruise country / begin date / end date -->
+ <!-- cruise name / multirigNumber -->
<row>
<cell>
- <JLabel id='countryLabel'/>
+ <JLabel id='multirigNumberLabel'/>
</cell>
- <cell weightx='0.3'>
- <BeanFilterableComboBox id='countryComboBox' constructorParams='this'
- genericType='Country'/>
- </cell>
<cell>
- <JLabel id='beginDateLabel'/>
+ <NumberEditor id='multirigNumberField' constructorParams='this'/>
</cell>
- <cell weightx='0.3'>
- <JXDatePicker id='beginDateField'
- onActionPerformed='handler.setDate(event, "beginDate")'/>
+ <cell columns="2">
+ <JLabel/>
</cell>
- <cell>
- <JLabel id='endDateLabel'/>
- </cell>
- <cell weightx='0.3'>
- <JXDatePicker id='endDateField'
- onActionPerformed='handler.setDate(event, "endDate")'/>
- </cell>
</row>
<!-- cruise vessel / gear -->
<row>
- <cell columns='6'>
+ <cell columns='4'>
<JSeparator constructorParams='SwingConstants.HORIZONTAL'/>
</cell>
</row>
<row>
- <cell columns='6'>
+ <cell columns='4'>
<JPanel id='vesselFilterPane'>
<JLabel id='filterVesselLabel'/>
<JRadioButton id='filterVesselAllButton'
@@ -190,26 +197,25 @@
</JPanel>
</cell>
</row>
- <row weighty='0.3'>
- <!--cell>
+ <row>
+ <cell>
<JLabel id='vesselLabel'/>
- </cell-->
- <cell weightx='0.3' columns="3">
- <JPanel layout='{new BorderLayout()}'>
- <BeanFilterableComboBox id='vesselComboBox' constructorParams='this'
- genericType='Vessel'
- constraints='BorderLayout.NORTH'/>
- </JPanel>
+ </cell>
+ <cell columns="3">
+ <BeanFilterableComboBox id='vesselComboBox' constructorParams='this'
+ genericType='Vessel'/>
</cell>
- <cell columns="3">
+ </row>
+ <row weighty='0.3'>
+ <cell columns="4">
<BeanDoubleList id='gearList' genericType='Gear'/>
</cell>
</row>
<!-- cruise headOfMission / headOfSortRoom -->
<row weighty='0.3'>
- <cell columns='6'>
+ <cell columns='4'>
<JPanel layout='{new GridLayout(1, 0)}'>
<BeanDoubleList id='headOfMissionList' genericType='Person'/>
<BeanDoubleList id='headOfSortRoomList' genericType='Person'/>
@@ -219,7 +225,7 @@
<!-- cruise comment -->
<row weighty='0.3'>
- <cell columns='6'>
+ <cell columns='4'>
<JScrollPane id='commentPane'
onFocusGained='commentField.requestFocus()'>
<JTextArea id='commentField'
@@ -230,7 +236,7 @@
<!-- Form Actions -->
<row>
- <cell columns='6'>
+ <cell columns='4'>
<JPanel layout='{new GridLayout(1, 0)}'>
<JButton id='closeButton'/>
<JButton id='saveButton'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -181,10 +181,14 @@
persistenceService.getAllProgram(),
model.getProgram());
- initBeanFilterableComboBox(ui.getCountryComboBox(),
- persistenceService.getAllCountry(),
- model.getCountry());
+ initBeanFilterableComboBox(ui.getDepartureLocationComboBox(),
+ persistenceService.getAllHarbour(),
+ model.getDepartureLocation());
+ initBeanFilterableComboBox(ui.getReturnLocationComboBox(),
+ persistenceService.getAllHarbour(),
+ model.getReturnLocation());
+
initBeanFilterableComboBox(ui.getVesselComboBox(),
allVesselList,
model.getVessel());
@@ -210,7 +214,6 @@
model.setModify(model.isCreate());
registerValidators(validator);
-
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -29,9 +29,9 @@
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Country;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
@@ -39,6 +39,7 @@
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
+import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.List;
@@ -59,8 +60,10 @@
public static final String PROPERTY_COMMENT = "comment";
- public static final String PROPERTY_COUNTRY = "country";
+ public static final String PROPERTY_DEPARTURE_LOCATION = "departureLocation";
+ public static final String PROPERTY_LANDING_LOCATION = "returnLocation";
+
public static final String PROPERTY_SURVEY_PART = "surveyPart";
public static final String PROPERTY_VESSEL = "vessel";
@@ -71,8 +74,6 @@
public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom";
- public static final String PROPERTY_YEAR = "year";
-
public static final String PROPERTY_MULTIRIG_NUMBER = "multirigNumber";
public static final String PROPERTY_BEGIN_DATE = "beginDate";
@@ -91,8 +92,10 @@
protected Program program;
- protected Country country;
+ protected TuttiLocation departureLocation;
+ protected TuttiLocation returnLocation;
+
protected String name;
protected String surveyPart;
@@ -107,8 +110,6 @@
protected String comment;
- protected Integer year;
-
protected Integer multirigNumber;
protected Date beginDate;
@@ -161,16 +162,26 @@
firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
}
- public Country getCountry() {
- return country;
+ public TuttiLocation getDepartureLocation() {
+ return departureLocation;
}
- public void setCountry(Country country) {
- Object oldValue = getCountry();
- this.country = country;
- firePropertyChange(PROPERTY_COUNTRY, oldValue, country);
+ public void setDepartureLocation(TuttiLocation departureLocation) {
+ Object oldValue = getDepartureLocation();
+ this.departureLocation = departureLocation;
+ firePropertyChange(PROPERTY_DEPARTURE_LOCATION, oldValue, departureLocation);
}
+ public TuttiLocation getReturnLocation() {
+ return returnLocation;
+ }
+
+ public void setReturnLocation(TuttiLocation returnLocation) {
+ Object oldValue = getReturnLocation();
+ this.returnLocation = returnLocation;
+ firePropertyChange(PROPERTY_LANDING_LOCATION, oldValue, returnLocation);
+ }
+
public String getSurveyPart() {
return surveyPart;
}
@@ -179,16 +190,6 @@
Object oldValue = getSurveyPart();
this.surveyPart = surveyPart;
firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
- }
-
- public Integer getYear() {
- return year;
- }
-
- public void setYear(Integer year) {
- Object oldValue = getYear();
- this.year = year;
- firePropertyChange(PROPERTY_YEAR, oldValue, year);
firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
}
@@ -210,6 +211,7 @@
Object oldValue = getBeginDate();
this.beginDate = beginDate;
firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate);
+ firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
}
public Date getEndDate() {
@@ -289,12 +291,20 @@
}
public boolean isCanGenerateName() {
- return program != null && year != null;
+ return program != null && beginDate != null;
}
public static final String CRUISE_NAME_FORMAT = "%1$s_%2$s";
public String getGeneratedCampaignName() {
+ int year;
+ if (beginDate == null) {
+ year = 0;
+ } else {
+ Calendar c = Calendar.getInstance();
+ c.setTime(beginDate);
+ year = c.get(Calendar.YEAR);
+ }
String result = String.format(CRUISE_NAME_FORMAT, program.getName(), year);
if (StringUtils.isNotEmpty(surveyPart)) {
result += "_" + surveyPart;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2013-03-26 17:02:29 UTC (rev 683)
@@ -55,7 +55,7 @@
beanType: {Program.class};
selectedItem: {model.getProgram()};
enabled: {!programCombobox.isEmpty()};
- _validatorLabel : {_("tutti.selectCruise.field.program")};
+ _validatorLabel: {_("tutti.selectCruise.field.program")};
}
#editProgramButton {
@@ -89,7 +89,7 @@
property: cruise;
selectedItem: {model.getCruise()};
enabled: {!cruiseCombobox.isEmpty()};
- _validatorLabel : {_("tutti.selectCruise.field.cruise")};
+ _validatorLabel: {_("tutti.selectCruise.field.cruise")};
}
#editCruiseButton {
@@ -124,7 +124,7 @@
property: protocol;
selectedItem: {model.getProtocol()};
enabled: {!protocolCombobox.isEmpty()};
- _validatorLabel : {_("tutti.selectCruise.field.protocol")};
+ _validatorLabel: {_("tutti.selectCruise.field.protocol")};
}
#newProtocolComboBox {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -31,8 +31,8 @@
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.content.operation.catches.ComputeWeightsAction;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
@@ -398,17 +398,15 @@
} else { //if (!bean.equals(editFishingOperationUIModel.getFishingOperation()) || handler.isAModelModified()) {
- FishingOperationLocation strata = bean.getStrata();
- FishingOperationLocation subStrata = bean.getSubStrata();
- FishingOperationLocation location = bean.getLocation();
+ TuttiLocation strata = bean.getStrata();
+ TuttiLocation subStrata = bean.getSubStrata();
+ TuttiLocation location = bean.getLocation();
Cruise cruise = bean.getCruise();
if (cruise != null) {
+
// update gear universe
ui.getGearComboBox().setData(Lists.newArrayList(cruise.getGear()));
-
- // update vessel universe
- ui.getVesselComboBox().setData(Lists.newArrayList(cruise.getVessel()));
}
editFishingOperationUIModel.fromBean(bean);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.css 2013-03-26 17:02:29 UTC (rev 683)
@@ -89,7 +89,7 @@
#stationNumberField {
text: {model.getStationNumber()};
- _validatorLabel : {_("tutti.editFishingOperation.field.stationNumber")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.stationNumber")};
_selectOnFocus: {true};
}
@@ -105,7 +105,7 @@
model: {model.getFishingOperationNumber()};
useFloat: false;
numberPattern: {INT_6_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.fishingOperationNumber")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.fishingOperationNumber")};
}
#strataLabel {
@@ -118,7 +118,7 @@
#strataComboBox {
property: strata;
selectedItem: {model.getStrata()};
- _validatorLabel : {_("tutti.editFishingOperation.field.strata")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.strata")};
}
#subStrataLabel {
@@ -131,7 +131,7 @@
#subStrataComboBox {
property: subStrata;
selectedItem: {model.getSubStrata()};
- _validatorLabel : {_("tutti.editFishingOperation.field.subStrata")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.subStrata")};
}
#locationLabel {
@@ -144,33 +144,33 @@
#locationComboBox {
property: location;
selectedItem: {model.getLocation()};
- _validatorLabel : {_("tutti.editFishingOperation.field.location")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.location")};
}
#gearLongitudeLabel {
text: {handler.getGearLongitudeLabelText(handler.getConfig().getCoordinateEditorType())};
- actionIcon: "coordinates";
+ actionIcon: coordinates;
toolTipText: "tutti.editFishingOperation.field.gearLongitude.tip";
_help: {"tutti.editFishingOperation.field.gearLongitude.help"};
}
#gearLatitudeLabel {
text: {handler.getGearLatitudeLabelText(handler.getConfig().getCoordinateEditorType())};
- actionIcon: "coordinates";
+ actionIcon: coordinates;
toolTipText: "tutti.editFishingOperation.field.gearLatitude.tip";
_help: {"tutti.editFishingOperation.field.gearLatitude.help"};
}
#gearDateLabel {
text: "tutti.editFishingOperation.field.gearDate";
- actionIcon: "calendar";
+ actionIcon: calendar;
toolTipText: "tutti.editFishingOperation.field.gearDate.tip";
_help: {"tutti.editFishingOperation.field.gearDate.help"};
}
#gearTimeLabel {
text: "tutti.editFishingOperation.field.gearTime";
- actionIcon: "time";
+ actionIcon: time;
toolTipText: "tutti.editFishingOperation.field.gearTime.tip";
_help: {"tutti.editFishingOperation.field.gearTime.help"};
}
@@ -197,22 +197,20 @@
#vesselLabel {
text: "tutti.editFishingOperation.field.vessel";
- labelFor: {vesselComboBox};
- actionIcon: "vessel";
+ labelFor: {vesselField};
+ actionIcon: vessel;
toolTipText: "tutti.editFishingOperation.field.vessel.tip";
_help: {"tutti.editFishingOperation.field.vessel.help"};
}
-#vesselComboBox {
- property: vessel;
- selectedItem: {model.getVessel()};
- _validatorLabel : {_("tutti.editFishingOperation.field.vessel")};
+#vesselField {
+ text: {handler.decorateVessel(model.getVessel())};
}
#gearLabel {
text: "tutti.editFishingOperation.field.gear";
labelFor: {gearComboBox};
- actionIcon: "gear";
+ actionIcon: gear;
toolTipText: "tutti.editFishingOperation.field.gear.tip";
_help: {"tutti.editFishingOperation.field.gear.help"};
}
@@ -220,7 +218,7 @@
#gearComboBox {
property: gear;
selectedItem: {model.getGear()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gear")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gear")};
}
#multirigAggregationLabel {
@@ -232,7 +230,7 @@
#multirigAggregationField {
text: {model.getMultirigAggregation()};
- _validatorLabel : {_("tutti.editFishingOperation.field.multirigAggregation")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.multirigAggregation")};
}
.degree {
@@ -272,32 +270,32 @@
property: gearShootingStartLongitudeDegree;
model: {model.getGearShootingStartLongitudeDegree()};
numberPattern: {SIGNED_INT_3_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLongitudeDegree")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLongitudeDegree")};
}
#gearShootingStartLongitudeDMSMinuteField {
property: gearShootingStartLongitudeMinute;
model: {model.getGearShootingStartLongitudeMinute()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLongitudeMinute")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLongitudeMinute")};
}
#gearShootingStartLongitudeDMSSecondField {
property: gearShootingStartLongitudeSecond;
model: {model.getGearShootingStartLongitudeSecond()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLongitudeSecond")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLongitudeSecond")};
}
#gearShootingStartLongitudeDMDDegreeField {
property: gearShootingStartLongitudeDegree;
model: {model.getGearShootingStartLongitudeDegree()};
numberPattern: {SIGNED_INT_3_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLongitudeDegree")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLongitudeDegree")};
}
#gearShootingStartLongitudeDMDMinuteField {
property: gearShootingStartLongitudeDecimalMinute;
model: {model.getGearShootingStartLongitudeDecimalMinute()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLongitudeMinute")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLongitudeMinute")};
}
#gearShootingStartLongitudeDDField {
@@ -306,7 +304,7 @@
showReset: false;
useFloat: true;
useSign: true;
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLongitude")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLongitude")};
}
#gearShootingStartLatitudePanel {
@@ -319,32 +317,32 @@
property: gearShootingStartLatitudeDegree;
model: {model.getGearShootingStartLatitudeDegree()};
numberPattern: {SIGNED_INT_2_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLatitudeDegree")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLatitudeDegree")};
}
#gearShootingStartLatitudeDMSMinuteField {
property: gearShootingStartLatitudeMinute;
model: {model.getGearShootingStartLatitudeMinute()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLatitudeMinute")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLatitudeMinute")};
}
#gearShootingStartLatitudeDMSSecondField {
property: gearShootingStartLatitudeSecond;
model: {model.getGearShootingStartLatitudeSecond()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLatitudeSecond")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLatitudeSecond")};
}
#gearShootingStartLatitudeDMDDegreeField {
property: gearShootingStartLatitudeDegree;
model: {model.getGearShootingStartLatitudeDegree()};
numberPattern: {SIGNED_INT_2_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLatitudeDegree")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLatitudeDegree")};
}
#gearShootingStartLatitudeDMDMinuteField {
property: gearShootingStartLatitudeDecimalMinute;
model: {model.getGearShootingStartLatitudeDecimalMinute()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLatitudeMinute")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLatitudeMinute")};
}
#gearShootingStartLatitudeDDField {
@@ -353,12 +351,12 @@
showReset: false;
useFloat: true;
useSign: true;
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartLatitude")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartLatitude")};
}
#gearShootingStartDateField {
date: {model.getGearShootingStartDate()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingStartDate")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingStartDate")};
}
#gearShootingStartTimeField {
@@ -376,32 +374,32 @@
property: gearShootingEndLongitudeDegree;
model: {model.getGearShootingEndLongitudeDegree()};
numberPattern: {SIGNED_INT_3_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLongitudeDegree")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLongitudeDegree")};
}
#gearShootingEndLongitudeDMSMinuteField {
property: gearShootingEndLongitudeMinute;
model: {model.getGearShootingEndLongitudeMinute()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLongitudeMinute")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLongitudeMinute")};
}
#gearShootingEndLongitudeDMSSecondField {
property: gearShootingEndLongitudeSecond;
model: {model.getGearShootingEndLongitudeSecond()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLongitudeSecond")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLongitudeSecond")};
}
#gearShootingEndLongitudeDMDDegreeField {
property: gearShootingEndLongitudeDegree;
model: {model.getGearShootingEndLongitudeDegree()};
numberPattern: {SIGNED_INT_3_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLongitudeDegree")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLongitudeDegree")};
}
#gearShootingEndLongitudeDMDMinuteField {
property: gearShootingEndLongitudeDecimalMinute;
model: {model.getGearShootingEndLongitudeDecimalMinute()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLongitudeMinute")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLongitudeMinute")};
}
#gearShootingEndLongitudeDDField {
@@ -410,7 +408,7 @@
showReset: false;
useFloat: true;
useSign: true;
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLongitude")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLongitude")};
}
#gearShootingEndLatitudePanel {
@@ -423,32 +421,32 @@
property: gearShootingEndLatitudeDegree;
model: {model.getGearShootingEndLatitudeDegree()};
numberPattern: {SIGNED_INT_2_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLatitudeDegree")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLatitudeDegree")};
}
#gearShootingEndLatitudeDMSMinuteField {
property: gearShootingEndLatitudeMinute;
model: {model.getGearShootingEndLatitudeMinute()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLatitudeMinute")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLatitudeMinute")};
}
#gearShootingEndLatitudeDMSSecondField {
property: gearShootingEndLatitudeSecond;
model: {model.getGearShootingEndLatitudeSecond()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLatitudeSecond")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLatitudeSecond")};
}
#gearShootingEndLatitudeDMDDegreeField {
property: gearShootingEndLatitudeDegree;
model: {model.getGearShootingEndLatitudeDegree()};
numberPattern: {SIGNED_INT_2_DIGITS_PATTERN};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLatitudeDegree")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLatitudeDegree")};
}
#gearShootingEndLatitudeDMDMinuteField {
property: gearShootingEndLatitudeDecimalMinute;
model: {model.getGearShootingEndLatitudeDecimalMinute()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLatitudeMinute")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLatitudeMinute")};
}
#gearShootingEndLatitudeDDField {
@@ -457,12 +455,12 @@
showReset: false;
useFloat: true;
useSign: true;
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndLatitude")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndLatitude")};
}
#gearShootingEndDateField {
date: {model.getGearShootingEndDate()};
- _validatorLabel : {_("tutti.editFishingOperation.field.gearShootingEndDate")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.gearShootingEndDate")};
}
#gearShootingEndTimeField {
@@ -474,7 +472,7 @@
floatable: false;
borderPainted: false;
opaque: false;
- _validatorLabel : {_("tutti.editFishingOperation.field.fishingOperationValidity")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.fishingOperationValidity")};
toolTipText: "tutti.editFishingOperation.field.fishingOperationValid.tip";
_help: {"tutti.editFishingOperation.field.fishingOperationValid.help"};
}
@@ -517,7 +515,7 @@
numberPattern: {INT_6_DIGITS_PATTERN};
enabled: {!model.isFishingOperationRectiligne()};
toolTipText: {handler.getTrawlDistanceTooltipText(model.getTrawlDistance())};
- _validatorLabel : {_("tutti.editFishingOperation.field.trawlDistance")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.trawlDistance")};
}
#durationLabel {
@@ -530,13 +528,13 @@
#durationField {
text: {handler.getDuration(model.getGearShootingStartDate(), model.getGearShootingEndDate())};
enabled: false;
- _validatorLabel : {_("tutti.editFishingOperation.field.duration")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.duration")};
}
#recorderPersonList {
property: recorderPerson;
border: {BorderFactory.createTitledBorder(_("tutti.editFishingOperation.field.recorderPerson"))};
- _validatorLabel : {_("tutti.editFishingOperation.field.recorderPerson")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.recorderPerson")};
toolTipText: "tutti.editFishingOperation.field.recorderPerson.tip";
_help: {"tutti.editFishingOperation.field.recorderPerson.help"};
}
@@ -549,7 +547,7 @@
#commentField {
text: {model.getComment()};
- _validatorLabel : {_("tutti.editFishingOperation.field.comment")};
+ _validatorLabel: {_("tutti.editFishingOperation.field.comment")};
}
#resetValidStateButton {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2013-03-26 17:02:29 UTC (rev 683)
@@ -25,7 +25,7 @@
decorator='help'
implements='fr.ifremer.tutti.ui.swing.util.TuttiUI<EditFishingOperationUIModel, EditFishingOperationUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation
+ fr.ifremer.tutti.persistence.entities.referential.TuttiLocation
fr.ifremer.tutti.persistence.entities.referential.Gear
fr.ifremer.tutti.persistence.entities.referential.Person
fr.ifremer.tutti.persistence.entities.referential.Vessel
@@ -77,7 +77,6 @@
<field name='comment' component='commentPane'/>
<field name='recorderPerson' component='recorderPersonList'/>
<field name='trawlDistance' component='trawlDistanceField'/>
- <field name='vessel' component='vesselComboBox'/>
<field name='gear' component='gearComboBox'/>
<field name='multirigAggregation' component='multirigAggregationField'/>
<field name='gearShootingStartLatitude'
@@ -195,7 +194,7 @@
<cell weightx='0.3'>
<BeanFilterableComboBox id='strataComboBox'
constructorParams='this'
- genericType='FishingOperationLocation'/>
+ genericType='TuttiLocation'/>
</cell>
<cell>
<JLabel id='subStrataLabel'/>
@@ -203,7 +202,7 @@
<cell weightx='0.3'>
<BeanFilterableComboBox id='subStrataComboBox'
constructorParams='this'
- genericType='FishingOperationLocation'/>
+ genericType='TuttiLocation'/>
</cell>
<cell>
<JLabel id='locationLabel'/>
@@ -211,7 +210,7 @@
<cell weightx='0.3'>
<BeanFilterableComboBox id='locationComboBox'
constructorParams='this'
- genericType='FishingOperationLocation'/>
+ genericType='TuttiLocation'/>
</cell>
</row>
@@ -466,9 +465,7 @@
<JLabel id='vesselLabel'/>
</cell>
<cell weightx="1.0" fill="both">
- <BeanFilterableComboBox id='vesselComboBox'
- constructorParams='this'
- genericType='Vessel'/>
+ <JLabel id='vesselField'/>
</cell>
</row>
<row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -31,11 +31,10 @@
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.content.operation.fishing.AbstractCaracteristicTabUIModel;
@@ -187,7 +186,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
EditFishingOperationUIModel source = (EditFishingOperationUIModel) evt.getSource();
- FishingOperationLocation newStrata = (FishingOperationLocation) evt.getNewValue();
+ TuttiLocation newStrata = (TuttiLocation) evt.getNewValue();
onSelectedStrata(source, newStrata);
}
});
@@ -196,7 +195,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
EditFishingOperationUIModel source = (EditFishingOperationUIModel) evt.getSource();
- FishingOperationLocation newStrata = (FishingOperationLocation) evt.getNewValue();
+ TuttiLocation newStrata = (TuttiLocation) evt.getNewValue();
onSelectedSubStrata(source, newStrata);
}
});
@@ -249,10 +248,6 @@
people,
model.getRecorderPerson());
- initBeanFilterableComboBox(ui.getVesselComboBox(),
- Lists.<Vessel>newArrayList(),
- null);
-
initBeanFilterableComboBox(ui.getGearComboBox(),
Lists.<Gear>newArrayList(),
null);
@@ -266,25 +261,25 @@
Preconditions.checkNotNull(program,
"Could not find program in ui context");
- Zone zone = program.getZone();
+ TuttiLocation zone = program.getZone();
- FishingOperationLocation strata = model.getStrata();
+ TuttiLocation strata = model.getStrata();
String strataId = strata == null ? null : strata.getId();
- FishingOperationLocation subStrata = model.getSubStrata();
+ TuttiLocation subStrata = model.getSubStrata();
String substrataId = subStrata == null ? null : subStrata.getId();
- FishingOperationLocation location = model.getLocation();
+ TuttiLocation location = model.getLocation();
String zoneId = zone.getId();
- List<FishingOperationLocation> stratas =
+ List<TuttiLocation> stratas =
persistenceService.getAllFishingOperationStrata(zoneId);
- List<FishingOperationLocation> subStratas =
+ List<TuttiLocation> subStratas =
persistenceService.getAllFishingOperationSubStrata(zoneId, strataId);
- List<FishingOperationLocation> locations =
+ List<TuttiLocation> locations =
persistenceService.getAllFishingOperationLocation(zoneId, strataId, substrataId);
initBeanFilterableComboBox(ui.getStrataComboBox(), stratas, strata);
@@ -543,7 +538,7 @@
//------------------------------------------------------------------------//
protected void onSelectedStrata(EditFishingOperationUIModel model,
- FishingOperationLocation newStrata) {
+ TuttiLocation newStrata) {
// reset substrata value
model.setSubStrata(null);
@@ -551,15 +546,15 @@
// reset sub strata combo
ui.getSubStrataComboBox().setData(null);
- Zone zone = getDataContext().getProgram().getZone();
+ TuttiLocation zone = getDataContext().getProgram().getZone();
String zoneId = zone.getId();
String strataId = newStrata == null ? null : newStrata.getId();
- List<FishingOperationLocation> subStrata =
+ List<TuttiLocation> subStrata =
persistenceService.getAllFishingOperationSubStrata(zoneId, strataId);
- List<FishingOperationLocation> location =
+ List<TuttiLocation> location =
persistenceService.getAllFishingOperationLocation(zoneId, strataId, null);
ui.getSubStrataComboBox().setData(subStrata);
@@ -585,22 +580,22 @@
}
protected void onSelectedSubStrata(EditFishingOperationUIModel model,
- FishingOperationLocation newSubStrata) {
+ TuttiLocation newSubStrata) {
// reset localite value
model.setLocation(null);
// reset localite combo
ui.getLocationComboBox().setData(null);
- Zone zone = getDataContext().getProgram().getZone();
+ TuttiLocation zone = getDataContext().getProgram().getZone();
String zoneId = zone.getId();
- FishingOperationLocation strata = model.getStrata();
+ TuttiLocation strata = model.getStrata();
String subStrataId = newSubStrata == null ? null : newSubStrata.getId();
String strataId = strata == null ? null : strata.getId();
- List<FishingOperationLocation> location =
+ List<TuttiLocation> location =
persistenceService.getAllFishingOperationLocation(zoneId, strataId, subStrataId);
ui.getLocationComboBox().setData(location);
@@ -648,4 +643,15 @@
getModel().removeAllAttachment(getModel().getAttachment());
getModel().addAllAttachment(attachments);
}
+
+ public String decorateVessel(Vessel vessel) {
+ String result;
+ if (vessel == null) {
+ result = "";
+ } else {
+ result = "<html><strong>" + decorate(vessel) +
+ "</strong></html>";
+ }
+ return result;
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -30,9 +30,9 @@
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.referential.FishingOperationLocation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.persistence.spatial.SexagecimalPosition;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
@@ -153,10 +153,12 @@
protected Integer fishingOperationNumber;
- protected FishingOperationLocation strata;
+ protected TuttiLocation strata;
- protected FishingOperationLocation subStrata;
+ protected TuttiLocation subStrata;
+ protected TuttiLocation location;
+
protected SexagecimalPosition gearShootingStartLatitudeAsSexagecimal;
protected SexagecimalPosition gearShootingStartLongitudeAsSexagecimal;
@@ -183,8 +185,6 @@
protected Boolean fishingOperationValid;
- protected FishingOperationLocation location;
-
protected String comment;
protected List<Person> recorderPerson = Lists.newArrayList();
@@ -315,21 +315,21 @@
firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
}
- public FishingOperationLocation getStrata() {
+ public TuttiLocation getStrata() {
return strata;
}
- public void setStrata(FishingOperationLocation strata) {
+ public void setStrata(TuttiLocation strata) {
Object oldValue = getStrata();
this.strata = strata;
firePropertyChange(PROPERTY_STRATA, oldValue, strata);
}
- public FishingOperationLocation getSubStrata() {
+ public TuttiLocation getSubStrata() {
return subStrata;
}
- public void setSubStrata(FishingOperationLocation subStrata) {
+ public void setSubStrata(TuttiLocation subStrata) {
Object oldValue = getSubStrata();
this.subStrata = subStrata;
firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
@@ -686,11 +686,11 @@
firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
}
- public FishingOperationLocation getLocation() {
+ public TuttiLocation getLocation() {
return location;
}
- public void setLocation(FishingOperationLocation location) {
+ public void setLocation(TuttiLocation location) {
Object oldValue = getLocation();
this.location = location;
firePropertyChange(PROPERTY_LOCATION, oldValue, location);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -385,6 +385,13 @@
initUI(ui);
+// SwingUtil.applyDataBinding(
+// ui,
+// SpeciesBatchUI.BINDING_CREATE_SPECIES_MELAG_MENU_ENABLED,
+// SpeciesBatchUI.BINDING_REMOVE_SPECIES_BATCH_MENU_ENABLED,
+// SpeciesBatchUI.BINDING_REMOVE_SPECIES_SUB_BATCH_MENU_ENABLED,
+// SpeciesBatchUI.BINDING_RENAME_SPECIES_BATCH_MENU_ENABLED);
+
Map<Integer, SampleCategoryEnum> categoryEnumMap =
SampleCategoryEnum.toIdMapping();
@@ -548,6 +555,7 @@
}
});
+ recomputeBatchActionEnable();
}
@Override
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.css 2013-03-26 17:02:29 UTC (rev 683)
@@ -49,7 +49,7 @@
#nameField {
text: {model.getName()};
- _validatorLabel : {_("tutti.editProgram.field.name")};
+ _validatorLabel: {_("tutti.editProgram.field.name")};
}
#descriptionPane {
@@ -60,7 +60,7 @@
#descriptionField {
text: {getStringValue(model.getDescription())};
- _validatorLabel : {_("tutti.editProgram.field.description")};
+ _validatorLabel: {_("tutti.editProgram.field.description")};
}
#zoneLabel {
@@ -73,7 +73,7 @@
#zoneComboBox {
property: zone;
selectedItem: {model.getZone()};
- _validatorLabel : {_("tutti.editProgram.field.zone")};
+ _validatorLabel: {_("tutti.editProgram.field.zone")};
}
#saveButton {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUI.jaxx 2013-03-26 17:02:29 UTC (rev 683)
@@ -25,17 +25,13 @@
implements='fr.ifremer.tutti.ui.swing.util.TuttiUI<EditProgramUIModel, EditProgramUIHandler>'>
<import>
- fr.ifremer.tutti.persistence.entities.referential.Zone
+ fr.ifremer.tutti.persistence.entities.referential.TuttiLocation
- fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.util.TuttiUI
jaxx.runtime.swing.editor.bean.BeanFilterableComboBox
- java.awt.Dimension
- javax.swing.ListSelectionModel
-
static org.nuiton.i18n.I18n._
static jaxx.runtime.SwingUtil.getStringValue
</import>
@@ -90,7 +86,7 @@
</cell>
<cell>
<BeanFilterableComboBox id='zoneComboBox' constructorParams='this'
- genericType='Zone'/>
+ genericType='TuttiLocation'/>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -25,7 +25,7 @@
*/
import fr.ifremer.tutti.persistence.entities.data.Program;
-import fr.ifremer.tutti.persistence.entities.referential.Zone;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -52,7 +52,7 @@
protected String description;
- protected Zone zone;
+ protected TuttiLocation zone;
private List<Program> existingPrograms;
@@ -88,11 +88,11 @@
firePropertyChange(PROPERTY_COMMENT, oldValue, description);
}
- public Zone getZone() {
+ public TuttiLocation getZone() {
return zone;
}
- public void setZone(Zone zone) {
+ public void setZone(TuttiLocation zone) {
Object oldValue = getZone();
this.zone = zone;
firePropertyChange(PROPERTY_ZONE, oldValue, zone);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-03-26 17:02:29 UTC (rev 683)
@@ -705,7 +705,7 @@
protected String decorate(Object object, String context) {
String result = "";
if (object != null) {
- getDecorator(object.getClass(), context).toString(object);
+ result = getDecorator(object.getClass(), context).toString(object);
}
return result;
}
Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml 2013-03-26 17:02:29 UTC (rev 683)
@@ -39,12 +39,18 @@
</field-validator>
</field>
- <field name="year">
+ <field name="departureLocation">
<field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.cruise.year.required</message>
+ <message>tutti.validator.error.cruise.departureLocation.required</message>
</field-validator>
</field>
+ <field name="returnLocation">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.returnLocation.required</message>
+ </field-validator>
+ </field>
+
<field name="multirigNumber">
<field-validator type="required" short-circuit="true">
<message>tutti.validator.error.cruise.multirigNumber.required</message>
@@ -77,13 +83,6 @@
</field-validator>
</field>
-
- <field name="country">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.cruise.country.required</message>
- </field-validator>
- </field>
-
<field name="vessel">
<field-validator type="required" short-circuit="true">
<message>tutti.validator.error.cruise.vessel.required</message>
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-03-26 17:02:29 UTC (rev 683)
@@ -338,6 +338,8 @@
tutti.editCruise.field.comment.tip=
tutti.editCruise.field.country=
tutti.editCruise.field.country.tip=
+tutti.editCruise.field.departureLocation=
+tutti.editCruise.field.departureLocation.tip=
tutti.editCruise.field.endDate=
tutti.editCruise.field.endDate.tip=
tutti.editCruise.field.gear=
@@ -352,6 +354,8 @@
tutti.editCruise.field.name.tip=
tutti.editCruise.field.program=
tutti.editCruise.field.program.tip=
+tutti.editCruise.field.returnLocation=
+tutti.editCruise.field.returnLocation.tip=
tutti.editCruise.field.surveyPart=
tutti.editCruise.field.surveyPart.tip=
tutti.editCruise.field.vessel=
@@ -975,6 +979,7 @@
tutti.validator.error.cruise.beginDate.required=
tutti.validator.error.cruise.country.required=
tutti.validator.error.cruise.dates.endBeforeStart=
+tutti.validator.error.cruise.departureLocation.required=
tutti.validator.error.cruise.endDate.required=
tutti.validator.error.cruise.gear.required=
tutti.validator.error.cruise.headOfMission.required=
@@ -982,6 +987,7 @@
tutti.validator.error.cruise.multirigNumber.required=
tutti.validator.error.cruise.name.required=
tutti.validator.error.cruise.program.required=
+tutti.validator.error.cruise.returnLocation.required=
tutti.validator.error.cruise.vessel.required=
tutti.validator.error.cruise.year.required=
tutti.validator.error.fishingOperation.catcher.required=
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-03-26 16:47:05 UTC (rev 682)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-03-26 17:02:29 UTC (rev 683)
@@ -347,8 +347,8 @@
tutti.editCruise.field.beginDate.tip=
tutti.editCruise.field.comment=Commentaire
tutti.editCruise.field.comment.tip=
-tutti.editCruise.field.country=Pays
-tutti.editCruise.field.country.tip=
+tutti.editCruise.field.departureLocation=Port de départ
+tutti.editCruise.field.departureLocation.tip=
tutti.editCruise.field.endDate=Date de fin
tutti.editCruise.field.endDate.tip=
tutti.editCruise.field.gear=Engin(s)
@@ -363,12 +363,12 @@
tutti.editCruise.field.name.tip=
tutti.editCruise.field.program=Série
tutti.editCruise.field.program.tip=
+tutti.editCruise.field.returnLocation=Port d'arrivée
+tutti.editCruise.field.returnLocation.tip=
tutti.editCruise.field.surveyPart=Série partielle
tutti.editCruise.field.surveyPart.tip=
-tutti.editCruise.field.vessel=Navire(s)
+tutti.editCruise.field.vessel=Navire
tutti.editCruise.field.vessel.tip=
-tutti.editCruise.field.year=Année
-tutti.editCruise.field.year.tip=
tutti.editCruise.filterVessel.tip=
tutti.editCruise.filterVesselType=Filtre \:
tutti.editCruise.filterVesselType.all=Tout
@@ -983,6 +983,7 @@
tutti.validator.error.cruise.beginDate.required=La date de début est obligatoire
tutti.validator.error.cruise.country.required=Le pays est obligatoire
tutti.validator.error.cruise.dates.endBeforeStart=La date de fin doit être après la date de début
+tutti.validator.error.cruise.departureLocation.required=Le port d'embarquement est obligatoire
tutti.validator.error.cruise.endDate.required=La date de fin est obligatoire
tutti.validator.error.cruise.gear.required=Au moins un engin doit être sélectionné
tutti.validator.error.cruise.headOfMission.required=Au moins un chef de mission doit être sélectionné
@@ -990,6 +991,7 @@
tutti.validator.error.cruise.multirigNumber.required=Le nombre de poche est obligatoire
tutti.validator.error.cruise.name.required=Le nom de la campagne est obligatoire
tutti.validator.error.cruise.program.required=La série est obligatoire
+tutti.validator.error.cruise.returnLocation.required=Le port de débarquement est obligatoire
tutti.validator.error.cruise.vessel.required=Au moins un bateau doit être sélectionné
tutti.validator.error.cruise.year.required=L'année est obligatoire
tutti.validator.error.fishingOperation.catcher.required=Au moins un saisisseur est obligatoire
1
0
26 Mar '13
Author: kmorin
Date: 2013-03-26 17:47:05 +0100 (Tue, 26 Mar 2013)
New Revision: 682
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/682
Log:
refs #1868 [CAPTURE] - Import/Export PUPITRI
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SplitSpeciesBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/AbstractChangeScreenAction.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -86,7 +86,6 @@
TuttiUIContext context = getContext();
- Exception error = null;
try {
TuttiScreen previousScreen = context.getScreen();
@@ -105,18 +104,20 @@
context.setScreen(screen);
} catch (Exception e) {
- error = e;
throw e;
- } finally {
+ }
+ }
- if (error != null)
-
- if (context.isDbLoaded()) {
-
- context.setScreen(TuttiScreen.SELECT_CRUISE);
- } else {
- context.setScreen(TuttiScreen.MANAGE_DB);
- }
+ @Override
+ public void postFailedAction(Throwable error) {
+ TuttiUIContext context = getContext();
+ if (error != null) {
+ if (context.isDbLoaded()) {
+ context.setScreen(TuttiScreen.SELECT_CRUISE);
+ } else {
+ context.setScreen(TuttiScreen.MANAGE_DB);
+ }
}
}
+
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/EditCatchesAction.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -57,4 +57,16 @@
getContext().setValidationContext(TuttiUIContext.VALIDATION_CONTEXT_EDIT);
super.doAction();
}
+
+ @Override
+ public void postFailedAction(Throwable error) {
+// TuttiUIContext context = getContext();
+// if (error != null) {
+// if (context.isDbLoaded()) {
+// context.setScreen(TuttiScreen.SELECT_CRUISE);
+// } else {
+// context.setScreen(TuttiScreen.MANAGE_DB);
+// }
+// }
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -537,7 +537,8 @@
Integer objectId = Integer.valueOf(batch.getId());
attachments = persistenceService.getAllAttachments(objectId);
getModel().setCatchEnabled(true);
- } catch (InvalidBatchModelException e) {
+
+ } catch (Exception e) {
// batch is not compatible with Tutti
if (log.isDebugEnabled()) {
@@ -569,7 +570,7 @@
// 4) Propagate new selected fishingoperation to others tabs
- ui.getSpeciesTabContent().getHandler().selectFishingOperation(batch == null ? null : bean);
+ ui.getSpeciesTabContent().getHandler().selectFishingOperation(batch == null ? null : bean);
ui.getBenthosTabContent().getHandler().selectFishingOperation(batch == null ? null : bean);
// ui.getPlanktonTabContent().getHandler().selectFishingOperation(bean);
// ui.getMacroWasteTabContent().getHandler().selectFishingOperation(bean);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/FishingOperationsUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -147,7 +147,13 @@
operation.setCruise(cruise);
}
editFishingOperationAction.setFishingOperation(operation);
- AbstractTuttiAction.runAction(editFishingOperationAction);
+// try {
+ AbstractTuttiAction.runAction(editFishingOperationAction);
+
+// } catch(RuntimeException e) {
+// getModel().setSelectedFishingOperation(null);
+//// throw e;
+// }
}
}
});
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriAction.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -24,24 +24,25 @@
* #L%
*/
-import com.google.common.base.Function;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
+import fr.ifremer.tutti.persistence.entities.data.SexEnum;
+import fr.ifremer.tutti.persistence.entities.data.SizeEnum;
import fr.ifremer.tutti.persistence.entities.data.SortedUnsortedEnum;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.service.pupitri.PupitriCatch;
import fr.ifremer.tutti.service.pupitri.TuttiPupitriImportExportService;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIHandler;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUIModel;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
import org.apache.commons.logging.Log;
@@ -50,7 +51,6 @@
import javax.swing.JOptionPane;
import java.io.File;
import java.util.List;
-import java.util.Map;
import static org.nuiton.i18n.I18n._;
@@ -66,16 +66,49 @@
protected File importedCarrouselFile;
+ protected File importedSpeciesFile;
+
protected ImportPupitriPopupUI importPupitriDialog;
protected TuttiProtocol currentProtocol;
protected PersistenceService persistenceService;
+ protected CaracteristicQualitativeValue sortedCaracteristic;
+
+ protected CaracteristicQualitativeValue unsortedCaracteristic;
+
+ protected CaracteristicQualitativeValue maleCaracteristic;
+
+ protected CaracteristicQualitativeValue femaleCaracteristic;
+
+ protected CaracteristicQualitativeValue smallCaracteristic;
+
+ protected CaracteristicQualitativeValue mediumCaracteristic;
+
+ protected CaracteristicQualitativeValue bigCaracteristic;
+
public ImportPupitriAction(EditCatchesUIHandler handler) {
super(handler, false);
persistenceService = getContext().getPersistenceService();
importPupitriDialog = new ImportPupitriPopupUI(handler.getContext());
+
+ // get the sorted/unsorted caracteristics
+ Caracteristic sortedUnsortedcaracteristic =
+ persistenceService.getSortedUnsortedCaracteristic();
+ sortedCaracteristic =
+ SortedUnsortedEnum.SORTED.getValue(sortedUnsortedcaracteristic);
+ unsortedCaracteristic =
+ SortedUnsortedEnum.UNSORTED.getValue(sortedUnsortedcaracteristic);
+
+ Caracteristic sexCaracteristic = persistenceService.getSexCaracteristic();
+ maleCaracteristic = SexEnum.MALE.getValue(sexCaracteristic);
+ femaleCaracteristic = SexEnum.FEMALE.getValue(sexCaracteristic);
+
+ Caracteristic sizeCaracteristic = persistenceService.getSizeCategoryCaracteristic();
+ smallCaracteristic = SizeEnum.SMALL.getValue(sizeCaracteristic);
+ mediumCaracteristic = SizeEnum.MEDIUM.getValue(sizeCaracteristic);
+ bigCaracteristic = SizeEnum.BIG.getValue(sizeCaracteristic);
}
@Override
@@ -118,7 +151,10 @@
importPupitriDialog.open();
importedTrunkFile = importPupitriDialog.getTrunkFile().getSelectedFile();
importedCarrouselFile = importPupitriDialog.getCarrouselFile().getSelectedFile();
- result = importedTrunkFile != null && importedCarrouselFile != null;
+ importedSpeciesFile = importPupitriDialog.getSpeciesFile().getSelectedFile();
+ result = importedTrunkFile != null
+ && importedCarrouselFile != null
+ && importedSpeciesFile != null;
}
return result;
@@ -141,54 +177,85 @@
model.setCatchTotalRejectedWeight(catchBatch.getCatchTotalRejectedWeight());
model.setCatchTotalSortedTremisWeight(catchBatch.getCatchTotalSortedTremisWeight());
- addFileAsAttachment(importedTrunkFile);
-
-
// import carrousel
- Map<String, Float> sortedWeights = Maps.newLinkedHashMap();
- Map<String, Float> unsortedWeights = Maps.newLinkedHashMap();
- pupitriImportExportService.importPupitriCarrousel(importedCarrouselFile, operation, catchBatch, sortedWeights, unsortedWeights);
+ List<PupitriCatch> catches =
+ pupitriImportExportService.importPupitriCarrousel(importedCarrouselFile,
+ importedSpeciesFile,
+ operation,
+ catchBatch,
+ getDataContext().getReferentSpeciesWithSurveyCode());
// remove existing species
SpeciesBatchUIModel speciesBatchUIModel = getUI().getSpeciesTabContent().getModel();
List<SpeciesBatchRowModel> rows = speciesBatchUIModel.getRows();
for (SpeciesBatchRowModel row : rows) {
- persistenceService.deleteSpeciesBatch(row.getId());
+ if (row.isBatchRoot()) {
+ persistenceService.deleteSpeciesBatch(row.getId());
+ }
}
speciesBatchUIModel.setRows(null);
- // get the map of species by survey code
- Multimap<String, Species> speciesBySurveyCode =
- Multimaps.index(getDataContext().getReferentSpeciesWithSurveyCode(), new Function<Species, String>() {
- @Override
- public String apply(Species input) {
- String surveyCode = String.valueOf(input.getSurveyCode());
- int end = Math.min(surveyCode.length(), 7);
- return surveyCode.substring(0, end);
- }
- });
-
- // get the sorted/unsorted caracteristic
- Caracteristic caracteristic =
- persistenceService.getSortedUnsortedCaracteristic();
- CaracteristicQualitativeValue sortedvalue =
- SortedUnsortedEnum.SORTED.getValue(caracteristic);
-
// add the valid species in the species table
SpeciesBatchUIHandler speciesBatchUIHandler = getUI().getSpeciesTabContent().getHandler();
- for (String speciesId : sortedWeights.keySet()) {
+ for (PupitriCatch pupitriCatch : catches) {
+ Float catchWeight = pupitriCatch.getWeightBySign().get(PupitriCatch.Signs.DEFAULT);
+ CaracteristicQualitativeValue cqv = pupitriCatch.isSorted() ?
+ sortedCaracteristic : unsortedCaracteristic;
- Float weight = sortedWeights.get(speciesId);
- List<Species> speciesList = Lists.newArrayList(speciesBySurveyCode.get(speciesId.trim()));
- if (!speciesList.isEmpty()) {
- Species species = speciesList.get(0);
- ImportPupitriSpeciesBatchRootRowModel rowModel = new ImportPupitriSpeciesBatchRootRowModel(species, sortedvalue, weight);
- speciesBatchUIHandler.addBatch(rowModel);
+ ImportPupitriSpeciesBatchRootRowModel rowModel =
+ new ImportPupitriSpeciesBatchRootRowModel(
+ pupitriCatch.getSpecies(), cqv, catchWeight);
+
+ speciesBatchUIHandler.addBatch(rowModel);
+
+ if (catchWeight == null) {
+ SampleCategoryEnum category = null;
+ List<SplitSpeciesBatchRowModel> splitRows = Lists.newArrayList();
+ for (PupitriCatch.Signs s : pupitriCatch.getWeightBySign().keySet()) {
+ CaracteristicQualitativeValue splitCqv = null;
+ switch (s) {
+ case MALE:
+ splitCqv = maleCaracteristic;
+ category = SampleCategoryEnum.sex;
+ break;
+
+ case FEMALE:
+ splitCqv = femaleCaracteristic;
+ category = SampleCategoryEnum.sex;
+ break;
+
+ case SMALL:
+ splitCqv = smallCaracteristic;
+ category = SampleCategoryEnum.size;
+ break;
+
+ case MEDIUM:
+ splitCqv = mediumCaracteristic;
+ category = SampleCategoryEnum.size;
+ break;
+
+ case BIG:
+ splitCqv = bigCaracteristic;
+ category = SampleCategoryEnum.size;
+ break;
+ }
+ SplitSpeciesBatchRowModel row = new SplitSpeciesBatchRowModel();
+ row.setCategoryType(category);
+ row.setCategoryValue(splitCqv);
+ row.setWeight(pupitriCatch.getWeightBySign().get(s));
+ row.setValid(true);
+ splitRows.add(row);
+ }
+ speciesBatchUIHandler.splitBatch(category, splitRows);
}
}
model.setCatchTotalSortedCarousselWeight(catchBatch.getCatchTotalSortedCarousselWeight());
+
+ // add attachments
+ addFileAsAttachment(importedTrunkFile);
addFileAsAttachment(importedCarrouselFile);
+ addFileAsAttachment(importedSpeciesFile);
}
@@ -249,7 +316,7 @@
}
public boolean isValid() {
- return species != null && batchWeight != null && sortedUnsortedCategory != null;
+ return species != null && sortedUnsortedCategory != null;
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.css 2013-03-26 16:47:05 UTC (rev 682)
@@ -51,6 +51,18 @@
acceptAllFileFilterUsed: false;
}
+#speciesFileLabel {
+ text: "tutti.importPupitri.field.speciesFile";
+ labelFor: {carrouselFile};
+}
+
+#speciesFile {
+ directoryEnabled: false;
+ exts: {_("tutti.importPupitri.speciesFile.extension")};
+ extsDescription: {_("tutti.importPupitri.speciesFile.extension.description")};
+ acceptAllFileFilterUsed: false;
+}
+
#cancelButton {
actionIcon: cancel;
text: "tutti.common.cancel";
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUI.jaxx 2013-03-26 16:47:05 UTC (rev 682)
@@ -81,6 +81,15 @@
</row>
<row>
+ <cell>
+ <JLabel id='speciesFileLabel'/>
+ </cell>
+ <cell weightx='1'>
+ <FileEditor id='speciesFile'/>
+ </cell>
+ </row>
+
+ <row>
<cell columns='2'>
<JPanel layout='{new GridLayout(1,0)}'>
<JButton id='cancelButton' onActionPerformed='handler.cancel()'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/ImportPupitriPopupUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -67,6 +67,7 @@
protected void resetFields() {
ui.getTrunkFile().setSelectedFile((String) null);
ui.getCarrouselFile().setSelectedFile((String) null);
+ ui.getSpeciesFile().setSelectedFile((String) null);
}
public void open() {
@@ -82,7 +83,8 @@
public void validate() {
if (ui.getTrunkFile().getSelectedFile() != null
- && ui.getCarrouselFile().getSelectedFile() != null) {
+ && ui.getCarrouselFile().getSelectedFile() != null
+ && ui.getSpeciesFile().getSelectedFile() != null) {
ui.dispose();
} else {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -48,7 +48,6 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyRowModel;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
@@ -631,11 +630,11 @@
recomputeRowValidState(newRow);
+ saveRow(newRow);
+
tableModel.addNewRow(newRow);
AbstractSelectTableAction.doSelectCell(getTable(), tableModel.getRowCount() - 1, 0);
- saveRow(newRow);
-
// update speciesUsed
addToSpeciesUsed(newRow);
}
@@ -690,61 +689,52 @@
}
}
- public void splitBatch(SplitSpeciesBatchUIModel splitModel) {
- if (splitModel.isValid()) {
+ public void splitBatch(SampleCategoryEnum sampleCategoryEnum, List<SplitSpeciesBatchRowModel> rows) {
+ JXTable table = getTable();
- JXTable table = getTable();
+ // get selected row
+ int insertRow = table.getSelectedRow();
- // get selected row
- int insertRow = table.getSelectedRow();
+ SpeciesBatchTableModel tableModel = getTableModel();
+ SpeciesBatchRowModel parentBatch = tableModel.getEntry(insertRow);
- SpeciesBatchTableModel tableModel = getTableModel();
- SpeciesBatchRowModel parentBatch = tableModel.getEntry(insertRow);
+ // Create rows in batch table model
- // create batch rows
+ List<SpeciesBatchRowModel> newBatches = Lists.newArrayList();
+ for (SplitSpeciesBatchRowModel row : rows) {
+ if (row.isValid()) {
- SampleCategoryEnum sampleCategoryEnum = splitModel.getSelectedCategory();
+ // can keep this row
+ SpeciesBatchRowModel newBatch = tableModel.createNewRow();
- // Create rows in batch table model
+ loadBatchRow(parentBatch,
+ newBatch,
+ sampleCategoryEnum,
+ row.getCategoryValue(),
+ row.getWeight());
- List<SpeciesBatchRowModel> newBatches = Lists.newArrayList();
- for (SplitSpeciesBatchRowModel row : splitModel.getRows()) {
- if (row.isValid()) {
+ recomputeRowValidState(newBatch);
+ newBatches.add(newBatch);
- // can keep this row
- SpeciesBatchRowModel newBatch = tableModel.createNewRow();
-
- loadBatchRow(parentBatch,
- newBatch,
- sampleCategoryEnum,
- row.getCategoryValue(),
- row.getWeight());
-
- recomputeRowValidState(newBatch);
- newBatches.add(newBatch);
-
- tableModel.addNewRow(++insertRow, newBatch);
- }
+ tableModel.addNewRow(++insertRow, newBatch);
+ AbstractSelectTableAction.doSelectCell(getTable(), insertRow, 0);
}
+ }
- // add new batches to his parent
- parentBatch.setChildBatch(newBatches);
+ // add new batches to his parent
+ parentBatch.setChildBatch(newBatches);
- //TODO Should only save parentBatch (will persist all his childs)
+ //TODO Should only save parentBatch (will persist all his childs)
//saveRow(parentBatch);
- // save new batches
- saveRows(newBatches);
+ // save new batches
+ saveRows(newBatches);
- SpeciesBatchUIModel model = getModel();
- model.setLeafNumber(model.getLeafNumber() + newBatches.size() - 1);
- }
+ SpeciesBatchUIModel model = getModel();
+ model.setLeafNumber(model.getLeafNumber() + newBatches.size() - 1);
recomputeBatchActionEnable();
-// // reselect this cell
-// AbstractSelectTableAction.doSelectCell(table, rowIndex, 0);
-// table.requestFocus();
}
public void updateTotalFromFrequencies(SpeciesBatchRowModel row) {
@@ -797,11 +787,9 @@
if (TuttiEntities.isNew(catchBean)) {
- SpeciesBatchRowModel batchParent = row.getParentBatch();
String parentBatchId = null;
-
- if (batchParent != null) {
- parentBatchId = batchParent.getId();
+ if (parent != null) {
+ parentBatchId = parent.getId();
}
if (log.isInfoEnabled()) {
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SplitSpeciesBatchRowModel.java (from rev 677, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SplitSpeciesBatchRowModel.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SplitSpeciesBatchRowModel.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -0,0 +1,102 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.species;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategory;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
+import org.nuiton.util.beans.Binder;
+import org.nuiton.util.beans.BinderFactory;
+
+import java.io.Serializable;
+
+/**
+ * A row in the {@link SplitSpeciesBatchUIModel}.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class SplitSpeciesBatchRowModel
+ extends AbstractTuttiBeanUIModel<SplitSpeciesBatchRowModel, SplitSpeciesBatchRowModel> {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_CATEGORY_VALUE = "categoryValue";
+
+ public static final String PROPERTY_WEIGHT = "weight";
+
+ /**
+ * Delegate sample category which contains category value + weight.
+ *
+ * @since 0.3
+ */
+ protected final SampleCategory<Serializable> category = SampleCategory.newSample(null);
+
+ public SplitSpeciesBatchRowModel() {
+ super(SplitSpeciesBatchRowModel.class, null, null);
+ }
+
+ public SampleCategoryEnum getCategoryType() {
+ return category.getCategoryType();
+ }
+
+ public void setCategoryType(SampleCategoryEnum categoryType) {
+ category.setCategoryType(categoryType);
+ }
+
+ public Serializable getCategoryValue() {
+ return category.getCategoryValue();
+ }
+
+ public void setCategoryValue(Serializable categoryValue) {
+ Object oldValue = getCategoryValue();
+ category.setCategoryValue(categoryValue);
+ firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
+ }
+
+ public void setCategoryValue(CaracteristicQualitativeValue categoryValue) {
+ Object oldValue = getCategoryValue();
+ category.setCategoryValue(categoryValue);
+ firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
+ }
+
+ public void setCategoryValue(Float categoryValue) {
+ Object oldValue = getCategoryValue();
+ category.setCategoryValue(categoryValue);
+ firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
+ }
+
+ public Float getWeight() {
+ return category.getCategoryWeight();
+ }
+
+ public void setWeight(Float weight) {
+ Object oldValue = getWeight();
+ category.setCategoryWeight(weight);
+ firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
+ }
+
+}
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -1,110 +0,0 @@
-package fr.ifremer.tutti.ui.swing.content.operation.catches.species.split;
-
-/*
- * #%L
- * Tutti :: UI
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2012 Ifremer
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program. If not, see
- * <http://www.gnu.org/licenses/gpl-3.0.html>.
- * #L%
- */
-
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
-import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategory;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
-import org.nuiton.util.beans.Binder;
-import org.nuiton.util.beans.BinderFactory;
-
-import java.io.Serializable;
-
-/**
- * A row in the {@link SplitSpeciesBatchUIModel}.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.3
- */
-public class SplitSpeciesBatchRowModel
- extends AbstractTuttiBeanUIModel<SplitSpeciesBatchRowModel, SplitSpeciesBatchRowModel> {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_CATEGORY_VALUE = "categoryValue";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- /**
- * Delegate sample category which contains category value + weight.
- *
- * @since 0.3
- */
- protected final SampleCategory<Serializable> category = SampleCategory.newSample(null);
-
- protected static final Binder<SplitSpeciesBatchRowModel, SplitSpeciesBatchRowModel> fromBeanBinder =
- BinderFactory.newBinder(SplitSpeciesBatchRowModel.class,
- SplitSpeciesBatchRowModel.class);
-
- protected static final Binder<SplitSpeciesBatchRowModel, SplitSpeciesBatchRowModel> toBeanBinder =
- BinderFactory.newBinder(SplitSpeciesBatchRowModel.class,
- SplitSpeciesBatchRowModel.class);
-
- public SplitSpeciesBatchRowModel() {
- super(SplitSpeciesBatchRowModel.class, fromBeanBinder, toBeanBinder);
- }
-
- public SampleCategoryEnum getCategoryType() {
- return category.getCategoryType();
- }
-
- public void setCategoryType(SampleCategoryEnum categoryType) {
- category.setCategoryType(categoryType);
- }
-
- public Serializable getCategoryValue() {
- return category.getCategoryValue();
- }
-
- public void setCategoryValue(Serializable categoryValue) {
- Object oldValue = getCategoryValue();
- category.setCategoryValue(categoryValue);
- firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
- }
-
- public void setCategoryValue(CaracteristicQualitativeValue categoryValue) {
- Object oldValue = getCategoryValue();
- category.setCategoryValue(categoryValue);
- firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
- }
-
- public void setCategoryValue(Float categoryValue) {
- Object oldValue = getCategoryValue();
- category.setCategoryValue(categoryValue);
- firePropertyChange(PROPERTY_CATEGORY_VALUE, oldValue, categoryValue);
- }
-
- public Float getWeight() {
- return category.getCategoryWeight();
- }
-
- public void setWeight(Float weight) {
- Object oldValue = getWeight();
- category.setCategoryWeight(weight);
- firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
- }
-
-}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchTableModel.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableModel;
import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import org.jdesktop.swingx.table.TableColumnModelExt;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SplitSpeciesBatchRowModel;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
@@ -32,6 +33,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.SampleCategory;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchUI;
@@ -300,7 +302,12 @@
}
EditCatchesUI parent = SwingUtil.getParentContainer(ui, EditCatchesUI.class);
- parent.getSpeciesTabContent().getHandler().splitBatch(getModel());
+ SplitSpeciesBatchUIModel model = getModel();
+ if (model.isValid()) {
+ parent.getSpeciesTabContent().getHandler().splitBatch(
+ model.getSelectedCategory(),
+ model.getRows());
+ }
// close dialog
closeUI(ui);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SplitSpeciesBatchRowModel;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2013-03-26 16:47:05 UTC (rev 682)
@@ -201,6 +201,15 @@
_help: {"tutti.editProtocol.action.exportProtocolSpecies.help"};
}
+#exportPupitriButton {
+ actionIcon: export;
+ text: "tutti.editProtocol.action.exportPupitri";
+ toolTipText: "tutti.editProtocol.action.exportPupitri.tip";
+ i18nMnemonic: "tutti.editProtocol.action.exportPupitri.mnemonic";
+ _tuttiAction: {ExportPupitriAction.class};
+ _help: {"tutti.editProtocol.action.exportPupitri.help"};
+}
+
#selectOtherBenthosButton {
text: "tutti.editProtocol.action.selectOtherBenthos";
toolTipText: "tutti.editProtocol.action.selectOtherBenthos.tip";
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx 2013-03-26 16:47:05 UTC (rev 682)
@@ -141,6 +141,7 @@
constraints='BorderLayout.NORTH'>
<JButton id='importSpeciesButton'/>
<JButton id='exportSpeciesButton'/>
+ <JButton id='exportPupitriButton'/>
</JPanel>
<Table fill='both' constraints='BorderLayout.CENTER'>
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java (from rev 677, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -0,0 +1,127 @@
+package fr.ifremer.tutti.ui.swing.content.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.protocol.TuttiProtocolImportExportService;
+import fr.ifremer.tutti.service.pupitri.TuttiPupitriImportExportService;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export protocol species.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ExportPupitriAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportPupitriAction.class);
+
+ private File file;
+
+ public ExportPupitriAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ protected boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = TuttiUIUtil.chooseFile(
+ getContext().getMainUI(),
+ _("tutti.editProtocol.title.choose.speciesExportFile"),
+ _("tutti.editProtocol.action.chooseProtocolSpeciesFile"),
+ "^.*\\.ibts", _("tutti.common.file.ibts")
+ );
+ if (file == null) {
+
+ // user cancel
+ doAction = false;
+ } else {
+
+ // add extension if missing
+ file = TuttiIOUtil.addExtensionIfMissing(file, ".ibts");
+
+ // ask user to confirm overwrite.
+ doAction = getHandler().askOverwriteFile(file);
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ protected void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export protocol species to file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // build species protocol to export
+
+ List<Species> speciesList = Lists.newArrayList();
+ for (EditProtocolSpeciesRowModel row : model.getSpecies()) {
+ if (row.isValid()) {
+ Species species = row.getSpecies();
+ species.setSurveyCode(row.getSpeciesSurveyCode());
+ speciesList.add(species);
+ }
+ }
+
+ // import
+ TuttiPupitriImportExportService service =
+ getContext().getTuttiPupitriImportExportService();
+
+ service.exportSpecies(speciesList, file);
+
+ sendMessage(_("tutti.flash.info.species.exported.from.protocol",
+ file));
+ }
+}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-03-26 16:47:05 UTC (rev 682)
@@ -366,11 +366,11 @@
protected Component getTopestUI() {
Component result;
TuttiActionUI actionUI = getContext().getActionUI();
- if (actionUI.isVisible()) {
+// if (actionUI.isVisible()) {
result = actionUI;
- } else {
- result = getContext().getMainUI();
- }
+// } else {
+// result = getContext().getMainUI();
+// }
return result;
}
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-03-26 16:47:05 UTC (rev 682)
@@ -53,6 +53,7 @@
tutti.common.cancel=
tutti.common.cancel.mnemonic=
tutti.common.file.csv=
+tutti.common.file.ibts=
tutti.common.file.protocol=
tutti.common.file.zip=
tutti.common.validate=
@@ -508,6 +509,9 @@
tutti.editProtocol.action.exportProtocolSpecies=
tutti.editProtocol.action.exportProtocolSpecies.mnemonic=
tutti.editProtocol.action.exportProtocolSpecies.tip=
+tutti.editProtocol.action.exportPupitri=
+tutti.editProtocol.action.exportPupitri.mnemonic=
+tutti.editProtocol.action.exportPupitri.tip=
tutti.editProtocol.action.importProtocolBenthos=
tutti.editProtocol.action.importProtocolBenthos.mnemonic=
tutti.editProtocol.action.importProtocolBenthos.tip=
@@ -716,7 +720,10 @@
tutti.importPupitri.error.fileMissing.message=
tutti.importPupitri.error.fileMissing.title=
tutti.importPupitri.field.carrouselFile=
+tutti.importPupitri.field.speciesFile=
tutti.importPupitri.field.trunkFile=
+tutti.importPupitri.speciesFile.extension=
+tutti.importPupitri.speciesFile.extension.description=
tutti.importPupitri.title=
tutti.importPupitri.trunkFile.extension=
tutti.importPupitri.trunkFile.extension.description=
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-03-26 16:46:19 UTC (rev 681)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-03-26 16:47:05 UTC (rev 682)
@@ -52,6 +52,7 @@
tutti.common.cancel=Annuler
tutti.common.cancel.mnemonic=A
tutti.common.file.csv=Extension d'un fichier csv
+tutti.common.file.ibts=
tutti.common.file.protocol=Extension d'un fichier de protocole Tutti
tutti.common.file.zip=Extension d'une archive zip
tutti.common.validate=Valider
@@ -518,6 +519,9 @@
tutti.editProtocol.action.exportProtocolSpecies=Exporter les espèces
tutti.editProtocol.action.exportProtocolSpecies.mnemonic=è
tutti.editProtocol.action.exportProtocolSpecies.tip=Exporter les espèces du protocole
+tutti.editProtocol.action.exportPupitri=
+tutti.editProtocol.action.exportPupitri.mnemonic=
+tutti.editProtocol.action.exportPupitri.tip=
tutti.editProtocol.action.importProtocolBenthos=Importer les benthos
tutti.editProtocol.action.importProtocolBenthos.mnemonic=i
tutti.editProtocol.action.importProtocolBenthos.tip=Importer les benthos dans le protocole
@@ -725,7 +729,10 @@
tutti.importPupitri.error.fileMissing.message=Vous devez sélectionner un fichier pour le trémie et un fichier pour le carrousel pour pouvoir continuer l'import.
tutti.importPupitri.error.fileMissing.title=Fichier non renseigné
tutti.importPupitri.field.carrouselFile=Fichier du carrousel
+tutti.importPupitri.field.speciesFile=Fichier des espèces
tutti.importPupitri.field.trunkFile=Fichier du trémie
+tutti.importPupitri.speciesFile.extension=ibts
+tutti.importPupitri.speciesFile.extension.description=Fichier des espèces (.ibts)
tutti.importPupitri.title=Import Pupitri
tutti.importPupitri.trunkFile.extension=tnk
tutti.importPupitri.trunkFile.extension.description=Fichier du trémie (.tnk)
1
0
r681 - trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri
by kmorin@users.forge.codelutin.com 26 Mar '13
by kmorin@users.forge.codelutin.com 26 Mar '13
26 Mar '13
Author: kmorin
Date: 2013-03-26 17:46:19 +0100 (Tue, 26 Mar 2013)
New Revision: 681
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/681
Log:
refs #1868 [CAPTURE] - Import/Export PUPITRI
Added:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/PupitriCatch.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/SpeciesRow.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/SpeciesRowModel.java
Modified:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRow.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRowModel.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TuttiPupitriImportExportService.java
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRow.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRow.java 2013-03-26 16:46:02 UTC (rev 680)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRow.java 2013-03-26 16:46:19 UTC (rev 681)
@@ -58,8 +58,6 @@
public static final String PROPERTY_WEIGHT = "weight";
- public static final String PROPERTY_EMPTY = "";
-
protected Integer operationCode;
protected String rigNumber;
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRowModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRowModel.java 2013-03-26 16:46:02 UTC (rev 680)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRowModel.java 2013-03-26 16:46:19 UTC (rev 681)
@@ -25,13 +25,12 @@
*/
import fr.ifremer.tutti.service.TuttiCsvUtil;
+import java.text.ParseException;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.util.csv.ValueParser;
-import java.text.ParseException;
-
/**
* @author kmorin <kmorin(a)codelutin.com>
* @since 1.2
@@ -58,7 +57,7 @@
newMandatoryColumn(CarrouselRow.PROPERTY_SPECIES_ID, new ValueParser<String>() {
public String parse(String string) throws ParseException {
- return StringUtils.remove(string, '-');
+ return StringUtils.remove(string, '-').trim();
}
});
newMandatoryColumn(CarrouselRow.PROPERTY_SIGN);
@@ -83,7 +82,6 @@
newIgnoredColumn(CarrouselRow.PROPERTY_BALANCE_ID);
newIgnoredColumn(CarrouselRow.PROPERTY_TO_CONFIRM);
newIgnoredColumn(CarrouselRow.PROPERTY_BOX_TYPE);
- newIgnoredColumn(CarrouselRow.PROPERTY_EMPTY);
}
Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/PupitriCatch.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/PupitriCatch.java (rev 0)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/PupitriCatch.java 2013-03-26 16:46:19 UTC (rev 681)
@@ -0,0 +1,102 @@
+
+package fr.ifremer.tutti.service.pupitri;
+
+import com.google.common.collect.Maps;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import java.io.Serializable;
+import java.util.Map;
+
+/**
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.2
+ */
+public class PupitriCatch implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public static enum Signs {
+ DEFAULT("0"),
+ MALE("1"),
+ FEMALE("2"),
+ SMALL("P"),
+ MEDIUM("M"),
+ BIG("G");
+
+ private String sign;
+
+ Signs(String sign) {
+ this.sign = sign;
+ }
+
+ public static Signs getSign(String sign) {
+ Signs result = null;
+ for (Signs s : values()) {
+ if (s.sign.equals(sign)) {
+ result = s;
+ break;
+ }
+ }
+ return result;
+ }
+ }
+
+ protected Species species;
+
+ protected boolean sorted;
+
+ protected Map<Signs, Float> weightBySign = Maps.newHashMap();
+
+ public PupitriCatch(Species species, boolean sorted) {
+ this.species = species;
+ this.sorted = sorted;
+ }
+
+ public Species getSpecies() {
+ return species;
+ }
+
+ public boolean isSorted() {
+ return sorted;
+ }
+
+ public Map<Signs, Float> getWeightBySign() {
+ return weightBySign;
+ }
+
+ public void addToSign(String sign, Float weight) {
+ Signs s = Signs.getSign(sign);
+ Float f = weightBySign.get(s);
+ if (f == null) {
+ f = 0f;
+ }
+ f += weight;
+ weightBySign.put(s, f);
+ }
+
+ @Override
+ public int hashCode() {
+ int speciesHashCode = species != null ? species.hashCode() : 0;
+ int sortedHashCode = sorted ? 0x55555555 : 0x2AAAAAAA;
+ return speciesHashCode ^ sortedHashCode;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ final PupitriCatch other = (PupitriCatch) obj;
+ if (this.species != other.species && (this.species == null || !this.species.equals(other.species))) {
+ return false;
+ }
+ if (this.sorted != other.sorted) {
+ return false;
+ }
+ return true;
+ }
+
+}
Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/SpeciesRow.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/SpeciesRow.java (rev 0)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/SpeciesRow.java 2013-03-26 16:46:19 UTC (rev 681)
@@ -0,0 +1,51 @@
+
+package fr.ifremer.tutti.service.pupitri;
+
+import java.io.Serializable;
+
+/**
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.2
+ */
+public class SpeciesRow implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ public static final String PROPERTY_CODE_FIRST_PART = "codeFirstPart";
+
+ public static final String PROPERTY_CODE_SECOND_PART = "codeSecondPart";
+
+ public static final String PROPERTY_SCIENTIFIC_NAME = "scientificName";
+
+ protected String codeFirstPart;
+
+ protected String codeSecondPart;
+
+ protected String scientificName;
+
+ public String getCodeFirstPart() {
+ return codeFirstPart;
+ }
+
+ public void setCodeFirstPart(String codeFirstPart) {
+ this.codeFirstPart = codeFirstPart;
+ }
+
+ public String getCodeSecondPart() {
+ return codeSecondPart;
+ }
+
+ public void setCodeSecondPart(String codeSecondPart) {
+ this.codeSecondPart = codeSecondPart;
+ }
+
+ public String getScientificName() {
+ return scientificName;
+ }
+
+ public void setScientificName(String scientificName) {
+ this.scientificName = scientificName;
+ }
+
+}
Copied: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/SpeciesRowModel.java (from rev 677, trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRowModel.java)
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/SpeciesRowModel.java (rev 0)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/SpeciesRowModel.java 2013-03-26 16:46:19 UTC (rev 681)
@@ -0,0 +1,57 @@
+package fr.ifremer.tutti.service.pupitri;
+
+/*
+ * #%L
+ * Tutti :: Service
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import fr.ifremer.tutti.service.TuttiCsvUtil;
+import java.text.ParseException;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.csv.ValueParser;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.2
+ */
+public class SpeciesRowModel extends TuttiCsvUtil.AbstractTuttiImportExportModel<SpeciesRow> {
+
+ private static final Log log = LogFactory.getLog(SpeciesRowModel.class);
+
+ public SpeciesRowModel(char separator) {
+ super(separator);
+
+ // import definition
+
+ newColumnForImportExport(SpeciesRow.PROPERTY_CODE_FIRST_PART);
+ newColumnForImportExport(SpeciesRow.PROPERTY_CODE_SECOND_PART);
+ newColumnForImportExport(SpeciesRow.PROPERTY_SCIENTIFIC_NAME);
+
+ }
+
+ public SpeciesRow newEmptyInstance() {
+ return new SpeciesRow();
+ }
+
+}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TuttiPupitriImportExportService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TuttiPupitriImportExportService.java 2013-03-26 16:46:02 UTC (rev 680)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TuttiPupitriImportExportService.java 2013-03-26 16:46:19 UTC (rev 681)
@@ -25,11 +25,21 @@
*/
import com.google.common.base.Charsets;
+import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Multimap;
+import com.google.common.collect.Multimaps;
import com.google.common.io.Files;
import fr.ifremer.tutti.TuttiTechnicalException;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.AbstractTuttiService;
+import fr.ifremer.tutti.service.protocol.TuttiProtocolImportExportService;
+import java.io.BufferedWriter;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
@@ -37,9 +47,16 @@
import org.nuiton.util.csv.Import;
import java.io.File;
+import java.io.IOException;
import java.io.Reader;
+import java.util.Collection;
import java.util.Collections;
+import java.util.List;
import java.util.Map;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.nuiton.util.csv.Export;
+import org.nuiton.util.csv.ExportModel;
/**
* @author kmorin <kmorin(a)codelutin.com>
@@ -123,102 +140,181 @@
}
- public void importPupitriCarrousel(File file,
+ public List<PupitriCatch> importPupitriCarrousel(File carrouselFile,
+ File speciesFile,
FishingOperation operation,
CatchBatch catchBatch,
- Map<String, Float> sortedWeights,
- Map<String, Float> unsortedWeights) {
+ List<Species> referentSpecies) {
if (log.isInfoEnabled()) {
log.info("Will import pupitri operation [" + operation.toString() +
- "] carrousel from file: " + file);
+ "] carrousel from file: " + carrouselFile);
}
- char separator = ',';
- CarrouselRowModel csvModel = new CarrouselRowModel(separator);
-
+ List<PupitriCatch> result = Lists.newArrayList();
Reader reader = null;
File fileWithHeaders = null;
- Import<CarrouselRow> importer = null;
+ Import<SpeciesRow> speciesImporter = null;
+ Import<CarrouselRow> carrouselImporter = null;
+
+ char speciesSeparator = ';';
+ SpeciesRowModel speciesCsvModel = new SpeciesRowModel(speciesSeparator);
+ char carrouselSeparator = ',';
+ CarrouselRowModel carrouselCsvModel = new CarrouselRowModel(carrouselSeparator);
+
try {
- fileWithHeaders = new File(FileUtils.getTempDirectory(), file.getName());
- String headers = CarrouselRow.PROPERTY_FILE_ORIGIN + separator +
- CarrouselRow.PROPERTY_DATE + separator +
- CarrouselRow.PROPERTY_TIME + separator +
- CarrouselRow.PROPERTY_BALANCE_ID + separator +
- CarrouselRow.PROPERTY_TO_CONFIRM + separator +
- CarrouselRow.PROPERTY_OPERATION_CODE + separator +
- CarrouselRow.PROPERTY_RIG_NUMBER + separator +
- CarrouselRow.PROPERTY_BOX_TYPE + separator +
- CarrouselRow.PROPERTY_SPECIES_ID + separator +
- CarrouselRow.PROPERTY_SIGN + separator +
- CarrouselRow.PROPERTY_DIRECTION + separator +
- CarrouselRow.PROPERTY_WEIGHT + separator +
- CarrouselRow.PROPERTY_EMPTY;
- FileUtils.writeLines(fileWithHeaders, Collections.singletonList(headers));
- log.info(FileUtils.readFileToString(fileWithHeaders));
- FileUtils.writeLines(fileWithHeaders, FileUtils.readLines(file), true);
- log.info(FileUtils.readFileToString(fileWithHeaders));
+ // import the species
+ String[] header = new String [] {
+ SpeciesRow.PROPERTY_CODE_FIRST_PART,
+ SpeciesRow.PROPERTY_CODE_SECOND_PART,
+ SpeciesRow.PROPERTY_SCIENTIFIC_NAME
+ };
+ fileWithHeaders = createFileWithHeaders(speciesFile, header, speciesSeparator);
+ reader = Files.newReader(fileWithHeaders, Charsets.UTF_8);
+ speciesImporter = Import.newImport(speciesCsvModel, reader);
+ // get the map of species by survey code
+ Multimap<String, Species> speciesBySurveyCode =
+ Multimaps.index(referentSpecies, new Function<Species, String>() {
+ @Override
+ public String apply(Species input) {
+ String surveyCode = String.valueOf(input.getSurveyCode());
+ int end = Math.min(surveyCode.length(), 7);
+ return surveyCode.substring(0, end);
+ }
+ });
+ // keep only the species whose survey code and name are the same
+ // in theimported file and the referent species
+ Map<String, Species> speciesMap = Maps.newHashMap();
+ for (SpeciesRow bean : speciesImporter) {
+ String code = bean.getCodeFirstPart() + bean.getCodeSecondPart();
+ Collection<Species> speciesCollection = speciesBySurveyCode.get(code.trim());
+ for (Species species : speciesCollection) {
+ if (species.getName().equals(bean.getScientificName())) {
+ speciesMap.put(code, species);
+ break;
+ }
+ }
+ }
+
+ // import the batches
+ header = new String[] {
+ CarrouselRow.PROPERTY_FILE_ORIGIN,
+ CarrouselRow.PROPERTY_DATE,
+ CarrouselRow.PROPERTY_TIME,
+ CarrouselRow.PROPERTY_BALANCE_ID,
+ CarrouselRow.PROPERTY_TO_CONFIRM,
+ CarrouselRow.PROPERTY_OPERATION_CODE,
+ CarrouselRow.PROPERTY_RIG_NUMBER,
+ CarrouselRow.PROPERTY_BOX_TYPE,
+ CarrouselRow.PROPERTY_SPECIES_ID,
+ CarrouselRow.PROPERTY_SIGN,
+ CarrouselRow.PROPERTY_DIRECTION,
+ CarrouselRow.PROPERTY_WEIGHT
+ };
+ fileWithHeaders = createFileWithHeaders(carrouselFile, header, carrouselSeparator);
reader = Files.newReader(fileWithHeaders, Charsets.UTF_8);
+ carrouselImporter = Import.newImport(carrouselCsvModel, reader);
- importer = Import.newImport(csvModel, reader);
-
Integer operationNumber = operation.getFishingOperationNumber();
String rigNumber = operation.getMultirigAggregation();
Float carrouselSortedWeight = 0f;
- for (CarrouselRow bean : importer) {
+ for (CarrouselRow bean : carrouselImporter) {
+ // is the bean from the current operation and rig ?
if (bean.getOperationCode().equals(operationNumber)
- && bean.getRigNumber().equals(rigNumber)
- && "0".equals(bean.getSign())) {
+ && bean.getRigNumber().equals(rigNumber)) {
String speciesId = bean.getSpeciesId();
- Map<String, Float> weights = null;
+ Species species = speciesMap.get(speciesId);
Float beanWeight = bean.getWeight();
if (beanWeight < 0f) {
beanWeight = 0f;
}
-
+ boolean sorted;
switch (bean.getDirection()) {
- case VAT:
- weights = sortedWeights;
- carrouselSortedWeight += beanWeight;
+ case HOV:
+ sorted = false;
break;
- case HOV:
- weights = unsortedWeights;
+ default :
+ sorted = true;
+ carrouselSortedWeight += beanWeight;
}
- if (weights != null) {
- Float speciesWeight = weights.get(speciesId);
+ if (species != null) {
- if (speciesWeight == null) {
- speciesWeight = beanWeight;
-
+ PupitriCatch pupitriCatch = new PupitriCatch(species, sorted);
+ int catchIndex = result.indexOf(pupitriCatch);
+ if (catchIndex >= 0) {
+ pupitriCatch = result.get(catchIndex);
} else {
- speciesWeight += beanWeight;
+ result.add(pupitriCatch);
}
- weights.put(speciesId, speciesWeight);
+ pupitriCatch.addToSign(bean.getSign(), beanWeight);
}
}
}
catchBatch.setCatchTotalSortedCarousselWeight(carrouselSortedWeight);
- importer.close();
+ carrouselImporter.close();
+ speciesImporter.close();
reader.close();
} catch (Exception e) {
- throw new TuttiTechnicalException("Could not import protocol [" + operation.toString() + "] caracteristic from file " + file, e);
+ throw new TuttiTechnicalException("Could not import protocol [" + operation.toString() + "] caracteristic from file " + carrouselFile, e);
} finally {
- IOUtils.closeQuietly(importer);
+ IOUtils.closeQuietly(carrouselImporter);
+ IOUtils.closeQuietly(speciesImporter);
IOUtils.closeQuietly(reader);
FileUtils.deleteQuietly(fileWithHeaders);
}
+
+ return result;
}
+
+ public void exportSpecies(List<Species> species, File target) {
+ SpeciesRowModel speciesCsvModel = new SpeciesRowModel(';');
+
+ List<SpeciesRow> rows = Lists.newArrayList();
+
+ if (CollectionUtils.isNotEmpty(species)) {
+ rows = Lists.transform(species, new Function<Species, SpeciesRow>() {
+
+ public SpeciesRow apply(Species input) {
+ Preconditions.checkNotNull(input.getSurveyCode(),
+ "Unable to export a species with a null survey code : " + input);
+ SpeciesRow row = new SpeciesRow();
+ String codeFirstPart = StringUtils.substring(input.getSurveyCode(), 0, 4);
+ row.setCodeFirstPart(StringUtils.rightPad(codeFirstPart, 4));
+ String codeSecondPart = StringUtils.substring(input.getSurveyCode(), 4, 7);
+ row.setCodeSecondPart(StringUtils.rightPad(codeSecondPart, 3));
+ row.setScientificName(input.getName());
+ return row;
+ }
+ });
+ }
+
+ try {
+ Export.exportToFile(speciesCsvModel, rows, target, Charsets.UTF_8, false);
+
+ } catch (Exception e) {
+ throw new TuttiTechnicalException("Could not export all species to file " + target, e);
+ }
+ }
+
+ protected File createFileWithHeaders(File file, String[] header, char separator) throws IOException {
+ File fileWithHeaders = new File(FileUtils.getTempDirectory(), file.getName());
+ String headers = StringUtils.join(header, separator);
+
+ FileUtils.writeLines(fileWithHeaders, Collections.singletonList(headers));
+ FileUtils.writeLines(fileWithHeaders, FileUtils.readLines(file), true);
+
+ return fileWithHeaders;
+ }
}
1
0
r680 - in trunk/tutti-persistence/src/main: java/fr/ifremer/tutti/persistence/entities/data java/fr/ifremer/tutti/persistence/service resources
by kmorin@users.forge.codelutin.com 26 Mar '13
by kmorin@users.forge.codelutin.com 26 Mar '13
26 Mar '13
Author: kmorin
Date: 2013-03-26 17:46:02 +0100 (Tue, 26 Mar 2013)
New Revision: 680
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/680
Log:
refs #1868 [CAPTURE] - Import/Export PUPITRI
Added:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SexEnum.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SizeEnum.java
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java
trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SexEnum.java (from rev 677, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SortedUnsortedEnum.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SexEnum.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SexEnum.java 2013-03-26 16:46:02 UTC (rev 680)
@@ -0,0 +1,95 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.persistence.service.TuttiEnumerationFile;
+
+/**
+ * Represents the sorted - unsorted pmfm.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+public enum SexEnum implements TuttiEnumerationFile.TuttiEnumerable<Integer> {
+
+ MALE("QUALITATIVE_SEX_MALE_ID"),
+ FEMALE("QUALITATIVE_SEX_FEMALE_ID");
+
+ private final String fieldName;
+
+ private Integer fieldValue;
+
+ private boolean init;
+
+ SexEnum(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ @Override
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ @Override
+ public Integer getFieldValue() {
+ Preconditions.checkState(isInit(), "Enumeration " + getClass() + " was not init!");
+ return fieldValue;
+ }
+
+ @Override
+ public void setFieldValue(Object fieldValue) {
+ this.fieldValue = (Integer) fieldValue;
+ }
+
+ @Override
+ public boolean isInit() {
+ return init;
+ }
+
+ @Override
+ public void setInit(boolean init) {
+ this.init = init;
+ }
+
+ public boolean matchValue(CaracteristicQualitativeValue value) {
+ return fieldValue.equals(Integer.valueOf(value.getId()));
+ }
+
+ public CaracteristicQualitativeValue getValue(Caracteristic c) {
+ Preconditions.checkNotNull(c);
+ Preconditions.checkState(!c.isQualitativeValueEmpty());
+ CaracteristicQualitativeValue result = null;
+ for (CaracteristicQualitativeValue value : c.getQualitativeValue()) {
+ if (matchValue(value)) {
+ result = value;
+ break;
+ }
+ }
+ return result;
+ }
+}
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SizeEnum.java (from rev 677, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SortedUnsortedEnum.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SizeEnum.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SizeEnum.java 2013-03-26 16:46:02 UTC (rev 680)
@@ -0,0 +1,96 @@
+package fr.ifremer.tutti.persistence.entities.data;
+
+/*
+ * #%L
+ * Tutti :: Persistence
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.persistence.service.TuttiEnumerationFile;
+
+/**
+ * Represents the sorted - unsorted pmfm.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+public enum SizeEnum implements TuttiEnumerationFile.TuttiEnumerable<Integer> {
+
+ SMALL("QUALITATIVE_SIZE_SMALL_ID"),
+ MEDIUM("QUALITATIVE_SIZE_MEDIUM_ID"),
+ BIG("QUALITATIVE_SIZE_BIG_ID");
+
+ private final String fieldName;
+
+ private Integer fieldValue;
+
+ private boolean init;
+
+ SizeEnum(String fieldName) {
+ this.fieldName = fieldName;
+ }
+
+ @Override
+ public String getFieldName() {
+ return fieldName;
+ }
+
+ @Override
+ public Integer getFieldValue() {
+ Preconditions.checkState(isInit(), "Enumeration " + getClass() + " was not init!");
+ return fieldValue;
+ }
+
+ @Override
+ public void setFieldValue(Object fieldValue) {
+ this.fieldValue = (Integer) fieldValue;
+ }
+
+ @Override
+ public boolean isInit() {
+ return init;
+ }
+
+ @Override
+ public void setInit(boolean init) {
+ this.init = init;
+ }
+
+ public boolean matchValue(CaracteristicQualitativeValue value) {
+ return fieldValue.equals(Integer.valueOf(value.getId()));
+ }
+
+ public CaracteristicQualitativeValue getValue(Caracteristic c) {
+ Preconditions.checkNotNull(c);
+ Preconditions.checkState(!c.isQualitativeValueEmpty());
+ CaracteristicQualitativeValue result = null;
+ for (CaracteristicQualitativeValue value : c.getQualitativeValue()) {
+ if (matchValue(value)) {
+ result = value;
+ break;
+ }
+ }
+ return result;
+ }
+}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java 2013-03-25 19:08:05 UTC (rev 679)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java 2013-03-26 16:46:02 UTC (rev 680)
@@ -29,6 +29,8 @@
import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
+import fr.ifremer.tutti.persistence.entities.data.SexEnum;
+import fr.ifremer.tutti.persistence.entities.data.SizeEnum;
import fr.ifremer.tutti.persistence.entities.data.SortedUnsortedEnum;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ReflectionUtils;
@@ -132,6 +134,21 @@
@Value("${QualitativeValueId.UNSORTED}")
public final Integer QUALITATIVE_UNSORTED_ID = null;
+ @Value("${QualitativeValueId.SEX_MALE}")
+ public final Integer QUALITATIVE_SEX_MALE_ID = null;
+
+ @Value("${QualitativeValueId.SEX_FEMALE}")
+ public final Integer QUALITATIVE_SEX_FEMALE_ID = null;
+
+ @Value("${QualitativeValueId.SIZE_SMALL}")
+ public final Integer QUALITATIVE_SIZE_SMALL_ID = null;
+
+ @Value("${QualitativeValueId.SIZE_MEDIUM}")
+ public final Integer QUALITATIVE_SIZE_MEDIUM_ID = null;
+
+ @Value("${QualitativeValueId.SIZE_BIG}")
+ public final Integer QUALITATIVE_SIZE_BIG_ID = null;
+
@Value("${QualitativeValueId.SORTING_TYPE_SPECIES}")
public final Integer QUALITATIVE_ID_SORTING_TYPE_SPECIES = null;
@@ -271,6 +288,8 @@
// init enums
initEnum(SortedUnsortedEnum.class, annotatedFieldValues);
+ initEnum(SexEnum.class, annotatedFieldValues);
+ initEnum(SizeEnum.class, annotatedFieldValues);
initEnum(AttachementObjectTypeEnum.class, annotatedFieldValues);
initEnum(SampleCategoryEnum.class, annotatedFieldValues);
Modified: trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties 2013-03-25 19:08:05 UTC (rev 679)
+++ trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties 2013-03-26 16:46:02 UTC (rev 680)
@@ -317,8 +317,15 @@
# Catégorie Sex
PmfmId.SEX=196
+QualitativeValueId.SEX_MALE=300
+QualitativeValueId.SEX_FEMALE=301
+
# Catégorie classe de tri
PmfmId.SIZE_CATEGORY=198
+QualitativeValueId.SIZE_SMALL=307
+QualitativeValueId.SIZE_MEDIUM=306
+QualitativeValueId.SIZE_BIG=305
+
# Catégorie Age
PmfmId.AGE=1430
# Catégorie maturité
1
0
25 Mar '13
Author: tchemit
Date: 2013-03-25 20:08:05 +0100 (Mon, 25 Mar 2013)
New Revision: 679
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/679
Log:
fix properties files
Modified:
trunk/tutti-persistence/src/main/resources/tutti-db-conf.properties
Modified: trunk/tutti-persistence/src/main/resources/tutti-db-conf.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/tutti-db-conf.properties 2013-03-25 17:44:48 UTC (rev 678)
+++ trunk/tutti-persistence/src/main/resources/tutti-db-conf.properties 2013-03-25 19:08:05 UTC (rev 679)
@@ -47,5 +47,4 @@
hibernate.query.substitutions=true 1, false 0
hibernate.hbm2ddl.auto=none
hibernate.default_batch_fetch_size=1
-adagio.cache.use_tree_cache=true
-ehcache.disk.store.dir=c:/temp/ehcache
\ No newline at end of file
+adagio.cache.use_tree_cache=true
\ No newline at end of file
1
0
25 Mar '13
Author: tchemit
Date: 2013-03-25 18:44:48 +0100 (Mon, 25 Mar 2013)
New Revision: 678
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/678
Log:
fixes #1863: [BENTHOS] - Gestion de la saisie du benthos
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java
Modified:
trunk/pom.xml
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocolsTest.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportService.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportServiceTest.java
trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties
trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/pom.xml 2013-03-25 17:44:48 UTC (rev 678)
@@ -28,7 +28,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.4.8</version>
+ <version>3.4.9</version>
</parent>
<groupId>fr.ifremer</groupId>
@@ -120,8 +120,7 @@
<!-- libraries version -->
- <nuitonUtilsVersion>2.6.12-SNAPSHOT</nuitonUtilsVersion>
- <nuitonUpdaterVersion>2.6.12-SNAPSHOT</nuitonUpdaterVersion>
+ <nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
<eugenePluginVersion>2.6.1</eugenePluginVersion>
@@ -190,7 +189,7 @@
<dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-updater</artifactId>
- <version>${nuitonUpdaterVersion}</version>
+ <version>${nuitonUtilsVersion}</version>
</dependency>
<dependency>
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -133,6 +133,17 @@
}
result.setSpecies(species);
+ List<SpeciesProtocol> benthos= Lists.newArrayList();
+ if (!bean.isBenthosEmpty()) {
+ for (SpeciesProtocol speciesProtocol : bean.getBenthos()) {
+ SpeciesProtocol s = new SpeciesProtocol();
+ speciesProtocolBinder.copy(speciesProtocol, s);
+ s.setId(UUID.randomUUID().toString());
+ species.add(s);
+ }
+ }
+ result.setBenthos(benthos);
+
String id = result.getId();
File file = getProtocolFile(id);
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocolsTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocolsTest.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocolsTest.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -52,6 +52,28 @@
public static final String PROTOCOL_FILE_CONTENT =
"id: 1\n" +
"name: protocolName\n" +
+ "benthos: \n" +
+ "- !SpeciesProtocol\n" +
+ " id: 1\n" +
+ " calcifySampleEnabled: true\n" +
+ " lengthStepPmfmId: 1394\n" +
+ " maturityEnabled: true\n" +
+ " sexEnabled: true\n" +
+ " speciesReferenceTaxonId: 11242\n" +
+ " speciesSurveyCode: BAR\n" +
+ " weightEnabled: true\n" +
+ "- !SpeciesProtocol\n" +
+ " id: 2\n" +
+ " ageEnabled: true\n" +
+ " calcifySampleEnabled: true\n" +
+ " countIfNoFrequencyEnabled: true\n" +
+ " lengthStepPmfmId: 323\n" +
+ " maturityEnabled: true\n" +
+ " sexEnabled: true\n" +
+ " sizeEnabled: true\n" +
+ " speciesReferenceTaxonId: 3835\n" +
+ " speciesSurveyCode: CHIN\n" +
+ " weightEnabled: true\n" +
"comment: Commentaire\n" +
"gearUseFeaturePmfmId: \n" +
"- 21\n" +
@@ -137,6 +159,7 @@
Assert.assertEquals(Lists.newArrayList("14", "18"), protocol.getLengthClassesPmfmId());
Assert.assertEquals(Lists.newArrayList("114", "228", "821"), protocol.getVesselUseFeaturePmfmId());
Assert.assertEquals(Lists.newArrayList("21", "22"), protocol.getGearUseFeaturePmfmId());
+
Assert.assertNotNull(protocol.getSpecies());
Assert.assertEquals(2, protocol.getSpecies().size());
SpeciesProtocol sp1 = protocol.getSpecies().get(0);
@@ -166,6 +189,36 @@
Assert.assertTrue(sp2.isSexEnabled());
Assert.assertTrue(sp2.isSizeEnabled());
Assert.assertTrue(sp2.isWeightEnabled());
+
+ Assert.assertNotNull(protocol.getBenthos());
+ Assert.assertEquals(2, protocol.getBenthos().size());
+ SpeciesProtocol b1 = protocol.getBenthos().get(0);
+ Assert.assertNotNull(b1);
+ Assert.assertEquals("1", b1.getId());
+ Assert.assertEquals(11242, b1.getSpeciesReferenceTaxonId(), 0);
+ Assert.assertEquals("BAR", b1.getSpeciesSurveyCode());
+ Assert.assertEquals("1394", b1.getLengthStepPmfmId());
+ Assert.assertFalse(b1.isAgeEnabled());
+ Assert.assertTrue(b1.isCalcifySampleEnabled());
+ Assert.assertFalse(b1.isCountIfNoFrequencyEnabled());
+ Assert.assertTrue(b1.isMaturityEnabled());
+ Assert.assertTrue(b1.isSexEnabled());
+ Assert.assertFalse(b1.isSizeEnabled());
+ Assert.assertTrue(b1.isWeightEnabled());
+
+ SpeciesProtocol b2 = protocol.getBenthos().get(1);
+ Assert.assertNotNull(b2);
+ Assert.assertEquals("2", b2.getId());
+ Assert.assertEquals(3835, b2.getSpeciesReferenceTaxonId(), 0);
+ Assert.assertEquals("CHIN", b2.getSpeciesSurveyCode());
+ Assert.assertEquals("323", b2.getLengthStepPmfmId());
+ Assert.assertTrue(b2.isAgeEnabled());
+ Assert.assertTrue(b2.isCalcifySampleEnabled());
+ Assert.assertTrue(b2.isCountIfNoFrequencyEnabled());
+ Assert.assertTrue(b2.isMaturityEnabled());
+ Assert.assertTrue(b2.isSexEnabled());
+ Assert.assertTrue(b2.isSizeEnabled());
+ Assert.assertTrue(b2.isWeightEnabled());
}
private TuttiProtocol createProtocolFixture() {
@@ -202,6 +255,33 @@
sp2.setSizeEnabled(true);
sp2.setWeightEnabled(true);
protocol.addSpecies(sp2);
+
+ protocol.setBenthos(Lists.<SpeciesProtocol>newArrayList());
+ SpeciesProtocol b1 = new SpeciesProtocol();
+ b1.setId("1");
+ b1.setSpeciesReferenceTaxonId(11242);
+ b1.setSpeciesSurveyCode("BAR");
+ b1.setLengthStepPmfmId("1394");
+ b1.setCalcifySampleEnabled(true);
+ b1.setMaturityEnabled(true);
+ b1.setSexEnabled(true);
+ b1.setWeightEnabled(true);
+ protocol.addBenthos(b1);
+
+ SpeciesProtocol b2 = new SpeciesProtocol();
+ b2.setId("2");
+ b2.setSpeciesReferenceTaxonId(3835);
+ b2.setSpeciesSurveyCode("CHIN");
+ b2.setLengthStepPmfmId("323");
+ b2.setAgeEnabled(true);
+ b2.setCalcifySampleEnabled(true);
+ b2.setCountIfNoFrequencyEnabled(true);
+ b2.setMaturityEnabled(true);
+ b2.setSexEnabled(true);
+ b2.setSizeEnabled(true);
+ b2.setWeightEnabled(true);
+ protocol.addBenthos(b2);
+
return protocol;
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportService.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportService.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -272,6 +272,73 @@
protocol.setSpecies(values);
}
+ public void importProtocolBenthos(File file,
+ TuttiProtocol protocol,
+ Map<String, Caracteristic> caracteristicMap,
+ Map<String, Species> speciesMap) {
+
+ if (log.isInfoEnabled()) {
+ log.info("Will import protocol [" + protocol.getName() +
+ "] species from file: " + file);
+ }
+
+ Map<Integer, SpeciesProtocol> ids = Maps.newLinkedHashMap();
+
+ if (!protocol.isBenthosEmpty()) {
+
+ // get existing species (will be replaced if required)
+
+ for (SpeciesProtocol speciesProtocol : protocol.getBenthos()) {
+ ids.put(speciesProtocol.getSpeciesReferenceTaxonId(), speciesProtocol);
+ }
+
+ }
+ SpeciesRowModel csvModel = new SpeciesRowModel(getCsvSeparator(),
+ caracteristicMap,
+ speciesMap);
+
+ Reader reader = null;
+ try {
+ reader = Files.newReader(file, Charsets.UTF_8);
+
+ Import<SpeciesRow> importer = Import.newImport(csvModel, reader);
+
+ try {
+
+ Binder<SpeciesRow, SpeciesProtocol> binder =
+ BinderFactory.newBinder(SpeciesRow.class,
+ SpeciesProtocol.class);
+
+ for (SpeciesRow bean : importer) {
+
+ Species species = bean.getSpecies();
+ Integer id = species.getReferenceTaxonId();
+
+ SpeciesProtocol sp = ids.get(id);
+ if (sp == null) {
+
+ // create a new species protocol
+ sp = new SpeciesProtocol();
+ }
+ binder.copy(bean, sp);
+
+ ids.put(id, sp);
+ }
+ importer.close();
+ } finally {
+ IOUtils.closeQuietly(importer);
+ }
+ reader.close();
+ } catch (Exception e) {
+ throw new TuttiTechnicalException("Could not import protocol [" + protocol.getName() + "] caracteristic from file " + file, e);
+ } finally {
+ IOUtils.closeQuietly(reader);
+ }
+
+ List<SpeciesProtocol> values = Lists.newArrayList(ids.values());
+ protocol.setBenthos(values);
+ }
+
public void exportProtocolSpecies(File file,
List<SpeciesProtocol> protocol,
Map<String, Caracteristic> caracteristicMap,
@@ -306,6 +373,40 @@
}
}
+ public void exportProtocolBenthos(File file,
+ List<SpeciesProtocol> protocol,
+ Map<String, Caracteristic> caracteristicMap,
+ Map<String, Species> speciesMap) {
+ if (log.isInfoEnabled()) {
+ log.info("Will export benthos to file: " + file);
+ }
+
+ List<SpeciesRow> rows = Lists.newArrayList();
+
+ if (CollectionUtils.isNotEmpty(protocol)) {
+ rows = Lists.transform(protocol, new SpeciesProtocolToSpeciesRowFunction(
+ caracteristicMap,
+ speciesMap));
+ }
+
+ SpeciesRowModel csvModel =
+ new SpeciesRowModel(getCsvSeparator(),
+ caracteristicMap,
+ speciesMap);
+
+ BufferedWriter writer = null;
+ try {
+ writer = Files.newWriter(file, Charsets.UTF_8);
+ Export export = Export.newExport(csvModel, rows);
+ export.write(writer);
+ writer.close();
+ } catch (Exception e) {
+ throw new TuttiTechnicalException("Could not export species protocol to file " + file, e);
+ } finally {
+ IOUtils.closeQuietly(writer);
+ }
+ }
+
protected char getCsvSeparator() {
return context.getConfig().getCsvSeparator();
}
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportServiceTest.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportServiceTest.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -60,6 +60,25 @@
public static final String PROTOCOL_FILE_CONTENT =
"id: 1\n" +
"name: protocolName\n" +
+ "benthos: \n" +
+ "- !SpeciesProtocol\n" +
+ " calcifySampleEnabled: true\n" +
+ " lengthStepPmfmId: 1394\n" +
+ " maturityEnabled: true\n" +
+ " sexEnabled: true\n" +
+ " speciesReferenceTaxonId: 11242\n" +
+ " speciesSurveyCode: cruiseCode1\n" +
+ " weightEnabled: true\n" +
+ "- !SpeciesProtocol\n" +
+ " ageEnabled: true\n" +
+ " calcifySampleEnabled: true\n" +
+ " countIfNoFrequencyEnabled: true\n" +
+ " lengthStepPmfmId: 323\n" +
+ " maturityEnabled: true\n" +
+ " sexEnabled: true\n" +
+ " sizeEnabled: true\n" +
+ " speciesReferenceTaxonId: 3835\n" +
+ " weightEnabled: true\n" +
"comment: Commentaire\n" +
"gearUseFeaturePmfmId: \n" +
"- 21\n" +
@@ -110,6 +129,11 @@
"1;speciesRefTaxCode1;speciesName1;cruiseCode1;2;parameterName2;matrixName2;fractionName2;methodName2;Y;Y;Y;Y;Y;Y;Y;\n" +
"2;speciesRefTaxCode2;speciesName2;;;;;;;N;Y;N;Y;Y;Y;Y;";
+ public static final String PROTOCOL_BENTHOS_FILE_CONTENT =
+ "speciesReferenceTaxonId;speciesRefTaxCode;speciesName;speciesSurveyCode;lengthStepPmfmId;lengthStepPmfmParameterName;lengthStepPmfmMatrixName;lengthStepPmfmFractionName;lengthStepPmfmMethodName;sizeEnabled;sexEnabled;maturityEnabled;ageEnabled;weightEnabled;countIfNoFrequencyEnabled;calcifySampleEnabled\n" +
+ "1;speciesRefTaxCode1;speciesName1;cruiseCode1;2;parameterName2;matrixName2;fractionName2;methodName2;Y;Y;Y;Y;Y;Y;Y;\n" +
+ "2;speciesRefTaxCode2;speciesName2;;;;;;;N;Y;N;Y;Y;Y;Y;";
+
@Before
public void setUp() throws Exception {
datadirectory = FileUtil.getTestSpecificDirectory(getClass(),
@@ -164,6 +188,29 @@
sp2.setWeightEnabled(true);
protocol.addSpecies(sp2);
+ protocol.setBenthos(Lists.<SpeciesProtocol>newArrayList());
+ SpeciesProtocol b1 = new SpeciesProtocol();
+ b1.setSpeciesReferenceTaxonId(11242);
+ b1.setSpeciesSurveyCode("cruiseCode1");
+ b1.setLengthStepPmfmId("1394");
+ b1.setCalcifySampleEnabled(true);
+ b1.setMaturityEnabled(true);
+ b1.setSexEnabled(true);
+ b1.setWeightEnabled(true);
+ protocol.addBenthos(b1);
+
+ SpeciesProtocol b2 = new SpeciesProtocol();
+ b2.setSpeciesReferenceTaxonId(3835);
+ b2.setLengthStepPmfmId("323");
+ b2.setAgeEnabled(true);
+ b2.setCalcifySampleEnabled(true);
+ b2.setCountIfNoFrequencyEnabled(true);
+ b2.setMaturityEnabled(true);
+ b2.setSexEnabled(true);
+ b2.setSizeEnabled(true);
+ b2.setWeightEnabled(true);
+ protocol.addBenthos(b2);
+
service.exportProtocol(protocol, exportFile);
Assert.assertTrue(exportFile.exists());
@@ -189,9 +236,10 @@
Assert.assertEquals(Lists.newArrayList("14", "18"), protocol.getLengthClassesPmfmId());
Assert.assertEquals(Lists.newArrayList("114", "228", "821"), protocol.getVesselUseFeaturePmfmId());
Assert.assertEquals(Lists.newArrayList("21", "22"), protocol.getGearUseFeaturePmfmId());
+
Assert.assertNotNull(protocol.getSpecies());
- Assert.assertEquals(2, protocol.getSpecies().size());
- SpeciesProtocol sp1 = protocol.getSpecies().get(0);
+ Assert.assertEquals(2, protocol.sizeSpecies());
+ SpeciesProtocol sp1 = protocol.getSpecies(0);
Assert.assertNotNull(sp1);
Assert.assertEquals(11242, sp1.getSpeciesReferenceTaxonId(), 0);
Assert.assertEquals("cruiseCode1", sp1.getSpeciesSurveyCode());
@@ -204,7 +252,7 @@
Assert.assertFalse(sp1.isSizeEnabled());
Assert.assertTrue(sp1.isWeightEnabled());
- SpeciesProtocol sp2 = protocol.getSpecies().get(1);
+ SpeciesProtocol sp2 = protocol.getSpecies(1);
Assert.assertNotNull(sp2);
Assert.assertEquals(3835, sp2.getSpeciesReferenceTaxonId(), 0);
Assert.assertEquals("323", sp2.getLengthStepPmfmId());
@@ -215,6 +263,33 @@
Assert.assertTrue(sp2.isSexEnabled());
Assert.assertTrue(sp2.isSizeEnabled());
Assert.assertTrue(sp2.isWeightEnabled());
+
+ Assert.assertNotNull(protocol.getBenthos());
+ Assert.assertEquals(2, protocol.sizeBenthos());
+ SpeciesProtocol b1 = protocol.getBenthos(0);
+ Assert.assertNotNull(b1);
+ Assert.assertEquals(11242, b1.getSpeciesReferenceTaxonId(), 0);
+ Assert.assertEquals("cruiseCode1", b1.getSpeciesSurveyCode());
+ Assert.assertEquals("1394", b1.getLengthStepPmfmId());
+ Assert.assertFalse(b1.isAgeEnabled());
+ Assert.assertTrue(b1.isCalcifySampleEnabled());
+ Assert.assertFalse(b1.isCountIfNoFrequencyEnabled());
+ Assert.assertTrue(b1.isMaturityEnabled());
+ Assert.assertTrue(b1.isSexEnabled());
+ Assert.assertFalse(b1.isSizeEnabled());
+ Assert.assertTrue(b1.isWeightEnabled());
+
+ SpeciesProtocol b2 = protocol.getBenthos(1);
+ Assert.assertNotNull(b2);
+ Assert.assertEquals(3835, b2.getSpeciesReferenceTaxonId(), 0);
+ Assert.assertEquals("323", b2.getLengthStepPmfmId());
+ Assert.assertTrue(b2.isAgeEnabled());
+ Assert.assertTrue(b2.isCalcifySampleEnabled());
+ Assert.assertTrue(b2.isCountIfNoFrequencyEnabled());
+ Assert.assertTrue(b2.isMaturityEnabled());
+ Assert.assertTrue(b2.isSexEnabled());
+ Assert.assertTrue(b2.isSizeEnabled());
+ Assert.assertTrue(b2.isWeightEnabled());
}
@Test
@@ -382,6 +457,104 @@
Assert.assertEquals(PROTOCOL_SPECIES_FILE_CONTENT, exportFileToString);
}
+ @Test
+ public void importProtocolBenthos() throws Exception {
+
+ File file = new File(datadirectory, "importProtocolBenthos.csv");
+
+ Files.createParentDirs(file);
+
+ Files.write(PROTOCOL_BENTHOS_FILE_CONTENT, file, Charsets.UTF_8);
+
+ TuttiProtocol protocol = new TuttiProtocol();
+ Map<String, Species> speciesMap = createSpecies();
+ Map<String, Caracteristic> caracteristicMap = createCaracteristics();
+
+ service.importProtocolBenthos(file,
+ protocol,
+ caracteristicMap,
+ speciesMap);
+
+ Assert.assertEquals(2, protocol.sizeBenthos());
+
+ SpeciesProtocol sp1 = protocol.getBenthos(0);
+ Assert.assertNotNull(sp1);
+ Assert.assertEquals(1, sp1.getSpeciesReferenceTaxonId(), 0);
+ Assert.assertEquals("cruiseCode1", sp1.getSpeciesSurveyCode());
+ Assert.assertEquals("2", sp1.getLengthStepPmfmId());
+ Assert.assertTrue(sp1.isAgeEnabled());
+ Assert.assertTrue(sp1.isCalcifySampleEnabled());
+ Assert.assertTrue(sp1.isCountIfNoFrequencyEnabled());
+ Assert.assertTrue(sp1.isMaturityEnabled());
+ Assert.assertTrue(sp1.isSexEnabled());
+ Assert.assertTrue(sp1.isSizeEnabled());
+ Assert.assertTrue(sp1.isWeightEnabled());
+
+ SpeciesProtocol sp2 = protocol.getBenthos(1);
+ Assert.assertNotNull(sp2);
+ Assert.assertEquals(2, sp2.getSpeciesReferenceTaxonId(), 0);
+ Assert.assertNull(sp2.getSpeciesSurveyCode());
+ Assert.assertNull(sp2.getLengthStepPmfmId());
+ Assert.assertTrue(sp2.isAgeEnabled());
+ Assert.assertTrue(sp2.isCalcifySampleEnabled());
+ Assert.assertTrue(sp2.isCountIfNoFrequencyEnabled());
+ Assert.assertFalse(sp2.isMaturityEnabled());
+ Assert.assertTrue(sp2.isSexEnabled());
+ Assert.assertFalse(sp2.isSizeEnabled());
+ Assert.assertTrue(sp2.isWeightEnabled());
+ }
+
+ @Test
+ public void exportProtocolBenthos() throws Exception {
+
+ File file = new File(datadirectory, "exportProtocolBenthos.csv");
+
+ Files.createParentDirs(file);
+
+ Map<String, Species> speciesMap = createSpecies();
+
+ TuttiProtocol protocol = new TuttiProtocol();
+ protocol.setBenthos(Lists.<SpeciesProtocol>newArrayList());
+
+ SpeciesProtocol sp1 = new SpeciesProtocol();
+ sp1.setSpeciesReferenceTaxonId(1);
+ sp1.setSpeciesSurveyCode("cruiseCode1");
+ sp1.setAgeEnabled(true);
+ sp1.setSizeEnabled(true);
+ sp1.setMaturityEnabled(true);
+ sp1.setSexEnabled(true);
+ sp1.setWeightEnabled(true);
+ sp1.setCountIfNoFrequencyEnabled(true);
+ sp1.setCalcifySampleEnabled(true);
+ sp1.setLengthStepPmfmId("2");
+
+ protocol.addBenthos(sp1);
+
+ SpeciesProtocol sp2 = new SpeciesProtocol();
+ sp2.setSpeciesReferenceTaxonId(2);
+ sp2.setAgeEnabled(true);
+ sp1.setSizeEnabled(true);
+ sp1.setMaturityEnabled(true);
+ sp2.setSexEnabled(true);
+ sp2.setWeightEnabled(true);
+ sp2.setCalcifySampleEnabled(true);
+ sp2.setCountIfNoFrequencyEnabled(true);
+ sp2.setLengthStepPmfmId(null);
+
+ protocol.addBenthos(sp2);
+
+ Assert.assertFalse(file.exists());
+ service.exportProtocolBenthos(file,
+ protocol.getBenthos(),
+ createCaracteristics(),
+ speciesMap);
+
+ Assert.assertTrue(file.exists());
+
+ String exportFileToString = Files.toString(file, Charsets.UTF_8).trim();
+ Assert.assertEquals(PROTOCOL_BENTHOS_FILE_CONTENT, exportFileToString);
+ }
+
protected Map<String, Caracteristic> createCaracteristics() {
Map<String, Caracteristic> result = Maps.newTreeMap();
for (int i = 1; i < 6; i++) {
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-03-25 17:44:48 UTC (rev 678)
@@ -22,7 +22,7 @@
# #L%
###
#Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo
-#Sat Mar 23 16:49:12 CET 2013
+#Mon Mar 25 16:24:40 CET 2013
tutti.createBenthosBatch.action.addSpecies.help=
tutti.createBenthosBatch.action.cancel.help=
tutti.createBenthosBatch.action.save.help=
@@ -144,16 +144,22 @@
tutti.editProgram.field.name.help=editProgram.html\#fields
tutti.editProgram.field.zone.help=editProgram.html\#fields
tutti.editProgram.help=editProgram.html
+tutti.editProtocol.action.addBenthosProtocol.help=
tutti.editProtocol.action.addSpeciesProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.closeEditProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolAllCaracteristic.help=editProtocol.html\#actions
+tutti.editProtocol.action.exportProtocolBenthos.help=
tutti.editProtocol.action.exportProtocolCaracteristic.tip=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolSpecies.help=editProtocol.html\#actions
+tutti.editProtocol.action.importProtocolBenthos.help=
tutti.editProtocol.action.importProtocolCaracteristic.help=editProtocol.html\#actions
tutti.editProtocol.action.importProtocolSpecies.help=editProtocol.html\#actions
+tutti.editProtocol.action.removeBenthosProtocol.help=
tutti.editProtocol.action.removeSpeciesProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.saveProtocol.help=editProtocol.html\#actions
+tutti.editProtocol.action.selectOtherBenthos.help=
tutti.editProtocol.action.selectOtherSpecies.help=editProtocol.html\#actions
+tutti.editProtocol.field.benthos.help=
tutti.editProtocol.field.comment.help=editProtocol.html\#fields
tutti.editProtocol.field.gearUseFeature.help=editProtocol.html\#fields
tutti.editProtocol.field.lengthClasses.help=editProtocol.html\#fields
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-03-25 17:44:48 UTC (rev 678)
@@ -22,7 +22,7 @@
# #L%
###
#Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo
-#Sat Mar 23 16:49:12 CET 2013
+#Mon Mar 25 16:24:40 CET 2013
tutti.createBenthosBatch.action.addSpecies.help=createBenthosBatch.html\#actions
tutti.createBenthosBatch.action.cancel.help=createBenthosBatch.html\#actions
tutti.createBenthosBatch.action.save.help=createBenthosBatch.html\#actions
@@ -153,16 +153,22 @@
tutti.editProgram.field.name.help=editProgram.html\#fields
tutti.editProgram.field.zone.help=editProgram.html\#fields
tutti.editProgram.help=editProgram.html
+tutti.editProtocol.action.addBenthosProtocol.help=
tutti.editProtocol.action.addSpeciesProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.closeEditProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolAllCaracteristic.help=editProtocol.html\#actions
+tutti.editProtocol.action.exportProtocolBenthos.help=
tutti.editProtocol.action.exportProtocolCaracteristic.tip=editProtocol.html\#actions
tutti.editProtocol.action.exportProtocolSpecies.help=editProtocol.html\#actions
+tutti.editProtocol.action.importProtocolBenthos.help=
tutti.editProtocol.action.importProtocolCaracteristic.help=editProtocol.html\#actions
tutti.editProtocol.action.importProtocolSpecies.help=editProtocol.html\#actions
+tutti.editProtocol.action.removeBenthosProtocol.help=
tutti.editProtocol.action.removeSpeciesProtocol.help=editProtocol.html\#actions
tutti.editProtocol.action.saveProtocol.help=editProtocol.html\#actions
+tutti.editProtocol.action.selectOtherBenthos.help=
tutti.editProtocol.action.selectOtherSpecies.help=editProtocol.html\#actions
+tutti.editProtocol.field.benthos.help=
tutti.editProtocol.field.comment.help=editProtocol.html\#fields
tutti.editProtocol.field.gearUseFeature.help=editProtocol.html\#fields
tutti.editProtocol.field.lengthClasses.help=editProtocol.html\#fields
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -57,9 +57,7 @@
*/
public class TuttiDataContext implements Closeable {
- /**
- * Logger.
- */
+ /** Logger. */
private static final Log log = LogFactory.getLog(TuttiDataContext.class);
protected Program program;
@@ -78,6 +76,8 @@
protected List<Species> referentSpeciesWithSurveyCode;
+ protected List<Species> referentBenthosWithSurveyCode;
+
protected List<Species> referentSpecies;
protected List<Vessel> fishingVessels;
@@ -204,10 +204,9 @@
TuttiProtocol protocol = getProtocol();
Preconditions.checkNotNull(protocol,
- "Could not find protocol in ui context");
+ "Could not find protocol in ui context");
// fill available species from protocol
-
referentSpeciesWithSurveyCode = Lists.newArrayList();
if (!protocol.isSpeciesEmpty()) {
@@ -225,15 +224,52 @@
} else {
// no protocol, use default values
-
referentSpeciesWithSurveyCode = Lists.newArrayList(getReferentSpecies());
+ }
- }
referentSpeciesWithSurveyCode = Collections.unmodifiableList(referentSpeciesWithSurveyCode);
}
return referentSpeciesWithSurveyCode;
}
+ public List<Species> getReferentBenthosWithSurveyCode() {
+ if (referentBenthosWithSurveyCode == null) {
+
+ if (uiContext.isProtocolFilled()) {
+
+ // get loaded protocol
+
+ TuttiProtocol protocol = getProtocol();
+ Preconditions.checkNotNull(protocol,
+ "Could not find protocol in ui context");
+
+ // fill available species from protocol
+
+ referentBenthosWithSurveyCode = Lists.newArrayList();
+ if (!protocol.isBenthosEmpty()) {
+
+ // split by taxonId
+ Map<String, Species> map = TuttiEntities.splitByTaxonId(getReferentSpecies());
+
+ for (SpeciesProtocol protocolSpecy : protocol.getBenthos()) {
+ String taxonId = String.valueOf(protocolSpecy.getSpeciesReferenceTaxonId());
+ Species species = map.get(taxonId);
+ species.setSurveyCode(protocolSpecy.getSpeciesSurveyCode());
+ referentBenthosWithSurveyCode.add(species);
+ }
+ }
+
+ } else {
+
+ // no protocol, use default values
+ referentBenthosWithSurveyCode = Lists.newArrayList(getReferentSpecies());
+ }
+
+ referentBenthosWithSurveyCode = Collections.unmodifiableList(referentBenthosWithSurveyCode);
+ }
+ return referentBenthosWithSurveyCode;
+ }
+
public List<Species> getSpecies() {
if (species == null) {
if (log.isInfoEnabled()) {
@@ -349,6 +385,7 @@
species = null;
referentSpecies = null;
referentSpeciesWithSurveyCode = null;
+ referentBenthosWithSurveyCode = null;
}
public void resetCaracteristics() {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -968,7 +968,7 @@
// the species of the parent is set to the children in loadBatchRow
if (parentRow == null && context.isProtocolFilled()) {
// get the surveycode from the species list of the model
- List<Species> speciesList = getDataContext().getReferentSpeciesWithSurveyCode();
+ List<Species> speciesList = getDataContext().getReferentBenthosWithSurveyCode();
int i = speciesList.indexOf(newRow.getSpecies());
if (i > -1) {
newRow.setSpecies(speciesList.get(i));
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/RenameBenthosBatchAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -59,7 +59,8 @@
BenthosBatchRowModel row = tableModel.getEntry(table.getSelectedRow());
BenthosBatchUIModel model = handler.getModel();
- List<Species> speciesList = Lists.newArrayList(getDataContext().getReferentSpeciesWithSurveyCode());
+ List<Species> speciesList = Lists.newArrayList(
+ getDataContext().getReferentBenthosWithSurveyCode());
speciesList.removeAll(
model.getSpeciesUsed().get(
row.getSortedUnsortedCategoryValue()));
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIHandler.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -208,7 +208,8 @@
// compute which species can still be used
- List<Species> allSpecies = getDataContext().getReferentSpeciesWithSurveyCode();
+ List<Species> allSpecies =
+ getDataContext().getReferentBenthosWithSurveyCode();
speciesToUse.addAll(allSpecies);
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java (from rev 677, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddBenthosProtocolAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -0,0 +1,89 @@
+package fr.ifremer.tutti.ui.swing.content.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
+
+import java.util.Collection;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To add a new benthos protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class AddBenthosProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ public AddBenthosProtocolAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ protected Species species;
+
+ @Override
+ protected void doAction() throws Exception {
+
+ species = null;
+
+ EditProtocolUI ui = getUI();
+
+ EditProtocolSpeciesTableModel tableModel = handler.getBenthosTableModel();
+ BeanFilterableComboBox<Species> benthosComboBox = ui.getBenthosComboBox();
+
+ species = (Species) benthosComboBox.getSelectedItem();
+ Preconditions.checkNotNull(
+ species, "Can't add a benthosProtocol with a null species");
+ Preconditions.checkArgument(species.isReferenceTaxon(),
+ "Can't add a benthosProtocol with a not referent species");
+
+ Integer taxonId = species.getReferenceTaxonId();
+ String taxonIdStr = String.valueOf(taxonId);
+
+ // remove all synonyms of this taxon
+ Collection<Species> allSynonyms = getModel().getAllSynonyms(taxonIdStr);
+ getModel().getAllSynonyms().removeAll(allSynonyms);
+
+ benthosComboBox.removeItem(species);
+ ui.getSpeciesComboBox().removeItem(species);
+
+ // add new row to model (do it after combo stuff for ui best display)
+ EditProtocolSpeciesRowModel protocol = tableModel.createNewRow();
+ protocol.setSpecies(species);
+ tableModel.addNewRow(protocol);
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+ String speciesStr = decorate(species);
+ sendMessage(_("tutti.flash.info.benthos.add.to.protocol",
+ speciesStr));
+ }
+}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/AddSpeciesProtocolAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -27,6 +27,8 @@
import com.google.common.base.Preconditions;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
+
import java.util.Collection;
import static org.nuiton.i18n.I18n._;
@@ -43,13 +45,17 @@
super(handler, false);
}
+ protected Species species;
+
@Override
protected void doAction() throws Exception {
EditProtocolUI ui = getUI();
- EditProtocolSpeciesTableModel tableModel = handler.getTableModel();
- Species species = (Species) ui.getSpeciesComboBox().getSelectedItem();
+ EditProtocolSpeciesTableModel tableModel = handler.getSpeciesTableModel();
+ BeanFilterableComboBox<Species> speciesComboBox = ui.getSpeciesComboBox();
+
+ species = (Species) speciesComboBox.getSelectedItem();
Preconditions.checkNotNull(
species, "Can't add a speciesProtocol with a null species");
Preconditions.checkArgument(species.isReferenceTaxon(),
@@ -62,19 +68,20 @@
Collection<Species> allSynonyms = getModel().getAllSynonyms(taxonIdStr);
getModel().getAllSynonyms().removeAll(allSynonyms);
- ui.getSpeciesComboBox().getHandler().removeItem(species);
+ speciesComboBox.getHandler().removeItem(species);
+ ui.getBenthosComboBox().removeItem(species);
// add new row to model (do it after combo stuff for ui best display)
EditProtocolSpeciesRowModel protocol = tableModel.createNewRow();
protocol.setSpecies(species);
tableModel.addNewRow(protocol);
+ }
- getModel().setModify(true);
-
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
String speciesStr = decorate(species);
sendMessage(_("tutti.flash.info.species.add.to.protocol",
speciesStr));
-
}
-
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesTableModel.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -94,8 +94,7 @@
setNoneEditableCols(SPECIES_ID);
}
- @Override
- public EditProtocolSpeciesRowModel createNewRow() {
+ public static EditProtocolSpeciesRowModel newRow() {
EditProtocolSpeciesRowModel result = new EditProtocolSpeciesRowModel();
result.setMaturityEnabled(true);
result.setSizeEnabled(true);
@@ -108,4 +107,20 @@
return result;
}
+ @Override
+ public EditProtocolSpeciesRowModel createNewRow() {
+ EditProtocolSpeciesRowModel result = newRow();
+ return result;
+ }
+
+ @Override
+ protected void setValueAt(Object aValue,
+ int rowIndex,
+ int columnIndex,
+ ColumnIdentifier<EditProtocolSpeciesRowModel> propertyName,
+ EditProtocolSpeciesRowModel entry) {
+ super.setValueAt(aValue, rowIndex, columnIndex, propertyName, entry);
+ fireTableCellUpdated(rowIndex, columnIndex);
+ }
+
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.css 2013-03-25 17:44:48 UTC (rev 678)
@@ -58,7 +58,7 @@
}
#commentPane {
- border: {BorderFactory.createTitledBorder(_("tutti.editProgram.field.description"))};
+ border: {BorderFactory.createTitledBorder(_("tutti.editProtocol.field.comment"))};
toolTipText: "tutti.editProtocol.field.comment.tip";
_help: {"tutti.editProtocol.field.comment.help"};
}
@@ -84,7 +84,7 @@
_help: {"tutti.editProtocol.field.species.help"};
}
-#tablePopup {
+#speciesTablePopup {
label: "tutti.editProtocol.title.batchActions";
}
@@ -96,6 +96,24 @@
_help: {"tutti.editProtocol.field.species.help"};
}
+#benthosComboBox {
+ enabled: {!benthosComboBox.isEmpty()};
+ toolTipText: "tutti.editProtocol.field.benthos.tip";
+ _help: {"tutti.editProtocol.field.benthos.help"};
+}
+
+#benthosTablePopup {
+ label: "tutti.editProtocol.title.batchActions";
+}
+
+#benthosTable {
+ selectionMode: {ListSelectionModel.SINGLE_SELECTION};
+ selectionBackground: {null};
+ selectionForeground: {Color.BLACK};
+ sortable: false;
+ _help: {"tutti.editProtocol.field.benthos.help"};
+}
+
#caracteristicPane {
tabPlacement: {JTabbedPane.LEFT};
_help: {"tutti.editProtocol.pane.caracteristic.help"};
@@ -183,6 +201,51 @@
_help: {"tutti.editProtocol.action.exportProtocolSpecies.help"};
}
+#selectOtherBenthosButton {
+ text: "tutti.editProtocol.action.selectOtherBenthos";
+ toolTipText: "tutti.editProtocol.action.selectOtherBenthos.tip";
+ i18nMnemonic: "tutti.editProtocol.action.selectOtherBenthos.mnemonic";
+ _tuttiAction: {SelectOtherBenthosAction.class};
+ _help: {"tutti.editProtocol.action.selectOtherBenthos.help"};
+}
+
+#addBenthosProtocolButton {
+ actionIcon: add;
+ toolTipText: "tutti.editProtocol.action.addBenthosProtocol.tip";
+ i18nMnemonic: "tutti.editProtocol.action.addBenthosProtocol.mnemonic";
+ _tuttiAction: {AddBenthosProtocolAction.class};
+ enabled: {benthosComboBox.getSelectedItem() != null};
+ _help: {"tutti.editProtocol.action.addBenthosProtocol.help"};
+}
+
+#removeBenthosProtocolButton {
+ actionIcon: batch-delete;
+ text: "tutti.editProtocol.action.removeBenthosProtocol";
+ toolTipText: "tutti.editProtocol.action.removeBenthosProtocol.tip";
+ i18nMnemonic: "tutti.editProtocol.action.removeBenthosProtocol.mnemonic";
+ _tuttiAction: {RemoveBenthosProtocolAction.class};
+ enabled: {model.isRemoveBenthosEnabled()};
+ _help: {"tutti.editProtocol.action.removeBenthosProtocol.help"};
+}
+
+#importBenthosButton {
+ actionIcon: import;
+ text: "tutti.editProtocol.action.importProtocolBenthos";
+ toolTipText: "tutti.editProtocol.action.importProtocolBenthos.tip";
+ i18nMnemonic: "tutti.editProtocol.action.importProtocolBenthos.mnemonic";
+ _tuttiAction: {ImportProtocolBenthosAction.class};
+ _help: {"tutti.editProtocol.action.importProtocolBenthos.help"};
+}
+
+#exportBenthosButton {
+ actionIcon: export;
+ text: "tutti.editProtocol.action.exportProtocolBenthos";
+ toolTipText: "tutti.editProtocol.action.exportProtocolBenthos.tip";
+ i18nMnemonic: "tutti.editProtocol.action.exportProtocolBenthos.mnemonic";
+ _tuttiAction: {ExportProtocolBenthosAction.class};
+ _help: {"tutti.editProtocol.action.exportProtocolBenthos.help"};
+}
+
#importCaracteristicButton {
actionIcon: import;
text: "tutti.editProtocol.action.importProtocolCaracteristic";
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUI.jaxx 2013-03-25 17:44:48 UTC (rev 678)
@@ -29,13 +29,11 @@
fr.ifremer.tutti.persistence.entities.referential.Species
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
- fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.util.TuttiUI
jaxx.runtime.swing.editor.bean.BeanFilterableComboBox
jaxx.runtime.swing.editor.bean.BeanDoubleList
- java.awt.Dimension
java.awt.Color
javax.swing.ListSelectionModel
@@ -76,10 +74,14 @@
<field name='comment' component='commentPane'/>
</BeanValidator>
- <JPopupMenu id='tablePopup'>
+ <JPopupMenu id='speciesTablePopup'>
<JMenuItem id='removeSpeciesProtocolButton'/>
</JPopupMenu>
+ <JPopupMenu id='benthosTablePopup'>
+ <JMenuItem id='removeBenthosProtocolButton'/>
+ </JPopupMenu>
+
<JTabbedPane constraints='BorderLayout.CENTER'>
<tab title='tutti.editProtocol.tab.info'>
<Table id='protocolInfoForm' fill='both'>
@@ -160,15 +162,46 @@
<cell fill='both' columns='3'>
<JScrollPane>
<JXTable id='speciesTable'
- onMouseClicked='handler.autoSelectRowInTable(event, tablePopup)'/>
+ onMouseClicked='handler.autoSelectRowInTable(event, speciesTablePopup)'/>
</JScrollPane>
</cell>
</row>
</Table>
</JPanel>
</tab>
- <tab title='tutti.editProtocol.tab.benthos' enabled='false'>
- <JLabel text='tutti.to.be.done' horizontalAlignment="{JLabel.CENTER}"/>
+ <tab title='tutti.editProtocol.tab.benthos'>
+ <JPanel id='benthosPanel' layout="{new BorderLayout()}">
+ <JPanel id='benthosActions' layout="{new GridLayout()}"
+ constraints='BorderLayout.NORTH'>
+ <JButton id='importBenthosButton'/>
+ <JButton id='exportBenthosButton'/>
+ </JPanel>
+
+ <Table fill='both' constraints='BorderLayout.CENTER'>
+
+ <row fill='both'>
+ <cell fill='both' weightx='1'>
+ <BeanFilterableComboBox id='benthosComboBox'
+ constructorParams='this'
+ genericType='Species'/>
+ </cell>
+ <cell fill='both'>
+ <JButton id='selectOtherBenthosButton'/>
+ </cell>
+ <cell fill='both'>
+ <JButton id='addBenthosProtocolButton'/>
+ </cell>
+ </row>
+ <row fill='both' weighty='1'>
+ <cell fill='both' columns='3'>
+ <JScrollPane>
+ <JXTable id='benthosTable'
+ onMouseClicked='handler.autoSelectRowInTable(event, benthosTablePopup)'/>
+ </JScrollPane>
+ </cell>
+ </row>
+ </Table>
+ </JPanel>
</tab>
<tab title='tutti.editProtocol.tab.plankton' enabled='false'>
<JLabel text='tutti.to.be.done' horizontalAlignment="{JLabel.CENTER}"/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -33,17 +33,19 @@
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.content.home.CloneProtocolAction;
import fr.ifremer.tutti.ui.swing.content.home.ImportProtocolAction;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
+import fr.ifremer.tutti.ui.swing.util.CloseableUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiUI;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUI;
import fr.ifremer.tutti.ui.swing.util.species.SelectSpeciesUIModel;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiBeanMonitor;
-import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIHandler;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.editor.bean.BeanDoubleList;
import jaxx.runtime.swing.editor.bean.BeanDoubleListModel;
+import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import jaxx.runtime.swing.editor.bean.BeanUIUtil;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.collections.CollectionUtils;
@@ -52,21 +54,29 @@
import org.jdesktop.swingx.JXTable;
import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+import org.jdesktop.swingx.decorator.ComponentAdapter;
+import org.jdesktop.swingx.decorator.HighlightPredicate;
+import org.jdesktop.swingx.decorator.Highlighter;
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
import org.nuiton.util.decorator.Decorator;
import javax.swing.JComboBox;
import javax.swing.JTabbedPane;
+import javax.swing.ListSelectionModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
import javax.swing.table.TableColumnModel;
+import java.awt.Component;
import java.awt.Dimension;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.List;
import java.util.Map;
-import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import static org.nuiton.i18n.I18n._;
@@ -75,7 +85,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public class EditProtocolUIHandler extends AbstractTuttiTableUIHandler<EditProtocolSpeciesRowModel, EditProtocolUIModel, EditProtocolUI> implements CloseableUI {
+public class EditProtocolUIHandler extends AbstractTuttiUIHandler<EditProtocolUIModel, EditProtocolUI> implements CloseableUI {
/** Logger. */
private static final Log log =
@@ -94,62 +104,75 @@
protected SelectSpeciesUI dialog;
+ /**
+ * Persistence service.
+ *
+ * @since 0.2
+ */
+ protected final PersistenceService persistenceService;
+
public EditProtocolUIHandler(TuttiUI parentUi, EditProtocolUI ui) {
super(parentUi.getHandler().getContext(), ui);
+ this.persistenceService = context.getPersistenceService();
}
- //------------------------------------------------------------------------//
- //-- AbstractTuttiTableUIHandler methods --//
- //------------------------------------------------------------------------//
-
- @Override
- public EditProtocolSpeciesTableModel getTableModel() {
- return (EditProtocolSpeciesTableModel) getTable().getModel();
- }
-
- @Override
- public JXTable getTable() {
+ public JXTable getSpeciesTable() {
return ui.getSpeciesTable();
}
- @Override
- protected boolean isRowValid(EditProtocolSpeciesRowModel row) {
- return true;
+ public JXTable getBenthosTable() {
+ return ui.getBenthosTable();
}
- @Override
- protected void onRowModified(int rowIndex,
- EditProtocolSpeciesRowModel row,
- String propertyName,
- Object oldValue,
- Object newValue) {
-
- recomputeRowValidState(row);
+ public EditProtocolSpeciesTableModel getSpeciesTableModel() {
+ return (EditProtocolSpeciesTableModel) getSpeciesTable().getModel();
}
-
- @Override
- protected void onRowValidStateChanged(int rowIndex,
- EditProtocolSpeciesRowModel row,
- Boolean oldValue,
- Boolean newValue) {
- super.onRowValidStateChanged(rowIndex, row, oldValue, newValue);
-
- if (row != null && row.isModify() && newValue != null && newValue) {
- // row was modified and is valid, we can save protocol
- // even if after the row becomes again not valid, this is not a
- // problem since we will only save valid data!
- getModel().setModify(true);
- }
+ public EditProtocolSpeciesTableModel getBenthosTableModel() {
+ return (EditProtocolSpeciesTableModel) getBenthosTable().getModel();
}
- @Override
- protected void saveSelectedRowIfRequired(TuttiBeanMonitor<EditProtocolSpeciesRowModel> rowMonitor,
- EditProtocolSpeciesRowModel row) {
+//
+// @Override
+// public EditProtocolSpeciesTableModel getTableModel() {
+// return (EditProtocolSpeciesTableModel) getTable().getModel();
+// }
+//
+// @Override
+// public JXTable getTable() {
+// return ui.getSpeciesTable();
+// }
+//
+// @Override
+// protected boolean isRowValid(EditProtocolSpeciesRowModel row) {
+// return true;
+// }
- // nothing to save when row changes, model is marked to be save
- // when a row has changed and is valid or other protocol properties are modified
- }
+// @Override
+// protected void onRowModified(int rowIndex,
+// EditProtocolSpeciesRowModel row,
+// String propertyName,
+// Object oldValue,
+// Object newValue) {
+//
+// recomputeRowValidState(row);
+// }
+//
+//
+// @Override
+// protected void onRowValidStateChanged(int rowIndex,
+// EditProtocolSpeciesRowModel row,
+// Boolean oldValue,
+// Boolean newValue) {
+// super.onRowValidStateChanged(rowIndex, row, oldValue, newValue);
+//
+// if (row != null && row.isModify() && newValue != null && newValue) {
+// // row was modified and is valid, we can save protocol
+// // even if after the row becomes again not valid, this is not a
+// // problem since we will only save valid data!
+// getModel().setModify(true);
+// }
+// }
//------------------------------------------------------------------------//
//-- AbstractTuttiUIHandler methods --//
@@ -249,68 +272,136 @@
registerValidators(validator);
- // create table model
+ Collection<Species> referents =
+ model.getAllReferentSpeciesByTaxonId().values();
- JXTable table = getTable();
+ initBeanFilterableComboBox(ui.getSpeciesComboBox(),
+ Lists.newArrayList(referents), null);
+ initBeanFilterableComboBox(ui.getBenthosComboBox(),
+ Lists.newArrayList(referents), null);
- DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
+ List<EditProtocolSpeciesRowModel> speciesRows;
+ List<EditProtocolSpeciesRowModel> benthosRows;
- addColumnToModel(columnModel,
- null,
- newTableCellRender(Species.class),
- EditProtocolSpeciesTableModel.SPECIES_ID);
+ // build species and benthos rows
+ if (protocol == null) {
+ speciesRows = Lists.newArrayList();
+ benthosRows = Lists.newArrayList();
+ } else {
- addColumnToModel(columnModel,
- null,
- null,
- EditProtocolSpeciesTableModel.SURVEY_CODE_ID);
+ speciesRows = toRows(protocol.getSpecies());
+ benthosRows = toRows(protocol.getBenthos());
- addLengthClassesColumnToModel(columnModel, model.getLengthClassesPmfmId());
+ if (log.isDebugEnabled()) {
+ log.debug("Will edit protocol with " +
+ speciesRows.size() + " species and " +
+ benthosRows.size() + " benthos declared.");
+ }
+ }
- addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.WEIGHT_ENABLED, table);
- addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.COUNT_IF_NO_FREQUENCY_ENABLED, table);
+ // set to model ( will propagate to tableModel)
+ model.setSpecies(speciesRows);
+ model.setBenthos(benthosRows);
- addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.SIZE_ENABLED, table);
- addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.SEX_ENABLED, table);
- addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.MATURITY_ENABLED, table);
- addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.AGE_ENABLED, table);
+ ui.getSpeciesComboBox().getHandler().reset();
+ ui.getBenthosComboBox().getHandler().reset();
- addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.CALCIFY_SAMPLE_ENABLED, table);
+ {
+ // create species table model
- EditProtocolSpeciesTableModel tableModel =
- new EditProtocolSpeciesTableModel(columnModel);
- table.setModel(tableModel);
- table.setColumnModel(columnModel);
+ JXTable table = getSpeciesTable();
- initTable(table);
+ DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
- Collection<Species> referents =
- model.getAllReferentSpeciesByTaxonId().values();
- List<Species> speciesList = Lists.newArrayList(referents);
+ addColumnToModel(columnModel,
+ null,
+ newTableCellRender(Species.class),
+ EditProtocolSpeciesTableModel.SPECIES_ID);
- initBeanFilterableComboBox(ui.getSpeciesComboBox(), speciesList, null);
+ addColumnToModel(columnModel,
+ null,
+ null,
+ EditProtocolSpeciesTableModel.SURVEY_CODE_ID);
- List<EditProtocolSpeciesRowModel> rows;
+ addLengthClassesColumnToModel(columnModel, model.getLengthClassesPmfmId());
- // build speciesProtocol rows
- if (protocol == null) {
- rows = Lists.newArrayList();
- } else {
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.WEIGHT_ENABLED, table);
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.COUNT_IF_NO_FREQUENCY_ENABLED, table);
- rows = toRows(protocol.getSpecies());
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.SIZE_ENABLED, table);
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.SEX_ENABLED, table);
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.MATURITY_ENABLED, table);
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.AGE_ENABLED, table);
- if (log.isDebugEnabled()) {
- log.debug("Will edit protocol with " +
- rows.size() + " species declared.");
- }
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.CALCIFY_SAMPLE_ENABLED, table);
+
+ EditProtocolSpeciesTableModel tableModel =
+ new EditProtocolSpeciesTableModel(columnModel);
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ initTable(table);
+
+ table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ ListSelectionModel source = (ListSelectionModel) e.getSource();
+ ui.getRemoveSpeciesProtocolButton().setEnabled(
+ !source.isSelectionEmpty());
+ }
+ });
+
+ tableModel.setRows(speciesRows);
}
- // set to model ( will propagate to tableModel)
- model.setRows(rows);
+ {
+ // create benthos table model
-// selectFirstInCombo(ui.getSpeciesComboBox());
- ui.getSpeciesComboBox().getHandler().reset();
+ JXTable table = getBenthosTable();
+ DefaultTableColumnModelExt columnModel = new DefaultTableColumnModelExt();
+
+ addColumnToModel(columnModel,
+ null,
+ newTableCellRender(Species.class),
+ EditProtocolSpeciesTableModel.SPECIES_ID);
+
+ addColumnToModel(columnModel,
+ null,
+ null,
+ EditProtocolSpeciesTableModel.SURVEY_CODE_ID);
+
+ addLengthClassesColumnToModel(columnModel, model.getLengthClassesPmfmId());
+
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.WEIGHT_ENABLED, table);
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.COUNT_IF_NO_FREQUENCY_ENABLED, table);
+
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.SIZE_ENABLED, table);
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.SEX_ENABLED, table);
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.MATURITY_ENABLED, table);
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.AGE_ENABLED, table);
+
+ addBooleanColumnToModel(columnModel, EditProtocolSpeciesTableModel.CALCIFY_SAMPLE_ENABLED, table);
+
+ EditProtocolSpeciesTableModel tableModel =
+ new EditProtocolSpeciesTableModel(columnModel);
+ table.setModel(tableModel);
+ table.setColumnModel(columnModel);
+
+ initTable(table);
+
+ table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
+ @Override
+ public void valueChanged(ListSelectionEvent e) {
+ ListSelectionModel source = (ListSelectionModel) e.getSource();
+ ui.getRemoveBenthosProtocolButton().setEnabled(
+ !source.isSelectionEmpty());
+ }
+ });
+
+ tableModel.setRows(benthosRows);
+ }
+
initDoubleList(EditProtocolUIModel.PROPERTY_LENGTH_CLASSES_PMFM_ID,
ui.getLengthClassesList(),
Lists.newArrayList(model.getCaracteristics()),
@@ -388,6 +479,8 @@
public List<EditProtocolSpeciesRowModel> toRows(List<SpeciesProtocol> speciesProtocols) {
BeanFilterableComboBox<Species> speciesComboBox = ui.getSpeciesComboBox();
Preconditions.checkNotNull(speciesComboBox.getData());
+ BeanFilterableComboBox<Species> benthosComboBox = ui.getBenthosComboBox();
+ Preconditions.checkNotNull(benthosComboBox.getData());
EditProtocolUIModel model = getModel();
@@ -406,17 +499,18 @@
// get species referent taxon
Species species = allReferentSpeciesByTaxonId.get(taxonIdStr);
+
// remove it from the combo box
- speciesComboBox.getHandler().removeItem(species);
+ speciesComboBox.removeItem(species);
+ benthosComboBox.removeItem(species);
- EditProtocolSpeciesRowModel row = getTableModel().createNewRow();
+ EditProtocolSpeciesRowModel row = EditProtocolSpeciesTableModel.newRow();
row.setSpecies(species);
row.setLengthStepPmfm(allCaracteristic.get(speciesProtocol.getLengthStepPmfmId()));
row.fromBean(speciesProtocol);
result.add(row);
}
}
-
return result;
}
@@ -440,17 +534,6 @@
return result;
}
-
- @Override
- protected void onAfterSelectedRowChanged(int oldRowIndex,
- EditProtocolSpeciesRowModel oldRow,
- int newRowIndex,
- EditProtocolSpeciesRowModel newRow) {
-
- super.onAfterSelectedRowChanged(oldRowIndex, oldRow, newRowIndex, newRow);
- getModel().setRemoveSpeciesEnabled(newRow != null);
- }
-
//------------------------------------------------------------------------//
//-- Public methods --//
//------------------------------------------------------------------------//
@@ -544,7 +627,8 @@
SwingUtil.fillComboBox(comboBox, dataToList, null);
}
- protected void addLengthClassesColumnToModel(TableColumnModel model, List<String> selectedIds) {
+ protected void addLengthClassesColumnToModel(TableColumnModel model,
+ List<String> selectedIds) {
Decorator<Caracteristic> decorator =
getDecorator(Caracteristic.class, null);
@@ -565,13 +649,54 @@
BeanUIUtil.decorate(comboBox, converter);
ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox);
-
addColumnToModel(model,
editor,
newTableCellRender(decorator),
EditProtocolSpeciesTableModel.LENGTH_STEP_PMFM_ID);
}
+ protected void initTable(JXTable table) {
+
+ // by default do not authorize to change column orders
+ table.getTableHeader().setReorderingAllowed(false);
+
+ addHighlighters(table);
+
+ // always scroll to selected row
+ SwingUtil.scrollToTableSelection(table);
+
+ table.getModel().addTableModelListener(new TableModelListener() {
+ @Override
+ public void tableChanged(TableModelEvent e) {
+ getModel().setModify(true);
+ }
+ });
+ }
+
+ protected void addHighlighters(final JXTable table) {
+ // paint in a special color for read only cells
+ Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ HighlightPredicate.READ_ONLY, getConfig().getColorRowReadOnly());
+ table.addHighlighter(readOnlyHighlighter);
+
+ // paint in a special color inValid rows
+ Highlighter validHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
+ new HighlightPredicate.AndHighlightPredicate(HighlightPredicate.EDITABLE, new HighlightPredicate() {
+ @Override
+ public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
+
+ boolean result = false;
+ if (adapter.isEditable()) {
+ EditProtocolSpeciesTableModel model = (EditProtocolSpeciesTableModel) table.getModel();
+ EditProtocolSpeciesRowModel row = model.getEntry(adapter.row);
+ result = !row.isValid();
+ }
+ return result;
+ }
+ }), getConfig().getColorRowInvalid());
+ table.addHighlighter(validHighlighter);
+ }
+
protected static class UpdateSelectedList implements PropertyChangeListener {
private final BeanDoubleListModel<Caracteristic> model;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -30,7 +30,7 @@
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
+import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -42,7 +42,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public class EditProtocolUIModel extends AbstractTuttiTableUIModel<TuttiProtocol, EditProtocolSpeciesRowModel, EditProtocolUIModel> {
+public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, EditProtocolUIModel> {
private static final long serialVersionUID = 1L;
@@ -50,6 +50,10 @@
public static final String PROPERTY_NAME = "name";
+ public static final String PROPERTY_SPECIES = "species";
+
+ public static final String PROPERTY_BENTHOS = "benthos";
+
public static final String PROPERTY_LENGTH_CLASSES_PMFM_ID = "lengthClassesPmfmId";
public static final String PROPERTY_GEAR_USE_FEATURE_PMFM_ID = "gearUseFeaturePmfmId";
@@ -58,6 +62,8 @@
public static final String PROPERTY_REMOVE_SPECIES_ENABLED = "removeSpeciesEnabled";
+ public static final String PROPERTY_REMOVE_BENTHOS_ENABLED = "removeBenthosEnabled";
+
public static final String PROPERTY_IMPORTED = "imported";
public static final String PROPERTY_CLONED = "cloned";
@@ -93,6 +99,13 @@
*/
protected boolean removeSpeciesEnabled;
+ /**
+ * Can user remove a selected benthos?
+ *
+ * @since 0.3
+ */
+ protected boolean removeBenthosEnabled;
+
protected List<Species> allSpecies;
protected List<Species> allSynonyms;
@@ -105,6 +118,10 @@
protected Map<String, Caracteristic> allCaracteristic;
+ protected List<EditProtocolSpeciesRowModel> species;
+
+ protected List<EditProtocolSpeciesRowModel> benthos;
+
protected static Binder<EditProtocolUIModel, TuttiProtocol> toBeanBinder =
BinderFactory.newBinder(EditProtocolUIModel.class,
TuttiProtocol.class);
@@ -183,6 +200,26 @@
setVesselUseFeaturePmfmId(ids);
}
+ public List<EditProtocolSpeciesRowModel> getSpecies() {
+ return species;
+ }
+
+ public void setSpecies(List<EditProtocolSpeciesRowModel> species) {
+ Object oldValue = getSpecies();
+ this.species = species;
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ public List<EditProtocolSpeciesRowModel> getBenthos() {
+ return benthos;
+ }
+
+ public void setBenthos(List<EditProtocolSpeciesRowModel> benthos) {
+ Object oldValue = getBenthos();
+ this.benthos = benthos;
+ firePropertyChange(PROPERTY_BENTHOS, oldValue, species);
+ }
+
public boolean isRemoveSpeciesEnabled() {
return removeSpeciesEnabled;
}
@@ -193,6 +230,16 @@
firePropertyChange(PROPERTY_REMOVE_SPECIES_ENABLED, oldValue, removeSpeciesEnabled);
}
+ public boolean isRemoveBenthosEnabled() {
+ return removeBenthosEnabled;
+ }
+
+ public void setRemoveBenthosEnabled(boolean removeBenthosEnabled) {
+ Object oldValue = isRemoveBenthosEnabled();
+ this.removeBenthosEnabled = removeBenthosEnabled;
+ firePropertyChange(PROPERTY_REMOVE_BENTHOS_ENABLED, oldValue, removeBenthosEnabled);
+ }
+
public boolean isImported() {
return imported;
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java (from rev 677, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -0,0 +1,126 @@
+package fr.ifremer.tutti.ui.swing.content.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.service.protocol.TuttiProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To export protocol benthos.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+public class ExportProtocolBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ExportProtocolBenthosAction.class);
+
+ private File file;
+
+ public ExportProtocolBenthosAction(EditProtocolUIHandler handler) {
+ super(handler, true);
+ }
+
+ @Override
+ protected boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to export
+ file = TuttiUIUtil.chooseFile(
+ getContext().getMainUI(),
+ _("tutti.editProtocol.title.choose.benthosExportFile"),
+ _("tutti.editProtocol.action.chooseProtocolBenthosFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+ if (file == null) {
+
+ // user cancel
+ doAction = false;
+ } else {
+
+ // add extension if missing
+ file = TuttiIOUtil.addExtensionIfMissing(file, ".csv");
+
+ // ask user to confirm overwrite.
+ doAction = getHandler().askOverwriteFile(file);
+ }
+ }
+ return doAction;
+ }
+
+ @Override
+ protected void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will export protocol benthos to file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // build benthos protocol to export
+
+ List<SpeciesProtocol> protocols = Lists.newArrayList();
+ for (EditProtocolSpeciesRowModel row : model.getBenthos()) {
+ if (row.isValid()) {
+ protocols.add(row.toBean());
+ }
+ }
+
+ // import
+ TuttiProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.exportProtocolBenthos(file,
+ protocols,
+ model.getAllCaracteristic(),
+ model.getAllReferentSpeciesByTaxonId());
+
+ sendMessage(_("tutti.flash.info.species.exported.from.protocol",
+ file));
+ }
+}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -105,7 +105,7 @@
// build species protocol to export
List<SpeciesProtocol> protocols = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getRows()) {
+ for (EditProtocolSpeciesRowModel row : model.getSpecies()) {
if (row.isValid()) {
protocols.add(row.toBean());
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java (from rev 677, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -0,0 +1,147 @@
+package fr.ifremer.tutti.ui.swing.content.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.service.protocol.TuttiProtocolImportExportService;
+import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.io.File;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To import protocol benthos.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class ImportProtocolBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(ImportProtocolBenthosAction.class);
+
+ private File file;
+
+ public ImportProtocolBenthosAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ protected boolean prepareAction() throws Exception {
+
+ boolean doAction = super.prepareAction();
+
+ if (doAction) {
+
+ // choose file to import
+ file = TuttiUIUtil.chooseFile(
+ getContext().getMainUI(),
+ _("tutti.editProtocol.title.choose.benthosImportFile"),
+ _("tutti.editProtocol.action.chooseProtocolBenthosFile"),
+ "^.*\\.csv", _("tutti.common.file.csv")
+ );
+
+ doAction = file != null;
+ }
+ return doAction;
+ }
+
+ @Override
+ protected void releaseAction() {
+ file = null;
+ super.releaseAction();
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+ Preconditions.checkNotNull(file);
+ if (log.isInfoEnabled()) {
+ log.info("Will import protocol benthos file: " + file);
+ }
+
+ EditProtocolUIModel model = getModel();
+
+ // bind to a protocol
+ TuttiProtocol protocol = model.toBean();
+
+ // import
+ TuttiProtocolImportExportService service =
+ getContext().getTuttiProtocolImportExportService();
+
+ service.importProtocolBenthos(file,
+ protocol,
+ model.getAllCaracteristic(),
+ model.getAllReferentSpeciesByTaxonId());
+
+ // build rows from imported+merged protocol
+ // (will also remove all synonyms of species referent used)
+ List<EditProtocolSpeciesRowModel> rows =
+ handler.toRows(protocol.getBenthos());
+
+ // update species comboBox
+// getUI().getSpeciesComboBox().getHandler().sortData();
+ getUI().getSpeciesComboBox().getHandler().reset();
+
+ // update benthos comboBox
+// getUI().getBenthosComboBox().getHandler().sortData();
+ getUI().getBenthosComboBox().getHandler().reset();
+
+ // update rows in model
+ model.setBenthos(rows);
+
+ int nbSynonym = 0;
+ for (SpeciesProtocol speciesProtocol : protocol.getSpecies()) {
+ if (!speciesProtocol.isMadeFromAReferentTaxon()) {
+ nbSynonym++;
+ }
+ }
+
+ String message;
+ switch (nbSynonym) {
+ case 0:
+ message = _("tutti.flash.info.benthos.imported.in.protocol",
+ file);
+ break;
+
+ case 1:
+ message = _("tutti.flash.info.benthos.imported.in.protocol.oneReplaced",
+ file);
+ break;
+
+ default:
+ message = _("tutti.flash.info.benthos.imported.in.protocol.severalReplaced",
+ file, nbSynonym);
+ }
+ sendMessage(message);
+ }
+}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -27,11 +27,9 @@
import com.google.common.base.Preconditions;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.protocol.TuttiProtocolImportExportService;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -105,19 +103,21 @@
model.getAllCaracteristic(),
model.getAllReferentSpeciesByTaxonId());
- BeanFilterableComboBox<Species> speciesComboBox = getUI().getSpeciesComboBox();
-
// build rows from imported+merged protocol
// (will also remove all synonyms of species referent used)
List<EditProtocolSpeciesRowModel> rows =
handler.toRows(protocol.getSpecies());
// update species comboBox
- speciesComboBox.getHandler().sortData();
- speciesComboBox.getHandler().reset();
+// getUI().getSpeciesComboBox().getHandler().sortData();
+ getUI().getSpeciesComboBox().getHandler().reset();
+ // update benthos comboBox
+// getUI().getBenthosComboBox().getHandler().sortData();
+ getUI().getBenthosComboBox().getHandler().reset();
+
// update rows in model
- model.setRows(rows);
+ model.setSpecies(rows);
int nbSynonym = 0;
for (SpeciesProtocol speciesProtocol : protocol.getSpecies()) {
@@ -130,17 +130,17 @@
switch (nbSynonym) {
case 0:
message = _("tutti.flash.info.species.imported.in.protocol",
- file);
+ file);
break;
case 1:
message = _("tutti.flash.info.species.imported.in.protocol.oneReplaced",
- file);
+ file);
break;
default:
message = _("tutti.flash.info.species.imported.in.protocol.severalReplaced",
- file, nbSynonym);
+ file, nbSynonym);
}
sendMessage(message);
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java (from rev 677, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveBenthosProtocolAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -0,0 +1,90 @@
+package fr.ifremer.tutti.ui.swing.content.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import org.jdesktop.swingx.JXTable;
+
+import java.util.Collections;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * To add a new species protocol.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0
+ */
+public class RemoveBenthosProtocolAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ public RemoveBenthosProtocolAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+
+ JXTable table = handler.getBenthosTable();
+
+ int rowIndex = table.getSelectedRow();
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove benthos if no benthos selected");
+
+ EditProtocolSpeciesTableModel tableModel = handler.getBenthosTableModel();
+
+ EditProtocolSpeciesRowModel selectedRow = tableModel.getEntry(rowIndex);
+
+ // re-add all synonym of this taxon to the species / benthos combobox
+ Species species = selectedRow.getSpecies();
+ getUI().getBenthosComboBox().addItem(species);
+ getUI().getSpeciesComboBox().addItem(species);
+
+ EditProtocolUIModel model = getModel();
+ Integer taxonId = species.getReferenceTaxonId();
+ List<Species> allSynonyms = Lists.newArrayList(
+ model.getAllSynonyms(String.valueOf(taxonId)));
+ allSynonyms.remove(species);
+ model.getAllSynonyms().addAll(allSynonyms);
+ // reorder the list by name, otherwise,
+ // all the species without a reftax code will be at the end
+ Collections.sort(model.getAllSynonyms(), TuttiEntities.SPECIES_BY_NAME_COMPARATOR);
+
+
+ table.clearSelection();
+ // remove the row from the model(do it after treating the comboBox which can be long)
+ tableModel.removeRow(rowIndex);
+
+ String speciesStr = decorate(selectedRow.getSpecies());
+ sendMessage(_("tutti.flash.info.benthos.remove.from.protocol",
+ speciesStr));
+ }
+
+}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/RemoveSpeciesProtocolAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -29,9 +29,8 @@
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
-import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
-import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
+import javax.swing.JTable;
import java.util.Collections;
import java.util.List;
@@ -52,19 +51,21 @@
@Override
protected void doAction() throws Exception {
- int rowIndex = handler.getTable().getSelectedRow();
+ JTable table = handler.getSpeciesTable();
+ int rowIndex = table.getSelectedRow();
+
Preconditions.checkState(rowIndex != -1,
"Cant remove species if no species selected");
- EditProtocolSpeciesTableModel tableModel = handler.getTableModel();
+ EditProtocolSpeciesTableModel tableModel = handler.getSpeciesTableModel();
EditProtocolSpeciesRowModel selectedRow = tableModel.getEntry(rowIndex);
- // re-add all synonym of this taxon to the species comobox
+ // re-add all synonym of this taxon to the species / benthos combobox
Species species = selectedRow.getSpecies();
- BeanFilterableComboBox<Species> combo = getUI().getSpeciesComboBox();
- combo.getHandler().addItem(species);
+ getUI().getBenthosComboBox().addItem(species);
+ getUI().getSpeciesComboBox().addItem(species);
EditProtocolUIModel model = getModel();
Integer taxonId = species.getReferenceTaxonId();
@@ -76,7 +77,7 @@
// all the species without a reftax code will be at the end
Collections.sort(model.getAllSynonyms(), TuttiEntities.SPECIES_BY_NAME_COMPARATOR);
- handler.getTable().clearSelection();
+ table.clearSelection();
// remove the row from the model(do it after treating the comboBox which can be long)
tableModel.removeRow(rowIndex);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -68,16 +68,26 @@
TuttiProtocol bean = model.toBean();
// get the species protocols from the table
- List<SpeciesProtocol> protocols = Lists.newArrayList();
+ List<SpeciesProtocol> speciesProtocols = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getRows()) {
+ for (EditProtocolSpeciesRowModel row : model.getSpecies()) {
if (row.isValid()) {
SpeciesProtocol protocol = row.toBean();
- protocols.add(protocol);
+ speciesProtocols.add(protocol);
}
}
- bean.setSpecies(protocols);
+ bean.setSpecies(speciesProtocols);
+ List<SpeciesProtocol> benthosProtocols = Lists.newArrayList();
+
+ for (EditProtocolSpeciesRowModel row : model.getBenthos()) {
+ if (row.isValid()) {
+ SpeciesProtocol protocol = row.toBean();
+ benthosProtocols.add(protocol);
+ }
+ }
+ bean.setBenthos(benthosProtocols);
+
if (log.isDebugEnabled()) {
log.debug("protocol id to save: " + bean.getId());
}
Copied: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java (from rev 677, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherSpeciesAction.java)
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SelectOtherBenthosAction.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -0,0 +1,91 @@
+
+package fr.ifremer.tutti.ui.swing.content.protocol;
+
+/*
+ * #%L
+ * Tutti :: UI
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2012 - 2013 Ifremer
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program. If not, see
+ * <http://www.gnu.org/licenses/gpl-3.0.html>.
+ * #L%
+ */
+
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * Action to select a benthos which is not in the referent list.
+ *
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.1
+ */
+public class SelectOtherBenthosAction extends AbstractTuttiAction<EditProtocolUIModel, EditProtocolUI, EditProtocolUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(SelectOtherBenthosAction.class);
+
+ protected Species selectedSpecies;
+
+ public SelectOtherBenthosAction(EditProtocolUIHandler handler) {
+ super(handler, false);
+ }
+
+ @Override
+ protected boolean prepareAction() throws Exception {
+ boolean result = super.prepareAction();
+ if (result) {
+ EditProtocolUIModel model = getModel();
+
+ List<Species> species = Lists.newArrayList(model.getAllSynonyms());
+
+ selectedSpecies = getHandler().openSelectOtherSpeciesDialog(
+ _("tutti.selectBenthos.title"), species);
+
+ if (log.isInfoEnabled()) {
+ log.info("SelectedBenthos: " + selectedSpecies);
+ }
+ result = selectedSpecies != null;
+ }
+ return result;
+ }
+
+ @Override
+ protected void releaseAction() {
+ selectedSpecies = null;
+ super.releaseAction();
+ }
+
+ @Override
+ protected void doAction() throws Exception {
+ String decoratedSynonym = decorate(selectedSpecies);
+ String taxonId = String.valueOf(selectedSpecies.getReferenceTaxonId());
+ selectedSpecies = getModel().getAllReferentSpeciesByTaxonId().get(taxonId);
+ String decoratedReferent = decorate(selectedSpecies);
+ sendMessage(_("tutti.flash.info.benthos.replaced", decoratedSynonym, decoratedReferent));
+ getUI().getBenthosComboBox().setSelectedItem(selectedSpecies);
+ }
+
+}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -39,16 +39,26 @@
import fr.ifremer.tutti.ui.swing.util.action.TuttiActionUI;
import fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment;
import fr.ifremer.tutti.ui.swing.util.editor.SimpleTimeEditor;
+import fr.ifremer.tutti.ui.swing.util.table.ColumnIdentifier;
import jaxx.runtime.JAXXUtil;
import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.JAXXWidgetUtil;
import jaxx.runtime.swing.editor.NumberEditor;
import jaxx.runtime.swing.editor.bean.BeanDoubleList;
import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
+import jaxx.runtime.swing.editor.bean.BeanUIUtil;
+import jaxx.runtime.swing.editor.cell.NumberCellEditor;
import jaxx.runtime.swing.renderer.DecoratorListCellRenderer;
+import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
import jaxx.runtime.validator.swing.SwingValidator;
+import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXDatePicker;
+import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
+import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
+import org.jdesktop.swingx.table.TableColumnExt;
import org.nuiton.util.decorator.Decorator;
import org.nuiton.util.decorator.JXPathDecorator;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
@@ -57,30 +67,40 @@
import javax.swing.AbstractButton;
import javax.swing.Action;
import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
import javax.swing.JRootPane;
import javax.swing.JSpinner;
+import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
import javax.swing.ListCellRenderer;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
+import javax.swing.border.LineBorder;
import javax.swing.event.ListSelectionEvent;
+import javax.swing.table.TableCellEditor;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumnModel;
import javax.swing.text.JTextComponent;
+import java.awt.Color;
import java.awt.Component;
import java.awt.Dialog;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Frame;
+import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.beans.PropertyChangeEvent;
@@ -763,4 +783,161 @@
validator.setContext(newContext);
validator.setBean(bean);
}
+
+
+ protected <R extends AbstractTuttiBeanUIModel> void addColumnToModel(TableColumnModel model,
+ TableCellEditor editor,
+ TableCellRenderer renderer,
+ ColumnIdentifier<R> identifier) {
+
+ TableColumnExt col = new TableColumnExt(model.getColumnCount());
+ col.setCellEditor(editor);
+ col.setCellRenderer(renderer);
+ col.setHeaderValue(_(identifier.getHeaderI18nKey()));
+ col.setToolTipText(_(identifier.getHeaderTipI18nKey()));
+
+ col.setIdentifier(identifier);
+ model.addColumn(col);
+ }
+
+ protected <R extends AbstractTuttiBeanUIModel> void addColumnToModel(TableColumnModel model,
+ ColumnIdentifier<R> identifier) {
+
+ addColumnToModel(model, null, null, identifier);
+ }
+
+ protected <R extends AbstractTuttiBeanUIModel> void addFloatColumnToModel(TableColumnModel model,
+ ColumnIdentifier<R> identifier,
+ String numberPattern) {
+
+ NumberCellEditor<Float> editor =
+ JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
+ editor.getNumberEditor().setSelectAllTextOnError(true);
+ editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+ editor.getNumberEditor().setNumberPattern(numberPattern);
+
+ addColumnToModel(model, editor, null, identifier);
+
+ }
+
+ protected <R extends AbstractTuttiBeanUIModel> void addIntegerColumnToModel(TableColumnModel model,
+ ColumnIdentifier<R> identifier,
+ String numberPattern) {
+
+ NumberCellEditor<Integer> editor =
+ JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
+ editor.getNumberEditor().setSelectAllTextOnError(true);
+ editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+ editor.getNumberEditor().setNumberPattern(numberPattern);
+
+ addColumnToModel(model, editor, null, identifier);
+ }
+
+ protected <R extends AbstractTuttiBeanUIModel> void addBooleanColumnToModel(TableColumnModel model,
+ ColumnIdentifier<R> identifier,
+ JTable table) {
+
+ addColumnToModel(model,
+ table.getDefaultEditor(Boolean.class),
+ table.getDefaultRenderer(Boolean.class),
+ identifier);
+ }
+
+ protected <R extends AbstractTuttiBeanUIModel, B> void addComboDataColumnToModel(TableColumnModel model,
+ ColumnIdentifier<R> identifier,
+ Decorator<B> decorator,
+ List<B> data) {
+ JComboBox comboBox = new JComboBox();
+ comboBox.setRenderer(newListCellRender(decorator));
+
+ List<B> dataToList = Lists.newArrayList(data);
+
+ // add a null value at first position
+ if (!dataToList.isEmpty() && dataToList.get(0) != null) {
+ dataToList.add(0, null);
+ }
+ SwingUtil.fillComboBox(comboBox, dataToList, null);
+
+ ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+ BeanUIUtil.decorate(comboBox, converter);
+ ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox);
+
+ addColumnToModel(model,
+ editor,
+ newTableCellRender(decorator),
+ identifier);
+ }
+
+ protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
+
+ return newTableCellRender(type, null);
+ }
+
+ protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
+
+ Decorator<O> decorator = getDecorator(type, name);
+
+ TableCellRenderer result = newTableCellRender(decorator);
+ return result;
+ }
+
+ protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
+
+ Preconditions.checkNotNull(decorator);
+
+ DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator, true);
+ return result;
+ }
+
+ public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
+
+ boolean rightClick = SwingUtilities.isRightMouseButton(e);
+
+ if (rightClick || SwingUtilities.isLeftMouseButton(e)) {
+
+ // get the coordinates of the mouse click
+ Point p = e.getPoint();
+
+ JXTable source = (JXTable) e.getSource();
+
+ int[] selectedRows = source.getSelectedRows();
+
+ // get the row index at this point
+ int rowIndex = source.rowAtPoint(p);
+
+ if (log.isDebugEnabled()) {
+ log.debug("At point [" + p + "] found Row " + rowIndex);
+ }
+
+ boolean canContinue = true;
+
+ if (source.isEditing()) {
+
+ // stop editing
+ boolean stopEdit = source.getCellEditor().stopCellEditing();
+ if (!stopEdit) {
+ if (log.isWarnEnabled()) {
+ log.warn("Could not stop edit cell...");
+ }
+ canContinue = false;
+ }
+ }
+
+ if (canContinue) {
+
+ // select row (could empty selection)
+ if (rowIndex == -1) {
+ source.clearSelection();
+ } else if (!ArrayUtils.contains(selectedRows, rowIndex)) {
+ source.setRowSelectionInterval(rowIndex, rowIndex);
+ }
+
+ if (rightClick) {
+
+ // on right click show popup
+ popup.show(source, e.getX(), e.getY());
+ }
+ }
+ }
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIHandler.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -25,7 +25,6 @@
*/
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
@@ -36,42 +35,28 @@
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
import jaxx.runtime.SwingUtil;
-import jaxx.runtime.swing.JAXXWidgetUtil;
-import jaxx.runtime.swing.editor.bean.BeanUIUtil;
import jaxx.runtime.swing.editor.cell.NumberCellEditor;
-import jaxx.runtime.swing.renderer.DecoratorTableCellRenderer;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
-import org.jdesktop.swingx.autocomplete.ComboBoxCellEditor;
-import org.jdesktop.swingx.autocomplete.ObjectToStringConverter;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
-import org.jdesktop.swingx.table.TableColumnExt;
-import org.nuiton.util.decorator.Decorator;
-import javax.swing.JComboBox;
-import javax.swing.JPopupMenu;
import javax.swing.JTable;
import javax.swing.ListSelectionModel;
-import javax.swing.SwingUtilities;
-import javax.swing.border.LineBorder;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.TableCellEditor;
-import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import java.awt.Color;
import java.awt.Component;
-import java.awt.Point;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
-import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Collection;
@@ -79,8 +64,6 @@
import java.util.List;
import java.util.Set;
-import static org.nuiton.i18n.I18n._;
-
/**
* @param <R> type of a row
* @param <M> type of the ui model
@@ -313,7 +296,7 @@
installTableSaveOnRowChangedSelectionListener();
}
- protected void addHighlighters(JXTable table){
+ protected void addHighlighters(JXTable table) {
// paint in a special color for read only cells
Highlighter readOnlyHighlighter = TuttiUIUtil.newBackgroundColorHighlighter(
HighlightPredicate.READ_ONLY, getConfig().getColorRowReadOnly());
@@ -368,110 +351,110 @@
table.addHighlighter(validHighlighter);
}
- protected void addColumnToModel(TableColumnModel model,
- TableCellEditor editor,
- TableCellRenderer renderer,
- ColumnIdentifier<R> identifier) {
+// protected void addColumnToModel(TableColumnModel model,
+// TableCellEditor editor,
+// TableCellRenderer renderer,
+// ColumnIdentifier<R> identifier) {
+//
+// TableColumnExt col = new TableColumnExt(model.getColumnCount());
+// col.setCellEditor(editor);
+// col.setCellRenderer(renderer);
+// col.setHeaderValue(_(identifier.getHeaderI18nKey()));
+// col.setToolTipText(_(identifier.getHeaderTipI18nKey()));
+//
+// col.setIdentifier(identifier);
+// model.addColumn(col);
+// }
- TableColumnExt col = new TableColumnExt(model.getColumnCount());
- col.setCellEditor(editor);
- col.setCellRenderer(renderer);
- col.setHeaderValue(_(identifier.getHeaderI18nKey()));
- col.setToolTipText(_(identifier.getHeaderTipI18nKey()));
+// protected void addColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier) {
+//
+// addColumnToModel(model, null, null, identifier);
+// }
+//
+// protected void addFloatColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// String numberPattern) {
+//
+// NumberCellEditor<Float> editor =
+// JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
+// editor.getNumberEditor().setSelectAllTextOnError(true);
+// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+// editor.getNumberEditor().setNumberPattern(numberPattern);
+//
+// addColumnToModel(model, editor, null, identifier);
+//
+// }
- col.setIdentifier(identifier);
- model.addColumn(col);
- }
+// protected void addIntegerColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// String numberPattern) {
+//
+// NumberCellEditor<Integer> editor =
+// JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
+// editor.getNumberEditor().setSelectAllTextOnError(true);
+// editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
+// editor.getNumberEditor().setNumberPattern(numberPattern);
+//
+// addColumnToModel(model, editor, null, identifier);
+// }
- protected void addColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier) {
+// protected void addBooleanColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// JTable table) {
+//
+// addColumnToModel(model,
+// table.getDefaultEditor(Boolean.class),
+// table.getDefaultRenderer(Boolean.class),
+// identifier);
+// }
- addColumnToModel(model, null, null, identifier);
- }
+// protected <B> void addComboDataColumnToModel(TableColumnModel model,
+// ColumnIdentifier<R> identifier,
+// Decorator<B> decorator,
+// List<B> data) {
+// JComboBox comboBox = new JComboBox();
+// comboBox.setRenderer(newListCellRender(decorator));
+//
+// List<B> dataToList = Lists.newArrayList(data);
+//
+// // add a null value at first position
+// if (!dataToList.isEmpty() && dataToList.get(0) != null) {
+// dataToList.add(0, null);
+// }
+// SwingUtil.fillComboBox(comboBox, dataToList, null);
+//
+// ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
+// BeanUIUtil.decorate(comboBox, converter);
+// ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox);
+//
+// addColumnToModel(model,
+// editor,
+// newTableCellRender(decorator),
+// identifier);
+// }
+//
+// protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
+//
+// return newTableCellRender(type, null);
+// }
+//
+// protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
+//
+// Decorator<O> decorator = getDecorator(type, name);
+//
+// TableCellRenderer result = newTableCellRender(decorator);
+// return result;
+// }
+//
+// protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
+//
+// Preconditions.checkNotNull(decorator);
+//
+// DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator, true);
+// return result;
+// }
- protected void addFloatColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- String numberPattern) {
-
- NumberCellEditor<Float> editor =
- JAXXWidgetUtil.newNumberTableCellEditor(Float.class, false);
- editor.getNumberEditor().setSelectAllTextOnError(true);
- editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
- editor.getNumberEditor().setNumberPattern(numberPattern);
-
- addColumnToModel(model, editor, null, identifier);
-
- }
-
- protected void addIntegerColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- String numberPattern) {
-
- NumberCellEditor<Integer> editor =
- JAXXWidgetUtil.newNumberTableCellEditor(Integer.class, false);
- editor.getNumberEditor().setSelectAllTextOnError(true);
- editor.getNumberEditor().getTextField().setBorder(new LineBorder(Color.GRAY, 2));
- editor.getNumberEditor().setNumberPattern(numberPattern);
-
- addColumnToModel(model, editor, null, identifier);
- }
-
- protected void addBooleanColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- JTable table) {
-
- addColumnToModel(model,
- table.getDefaultEditor(Boolean.class),
- table.getDefaultRenderer(Boolean.class),
- identifier);
- }
-
- protected <B> void addComboDataColumnToModel(TableColumnModel model,
- ColumnIdentifier<R> identifier,
- Decorator<B> decorator,
- List<B> data) {
- JComboBox comboBox = new JComboBox();
- comboBox.setRenderer(newListCellRender(decorator));
-
- List<B> dataToList = Lists.newArrayList(data);
-
- // add a null value at first position
- if (!dataToList.isEmpty() && dataToList.get(0) != null) {
- dataToList.add(0, null);
- }
- SwingUtil.fillComboBox(comboBox, dataToList, null);
-
- ObjectToStringConverter converter = BeanUIUtil.newDecoratedObjectToStringConverter(decorator);
- BeanUIUtil.decorate(comboBox, converter);
- ComboBoxCellEditor editor = new ComboBoxCellEditor(comboBox);
-
- addColumnToModel(model,
- editor,
- newTableCellRender(decorator),
- identifier);
- }
-
- protected <O> TableCellRenderer newTableCellRender(Class<O> type) {
-
- return newTableCellRender(type, null);
- }
-
- protected <O> TableCellRenderer newTableCellRender(Class<O> type, String name) {
-
- Decorator<O> decorator = getDecorator(type, name);
-
- TableCellRenderer result = newTableCellRender(decorator);
- return result;
- }
-
- protected <O> TableCellRenderer newTableCellRender(Decorator<O> decorator) {
-
- Preconditions.checkNotNull(decorator);
-
- DecoratorTableCellRenderer result = new DecoratorTableCellRenderer(decorator, true);
- return result;
- }
-
//------------------------------------------------------------------------//
//-- Internal methods (listener methods) --//
//------------------------------------------------------------------------//
@@ -686,55 +669,55 @@
//-- Public methods --//
//------------------------------------------------------------------------//
- public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
-
- boolean rightClick = SwingUtilities.isRightMouseButton(e);
-
- if (rightClick || SwingUtilities.isLeftMouseButton(e)) {
-
- // get the coordinates of the mouse click
- Point p = e.getPoint();
-
- JXTable source = (JXTable) e.getSource();
-
- int[] selectedRows = source.getSelectedRows();
-
- // get the row index at this point
- int rowIndex = source.rowAtPoint(p);
-
- if (log.isDebugEnabled()) {
- log.debug("At point [" + p + "] found Row " + rowIndex);
- }
-
- boolean canContinue = true;
-
- if (source.isEditing()) {
-
- // stop editing
- boolean stopEdit = source.getCellEditor().stopCellEditing();
- if (!stopEdit) {
- if (log.isWarnEnabled()) {
- log.warn("Could not stop edit cell...");
- }
- canContinue = false;
- }
- }
-
- if (canContinue) {
-
- // select row (could empty selection)
- if (rowIndex == -1) {
- source.clearSelection();
- } else if (!ArrayUtils.contains(selectedRows, rowIndex)) {
- source.setRowSelectionInterval(rowIndex, rowIndex);
- }
-
- if (rightClick) {
-
- // on right click show popup
- popup.show(source, e.getX(), e.getY());
- }
- }
- }
- }
+// public void autoSelectRowInTable(MouseEvent e, JPopupMenu popup) {
+//
+// boolean rightClick = SwingUtilities.isRightMouseButton(e);
+//
+// if (rightClick || SwingUtilities.isLeftMouseButton(e)) {
+//
+// // get the coordinates of the mouse click
+// Point p = e.getPoint();
+//
+// JXTable source = (JXTable) e.getSource();
+//
+// int[] selectedRows = source.getSelectedRows();
+//
+// // get the row index at this point
+// int rowIndex = source.rowAtPoint(p);
+//
+// if (log.isDebugEnabled()) {
+// log.debug("At point [" + p + "] found Row " + rowIndex);
+// }
+//
+// boolean canContinue = true;
+//
+// if (source.isEditing()) {
+//
+// // stop editing
+// boolean stopEdit = source.getCellEditor().stopCellEditing();
+// if (!stopEdit) {
+// if (log.isWarnEnabled()) {
+// log.warn("Could not stop edit cell...");
+// }
+// canContinue = false;
+// }
+// }
+//
+// if (canContinue) {
+//
+// // select row (could empty selection)
+// if (rowIndex == -1) {
+// source.clearSelection();
+// } else if (!ArrayUtils.contains(selectedRows, rowIndex)) {
+// source.setRowSelectionInterval(rowIndex, rowIndex);
+// }
+//
+// if (rightClick) {
+//
+// // on right click show popup
+// popup.show(source, e.getX(), e.getY());
+// }
+// }
+// }
+// }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/table/AbstractTuttiTableUIModel.java 2013-03-25 17:44:48 UTC (rev 678)
@@ -26,7 +26,6 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.ui.swing.content.operation.fishing.VesselUseFeatureRowModel;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
@@ -67,7 +66,7 @@
@Override
public void propertyChange(PropertyChangeEvent evt) {
- Set<VesselUseFeatureRowModel> rowsInErorr = (Set<VesselUseFeatureRowModel>) evt.getNewValue();
+ Set<R> rowsInErorr = (Set<R>) evt.getNewValue();
if (log.isDebugEnabled()) {
log.debug(PROPERTY_ROWS_IN_ERROR + " changed " + rowsInErorr.size());
}
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-03-25 17:44:48 UTC (rev 678)
@@ -485,40 +485,57 @@
tutti.editProgram.field.zone.tip=
tutti.editProgram.title.create.program=
tutti.editProgram.title.edit.program=
+tutti.editProtocol.action.addBenthosProtocol.mnemonic=
+tutti.editProtocol.action.addBenthosProtocol.tip=
tutti.editProtocol.action.addSpeciesProtocol.mnemonic=
tutti.editProtocol.action.addSpeciesProtocol.tip=
+tutti.editProtocol.action.chooseProtocolBenthosFile=
tutti.editProtocol.action.chooseProtocolCaracteristicFile=
tutti.editProtocol.action.chooseProtocolSpeciesFile=
+tutti.editProtocol.action.chooseProtocolbenthosFile=
tutti.editProtocol.action.closeEditProtocol=
tutti.editProtocol.action.closeEditProtocol.mnemonic=
tutti.editProtocol.action.closeEditProtocol.tip=
tutti.editProtocol.action.exportProtocolAllCaracteristic=
tutti.editProtocol.action.exportProtocolAllCaracteristic.mnemonic=
tutti.editProtocol.action.exportProtocolAllCaracteristic.tip=
+tutti.editProtocol.action.exportProtocolBenthos=
+tutti.editProtocol.action.exportProtocolBenthos.mnemonic=
+tutti.editProtocol.action.exportProtocolBenthos.tip=
tutti.editProtocol.action.exportProtocolCaracteristic=
tutti.editProtocol.action.exportProtocolCaracteristic.mnemonic=
tutti.editProtocol.action.exportProtocolCaracteristic.tip=
tutti.editProtocol.action.exportProtocolSpecies=
tutti.editProtocol.action.exportProtocolSpecies.mnemonic=
tutti.editProtocol.action.exportProtocolSpecies.tip=
+tutti.editProtocol.action.importProtocolBenthos=
+tutti.editProtocol.action.importProtocolBenthos.mnemonic=
+tutti.editProtocol.action.importProtocolBenthos.tip=
tutti.editProtocol.action.importProtocolCaracteristic=
tutti.editProtocol.action.importProtocolCaracteristic.mnemonic=
tutti.editProtocol.action.importProtocolCaracteristic.tip=
tutti.editProtocol.action.importProtocolSpecies=
tutti.editProtocol.action.importProtocolSpecies.mnemonic=
tutti.editProtocol.action.importProtocolSpecies.tip=
+tutti.editProtocol.action.removeBenthosProtocol=
+tutti.editProtocol.action.removeBenthosProtocol.mnemonic=
+tutti.editProtocol.action.removeBenthosProtocol.tip=
tutti.editProtocol.action.removeSpeciesProtocol=
tutti.editProtocol.action.removeSpeciesProtocol.mnemonic=
tutti.editProtocol.action.removeSpeciesProtocol.tip=
tutti.editProtocol.action.saveProtocol=
tutti.editProtocol.action.saveProtocol.mnemonic=
tutti.editProtocol.action.saveProtocol.tip=
+tutti.editProtocol.action.selectOtherBenthos=
+tutti.editProtocol.action.selectOtherBenthos.mnemonic=
+tutti.editProtocol.action.selectOtherBenthos.tip=
tutti.editProtocol.action.selectOtherSpecies=
tutti.editProtocol.action.selectOtherSpecies.mnemonic=
tutti.editProtocol.action.selectOtherSpecies.tip=
tutti.editProtocol.askCancelEditBeforeLeaving.cancelSaveProtocol=
tutti.editProtocol.askSaveBeforeLeaving.saveProtocol=
tutti.editProtocol.field..tip=
+tutti.editProtocol.field.benthos.tip=
tutti.editProtocol.field.comment=
tutti.editProtocol.field.comment.tip=
tutti.editProtocol.field.protocol.name=
@@ -553,6 +570,8 @@
tutti.editProtocol.table.header.speciesSurveyCode.tip=
tutti.editProtocol.table.header.weight=
tutti.editProtocol.table.header.weight.tip=
+tutti.editProtocol.title.choose.benthosExportFile=
+tutti.editProtocol.title.choose.benthosImportFile=
tutti.editProtocol.title.choose.caracteristicExportFile=
tutti.editProtocol.title.choose.caracteristicImportFile=
tutti.editProtocol.title.choose.speciesExportFile=
@@ -657,7 +676,14 @@
tutti.fishingOperations.title.edit.operations=
tutti.fishingOperations.title.validate.operations=
tutti.fishingOperations.warn.invalid.batch.model=
+tutti.flash.benthos.species.remove.from.protocol=
tutti.flash.info.all.caractristic.exported=
+tutti.flash.info.benthos.add.to.protocol=
+tutti.flash.info.benthos.imported.in.protocol=
+tutti.flash.info.benthos.imported.in.protocol.oneReplaced=
+tutti.flash.info.benthos.imported.in.protocol.severalReplaced=
+tutti.flash.info.benthos.remove.from.protocol=
+tutti.flash.info.benthos.replaced=
tutti.flash.info.caracteristic.imported.in.protocol=
tutti.flash.info.caractristic.exported.from.protocol=
tutti.flash.info.cruiseCreated=
@@ -834,6 +860,7 @@
tutti.sampleCategoryType.sex=
tutti.sampleCategoryType.size=
tutti.sampleCategoryType.sortedUnsorted=
+tutti.selectBenthos.title=
tutti.selectCruise.action.chooseProtocolFile=
tutti.selectCruise.action.cloneProtocol=
tutti.selectCruise.action.cloneProtocol.mnemonic=
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-03-24 15:40:11 UTC (rev 677)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-03-25 17:44:48 UTC (rev 678)
@@ -63,8 +63,6 @@
tutti.config.application=Configuration de l'application Tutti
tutti.config.category.applications=Application
tutti.config.category.applications.description=Application
-tutti.config.category.shortcuts=Raccourcis
-tutti.config.category.shortcuts.description=Liste des raccourcis clavier
tutti.config.category.technical=Technique
tutti.config.category.technical.description=Informations techniques
tutti.config.category.ui=Interface utilisateur
@@ -498,8 +496,11 @@
tutti.editProgram.field.zone.tip=
tutti.editProgram.title.create.program=Créer une nouvelle série de campagne
tutti.editProgram.title.edit.program=Éditer une série de campagne existante
+tutti.editProtocol.action.addBenthosProtocol.mnemonic=j
+tutti.editProtocol.action.addBenthosProtocol.tip=Ajouter un benthos au protocole
tutti.editProtocol.action.addSpeciesProtocol.mnemonic=j
tutti.editProtocol.action.addSpeciesProtocol.tip=Ajouter une espèce au protocole
+tutti.editProtocol.action.chooseProtocolBenthosFile=Choisir le fichier des benthos
tutti.editProtocol.action.chooseProtocolCaracteristicFile=Choisir le fichier des caractéristiques
tutti.editProtocol.action.chooseProtocolSpeciesFile=Choisir le fichier des espèces
tutti.editProtocol.action.closeEditProtocol=Fermer
@@ -508,34 +509,47 @@
tutti.editProtocol.action.exportProtocolAllCaracteristic=Exporter toutes les caractéristiques
tutti.editProtocol.action.exportProtocolAllCaracteristic.mnemonic=t
tutti.editProtocol.action.exportProtocolAllCaracteristic.tip=Exporter toutes les caractéristiques (sans les affecter à un écran)
+tutti.editProtocol.action.exportProtocolBenthos=Exporter les benthos
+tutti.editProtocol.action.exportProtocolBenthos.mnemonic=b
+tutti.editProtocol.action.exportProtocolBenthos.tip=Exporter les benthos du protocole
tutti.editProtocol.action.exportProtocolCaracteristic=Exporter les caractéristiques
tutti.editProtocol.action.exportProtocolCaracteristic.mnemonic=c
tutti.editProtocol.action.exportProtocolCaracteristic.tip=Exporter les caractéristiques du protocole
tutti.editProtocol.action.exportProtocolSpecies=Exporter les espèces
tutti.editProtocol.action.exportProtocolSpecies.mnemonic=è
tutti.editProtocol.action.exportProtocolSpecies.tip=Exporter les espèces du protocole
+tutti.editProtocol.action.importProtocolBenthos=Importer les benthos
+tutti.editProtocol.action.importProtocolBenthos.mnemonic=i
+tutti.editProtocol.action.importProtocolBenthos.tip=Importer les benthos dans le protocole
tutti.editProtocol.action.importProtocolCaracteristic=Importer les caractéristiques
tutti.editProtocol.action.importProtocolCaracteristic.mnemonic=i
-tutti.editProtocol.action.importProtocolCaracteristic.tip=importer les caractéristiques dans le protocole
+tutti.editProtocol.action.importProtocolCaracteristic.tip=Importer les caractéristiques dans le protocole
tutti.editProtocol.action.importProtocolSpecies=Importer les espèces
tutti.editProtocol.action.importProtocolSpecies.mnemonic=é
-tutti.editProtocol.action.importProtocolSpecies.tip=importer les espèces dans le protocole
+tutti.editProtocol.action.importProtocolSpecies.tip=Importer les espèces dans le protocole
+tutti.editProtocol.action.removeBenthosProtocol=Supprimer le benthos
+tutti.editProtocol.action.removeBenthosProtocol.mnemonic=S
+tutti.editProtocol.action.removeBenthosProtocol.tip=Supprimer le benthos
tutti.editProtocol.action.removeSpeciesProtocol=Supprimer l'espèce
tutti.editProtocol.action.removeSpeciesProtocol.mnemonic=S
tutti.editProtocol.action.removeSpeciesProtocol.tip=Supprimer l'espèce
tutti.editProtocol.action.saveProtocol=Enregistrer
tutti.editProtocol.action.saveProtocol.mnemonic=E
tutti.editProtocol.action.saveProtocol.tip=Enregistrer le protocol
+tutti.editProtocol.action.selectOtherBenthos=...
+tutti.editProtocol.action.selectOtherBenthos.mnemonic=.
+tutti.editProtocol.action.selectOtherBenthos.tip=Sélectionner une autre espèce
tutti.editProtocol.action.selectOtherSpecies=...
tutti.editProtocol.action.selectOtherSpecies.mnemonic=.
tutti.editProtocol.action.selectOtherSpecies.tip=Sélectionner une autre espèce
tutti.editProtocol.askCancelEditBeforeLeaving.cancelSaveProtocol=Le protocole n'est pas valide et ne peut pas être enregistré.
tutti.editProtocol.askSaveBeforeLeaving.saveProtocol=Des modifications sur le protocole n'ont pas été enregistrées.
+tutti.editProtocol.field.benthos.tip=Benthos
tutti.editProtocol.field.comment=Commentaire
-tutti.editProtocol.field.comment.tip=
+tutti.editProtocol.field.comment.tip=Commentaire
tutti.editProtocol.field.protocol.name=Nom
-tutti.editProtocol.field.protocol.name.tip=
-tutti.editProtocol.field.species.tip=
+tutti.editProtocol.field.protocol.name.tip=Nom du protocole
+tutti.editProtocol.field.species.tip=Espèces
tutti.editProtocol.tab.accidental=Accidental
tutti.editProtocol.tab.benthos=Benthos
tutti.editProtocol.tab.caracteristic=Caractéristiques
@@ -565,6 +579,8 @@
tutti.editProtocol.table.header.speciesSurveyCode.tip=Code campagne (non synchronisable)
tutti.editProtocol.table.header.weight=Pesée
tutti.editProtocol.table.header.weight.tip=Pesée
+tutti.editProtocol.title.choose.benthosExportFile=Exporter les benthos
+tutti.editProtocol.title.choose.benthosImportFile=Importer les benthos
tutti.editProtocol.title.choose.caracteristicExportFile=Exporter les caractéristiques
tutti.editProtocol.title.choose.caracteristicImportFile=Importer les caractéristiques
tutti.editProtocol.title.choose.speciesExportFile=Exporter les espèces
@@ -671,6 +687,13 @@
tutti.fishingOperations.title.validate.operations=Validation des opérations de pêches (%s)
tutti.fishingOperations.warn.invalid.batch.model=L'arbre d'échantillonage n'est pas compatible. Les captures ne seront pas visibles.
tutti.flash.info.all.caractristic.exported=Toutes les caractéristiques exportées dans le fichier <strong>%s</strong>.
+tutti.flash.info.benthos.add.to.protocol=Le benthos <strong>%s</strong> a été ajoutée au protocole.
+tutti.flash.info.benthos.exported.from.protocol=Benthos du protocole exportées dans le fichier <strong>%s</strong>.
+tutti.flash.info.benthos.imported.in.protocol=Benthos importés dans le protocole depuis le fichier <strong>%s</strong>.
+tutti.flash.info.benthos.imported.in.protocol.oneReplaced=Benthos importés dans le protocole depuis le fichier <strong>%s</strong>. 1 remplacée par son référent.
+tutti.flash.info.benthos.imported.in.protocol.severalReplaced=Benthos importés dans le protocole depuis le fichier <strong>%s</strong>. %s remplacées par leur référent.
+tutti.flash.info.benthos.remove.from.protocol=Le benthos <strong>%s</strong> a été retiré du protocole.
+tutti.flash.info.benthos.replaced=Le benthos <strong>%s</strong> a été remplacé par son référent <strong>%s</strong>.
tutti.flash.info.caracteristic.imported.in.protocol=Caractéristiques importées dans le protocole depuis le fichier <strong>%s</strong>.
tutti.flash.info.caractristic.exported.from.protocol=Caractéristiques du protocole exportées dans le fichier <strong>%s</strong>.
tutti.flash.info.cruiseCreated=La campagne <strong>%s</strong> a été créée.
@@ -679,7 +702,6 @@
tutti.flash.info.db.exported=Base exportée dans l'archive <strong>%s</strong>.
tutti.flash.info.db.exported.and.clean=Base exportée dans l'archive <strong>%s</strong>.
tutti.flash.info.db.imported=La base de données <strong>%s</strong> est importée.
-tutti.flash.info.db.installed=La base de données <strong>%s</strong> est installée.
tutti.flash.info.db.opened=La base de données <strong>%s</strong> est ouverte.
tutti.flash.info.programCreated=La série de campagne <strong>%s</strong> a été créée.
tutti.flash.info.programSaved=La série de campagne <strong>%s</strong> a été enregistrée.
@@ -846,6 +868,7 @@
tutti.sampleCategoryType.sex=Sexe
tutti.sampleCategoryType.size=Class Tri.
tutti.sampleCategoryType.sortedUnsorted=V/HV
+tutti.selectBenthos.title=Choisissez un benthos
tutti.selectCruise.action.chooseProtocolFile=Choisir le fichier de protocole
tutti.selectCruise.action.cloneProtocol=Cloner
tutti.selectCruise.action.cloneProtocol.mnemonic=o
1
0
24 Mar '13
See <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/5…>
Changes:
[Tony Chemit] refs #1863: [BENTHOS] - Gestion de la saisie du benthos
- impact sur service de persistence
- debut de reusinage des APi d'ui
------------------------------------------
projectStarted fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutti :: Persistence 1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
mojoStarted org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tutti-persistence ---
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
mojoSucceeded org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
mojoStarted org.apache.maven.plugins:maven-enforcer-plugin:1.2(check-project-files)
[INFO]
[INFO] --- maven-enforcer-plugin:1.2:enforce (check-project-files) @ tutti-persistence ---
mojoSucceeded org.apache.maven.plugins:maven-enforcer-plugin:1.2(check-project-files)
mojoStarted org.nuiton.eugene:eugene-maven-plugin:2.6.1(default)
[INFO]
[INFO] --- eugene-maven-plugin:2.6.1:generate (default) @ tutti-persistence ---
[INFO] Process phase [zargo] for one entry.
[INFO] Expanding 1 xmi file(s) from <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Will generate <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Copy file <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…> to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Generate one file in 348.113ms.
[INFO] Process phase [xmi] for one entry.
[INFO] Processing XSL tranformation on <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…> for 1 file(s).
[INFO] Will generate <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Copy file <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…> to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Generate one file in 8.289s.
[INFO] Process phase [model] for one entry.
WARN [pool-1-thread-1] (ObjectModelReader.java:580) getObjectElements - Invalid stereotype [fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.hydrologyPmfmId.stereotype] : Element 'hydrologyPmfmId' of type 'attribute' on classifier 'fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol' is null.
INFO [pool-1-thread-1] (ObjectModelReader.java:273) loadModelProperties - 19 tag values were succesfull imported from <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Apply generator JavaInterfaceTransformer
[INFO] Apply generator SimpleJavaBeanTransformer
INFO [pool-1-thread-1] (ObjectModelTransformerToJava.java:911) isInClassPath - Will not generate [fr.ifremer.tutti.persistence.entities.data.Program], already found in class-path.
[INFO] Apply generator JavaEnumerationTransformer
INFO [pool-1-thread-1] (ObjectModelTransformerToJava.java:911) isInClassPath - Will not generate [fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum], already found in class-path.
INFO [pool-1-thread-1] (ObjectModelTransformerToJava.java:911) isInClassPath - Will not generate [fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum], already found in class-path.
[INFO] No file generated.
[INFO] Add compile source root : <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Add resource root :Resource {targetPath: null, filtering: false, FileSet {directory: <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…,> PatternSet [includes: {}, excludes: {**/*.java}]}}
mojoSucceeded org.nuiton.eugene:eugene-maven-plugin:2.6.1(default)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserJava (scan-sources) @ tutti-persistence ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(get)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:get (get) @ tutti-persistence ---
[INFO] Copying tutti-persistence.properties to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Copying tutti-persistence.properties to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(get)
forkedProjectSucceeded fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:gen (scan-sources) @ tutti-persistence ---
[WARNING] bundle en_GB contains 27/27 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
mojoStarted org.apache.maven.plugins:maven-resources-plugin:2.6(default-resources)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tutti-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 8 resources
[INFO] Copying 0 resource
mojoSucceeded org.apache.maven.plugins:maven-resources-plugin:2.6(default-resources)
mojoStarted org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-compile)
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ tutti-persistence ---
[INFO] Compiling 88 source files to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
mojoSucceeded org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-compile)
mojoStarted org.apache.maven.plugins:maven-antrun-plugin:1.7(generate-surefire-workdir)
[INFO]
[INFO] --- maven-antrun-plugin:1.7:run (generate-surefire-workdir) @ tutti-persistence ---
[INFO] Executing tasks
main:
[mkdir] Created dir: <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] Executed tasks
mojoSucceeded org.apache.maven.plugins:maven-antrun-plugin:1.7(generate-surefire-workdir)
mojoStarted org.apache.maven.plugins:maven-resources-plugin:2.6(default-testResources)
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ tutti-persistence ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 5 resources
mojoSucceeded org.apache.maven.plugins:maven-resources-plugin:2.6(default-testResources)
mojoStarted org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-testCompile)
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ tutti-persistence ---
[INFO] Compiling 29 source files to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] bootstrap class path not set in conjunction with -source 1.6
<http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-persistence/w…>:[858,15] error: no suitable method found for getSpeciesBatch(String,BatchContainer<SpeciesBatch>)
[INFO] 1 error
[INFO] -------------------------------------------------------------
mojoFailed org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-testCompile)
projectFailed fr.ifremer.tutti:tutti-persistence:1.2-SNAPSHOT
1
12