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
April 2013
- 5 participants
- 210 discussions
r720 - in trunk/tutti-persistence/src: main/java/fr/ifremer/tutti/persistence/service main/java/fr/ifremer/tutti/persistence/service/batch main/resources main/resources/i18n test test/java/fr/ifremer/tutti/persistence test/java/fr/ifremer/tutti/persistence/service test/java/fr/ifremer/tutti/persistence/service/synchro test/resources
by tchemit@users.forge.codelutin.com 03 Apr '13
by tchemit@users.forge.codelutin.com 03 Apr '13
03 Apr '13
Author: tchemit
Date: 2013-04-03 17:14:47 +0200 (Wed, 03 Apr 2013)
New Revision: 720
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/720
Log:
fixes #2068: [REFERENTIEL] Cr?\195?\169ation d'un nouveau pmfm pour la s?\195?\169rie partielle d'une campagne (SURVEY_PART)
fixes #2228: [REFERENTIEL] Cr?\195?\169er le pmfm Vivant non tri?\195?\169 / Inerte / Vivant
refs #1865: [MACRODECHET] - Gestion de la saisie des Macrod?\195?\169chets (sauvegarde du catchBatch)
refs #2227: [CAPTURE] Revoir la structure de l'arbre d'?\195?\169chantillonage (normalement ok, a bien tester)
Added:
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceCopyTest.java
trunk/tutti-persistence/src/test/resources/tutti-test-read-dbEmpty.properties
trunk/tutti-persistence/src/test/resources/tutti-test-write-dbEmpty.properties
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java
trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties
trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties
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/CatchBatchPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeHelperTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceImplTest.java
trunk/tutti-persistence/src/test/server.properties
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -89,7 +89,9 @@
// Vrac / Benthos
SortingBatch vracSpeciesBatch = catchBatchDao.getSortingBatch(catchBatchChils,
"pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+ "pmfmId", enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+ );
BatchContainer<SpeciesBatch> result = new BatchContainer<SpeciesBatch>();
result.setId(vracSpeciesBatch.getId());
@@ -97,17 +99,11 @@
for (Batch batch1 : vracSpeciesBatch.getChildBatchs()) {
SortingBatch source = (SortingBatch) batch1;
- // evict some special batches : Life (or Biota) and Inert
- if (source.getReferenceTaxon() != null
- && !enumeration.REFERENCE_TAXON_ID_LIFE.equals(source.getReferenceTaxon().getId())
- && !enumeration.REFERENCE_TAXON_ID_INERT.equals(source.getReferenceTaxon().getId())) {
-
- SpeciesBatch target = TuttiBeanFactory.newSpeciesBatch();
- batchHelper.entityToSpeciesBatch(source, target);
- result.addChildren(target);
- if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Vrac > Benthos > " + target.getSpecies().getReferenceTaxonId() + " : " + target.getId());
- }
+ SpeciesBatch target = TuttiBeanFactory.newSpeciesBatch();
+ batchHelper.entityToSpeciesBatch(source, target);
+ result.addChildren(target);
+ if (log.isInfoEnabled()) {
+ log.info("Loaded CatchBatch Vrac > Benthos > " + target.getSpecies().getReferenceTaxonId() + " : " + target.getId());
}
}
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -38,7 +38,6 @@
import fr.ifremer.adagio.core.dao.data.measure.SortingMeasurement;
import fr.ifremer.adagio.core.dao.data.operation.FishingOperationImpl;
import fr.ifremer.adagio.core.dao.referential.QualityFlagImpl;
-import fr.ifremer.adagio.core.dao.referential.taxon.ReferenceTaxonImpl;
import fr.ifremer.adagio.core.dao.technical.synchronization.SynchronizationStatus;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.CatchBatchBean;
@@ -99,7 +98,7 @@
Integer catchBatchId = catchBatchDao.getIdByFishingOperationId(Integer.valueOf(fishingOperationId));
Preconditions.checkNotNull(catchBatchId);
- // wenever want to repair anything from Tutti
+ // whenever want to repair anything from Tutti
fr.ifremer.adagio.core.dao.data.batch.CatchBatch source = catchBatchDao.loadFullTree(catchBatchId, true, false);
CatchBatch result = new CatchBatchBean();
@@ -111,8 +110,11 @@
}
// Vrac
- SortingBatch vracBatch = catchBatchDao.getSortingBatch(source.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID);
+ SortingBatch vracBatch = catchBatchDao.getSortingBatch(
+ source.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_VRAC_ID);
if (log.isInfoEnabled()) {
log.info("Loaded CatchBatch Vrac: " + vracBatch.getId());
}
@@ -120,41 +122,55 @@
result.setCatchTotalSortedTremisWeight(vracBatch.getWeightBeforeSampling());
{
// Vrac > Species
- SortingBatch speciesBatch = catchBatchDao.getSortingBatch(vracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch speciesBatch = catchBatchDao.getSortingBatch(
+ vracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Vrac > Species : " + speciesBatch.getId());
+ log.info("Loaded CatchBatch Vrac > Species: " + speciesBatch.getId());
}
result.setSpeciesTotalSortedWeight(speciesBatch.getWeight());
{
// Vrac > Species > Inert
- SortingBatch inertBatch = catchBatchDao.getSortingBatch(speciesBatch.getChildBatchs(),
- "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_INERT);
+ SortingBatch inertBatch = catchBatchDao.getSortingBatch(
+ speciesBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
- if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Vrac > Species > Inert: " + inertBatch.getId());
- }
+
if (inertBatch != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loaded CatchBatch Vrac > Species > Inert: " + inertBatch.getId());
+ }
result.setSpeciesTotalInertWeight(inertBatch.getWeight());
}
- // Vrac > Species > Alive no itemized
- SortingBatch livingNotItemizedBatch = catchBatchDao.getSortingBatch(speciesBatch.getChildBatchs(),
- "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_LIFE);
- if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Vrac > Species > Alive not itemized: " + livingNotItemizedBatch.getId());
- }
+ // Vrac > Species > Alive not itemized
+ SortingBatch livingNotItemizedBatch = catchBatchDao.getSortingBatch(
+ speciesBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
+
if (livingNotItemizedBatch != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loaded CatchBatch Vrac > Species > Alive not itemized: " + livingNotItemizedBatch.getId());
+ }
result.setSpeciesTotalLivingNotItemizedWeight(livingNotItemizedBatch.getWeight());
}
}
// Vrac > Benthos
- SortingBatch benthosBatch = catchBatchDao.getSortingBatch(vracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ SortingBatch benthosBatch = catchBatchDao.getSortingBatch(
+ vracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
if (log.isInfoEnabled()) {
log.info("Loaded CatchBatch Vrac > Benthos: " + benthosBatch.getId());
@@ -164,22 +180,30 @@
{
// Vrac > Benthos > Inert
- SortingBatch inertBatch = catchBatchDao.getSortingBatch(benthosBatch.getChildBatchs(),
- "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_INERT);
- if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Vrac > Benthos > Inert: " + inertBatch.getId());
- }
+ SortingBatch inertBatch = catchBatchDao.getSortingBatch(
+ benthosBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
+
if (inertBatch != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loaded CatchBatch Vrac > Benthos > Inert: " + inertBatch.getId());
+ }
result.setBenthosTotalInertWeight(inertBatch.getWeight());
}
// Vrac > Benthos > Alive no itemized
- SortingBatch livingNotItemizedBatch = catchBatchDao.getSortingBatch(benthosBatch.getChildBatchs(),
- "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_LIFE);
- if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Vrac > Benthos > Alive not itemized: " + livingNotItemizedBatch.getId());
- }
+ SortingBatch livingNotItemizedBatch = catchBatchDao.getSortingBatch(
+ benthosBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
+
if (livingNotItemizedBatch != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loaded CatchBatch Vrac > Benthos > Alive not itemized: " + livingNotItemizedBatch.getId());
+ }
result.setBenthosTotalLivingNotItemizedWeight(livingNotItemizedBatch.getWeight());
}
}
@@ -188,16 +212,22 @@
}
// Hors Vrac
- SortingBatch horsVracBatch = catchBatchDao.getSortingBatch(source.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID);
+ SortingBatch horsVracBatch = catchBatchDao.getSortingBatch(
+ source.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_HORS_VRAC_ID);
if (horsVracBatch != null) {
if (log.isInfoEnabled()) {
log.info("Loaded CatchBatch Hors Vrac: " + horsVracBatch.getId());
}
{
// Hors Vrac > Species
- SortingBatch speciesBatch = catchBatchDao.getSortingBatch(horsVracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch speciesBatch = catchBatchDao.getSortingBatch(
+ horsVracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (speciesBatch != null) {
if (log.isInfoEnabled()) {
@@ -206,8 +236,11 @@
}
// Hors Vrac > Benthos
- SortingBatch benthosBatch = catchBatchDao.getSortingBatch(horsVracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ SortingBatch benthosBatch = catchBatchDao.getSortingBatch(
+ horsVracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
if (benthosBatch != null) {
@@ -217,14 +250,19 @@
}
// Hors Vrac > MarineLitter
- SortingBatch marineLitterBatch = catchBatchDao.getSortingBatch(horsVracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+ SortingBatch marineLitterBatch = catchBatchDao.getSortingBatch(
+ horsVracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
if (marineLitterBatch != null) {
if (log.isInfoEnabled()) {
log.info("Loaded CatchBatch Hors Vrac> MarineLitter: " + marineLitterBatch.getId());
}
+
+ result.setMarineLitterTotalWeight(marineLitterBatch.getWeight());
}
// TODO : Plancton...
@@ -232,12 +270,16 @@
}
// Non trié
- SortingBatch unsortedBatch = catchBatchDao.getSortingBatch(source.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_UNSORTED_ID);
- if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Unsorted: " + unsortedBatch.getId());
- }
+ SortingBatch unsortedBatch = catchBatchDao.getSortingBatch(
+ source.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_UNSORTED_ID);
+
if (unsortedBatch != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loaded CatchBatch Unsorted: " + unsortedBatch.getId());
+ }
result.setCatchTotalRejectedWeight(unsortedBatch.getWeight());
}
@@ -348,9 +390,14 @@
target.getChildBatchs().add(batch);
}
//FIXME-TC what is the point catchTotalSortedCarousselWeight and catchTotalSortedTremisWeight ?
- beanToEntitySortingBatch(target, target, batch, recorderDepartmentId,
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
- source.getCatchTotalSortedCarousselWeight(), source.getCatchTotalSortedTremisWeight());
+ beanToEntitySortingBatch(target,
+ target,
+ batch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_VRAC_ID,
+ source.getCatchTotalSortedCarousselWeight(),
+ source.getCatchTotalSortedTremisWeight());
batch.setRankOrder((short) 1);
// Manage childs :
@@ -364,14 +411,19 @@
// -----------------------------------------------------------------------------
// Vrac / Species
// -----------------------------------------------------------------------------
+
SortingBatch speciesBatch = batchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (speciesBatch == null) {
speciesBatch = SortingBatch.Factory.newInstance();
batch.getChildBatchs().add(speciesBatch);
}
- beanToEntitySortingBatch(target, batch, speciesBatch, recorderDepartmentId,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+ beanToEntitySortingBatch(target,
+ batch,
+ speciesBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
source.getSpeciesTotalSortedWeight(),
null);
speciesBatch.setRankOrder((short) 1);
@@ -380,38 +432,68 @@
if (speciesBatch.getChildBatchs() == null) {
speciesBatch.setChildBatchs(Lists.<Batch>newArrayList());
}
+
+ Map<Integer, SortingBatch> speciesBatchChilds = getChildsMap(speciesBatch, enumeration.PMFM_ID_SORTING_TYPE_2);
+
// -----------------------------------------------------------------------------
// Vrac / Species / Alive not itemized
// -----------------------------------------------------------------------------
- SortingBatch aliveNotItemizedBatch = catchBatchDao.getSortingBatch(speciesBatch.getChildBatchs(), "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_LIFE);
+ SortingBatch aliveNotItemizedBatch = speciesBatchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
if (aliveNotItemizedBatch == null) {
aliveNotItemizedBatch = SortingBatch.Factory.newInstance();
speciesBatch.getChildBatchs().add(aliveNotItemizedBatch);
}
- //TODO beanToEntitySortingBatch avec nouveau psfm
- beanToEntityReferenceTaxonBatch(target, speciesBatch, aliveNotItemizedBatch, recorderDepartmentId,
- enumeration.REFERENCE_TAXON_ID_LIFE,
- source.getSpeciesTotalLivingNotItemizedWeight(), null);
+ beanToEntitySortingBatch(target,
+ speciesBatch,
+ aliveNotItemizedBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED,
+ source.getSpeciesTotalLivingNotItemizedWeight(),
+ null);
aliveNotItemizedBatch.setRankOrder((short) 1);
// -----------------------------------------------------------------------------
// Vrac / Species / Inert (not alive)
// -----------------------------------------------------------------------------
- SortingBatch inertBatch = catchBatchDao.getSortingBatch(speciesBatch.getChildBatchs(), "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_INERT);
+
+ SortingBatch inertBatch = speciesBatchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
if (inertBatch == null) {
inertBatch = SortingBatch.Factory.newInstance();
speciesBatch.getChildBatchs().add(inertBatch);
}
- //TODO beanToEntitySortingBatch avec nouveau psfm
- beanToEntityReferenceTaxonBatch(target, speciesBatch, inertBatch, recorderDepartmentId,
- enumeration.REFERENCE_TAXON_ID_INERT,
- source.getSpeciesTotalInertWeight(),
- null);
+
+ beanToEntitySortingBatch(target,
+ speciesBatch,
+ inertBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT,
+ source.getSpeciesTotalInertWeight(),
+ null);
inertBatch.setRankOrder((short) 2);
- // TODO Créer le noeud Vivant trié
+ // -----------------------------------------------------------------------------
+ // Vrac / Species / Alive itemized
+ // -----------------------------------------------------------------------------
+
+ SortingBatch aliveItemizedBatch = speciesBatchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
+ if (aliveItemizedBatch == null) {
+ aliveItemizedBatch = SortingBatch.Factory.newInstance();
+ speciesBatch.getChildBatchs().add(aliveItemizedBatch);
+ }
+
+ beanToEntitySortingBatch(target,
+ speciesBatch,
+ aliveItemizedBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED,
+ null,
+ null);
+ aliveItemizedBatch.setRankOrder((short) 3);
}
// -----------------------------------------------------------------------------
@@ -419,12 +501,17 @@
// -----------------------------------------------------------------------------
SortingBatch benthosBatch = batchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+
if (benthosBatch == null) {
benthosBatch = SortingBatch.Factory.newInstance();
batch.getChildBatchs().add(benthosBatch);
}
- beanToEntitySortingBatch(target, batch, benthosBatch, recorderDepartmentId,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+ beanToEntitySortingBatch(target,
+ batch,
+ benthosBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
source.getBenthosTotalSortedWeight(),
null);
benthosBatch.setRankOrder((short) 2);
@@ -435,38 +522,70 @@
benthosBatch.setChildBatchs(Lists.<Batch>newArrayList());
}
+ Map<Integer, SortingBatch> benthosBatchChilds = getChildsMap(benthosBatch, enumeration.PMFM_ID_SORTING_TYPE_2);
+
// -----------------------------------------------------------------------------
// Vrac / Benthos / Alive not itemized
// -----------------------------------------------------------------------------
- SortingBatch aliveNotItemizedBatch = catchBatchDao.getSortingBatch(benthosBatch.getChildBatchs(), "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_LIFE);
+ SortingBatch aliveNotItemizedBatch = benthosBatchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
if (aliveNotItemizedBatch == null) {
aliveNotItemizedBatch = SortingBatch.Factory.newInstance();
benthosBatch.getChildBatchs().add(aliveNotItemizedBatch);
}
- beanToEntityReferenceTaxonBatch(target, benthosBatch, aliveNotItemizedBatch, recorderDepartmentId,
- enumeration.REFERENCE_TAXON_ID_LIFE,
- source.getBenthosTotalLivingNotItemizedWeight(),
- null);
+
+ beanToEntitySortingBatch(target,
+ benthosBatch,
+ aliveNotItemizedBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED,
+ source.getBenthosTotalLivingNotItemizedWeight(),
+ null);
aliveNotItemizedBatch.setRankOrder((short) 1);
// -----------------------------------------------------------------------------
- // Vrac / Species / Inert (not alive)
+ // Vrac / Benthos / Inert (not alive)
// -----------------------------------------------------------------------------
- SortingBatch inertBatch = catchBatchDao.getSortingBatch(benthosBatch.getChildBatchs(), "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_INERT);
+ SortingBatch inertBatch = benthosBatchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
if (inertBatch == null) {
inertBatch = SortingBatch.Factory.newInstance();
benthosBatch.getChildBatchs().add(inertBatch);
}
- beanToEntityReferenceTaxonBatch(target, benthosBatch, inertBatch, recorderDepartmentId,
- enumeration.REFERENCE_TAXON_ID_INERT,
- source.getBenthosTotalInertWeight(),
- null);
+
+ beanToEntitySortingBatch(target,
+ benthosBatch,
+ inertBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT,
+ source.getBenthosTotalInertWeight(),
+ null);
inertBatch.setRankOrder((short) 2);
+
+ // -----------------------------------------------------------------------------
+ // Vrac / Benthos / Alive itemized
+ // -----------------------------------------------------------------------------
+
+ SortingBatch aliveItemizedBatch = benthosBatchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
+ if (aliveItemizedBatch == null) {
+ aliveItemizedBatch = SortingBatch.Factory.newInstance();
+ benthosBatch.getChildBatchs().add(aliveItemizedBatch);
+ }
+
+ beanToEntitySortingBatch(target,
+ benthosBatch,
+ aliveItemizedBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED,
+ null,
+ null);
+ aliveItemizedBatch.setRankOrder((short) 3);
}
- // TODO plancton, macro déchet...
+ // TODO plancton
}
}
@@ -479,8 +598,12 @@
batch = SortingBatch.Factory.newInstance();
target.getChildBatchs().add(batch);
}
- beanToEntitySortingBatch(target, target, batch, recorderDepartmentId,
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_HORS_VRAC_ID,
+ beanToEntitySortingBatch(target,
+ target,
+ batch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_HORS_VRAC_ID,
null,
null);
batch.setRankOrder((short) 2);
@@ -490,7 +613,7 @@
Map<Integer, SortingBatch> batchChilds = getChildsMap(batch, enumeration.PMFM_ID_SORTING_TYPE);
// -----------------------------------------------------------------------------
- // Hors Vrac > Species :
+ // Hors Vrac > Species
// -----------------------------------------------------------------------------
{
SortingBatch speciesBatch = batchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
@@ -502,15 +625,19 @@
batch.getChildBatchs().add(speciesBatch);
}
}
- beanToEntitySortingBatch(target, batch, speciesBatch, recorderDepartmentId,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+ beanToEntitySortingBatch(target,
+ batch,
+ speciesBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
null,
null);
speciesBatch.setRankOrder((short) 1);
}
// -----------------------------------------------------------------------------
- // Hors Vrac > Benthos :
+ // Hors Vrac > Benthos
// -----------------------------------------------------------------------------
{
SortingBatch benthosBatch = batchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
@@ -518,14 +645,38 @@
benthosBatch = SortingBatch.Factory.newInstance();
batch.getChildBatchs().add(benthosBatch);
}
- beanToEntitySortingBatch(target, batch, benthosBatch, recorderDepartmentId,
- enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
+ beanToEntitySortingBatch(target,
+ batch,
+ benthosBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS,
null,
null);
benthosBatch.setRankOrder((short) 2);
}
- // TODO : plancton, macro déchet...
+ // -----------------------------------------------------------------------------
+ // Hors Vrac > MarineLitter
+ // -----------------------------------------------------------------------------
+ {
+ SortingBatch marineLitterBatch = batchChilds.get(enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+ if (marineLitterBatch == null) {
+ marineLitterBatch = SortingBatch.Factory.newInstance();
+ batch.getChildBatchs().add(marineLitterBatch);
+ }
+ beanToEntitySortingBatch(target,
+ batch,
+ marineLitterBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER,
+ source.getMarineLitterTotalWeight(),
+ null);
+ marineLitterBatch.setRankOrder((short) 3);
+ }
+
+ // TODO : plancton
}
}
@@ -539,8 +690,12 @@
unsortedBatch = SortingBatch.Factory.newInstance();
target.getChildBatchs().add(unsortedBatch);
}
- beanToEntitySortingBatch(target, target, unsortedBatch, recorderDepartmentId,
- enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_UNSORTED_ID,
+ beanToEntitySortingBatch(target,
+ target,
+ unsortedBatch,
+ recorderDepartmentId,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_UNSORTED_ID,
source.getCatchTotalRejectedWeight(),
null);
unsortedBatch.setRankOrder((short) 3);
@@ -564,8 +719,8 @@
protected void beanToEntitySortingBatch(
fr.ifremer.adagio.core.dao.data.batch.CatchBatch rootBatch,
- fr.ifremer.adagio.core.dao.data.batch.Batch parentBatch,
- fr.ifremer.adagio.core.dao.data.batch.SortingBatch target,
+ Batch parentBatch,
+ SortingBatch target,
Integer recorderDepartmentId,
Integer sortingPmfmId,
Integer sortingQualitativeValueId,
@@ -586,7 +741,8 @@
}
// Some mandatory properties :
- target.setQualityFlag(load(QualityFlagImpl.class, enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED));
+ QualityFlagImpl qualityFlag = load(QualityFlagImpl.class, enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED);
+ target.setQualityFlag(qualityFlag);
target.setRootBatch(rootBatch);
target.setParentBatch(parentBatch);
target.setExhaustiveInventory(true);
@@ -636,71 +792,71 @@
}
}
- protected void beanToEntityReferenceTaxonBatch(
- fr.ifremer.adagio.core.dao.data.batch.CatchBatch rootBatch,
- fr.ifremer.adagio.core.dao.data.batch.Batch parentBatch,
- fr.ifremer.adagio.core.dao.data.batch.SortingBatch target,
- Integer recorderDepartmentId,
- Integer referenceTaxonId,
- Float weight,
- Float sampleWeight) {
+// protected void beanToEntityReferenceTaxonBatch(
+// fr.ifremer.adagio.core.dao.data.batch.CatchBatch rootBatch,
+// Batch parentBatch,
+// SortingBatch target,
+// Integer recorderDepartmentId,
+// Integer referenceTaxonId,
+// Float weight,
+// Float sampleWeight) {
+//
+// Collection<QuantificationMeasurement> quantificationMeasurements = target.getQuantificationMeasurements();
+// Collection<SortingMeasurement> sortingMeasurements = target.getSortingMeasurements();
+//
+// // Create lists to store all updates, then remove not updated items
+// Set<QuantificationMeasurement> notChangedQuantificationMeasurements = Sets.newHashSet();
+// if (quantificationMeasurements != null) {
+// notChangedQuantificationMeasurements.addAll(quantificationMeasurements);
+// }
+// Set<SortingMeasurement> notChangedSortingMeasurements = Sets.newHashSet();
+// if (sortingMeasurements != null) {
+// notChangedSortingMeasurements.addAll(sortingMeasurements);
+// }
+//
+// // Some mandatory properties :
+// target.setQualityFlag(load(QualityFlagImpl.class, enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED));
+// target.setRootBatch(rootBatch);
+// target.setParentBatch(parentBatch);
+// target.setExhaustiveInventory(true);
+//
+// // Reference taxon
+// target.setReferenceTaxon(load(ReferenceTaxonImpl.class, referenceTaxonId));
+// target.setTaxonGroup(null);
+//
+// // Sampling Ratio
+// if ((sampleWeight == null || weight == null)) {
+// target.setSamplingRatio(null);
+// target.setSamplingRatioText(null);
+// } else {
+// String samplingRatioText = weight + "/" + sampleWeight;
+// samplingRatioText = samplingRatioText.replaceAll(",", ".");
+// target.setSamplingRatioText(samplingRatioText);
+// target.setSamplingRatio(weight / sampleWeight);
+// }
+//
+// // Weight
+// if ((sampleWeight == null && weight == null)) {
+// // Nothing to do : will be removed later, using notChangedQuantificationMeasurements
+// } else {
+// Float batchReferenceWeight = weight;
+// if (batchReferenceWeight == null) {
+// batchReferenceWeight = sampleWeight;
+// }
+// QuantificationMeasurement quantificationMeasurement = catchBatchDao.setQuantificationMeasurement(target,
+// enumeration.PMFM_ID_WEIGHT_MEASURED, recorderDepartmentId, batchReferenceWeight, true);
+// notChangedQuantificationMeasurements.remove(quantificationMeasurement);
+// }
+//
+// // Removed not changed measurements (in sorting and quantification measurement lists)
+// if (quantificationMeasurements != null) {
+// quantificationMeasurements.removeAll(notChangedQuantificationMeasurements);
+// }
+// if (sortingMeasurements != null) {
+// sortingMeasurements.removeAll(notChangedSortingMeasurements);
+// }
+// }
- Collection<QuantificationMeasurement> quantificationMeasurements = target.getQuantificationMeasurements();
- Collection<SortingMeasurement> sortingMeasurements = target.getSortingMeasurements();
-
- // Create lists to store all updates, then remove not updated items
- Set<QuantificationMeasurement> notChangedQuantificationMeasurements = Sets.newHashSet();
- if (quantificationMeasurements != null) {
- notChangedQuantificationMeasurements.addAll(quantificationMeasurements);
- }
- Set<SortingMeasurement> notChangedSortingMeasurements = Sets.newHashSet();
- if (sortingMeasurements != null) {
- notChangedSortingMeasurements.addAll(sortingMeasurements);
- }
-
- // Some mandatory properties :
- target.setQualityFlag(load(QualityFlagImpl.class, enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED));
- target.setRootBatch(rootBatch);
- target.setParentBatch(parentBatch);
- target.setExhaustiveInventory(true);
-
- // Reference taxon
- target.setReferenceTaxon(load(ReferenceTaxonImpl.class, referenceTaxonId));
- target.setTaxonGroup(null);
-
- // Sampling Ratio
- if ((sampleWeight == null || weight == null)) {
- target.setSamplingRatio(null);
- target.setSamplingRatioText(null);
- } else {
- String samplingRatioText = weight + "/" + sampleWeight;
- samplingRatioText = samplingRatioText.replaceAll(",", ".");
- target.setSamplingRatioText(samplingRatioText);
- target.setSamplingRatio(weight / sampleWeight);
- }
-
- // Weight
- if ((sampleWeight == null && weight == null)) {
- // Nothing to do : will be removed later, using notChangedQuantificationMeasurements
- } else {
- Float batchReferenceWeight = weight;
- if (batchReferenceWeight == null) {
- batchReferenceWeight = sampleWeight;
- }
- QuantificationMeasurement quantificationMeasurement = catchBatchDao.setQuantificationMeasurement(target,
- enumeration.PMFM_ID_WEIGHT_MEASURED, recorderDepartmentId, batchReferenceWeight, true);
- notChangedQuantificationMeasurements.remove(quantificationMeasurement);
- }
-
- // Removed not changed measurements (in sorting and quantification measurement lists)
- if (quantificationMeasurements != null) {
- quantificationMeasurements.removeAll(notChangedQuantificationMeasurements);
- }
- if (sortingMeasurements != null) {
- sortingMeasurements.removeAll(notChangedSortingMeasurements);
- }
- }
-
protected Integer getRecorderDepartmentId() {
// TODO BL : voir si on peut récupérer le departement (du 1er saisisseur ?)
return enumeration.DEPARTMENT_ID_UNKNOWN_RECORDER_DEPARTMENT;
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -74,13 +74,13 @@
@Resource(name = "batchPersistenceHelper")
protected BatchPersistenceHelper batchHelper;
- Integer marineLitterCategory;
+ protected Integer marineLitterCategory;
- Integer marineLitterSizeCategory;
+ protected Integer marineLitterSizeCategory;
- Map<Integer, CaracteristicQualitativeValue> marineLitterCategoryCaracteristicValues;
+ protected Map<Integer, CaracteristicQualitativeValue> marineLitterCategoryCaracteristicValues;
- Map<Integer, CaracteristicQualitativeValue> marineLitterSizeCategoryCaracteristicValues;
+ protected Map<Integer, CaracteristicQualitativeValue> marineLitterSizeCategoryCaracteristicValues;
@Override
public void init() {
@@ -111,12 +111,15 @@
// Vrac / Marine Litter
SortingBatch vracMarineLitterBatch = catchBatchDao.getSortingBatch(
catchBatchChilds,
- "pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_HORS_VRAC_ID,
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
- // container of speciesBatch is arbitraty put on vrac type (there is
- // no common ancestor for all species batch).
BatchContainer<MarineLitterBatch> result = new BatchContainer<>();
+
result.setId(vracMarineLitterBatch.getId());
for (Batch batch1 : vracMarineLitterBatch.getChildBatchs()) {
@@ -143,8 +146,8 @@
Preconditions.checkArgument(bean.getId() == null);
Preconditions.checkNotNull(bean.getMarineLitterCategory());
Preconditions.checkNotNull(bean.getMarineLitterSizeCategory());
- Preconditions.checkNotNull(bean.getWeight());
// Preconditions.checkNotNull(bean.getNumber());
+// Preconditions.checkNotNull(bean.getWeight());
getCurrentSession().setFlushMode(FlushMode.COMMIT);
@@ -253,7 +256,6 @@
notChangedSortingMeasurements.addAll(sortingMeasurements);
}
-
// If parent and root need to be set
if (target.getId() == null || target.getRootBatch() == null) {
setBatchParents(source, target, catchBatch);
@@ -272,6 +274,7 @@
// Force subgroup count to '1', as Allegro
target.setSubgroupCount(1f);
+ //FIXME-TC Do we really need this ?
// Weight
if (source.getWeight() == null) {
// Nothing to do : will be removed later, using notChangedSortingMeasurements
@@ -298,7 +301,7 @@
notChangedQuantificationMeasurements.remove(quantificationMeasurement);
}
- // MarineLitterCategory
+ // MarineLitterSizeCategory
if (source.getMarineLitterSizeCategory() == null) {
// Nothing to do : will be removed later, using notChangedQuantificationMeasurements
} else {
@@ -312,12 +315,15 @@
}
// Sampling Ratio
- target.setSamplingRatio(null);
+ target.setSamplingRatio(1.0f);
target.setSamplingRatioText(null);
// Individual count
target.setIndividualCount(source.getNumber());
+ // Weight
+ target.setWeight(source.getWeight());
+
// QualityFlag
String qualityFlag;
qualityFlag = enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED;
@@ -326,7 +332,7 @@
// Comments
target.setComments(source.getComment());
- // Exhaustive inventory (always true under a species batch)
+ // Exhaustive inventory (always true under a marine litter batch)
target.setExhaustiveInventory(true);
// Removed not changed measurements (in sorting and quantification measurement lists)
@@ -348,16 +354,17 @@
Preconditions.checkNotNull(source.getFishingOperation().getId());
// Load existing parent and root
- SortingBatch parentBatch;
+ SortingBatch parentBatch = catchBatchDao.getSortingBatch(
+ catchBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
- parentBatch = catchBatchDao.getSortingBatch(catchBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
-
// Parent Batch
if (parentBatch == null) {
throw new DataIntegrityViolationException(
- "Could not retrieve parent batch, for a given speciesBatch : invalid batch tree structure. Please make sure CatchBatch has been saved before to create a SpeciesBatch.");
+ "Could not retrieve parent batch, for a given marineLitterBatch : invalid batch tree structure. Please make sure CatchBatch has been saved before to create a MarineLitterBatch.");
}
// Parent Batch
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -85,7 +85,9 @@
// Vrac / Species
SortingBatch vracSpeciesBatch = catchBatchDao.getSortingBatch(catchBatchChilds,
"pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID,
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES,
+ "pmfmId", enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED
+ );
// container of speciesBatch is arbitraty put on vrac type (there is
// no common ancestor for all species batch).
@@ -95,18 +97,12 @@
for (Batch batch1 : vracSpeciesBatch.getChildBatchs()) {
SortingBatch source = (SortingBatch) batch1;
- // evict some special batches : Life (or Biota) and Inert
- if (source.getReferenceTaxon() != null
- && !enumeration.REFERENCE_TAXON_ID_LIFE.equals(source.getReferenceTaxon().getId())
- && !enumeration.REFERENCE_TAXON_ID_INERT.equals(source.getReferenceTaxon().getId())) {
+ SpeciesBatch target = TuttiBeanFactory.newSpeciesBatch();
+ batchHelper.entityToSpeciesBatch(source, target);
+ result.addChildren(target);
- SpeciesBatch target = TuttiBeanFactory.newSpeciesBatch();
- batchHelper.entityToSpeciesBatch(source, target);
- result.addChildren(target);
-
- if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Vrac > Species > " + target.getSpecies().getReferenceTaxonId() + " : " + target.getId());
- }
+ if (log.isInfoEnabled()) {
+ log.info("Loaded CatchBatch Vrac > Species > " + target.getSpecies().getReferenceTaxonId() + " : " + target.getId());
}
}
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-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/TuttiEnumerationFile.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -107,6 +107,9 @@
@Value("${PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE}")
public final Integer PMFM_ID_SORTING_TYPE = null;
+ @Value("${PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE_2}")
+ public final Integer PMFM_ID_SORTING_TYPE_2 = null;
+
@Value("${UnitId.NONE}")
public final Integer UNIT_ID_NONE = null;
@@ -162,8 +165,17 @@
public final Integer QUALITATIVE_ID_SORTING_TYPE_BENTHOS = null;
@Value("${QualitativeValueId.SORTING_TYPE_MARINE_LITTER}")
- public final Integer QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER= null;
+ public final Integer QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER = null;
+ @Value("${QualitativeValueId.SORTING_TYPE_2_ALIVE_NOT_ITEMIZED}")
+ public final Integer QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED = null;
+
+ @Value("${QualitativeValueId.SORTING_TYPE_2_INERT}")
+ public final Integer QUALITATIVE_ID_SORTING_TYPE_2_INERT = null;
+
+ @Value("${QualitativeValueId.SORTING_TYPE_2_ALIVE_ITEMIZED}")
+ public final Integer QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED = null;
+
@Value("${StatusCode.ENABLE}")
public final String STATUS_VALID_CODE = null;
@@ -221,7 +233,8 @@
@Value("${PmfmId.SURVEY_PART}")
public final Integer PMFM_ID_SURVEY_PART = null;
- @Value("${PmfmId.MEASUREMENT_FILE}")
+ //FIXME-TC Remove this when no more used
+ @Value("${PmfmId.SURVEY_PART}")
public final Integer PMFM_ID_MEASUREMENT_FILE = null;
@Value("${ProgramCode.SCIENTIFIC_CRUISE_PREFIX}")
@@ -230,12 +243,6 @@
@Value("${TaxonGroupTypeCode.COMMERCIAL_SPECIES}")
public final String TAXON_GROUP_TYPE_ID_COMMERCIAL_SPECIES = null;
- @Value("${ReferenceTaxonId.LIFE}")
- public final Integer REFERENCE_TAXON_ID_LIFE = null;
-
- @Value("${ReferenceTaxonId.INERT}")
- public final Integer REFERENCE_TAXON_ID_INERT = null;
-
@Value("${ObjectTypeCode.SCIENTIFIC_CRUISE}")
public final String OBJECT_TYPE_SCIENTIFIC_CRUISE = null;
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -74,6 +74,8 @@
private static final Log log =
LogFactory.getLog(BatchPersistenceHelper.class);
+ public static final String BATCH_PMFM_ID = "pmfmId";
+
@Resource(name = "referentialPersistenceService")
protected ReferentialPersistenceService referentialService;
@@ -188,7 +190,7 @@
SpeciesBatch targetChild = TuttiBeanFactory.newSpeciesBatch();
entityToSpeciesBatch(sourceChild, targetChild);
if (log.isInfoEnabled()) {
- log.info("Loaded CatchBatch Hors Vrac > Benthos > " + target.getSpecies().getReferenceTaxonId() + " : " + target.getId());
+ log.info("Loaded CatchBatch Hors Vrac > (Species|Benthos) > " + target.getSpecies().getReferenceTaxonId() + " : " + target.getId());
}
if (targetChild.getSampleCategoryValue() != null) {
targetChilds.add(targetChild);
@@ -258,8 +260,8 @@
// RankOrder (initialize once, at creation)
if (target.getRankOrder() == null) {
- // Start rank order at 3, because of special batches 'Biota' and 'Inert'
- short rankOrder = (short) 3;
+ // Start rank order at 1
+ short rankOrder = (short) 1;
if (source.getParentBatch() != null && source.getParentBatch().getChildBatchs() != null) {
rankOrder += (short) source.getParentBatch().getChildBatchs().size();
} else if (target.getParentBatch() != null && target.getParentBatch().getChildBatchs() != null) {
@@ -358,7 +360,7 @@
// }
}
- public void setBatchParents(SpeciesBatch source,
+ protected void setBatchParents(SpeciesBatch source,
SortingBatch target,
String parentBatchIdStr,
fr.ifremer.adagio.core.dao.data.batch.CatchBatch catchBatch,
@@ -386,12 +388,18 @@
}
Integer qualitativeValueId = convertSampleCategoryValueIntoQualitativeId(source.getSampleCategoryValue());
+ //FIXME-TC Should have PMFM_ID_SORTING_TYPE > PMFM_ID_SORTING_TYPE_2 > pmfmId ?
+// parentBatch = catchBatchDao.getSortingBatch(catchBatch.getChildBatchs(),
+// BATCH_PMFM_ID, pmfmId, qualitativeValueId,
+// BATCH_PMFM_ID, enumeration.PMFM_ID_SORTING_TYPE, batchPmfmId,
+// BATCH_PMFM_ID, enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
parentBatch = catchBatchDao.getSortingBatch(catchBatch.getChildBatchs(),
- "pmfmId", pmfmId, qualitativeValueId,
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, batchPmfmId);
+ BATCH_PMFM_ID, enumeration.PMFM_ID_SORTING_TYPE, batchPmfmId, // species | Benthos
+ BATCH_PMFM_ID, enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED, // vivant trié
+ BATCH_PMFM_ID, pmfmId, qualitativeValueId); // vrac | hors vrac
- // Parent Batch
- target.setParentBatch(parentBatch);
+// // Parent Batch
+// target.setParentBatch(parentBatch);
}
@@ -405,56 +413,6 @@
target.setRootBatch(catchBatch);
}
- public Integer convertSampleCategoryValueIntoQualitativeId(Serializable value) {
- if (value == null)
- return null;
- Integer qualitativeValueId = null;
- if (value instanceof CaracteristicQualitativeValue) {
- CaracteristicQualitativeValue cqValue = (CaracteristicQualitativeValue) value;
- qualitativeValueId = cqValue.getIdAsInt();
- } else if (value instanceof String) {
- qualitativeValueId = Integer.valueOf((String) value);
- }
- return qualitativeValueId;
- }
-
- public void setSampleCategoryQualitative(SpeciesBatch target,
- Integer pmfmId,
- Float numericalvalue,
- String alphanumericalValue,
- Integer qualitativeValueId) {
- // skip if null or corresponding to the SORTING_TYPE PMFM (Expèce, Benthos, Plancton, etc.)
- if (pmfmId == null || pmfmId.equals(enumeration.PMFM_ID_SORTING_TYPE)) {
- return;
- }
-
- SampleCategoryEnum sampleCategory = enumeration.getSampleCategoryByPmfmId(pmfmId);
- Preconditions.checkNotNull(sampleCategory, "Unable to find corresponding SampleCategoryEnum for PMFM.ID : " + pmfmId);
-
- target.setSampleCategoryType(sampleCategory);
- if (numericalvalue != null) {
- target.setSampleCategoryValue(numericalvalue);
- return;
- }
- if (alphanumericalValue != null) {
- target.setSampleCategoryValue(alphanumericalValue);
- return;
- }
-
- Caracteristic caracteristic = referentialService.getCaracteristic(pmfmId);
- if (caracteristic == null || caracteristic.getCaracteristicType() != CaracteristicType.QUALITATIVE) {
- return;
- }
- CaracteristicQualitativeValue value = null;
- for (CaracteristicQualitativeValue qv : caracteristic.getQualitativeValue()) {
- if (qualitativeValueId.equals(qv.getIdAsInt())) {
- value = qv;
- break;
- }
- }
- target.setSampleCategoryValue(value);
- }
-
public void speciesBatchFrequencyToEntity(SpeciesBatchFrequency source,
SortingBatch target,
SortingBatch parentBatch,
@@ -542,6 +500,56 @@
// }
}
+ protected Integer convertSampleCategoryValueIntoQualitativeId(Serializable value) {
+ if (value == null)
+ return null;
+ Integer qualitativeValueId = null;
+ if (value instanceof CaracteristicQualitativeValue) {
+ CaracteristicQualitativeValue cqValue = (CaracteristicQualitativeValue) value;
+ qualitativeValueId = cqValue.getIdAsInt();
+ } else if (value instanceof String) {
+ qualitativeValueId = Integer.valueOf((String) value);
+ }
+ return qualitativeValueId;
+ }
+
+ protected void setSampleCategoryQualitative(SpeciesBatch target,
+ Integer pmfmId,
+ Float numericalvalue,
+ String alphanumericalValue,
+ Integer qualitativeValueId) {
+ // skip if null or corresponding to the SORTING_TYPE PMFM (Espèce, Benthos, Plancton, etc.)
+ if (pmfmId == null || pmfmId.equals(enumeration.PMFM_ID_SORTING_TYPE)) {
+ return;
+ }
+
+ SampleCategoryEnum sampleCategory = enumeration.getSampleCategoryByPmfmId(pmfmId);
+ Preconditions.checkNotNull(sampleCategory, "Unable to find corresponding SampleCategoryEnum for PMFM.ID : " + pmfmId);
+
+ target.setSampleCategoryType(sampleCategory);
+ if (numericalvalue != null) {
+ target.setSampleCategoryValue(numericalvalue);
+ return;
+ }
+ if (alphanumericalValue != null) {
+ target.setSampleCategoryValue(alphanumericalValue);
+ return;
+ }
+
+ Caracteristic caracteristic = referentialService.getCaracteristic(pmfmId);
+ if (caracteristic == null || caracteristic.getCaracteristicType() != CaracteristicType.QUALITATIVE) {
+ return;
+ }
+ CaracteristicQualitativeValue value = null;
+ for (CaracteristicQualitativeValue qv : caracteristic.getQualitativeValue()) {
+ if (qualitativeValueId.equals(qv.getIdAsInt())) {
+ value = qv;
+ break;
+ }
+ }
+ target.setSampleCategoryValue(value);
+ }
+
public Integer getRecorderDepartmentId() {
// TODO BL : voir si on peut récupérer le departement (du 1er saisisseur ?)
return enumeration.DEPARTMENT_ID_UNKNOWN_RECORDER_DEPARTMENT;
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -80,8 +80,11 @@
List<CatchBatchValidationError> errors) {
// Vrac
- SortingBatch vracBatch = catchBatchDao.getSortingBatch(batchs,
- "pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED, enumeration.QUALITATIVE_VRAC_ID);
+ SortingBatch vracBatch = catchBatchDao.getSortingBatch(
+ batchs,
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_VRAC_ID);
if (log.isDebugEnabled()) {
log.debug("Try to validate Vrac batch model " + vracBatch);
@@ -91,80 +94,124 @@
addError(errors, n_("tutti.persistence.batch.validation.vracNotFound"));
} else {
// Vrac > Species
- SortingBatch speciesBatch = catchBatchDao.getSortingBatch(vracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch speciesBatch = catchBatchDao.getSortingBatch(
+ vracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (speciesBatch == null) {
addError(errors, n_("tutti.persistence.batch.validation.vracSpeciesNotFound"));
} else {
+ // Vrac > Species > Alive not itemized
+ SortingBatch livingNotItemizedBatch = catchBatchDao.getSortingBatch(
+ speciesBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
+ if (livingNotItemizedBatch == null) {
+ addWarning(errors, n_("tutti.persistence.batch.validation.vracSpeciesLifeNotFound"));
+ }
+
// Vrac > Species > Inert
- SortingBatch inertBatch = catchBatchDao.getSortingBatch(speciesBatch.getChildBatchs(),
- "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_INERT);
+ SortingBatch inertBatch = catchBatchDao.getSortingBatch(
+ speciesBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
if (inertBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.vracSpeciesInertNotFound"));
}
- // Vrac > Species > Alive no itemized
- SortingBatch livingNotItemizedBatch = catchBatchDao.getSortingBatch(speciesBatch.getChildBatchs(),
- "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_LIFE);
- if (livingNotItemizedBatch == null) {
- addWarning(errors, n_("tutti.persistence.batch.validation.vracSpeciesLifeNotFound"));
+ // Vrac > Species > Alive itemized
+ SortingBatch aliveItemizedBatch = catchBatchDao.getSortingBatch(
+ speciesBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
+ if (aliveItemizedBatch == null) {
+ addWarning(errors, n_("tutti.persistence.batch.validation.vracSpeciesAliveItemizedNotFound"));
}
- // TODO verifier que les espèces en haut de grappe ont bien la catégorie voulue (sorted-unsroted)
+ // TODO verifier que les espèces en haut de grappe ont bien la catégorie voulue (sorted-unsorted)
}
// Vrac > Benthos
- SortingBatch benthosBatch = catchBatchDao.getSortingBatch(vracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ SortingBatch benthosBatch = catchBatchDao.getSortingBatch(
+ vracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
if (benthosBatch == null) {
addError(errors, n_("tutti.persistence.batch.validation.vracBenthosNotFound"));
} else {
+
+ // Vrac > Benthos > Alive not itemized
+ SortingBatch livingNotItemizedBatch = catchBatchDao.getSortingBatch(
+ benthosBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_NOT_ITEMIZED);
+ if (livingNotItemizedBatch == null) {
+ addWarning(errors, n_("tutti.persistence.batch.validation.vracBenthosLifeNotFound"));
+ }
+
// Vrac > Benthos > Inert
- SortingBatch inertBatch = catchBatchDao.getSortingBatch(benthosBatch.getChildBatchs(),
- "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_INERT);
+ SortingBatch inertBatch = catchBatchDao.getSortingBatch(
+ benthosBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_INERT);
if (inertBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.vracBenthosInertNotFound"));
}
- // Vrac > Benthos > Alive no itemized
- SortingBatch livingNotItemizedBatch = catchBatchDao.getSortingBatch(benthosBatch.getChildBatchs(),
- "referenceTaxonId", enumeration.REFERENCE_TAXON_ID_LIFE);
- if (livingNotItemizedBatch == null) {
- addWarning(errors, n_("tutti.persistence.batch.validation.vracBenthosLifeNotFound"));
+ // Vrac > Benthos > Alive itermized
+ SortingBatch aliveItemizedBatch = catchBatchDao.getSortingBatch(
+ benthosBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE_2,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED);
+ if (aliveItemizedBatch == null) {
+ addWarning(errors, n_("tutti.persistence.batch.validation.vracBenthosAliveItemizedNotFound"));
}
}
// TODO : Plancton...
}
// Hors Vrac
- SortingBatch horsVracBatch = catchBatchDao.getSortingBatch(batchs,
- "pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_HORS_VRAC_ID);
+ SortingBatch horsVracBatch = catchBatchDao.getSortingBatch(
+ batchs,
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_HORS_VRAC_ID);
if (horsVracBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.horsVracSpeciesNotFound"));
} else {
// Hors Vrac > Species
- SortingBatch speciesBatch = catchBatchDao.getSortingBatch(horsVracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
+ SortingBatch speciesBatch = catchBatchDao.getSortingBatch(
+ horsVracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_SPECIES);
if (speciesBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.horsVracSpeciesNotFound"));
}
// Hors Vrac > Benthos
- SortingBatch benthosBatch = catchBatchDao.getSortingBatch(horsVracBatch.getChildBatchs(),
- "pmfmId", enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
+ SortingBatch benthosBatch = catchBatchDao.getSortingBatch(
+ horsVracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_BENTHOS);
if (benthosBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.horsVracBenthosNotFound"));
}
- // Hors Vrac > MarineLitter
- SortingBatch marineLitterBatch = catchBatchDao.getSortingBatch(horsVracBatch.getChildBatchs(),
- "pmfmId",
- enumeration.PMFM_ID_SORTING_TYPE,
- enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+ // Hors Vrac > Marine Litter
+ SortingBatch marineLitterBatch = catchBatchDao.getSortingBatch(
+ horsVracBatch.getChildBatchs(),
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
if (marineLitterBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.horsVracMarineLitterNotFound"));
@@ -173,9 +220,11 @@
}
// Unsorted
- SortingBatch unsortedBatch = catchBatchDao.getSortingBatch(batchs,
- "pmfmId", enumeration.PMFM_ID_SORTED_UNSORTED,
- enumeration.QUALITATIVE_UNSORTED_ID);
+ SortingBatch unsortedBatch = catchBatchDao.getSortingBatch(
+ batchs,
+ BatchPersistenceHelper.BATCH_PMFM_ID,
+ enumeration.PMFM_ID_SORTED_UNSORTED,
+ enumeration.QUALITATIVE_UNSORTED_ID);
if (unsortedBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.unsortedNotFound"));
}
Modified: trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties 2013-04-03 15:14:47 UTC (rev 720)
@@ -19,10 +19,12 @@
tutti.persistence.batch.validation.horsVracSpeciesNotFound=
tutti.persistence.batch.validation.onlySpeciesBatchStructure=
tutti.persistence.batch.validation.unsortedNotFound=
+tutti.persistence.batch.validation.vracBenthosAliveItemizedNotFound=
tutti.persistence.batch.validation.vracBenthosInertNotFound=
tutti.persistence.batch.validation.vracBenthosLifeNotFound=
tutti.persistence.batch.validation.vracBenthosNotFound=
tutti.persistence.batch.validation.vracNotFound=
+tutti.persistence.batch.validation.vracSpeciesAliveItemizedNotFound=
tutti.persistence.batch.validation.vracSpeciesInertNotFound=
tutti.persistence.batch.validation.vracSpeciesLifeNotFound=
tutti.persistence.batch.validation.vracSpeciesNotFound=
Modified: trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2013-04-03 15:14:47 UTC (rev 720)
@@ -19,10 +19,12 @@
tutti.persistence.batch.validation.horsVracSpeciesNotFound=Lot 'Hors Vrac > Espèces' non trouvé ou configuré avec d'autres critères de classement.
tutti.persistence.batch.validation.onlySpeciesBatchStructure=Lot 'Espèces' (données historiques CGFS) détecté.
tutti.persistence.batch.validation.unsortedNotFound=Lot 'Hors Vrac > Espèces' non trouvé ou configuré avec d'autres critères de classement.
+tutti.persistence.batch.validation.vracBenthosAliveItemizedNotFound=
tutti.persistence.batch.validation.vracBenthosInertNotFound=Lot 'Vrac > Benthos > Inerte' non trouvé, ou configuré avec d'autres critères de classement.
tutti.persistence.batch.validation.vracBenthosLifeNotFound=Lot 'Vrac > Benthos > Biota' non trouvé, ou configuré avec d'autres critères de classement.
tutti.persistence.batch.validation.vracBenthosNotFound=Lot 'Vrac > Benthos' non trouvé, ou configuré avec d'autres critères de classement.
tutti.persistence.batch.validation.vracNotFound=Lot 'Vrac' non trouvé, ou configuré avec d'autres critères de classement.
+tutti.persistence.batch.validation.vracSpeciesAliveItemizedNotFound=
tutti.persistence.batch.validation.vracSpeciesInertNotFound=Lot 'Vrac > Espèces > Inerte' non trouvé, ou configuré avec d'autres critères de classement.
tutti.persistence.batch.validation.vracSpeciesLifeNotFound=Lot 'Vrac > Espèces > Biota' non trouvé, ou configuré avec d'autres critères de classement.
tutti.persistence.batch.validation.vracSpeciesNotFound=Lot 'Vrac > Espèces' non trouvé, ou configuré avec d'autres critères de classement.
Modified: trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties 2013-04-03 15:14:47 UTC (rev 720)
@@ -336,27 +336,17 @@
PmfmId.MARINE_LITTER_SIZE_CATEGORY=1422
# Pour stoquer Cruise.surveyPart
-# TODO Alphanumeric = true A creer (dans les enumerations Allegro)
-# FIXME Change this number
-PmfmId.SURVEY_PART=1310
+PmfmId.SURVEY_PART=1432
-# Pmfm associé aux pièces-jointes
-# TODO Alphanumeric = true A creer (dans les enumerations Allegro)
-# FIXME Change this number
-PmfmId.MEASUREMENT_FILE=1310
-
-# TODO A creer (dans les enumerations Allegro)
PmfmId.STATION_NUMBER=1243
-# TODO A creer (dans les enumerations Allegro)
PmfmId.TRAWL_DISTANCE=113
-# TODO A creer (dans les enumerations Allegro)
+
PmfmId.HAUL_VALID=1163
QualitativeValueId.HAUL_VALID_YES=1575
QualitativeValueId.HAUL_VALID_NO=1576
-# TODO A creer (dans les enumerations Allegro)
+
PmfmId.RECTILINEAR_OPERATION=192
QualitativeValueId.RECTILINEAR_OPERATION_YES=277
-# TODO A creer (dans les enumerations Allegro)
QualitativeValueId.RECTILINEAR_OPERATION_NO=278
# PSFM "Nombre de poche" d'un chalut (écran campagne)
@@ -364,11 +354,9 @@
# PSFM "Liste des poches observées" (écran opération)
PmfmId.MULTIRIG_AGGREGATION=1424
-# TODO A creer (dans les enumerations Allegro)
# PSFM "Poids - observation par une observateur" (écran captures, onglet espèce, benthos, etc)
PmfmId.WEIGHT_MEASURED=220
-# TODO A creer (dans les enumerations Allegro)
# PSFM "Vrac/Hors Vrac" - "Organisation des données campagnes"
PmfmId.SORTED_UNSORTED=1428
QualitativeValueId.SORTED_VRAC=311
@@ -382,25 +370,19 @@
QualitativeValueId.SORTING_TYPE_MARINE_LITTER=2150
QualitativeValueId.SORTING_TYPE_ACCIDENTAL_CATCH=2151
+PmfmId.SCIENTIFIC_CRUISE_SORTING_TYPE_2=1431
+QualitativeValueId.SORTING_TYPE_2_ALIVE_NOT_ITEMIZED=2161
+QualitativeValueId.SORTING_TYPE_2_INERT=2162
+QualitativeValueId.SORTING_TYPE_2_ALIVE_ITEMIZED=2160
-#TODO A creer (dans les enumerations Allegro)
# (20=observateur volant, 95=Administrateur SIH) -> L'avantage du 20 est qu'il est inactif (=20), donc plus facilement detectable
PersonId.UNKNOWN_RECORDER_PERSON=20
-#TODO A creer (dans les enumerations Allegro)
# 181=PDG-RBE (à confirmer par Vincent)
DepartmentId.UNKNOWN_RECORDER_DEPARTMENT=181
-#TODO A creer (dans les enumerations Allegro)
ProgramCode.SCIENTIFIC_CRUISE_PREFIX=CAM-
-#Reference taxon correspondant à "Biota" (ou "Vie")
-ReferenceTaxonId.LIFE=7637
-#Reference taxon correspondant à "Non Biota" (ou "Non Vie" - matière inerte)
-# TODO : a creer dans la base harmonie et achanger !
-ReferenceTaxonId.INERT=1
-
-# TODO : A Creer (dans les énumerations Allegro)
ObjectTypeCode.SCIENTIFIC_CRUISE=SCIENTIFIC_CRUISE
ObjectTypeCode.OPERATION=OPERATION
ObjectTypeCode.CATCH_BATCH=CATCH_BATCH
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-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseFixtures.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -67,15 +67,15 @@
}
public int refNbCaracteristic() {
- return 476;
+ return 478;
}
public int refNbSpecies() {
- return 16853;
+ return 16946;
}
public int refNbReferentSpecies() {
- return 8514;
+ return 8645;
}
public int refNbScientificGear() {
@@ -87,15 +87,15 @@
}
public int refNbCountry() {
- return 240;
+ return 239;
}
public int refNbHarbour() {
- return 1896;
+ return 1898;
}
public int refNbProgramZone() {
- return 16;
+ return 14;
}
public int refNbStrata() {
@@ -111,7 +111,7 @@
}
public int refNbFishingVessel() {
- return 24805;
+ return 24837;
}
public int refNbScientificVessel() {
@@ -119,11 +119,11 @@
}
public int refNbPerson() {
- return 123;
+ return 128;
}
public int refNbObjectType() {
- return 56;
+ return 57;
}
public String refSpeciesId() {
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-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/DatabaseResource.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -35,6 +35,7 @@
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.junit.Assume;
@@ -86,35 +87,47 @@
private final boolean writeDb;
+ private String dbName;
+
public static DatabaseResource readDb() {
- return new DatabaseResource();
+ return new DatabaseResource("");
}
public static DatabaseResource writeDb() {
- return new DatabaseResource(true);
+ return new DatabaseResource("", true);
}
+ public static DatabaseResource readDb(String dbName) {
+ return new DatabaseResource(dbName);
+ }
+
+ public static DatabaseResource writeDb(String dbName) {
+ return new DatabaseResource(dbName, true);
+ }
+
public static DatabaseResource noDb() {
return new DatabaseResource(
- "beanRefFactoryWitNoDb.xml", "TuttiBeanRefFactoryWithNoDb");
+ "", "beanRefFactoryWitNoDb.xml", "TuttiBeanRefFactoryWithNoDb");
}
- protected DatabaseResource() {
- this(null, null, false);
+ protected DatabaseResource(String dbName) {
+ this(dbName, null, null, false);
}
- protected DatabaseResource(boolean writeDb) {
- this(null, null, writeDb);
+ protected DatabaseResource(String dbName, boolean writeDb) {
+ this(dbName, null, null, writeDb);
}
- protected DatabaseResource(String beanFactoryReferenceLocation,
+ protected DatabaseResource(String dbName, String beanFactoryReferenceLocation,
String beanRefFactoryReferenceId) {
- this(beanFactoryReferenceLocation, beanRefFactoryReferenceId, false);
+ this(dbName, beanFactoryReferenceLocation,
+ beanRefFactoryReferenceId, false);
}
- protected DatabaseResource(String beanFactoryReferenceLocation,
+ protected DatabaseResource(String dbName, String beanFactoryReferenceLocation,
String beanRefFactoryReferenceId,
boolean writeDb) {
+ this.dbName = dbName;
this.beanFactoryReferenceLocation = beanFactoryReferenceLocation;
this.beanRefFactoryReferenceId = beanRefFactoryReferenceId;
this.writeDb = writeDb;
@@ -156,7 +169,12 @@
testClass = description.getTestClass();
- File db = new File("src/test/db");
+ boolean defaultDbName = StringUtils.isEmpty(dbName);
+
+ if (defaultDbName) {
+ dbName = "db";
+ }
+ File db = new File("src/test/" + dbName);
if (!db.exists()) {
if (log.isWarnEnabled()) {
@@ -182,8 +200,12 @@
// check that config file is in classpath (avoid to find out why it does not works...)
String configFilename = writeDb ?
- "tutti-test-write.properties" :
- "tutti-test-read.properties";
+ "tutti-test-write" :
+ "tutti-test-read";
+ if (!defaultDbName) {
+ configFilename += "-" + dbName;
+ }
+ configFilename += ".properties";
InputStream resourceAsStream = getClass().getResourceAsStream("/" + configFilename);
Preconditions.checkNotNull(resourceAsStream, "Could not find " + configFilename + " in test class-path");
@@ -319,7 +341,7 @@
}
} else {
if (log.isWarnEnabled()) {
- log.warn("Won't destroy directories caus of failures in test.");
+ log.warn("Won't destroy directories cause of failures in test.");
}
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceWriteTest.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceWriteTest.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -30,10 +30,6 @@
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.Caracteristic;
-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;
@@ -76,32 +72,6 @@
protected FishingOperation fishingOperationNoCatchBatch;
- protected FishingOperation fishingOperationWithEmptyBatch;
-
- protected CatchBatch catchBacth;
-
- protected List<Species> species;
-
- protected Caracteristic sortedUnsortedPMFM;
-
- protected CaracteristicQualitativeValue horsVracQualitativeValue;
-
- protected CaracteristicQualitativeValue vracQualitativeValue;
-
- protected Caracteristic maturityPMFM;
-
- protected CaracteristicQualitativeValue firstMaturityQualitativeValue;
-
- protected Caracteristic sexPMFM;
-
- protected CaracteristicQualitativeValue maleQualitativeValue;
-
- protected CaracteristicQualitativeValue femaleQualitativeValue;
-
- protected CaracteristicQualitativeValue unkQualitativeValue;
-
- protected Caracteristic frequencyPMFM;
-
@Before
public void setUp() throws Exception {
service = TuttiPersistenceServiceLocator.getCatchBatchPersistenceService();
@@ -109,10 +79,6 @@
fishingOperationService = TuttiPersistenceServiceLocator.getFishingOperationPersistenceService();
referentialService = TuttiPersistenceServiceLocator.getReferentialPersistenceService();
- species = referentialService.getAllSpecies();
- assertNotNull(species);
- assertTrue(species.size() > 2);
-
cruise = cruiseService.getCruise(dbResource.getFixtures().cruiseId());
cruise.setId((String) null);
Calendar calendar = new GregorianCalendar();
@@ -144,46 +110,6 @@
calendar.set(Calendar.MILLISECOND, 0);
fishingOperationNoCatchBatch.setGearShootingEndDate(calendar.getTime());
fishingOperationNoCatchBatch = fishingOperationService.createFishingOperation(fishingOperationNoCatchBatch);
-
- // Create a second operation, with no cacth batch : to test CatchBatch insert/update :
- fishingOperationWithEmptyBatch = fishingOperations.get(1);
- fishingOperationWithEmptyBatch = fishingOperationService.getFishingOperation(fishingOperationWithEmptyBatch.getId());
- fishingOperationWithEmptyBatch.setId((String) null);
- fishingOperationWithEmptyBatch.setCruise(cruise);
- calendar.setTime(new Date());
- calendar.set(Calendar.HOUR_OF_DAY, 11);
- calendar.set(Calendar.MILLISECOND, 0);
- fishingOperationWithEmptyBatch.setGearShootingStartDate(calendar.getTime());
- calendar.setTime(new Date());
- calendar.set(Calendar.HOUR_OF_DAY, 12);
- calendar.set(Calendar.MILLISECOND, 0);
- fishingOperationWithEmptyBatch.setGearShootingEndDate(calendar.getTime());
- fishingOperationWithEmptyBatch = fishingOperationService.createFishingOperation(fishingOperationWithEmptyBatch);
-
- catchBacth = TuttiBeanFactory.newCatchBatch();
- catchBacth.setFishingOperation(fishingOperationWithEmptyBatch);
- catchBacth = service.createCatchBatch(catchBacth);
-
- sortedUnsortedPMFM = referentialService.getSortedUnsortedCaracteristic();
- horsVracQualitativeValue = sortedUnsortedPMFM.getQualitativeValue(0);
- vracQualitativeValue = sortedUnsortedPMFM.getQualitativeValue(1);
- maturityPMFM = referentialService.getMaturityCaracteristic();
- firstMaturityQualitativeValue = maturityPMFM.getQualitativeValue(0);
- sexPMFM = referentialService.getSexCaracteristic();
- maleQualitativeValue = sexPMFM.getQualitativeValue(1);
- femaleQualitativeValue = sexPMFM.getQualitativeValue(2);
- unkQualitativeValue = sexPMFM.getQualitativeValue(3);
-
- List<Caracteristic> cara = referentialService.getAllCaracteristic();
- for (Caracteristic caracteristic : cara) {
- if (caracteristic.getCaracteristicType() == CaracteristicType.NUMBER
- && caracteristic.getPrecision() != null
- && caracteristic.getPrecision() == 0.5f) {
- frequencyPMFM = caracteristic;
- break;
- }
- }
- assertNotNull("no numerical PMFM with a precision has been found. Could not define a PMFM for batch frequencies.", frequencyPMFM);
}
@Test
@@ -228,6 +154,9 @@
catchBatch.setBenthosTotalInertWeight(0.2f);
}
}
+ // Hors-Vrac :
+ // MarineLitter
+ catchBatch.setMarineLitterTotalWeight(100f);
// Rejet : 15kg
catchBatch.setCatchTotalRejectedWeight(15f);
@@ -299,5 +228,7 @@
assertEquals(expectedCatchBatch.getBenthosTotalSortedWeight(), actualCatchBatch.getBenthosTotalSortedWeight());
assertEquals(expectedCatchBatch.getBenthosTotalInertWeight(), actualCatchBatch.getBenthosTotalInertWeight());
assertEquals(expectedCatchBatch.getBenthosTotalLivingNotItemizedWeight(), actualCatchBatch.getBenthosTotalLivingNotItemizedWeight());
+
+ assertEquals(expectedCatchBatch.getMarineLitterTotalWeight(), actualCatchBatch.getMarineLitterTotalWeight());
}
}
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-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -58,7 +58,7 @@
public class ReferentialPersistenceServiceReadTest {
@ClassRule
- public static final DatabaseResource dbResource = DatabaseResource.readDb();
+ public static final DatabaseResource dbResource = DatabaseResource.readDb("dbEmpty");
/** Logger. */
private static final Log log =
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeHelperTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeHelperTest.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeHelperTest.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -82,6 +82,8 @@
protected Properties localConnectionProperties;
+ protected boolean checkDate = true;
+
@Before
public void setUp() throws Exception {
helper = new ReferentialSynchronizeHelper();
@@ -178,34 +180,34 @@
getLastUpdateDate(TuttiTable.UNIT, internalDb, getSqlDate(2012, 8, 17));
getLastUpdateDate(TuttiTable.AGGREGATION_LEVEL, internalDb, getSqlDate(2011, 6, 9));
- getLastUpdateDate(TuttiTable.PARAMETER_GROUP, internalDb, getSqlDate(2013, 1, 29));
- getLastUpdateDate(TuttiTable.PARAMETER, internalDb, getSqlDate(2013, 1, 29));
+ getLastUpdateDate(TuttiTable.PARAMETER_GROUP, internalDb, getSqlDate(2013, 4, 2));
+ getLastUpdateDate(TuttiTable.PARAMETER, internalDb, getSqlDate(2013, 4, 2));
getLastUpdateDate(TuttiTable.MATRIX, internalDb, getSqlDate(2013, 1, 24));
getLastUpdateDate(TuttiTable.FRACTION, internalDb, getSqlDate(2013, 1, 24));
getLastUpdateDate(TuttiTable.METHOD, internalDb, getSqlDate(2013, 1, 29));
- getLastUpdateDate(TuttiTable.PMFM, internalDb, getSqlDate(2013, 1, 29));
+ getLastUpdateDate(TuttiTable.PMFM, internalDb, getSqlDate(2013, 4, 2));
getLastUpdateDate(TuttiTable.GEAR_CLASSIFICATION, internalDb, getSqlDate(2012, 12, 18));
getLastUpdateDate(TuttiTable.GEAR, internalDb, getSqlDate(2012, 12, 18));
getLastUpdateDate(TuttiTable.LOCATION_CLASSIFICATION, internalDb, getSqlDate(2010, 10, 26));
getLastUpdateDate(TuttiTable.LOCATION_LEVEL, internalDb, getSqlDate(2013, 1, 28));
getLastUpdateDate(TuttiTable.LOCATION, internalDb, getSqlDate(2013, 3, 29));
- getLastUpdateDate(TuttiTable.TAXONOMIC_LEVEL, internalDb, getSqlDate(2012, 4, 18));
- getLastUpdateDate(TuttiTable.REFERENCE_TAXON, internalDb, getSqlDate(2013, 1, 21));
+ getLastUpdateDate(TuttiTable.TAXONOMIC_LEVEL, internalDb, getSqlDate(2013, 2, 21));
+ getLastUpdateDate(TuttiTable.REFERENCE_TAXON, internalDb, getSqlDate(2013, 3, 26));
getLastUpdateDate(TuttiTable.TAXON_NAME, internalDb, getSqlDate(2013, 3, 29));
getLastUpdateDate(TuttiTable.TAXON_GROUP_TYPE, internalDb, getSqlDate(2012, 5, 24));
- getLastUpdateDate(TuttiTable.TAXON_GROUP, internalDb, getSqlDate(2013, 1, 16));
- getLastUpdateDate(TuttiTable.ROUND_WEIGHT_CONVERSION, internalDb, getSqlDate(2012, 10, 4));
- getLastUpdateDate(TuttiTable.WEIGHT_LENGTH_CONVERSION, internalDb, getSqlDate(2013, 1, 17));
+ getLastUpdateDate(TuttiTable.TAXON_GROUP, internalDb, getSqlDate(2013, 2, 20));
+ getLastUpdateDate(TuttiTable.ROUND_WEIGHT_CONVERSION, internalDb, getSqlDate(2013, 3, 28));
+ getLastUpdateDate(TuttiTable.WEIGHT_LENGTH_CONVERSION, internalDb, getSqlDate(2013, 2, 18));
getLastUpdateDate(TuttiTable.VESSEL_TYPE, internalDb, getSqlDate(2012, 4, 25));
- getLastUpdateDate(TuttiTable.VESSEL, internalDb, getSqlDate(2013, 1, 25));
+ getLastUpdateDate(TuttiTable.VESSEL, internalDb, getSqlDate(2013, 3, 29));
getLastUpdateDate(TuttiTable.USER_PROFIL, internalDb, getSqlDate(2009, 6, 18));
- getLastUpdateDate(TuttiTable.DEPARTMENT, internalDb, getSqlDate(2013, 1, 24));
- getLastUpdateDate(TuttiTable.PERSON, internalDb, getSqlDate(2013, 1, 29));
+ getLastUpdateDate(TuttiTable.DEPARTMENT, internalDb, getSqlDate(2013,2, 14));
+ getLastUpdateDate(TuttiTable.PERSON, internalDb, getSqlDate(2013, 4, 2));
getLastUpdateDate(TuttiTable.FRACTION2MATRIX, internalDb, null);
getLastUpdateDate(TuttiTable.PMFM2QUALITATIVE_VALUE, internalDb, null);
getLastUpdateDate(TuttiTable.GEAR_CLASSIFICATION_ASSOCIATIO, internalDb, getSqlDate(2012, 12, 18));
getLastUpdateDate(TuttiTable.GEAR_ASSOCIATION, internalDb, getSqlDate(2012, 12, 18));
- getLastUpdateDate(TuttiTable.LOCATION_ASSOCIATION, internalDb, getSqlDate(2013, 1, 29));
+ getLastUpdateDate(TuttiTable.LOCATION_ASSOCIATION, internalDb, getSqlDate(2013, 3, 27));
getLastUpdateDate(TuttiTable.LOCATION_HIERARCHY, internalDb, null);
getLastUpdateDate(TuttiTable.LOCATION_HIERARCHY_EXCEPTION, internalDb, null);
getLastUpdateDate(TuttiTable.TAXON_INFORMATION, internalDb, getSqlDate(2012, 2, 13));
@@ -215,16 +217,16 @@
getLastUpdateDate(TuttiTable.UNIT_CONVERSION, internalDb, getSqlDate(2011, 11, 21));
getLastUpdateDate(TuttiTable.VESSEL_REGISTRATION_PERIOD, internalDb, null);
getLastUpdateDate(TuttiTable.PERSON2USER_PROFIL, internalDb, null);
- getLastUpdateDate(TuttiTable.TAXON_NAME_HISTORY, internalDb, getSqlDate(2013, 1, 21));
+ getLastUpdateDate(TuttiTable.TAXON_NAME_HISTORY, internalDb, getSqlDate(2013, 3, 28));
getLastUpdateDate(TuttiTable.REFERENCE_DOCUMENT, internalDb, getSqlDate(2011, 11, 4));
getLastUpdateDate(TuttiTable.AUTHOR, internalDb, null);
- getLastUpdateDate(TuttiTable.CITATION, internalDb, getSqlDate(2012, 11, 30));
- getLastUpdateDate(TuttiTable.TAXON_GROUP_HISTORICAL_RECORD, internalDb, getSqlDate(2013, 1, 16));
+ getLastUpdateDate(TuttiTable.CITATION, internalDb, getSqlDate(2013, 3, 28));
+ getLastUpdateDate(TuttiTable.TAXON_GROUP_HISTORICAL_RECORD, internalDb, getSqlDate(2013, 2, 20));
getLastUpdateDate(TuttiTable.ORDER_ITEM, internalDb, getSqlDate(2010, 5, 5));
getLastUpdateDate(TuttiTable.PRECISION_TYPE, internalDb, null);
getLastUpdateDate(TuttiTable.NUMERICAL_PRECISION, internalDb, null);
getLastUpdateDate(TuttiTable.PHOTO_TYPE, internalDb, getSqlDate(2010, 5, 26));
- getLastUpdateDate(TuttiTable.OBJECT_TYPE, internalDb, getSqlDate(2013, 1, 7));
+ getLastUpdateDate(TuttiTable.OBJECT_TYPE, internalDb, getSqlDate(2013, 2, 14));
getLastUpdateDate(TuttiTable.ORDER_TYPE, internalDb, getSqlDate(2009, 10, 16));
getLastUpdateDate(TuttiTable.ANALYSIS_INSTRUMENT, internalDb, null);
@@ -736,11 +738,30 @@
log.debug("getLastUpdateDate(TuttiTable." + tuttiTable.name() + ", internalDb, getSqlDate(" + instance.get(Calendar.YEAR) + ", " + (1 + instance.get(Calendar.MONTH)) + ", " + instance.get(Calendar.DAY_OF_MONTH) + "));");
}
}
- if (expected == null) {
+ if (checkDate) {
+ if (expected == null) {
- Assert.assertNull(actual);
+ Assert.assertNull(actual);
+ } else {
+ assertDate(expected, actual);
+ }
} else {
- assertDate(expected, actual);
+ if (expected == null) {
+
+ if(actual!=null) {
+ if (log.isWarnEnabled()) {
+ log.warn("getLastUpdateDate(TuttiTable." + tuttiTable.name() + ", internalDb, null);");
+ }
+ }
+ } else {
+ if (!equalsDate(expected, actual)) {
+ if (log.isWarnEnabled()) {
+ Calendar instance = Calendar.getInstance();
+ instance.setTime(actual);
+ log.warn("getLastUpdateDate(TuttiTable." + tuttiTable.name() + ", internalDb, getSqlDate(" + instance.get(Calendar.YEAR) + ", " + (1 + instance.get(Calendar.MONTH)) + ", " + instance.get(Calendar.DAY_OF_MONTH) + "));");
+ }
+ }
+ }
}
}
@@ -863,6 +884,16 @@
Assert.assertEquals(expectedCal.get(Calendar.DAY_OF_MONTH), actualCal.get(Calendar.DAY_OF_MONTH));
}
+ public static boolean equalsDate(Date expected, Date actual) {
+ Calendar expectedCal = Calendar.getInstance();
+ expectedCal.setTime(expected);
+ Calendar actualCal = Calendar.getInstance();
+ actualCal.setTime(actual);
+ boolean result = expectedCal.get(Calendar.YEAR) == actualCal.get(Calendar.YEAR);
+ result &= expectedCal.get(Calendar.MONTH)== actualCal.get(Calendar.MONTH);
+ result &= expectedCal.get(Calendar.DAY_OF_MONTH)== actualCal.get(Calendar.DAY_OF_MONTH);
+ return result;
+ }
public static Date getSqlDate(int year, int month, int day) {
return getDate(year, month - 1, day);
Copied: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceCopyTest.java (from rev 717, trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceImplTest.java)
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceCopyTest.java (rev 0)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceCopyTest.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -0,0 +1,194 @@
+package fr.ifremer.tutti.persistence.service.synchro;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $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.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.ProgressionModel;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.service.TuttiPersistenceServiceLocator;
+import org.hibernate.dialect.Dialect;
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
+import org.springframework.jdbc.support.JdbcUtils;
+
+import javax.swing.JDialog;
+import javax.swing.JProgressBar;
+import java.awt.Frame;
+import java.awt.GraphicsEnvironment;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+
+/**
+ * To synchonize a db with cgfs data with last referentiel db.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+@Ignore
+public class ReferentialSynchronizeServiceCopyTest {
+
+ @ClassRule
+ public static final DatabaseResource dbResource =
+ DatabaseResource.writeDb();
+
+ @Rule
+ public final TestName n = new TestName();
+
+ protected ReferentialSynchronizeService service;
+
+ protected Properties remoteConnectionProperties;
+
+ protected Properties localConnectionProperties;
+
+ protected Connection remoteConnection;
+
+ protected Connection localConnection;
+
+ private Dialect dialect;
+
+ protected ReferentialSynchronizeHelper helper;
+
+ protected JDialog dialog;
+
+ @Before
+ public void setUp() throws Exception {
+
+ // create services
+ helper = new ReferentialSynchronizeHelper();
+ service = TuttiPersistenceServiceLocator.getReferentialSynchronizeService();
+
+ // create grab local stuff
+ localConnectionProperties = service.getLocalConnectionProperties();
+ dialect = service.getLocalDialect();
+
+ // create read-only remote db
+ remoteConnectionProperties = new Properties();
+ TuttiEntities.fillConnectionProperties(
+ remoteConnectionProperties,
+ TuttiEntities.getJdbcUrl(new File("src/test/dbEmpty"), dbResource.getConfig().getDbName()),
+ dbResource.getConfig().getJdbcUsername(),
+ dbResource.getConfig().getJdbcPassword());
+
+// dbResource.copyDb(n.getMethodName(), false, remoteConnectionProperties);
+
+ // open connections
+ remoteConnection = TuttiEntities.createConnection(remoteConnectionProperties);
+ localConnection = TuttiEntities.createConnection(localConnectionProperties);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (dialog != null) {
+ dialog.setVisible(false);
+ }
+ service = null;
+ remoteConnectionProperties = null;
+ dialect = null;
+ helper = null;
+ JdbcUtils.closeConnection(localConnection);
+
+ JdbcUtils.closeConnection(remoteConnection);
+ }
+
+ @Test
+ public void synchronize() throws SQLException {
+
+ ReferentialSynchronizeResult result =
+ new ReferentialSynchronizeResult();
+
+ dialog = createProgressBar(result);
+
+ service.prepare(remoteConnectionProperties, result);
+
+ Assert.assertNotNull(result);
+ Assert.assertNull(result.getError());
+ Assert.assertTrue(result.isSuccess());
+
+ service.synchronize(remoteConnectionProperties, result);
+
+ Assert.assertEquals(result.getTotalRows(), result.getProgressionModel().getTotal());
+ Assert.assertEquals(result.getProgressionModel().getTotal(), result.getProgressionModel().getCurrent());
+ Assert.assertEquals(1.0, result.getProgressionModel().getRate(), 0.01);
+
+ Assert.assertNull(result.getError());
+ Assert.assertTrue(result.isSuccess());
+
+ Statement statement = localConnection.createStatement();
+
+ statement.execute("SHUTDOWN");
+ statement.close();
+ }
+
+ public static JDialog createProgressBar(ReferentialSynchronizeResult result) {
+
+ JDialog dialog;
+ if (GraphicsEnvironment.isHeadless()) {
+ dialog = null;
+ } else {
+ dialog = new JDialog((Frame) null,
+ "synchronisation " + result.getLocalUrl() + " from " + result.getRemoteUrl(),
+ false);
+ dialog.setSize(600, 400);
+ final JProgressBar progressBar = new JProgressBar();
+ progressBar.setStringPainted(true);
+ progressBar.setIndeterminate(false);
+ ProgressionModel progressionModel = result.getProgressionModel();
+ progressionModel.addPropertyChangeListener(ProgressionModel.PROPERTY_MESSAGE, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ progressBar.setString((String) evt.getNewValue());
+ }
+ });
+ progressionModel.addPropertyChangeListener(ProgressionModel.PROPERTY_TOTAL, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ progressBar.setMinimum(0);
+ progressBar.setMaximum((Integer) evt.getNewValue());
+ }
+ });
+ progressionModel.addPropertyChangeListener(ProgressionModel.PROPERTY_CURRENT, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ progressBar.setValue((Integer) evt.getNewValue());
+
+ }
+ });
+ dialog.add(progressBar);
+ dialog.setVisible(true);
+ }
+ return dialog;
+ }
+}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceImplTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceImplTest.java 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/synchro/ReferentialSynchronizeServiceImplTest.java 2013-04-03 15:14:47 UTC (rev 720)
@@ -57,7 +57,8 @@
public class ReferentialSynchronizeServiceImplTest {
@ClassRule
- public static final DatabaseResource dbResource = DatabaseResource.writeDb();
+ public static final DatabaseResource dbResource =
+ DatabaseResource.writeDb();
@Rule
public final TestName n = new TestName();
Copied: trunk/tutti-persistence/src/test/resources/tutti-test-read-dbEmpty.properties (from rev 717, trunk/tutti-persistence/src/test/resources/tutti-test-read.properties)
===================================================================
--- trunk/tutti-persistence/src/test/resources/tutti-test-read-dbEmpty.properties (rev 0)
+++ trunk/tutti-persistence/src/test/resources/tutti-test-read-dbEmpty.properties 2013-04-03 15:14:47 UTC (rev 720)
@@ -0,0 +1,27 @@
+###
+# #%L
+# Tutti :: Persistence API
+# $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%
+###
+tutti.persistence.db.directory=src/test/dbEmpty
+tutti.persistence.jdbc.url=jdbc:hsqldb:file:src/test/dbEmpty/allegro
+#tutti.persistence.jdbc.url=jdbc:hsqldb:hsql://localhost/allegro
+tutti.persistence.jdbc.createScript=src/test/dbEmpty/allegro.script
Copied: trunk/tutti-persistence/src/test/resources/tutti-test-write-dbEmpty.properties (from rev 717, trunk/tutti-persistence/src/test/resources/tutti-test-write.properties)
===================================================================
--- trunk/tutti-persistence/src/test/resources/tutti-test-write-dbEmpty.properties (rev 0)
+++ trunk/tutti-persistence/src/test/resources/tutti-test-write-dbEmpty.properties 2013-04-03 15:14:47 UTC (rev 720)
@@ -0,0 +1,24 @@
+###
+# #%L
+# Tutti :: Persistence API
+# $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%
+###
+tutti.persistence.jdbc.createScript=src/test/dbEmpty/allegro.script
Modified: trunk/tutti-persistence/src/test/server.properties
===================================================================
--- trunk/tutti-persistence/src/test/server.properties 2013-04-03 09:21:33 UTC (rev 719)
+++ trunk/tutti-persistence/src/test/server.properties 2013-04-03 15:14:47 UTC (rev 720)
@@ -22,4 +22,6 @@
# #L%
###
server.database.0=file:db/allegro
-server.dbname.0=allegro
\ No newline at end of file
+server.dbname.0=allegro
+server.database.1=file:dbEmpty/allegro
+server.dbname.1=allegroEmpty
\ No newline at end of file
1
0
03 Apr '13
See <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/590/>
------------------------------------------
projectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutti :: UI 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
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-ma…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 37.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ma… (2 KB at 23.5 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.16-…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.… (808 B at 18.4 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.16-… (808 B at 15.5 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ru…
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 34.2 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ru… (2 KB at 30.5 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-co…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 20.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co… (2 KB at 16.1 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-wi…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-wi… (2 KB at 26.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 28.6 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va… (2 KB at 27.8 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 32.9 KB/sec)
mojoStarted org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tutti-ui-swing ---
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.16-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.16-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 43.9 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co… (2 KB at 29.9 KB/sec)
[INFO] use project compile scope class-path
[INFO] Detects 34 modified jaxx file(s).
[INFO] Generated 34 file(s) in 31.333s
mojoSucceeded org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
mojoStarted org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.16-SNAPSHOT:generate-help-ids (default) @ tutti-ui-swing ---
[INFO] Store detected help ids to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Merge help ids to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Use input file: <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>
[INFO] No keys to add.
[INFO] Use input file: <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>
[INFO] No keys to add.
mojoSucceeded org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserJava (scan-sources) @ tutti-ui-swing ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserValidation (scan-sources) @ tutti-ui-swing ---
[INFO] Load rules file validation.rules
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(get)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:get (get) @ tutti-ui-swing ---
[INFO] Copying tutti-ui-swing.properties to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Copying tutti-ui-swing.properties to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(get)
forkedProjectSucceeded fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:gen (scan-sources) @ tutti-ui-swing ---
[WARNING] bundle fr_FR contains 111/1050 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 1046/1046 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(collect-i18n-artifacts)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:collect-i18n-artifacts (collect-i18n-artifacts) @ tutti-ui-swing ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(collect-i18n-artifacts)[INFO] collected 11 i18n artifacts for locale fr_FR stored in <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] collected 11 i18n artifacts for locale en_GB stored in <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
forkedProjectSucceeded fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(make-bundle)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:bundle (make-bundle) @ tutti-ui-swing ---
[WARNING] bundle fr_FR contains 110/1281 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 1117/1277 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(make-bundle)
mojoStarted org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
[INFO]
[INFO] --- license-maven-plugin:1.4:update-project-license (attach-licenses) @ tutti-ui-swing ---
mojoSucceeded org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
mojoStarted org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
[INFO]
[INFO] --- license-maven-plugin:1.4:add-third-party (attach-licenses) @ tutti-ui-swing ---
[WARNING] No license name defined for org.hibernate.javax.persistence--hibernate-jpa-2.0-api--1.0.1.Final
[INFO] Load missing file <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>
[INFO] Missing file <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…> is up-to-date.
[INFO] Writing third-party file to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Writing bundled third-party file to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Will attach third party file from <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>
mojoSucceeded org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
mojoStarted org.apache.maven.plugins:maven-resources-plugin:2.6(default-resources)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tutti-ui-swing ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 82 resources
[INFO] Copying 4 resources
[INFO] Copying 4 resources
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-ui-swing ---
[INFO] Compiling 262 source files to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:[57,7] error: SpeciesBatchRowModel is not abstract and does not override abstract method setSampleCategoryComputedWeight(Float) in SpeciesBatch
[INFO] 1 error
[INFO] -------------------------------------------------------------
mojoFailed org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-compile)
projectFailed fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
1
1
See <http://ci.nuiton.org/jenkins/job/tutti/590/changes>
Changes:
[Kevin Morin] add computed weights
------------------------------------------
[...truncated 439 lines...]
2013-04-03 11:18:56,534 9053 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-03 11:18:56,534 9053 [main] INFO fr.ifremer.tutti.service.referential.TuttiReferentialImportExportService - Will import persons from file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/suref…>
2013-04-03 11:18:56,535 9054 [main] INFO org.nuiton.util.beans.BinderFactory - No binder model found for <fr.ifremer.tutti.persistence.entities.referential.Person - fr.ifremer.tutti.persistence.entities.referential.Person > [null] , will create a new default one.
2013-04-03 11:18:56,544 9063 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-03 11:18:56,545 9064 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-03 11:18:56,545 9064 [main] INFO fr.ifremer.tutti.service.referential.TuttiReferentialImportExportService - Will import vessels from file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/suref…>
2013-04-03 11:18:56,564 9083 [main] INFO org.nuiton.util.beans.BinderFactory - No binder model found for <fr.ifremer.tutti.persistence.entities.referential.Vessel - fr.ifremer.tutti.persistence.entities.referential.Vessel > [null] , will create a new default one.
2013-04-03 11:18:56,568 9087 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-03 11:18:56,568 9087 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-03 11:18:56,574 9093 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-03 11:18:56,574 9093 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-03 11:18:56,582 9101 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-03 11:18:56,582 9101 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-03 11:18:56,588 9107 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-03 11:18:56,588 9107 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-03 11:18:56,589 9108 [main] INFO fr.ifremer.tutti.service.referential.TuttiReferentialImportExportService - Will import species from file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/suref…>
2013-04-03 11:18:56,590 9109 [main] INFO org.nuiton.util.beans.BinderFactory - No binder model found for <fr.ifremer.tutti.persistence.entities.referential.Species - fr.ifremer.tutti.persistence.entities.referential.Species > [null] , will create a new default one.
2013-04-03 11:18:56,593 9112 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-03 11:18:56,593 9112 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-03 11:18:56,594 9113 [main] INFO fr.ifremer.tutti.service.referential.TuttiReferentialImportExportService - Will import gears from file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/suref…>
2013-04-03 11:18:56,596 9115 [main] INFO org.nuiton.util.beans.BinderFactory - No binder model found for <fr.ifremer.tutti.persistence.entities.referential.Gear - fr.ifremer.tutti.persistence.entities.referential.Gear > [null] , will create a new default one.
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.098 sec
Results :
Tests run: 27, Failures: 0, Errors: 0, Skipped: 1
mojoStarted org.apache.maven.plugins:maven-jar-plugin:2.4(default-jar)
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ tutti-service ---
[INFO] Building jar: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/tutti…>
mojoSucceeded org.apache.maven.plugins:maven-jar-plugin:2.4(default-jar)
mojoStarted org.apache.maven.plugins:maven-site-plugin:3.2(attach-descriptor)
[INFO]
[INFO] --- maven-site-plugin:3.2:attach-descriptor (attach-descriptor) @ tutti-service ---
mojoSucceeded org.apache.maven.plugins:maven-site-plugin:3.2(attach-descriptor)
[INFO] Installing <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/tutti…> to /var/local/maven/data/repository/fr/ifremer/tutti/tutti-service/1.3-SNAPSHOT/tutti-service-1.3-SNAPSHOT.jar
mojoStarted org.apache.maven.plugins:maven-install-plugin:2.4(default-install)
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ tutti-service ---
[INFO] Installing <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/pom.xml> to /var/local/maven/data/repository/fr/ifremer/tutti/tutti-service/1.3-SNAPSHOT/tutti-service-1.3-SNAPSHOT.pom
mojoSucceeded org.apache.maven.plugins:maven-install-plugin:2.4(default-install)
projectSucceeded fr.ifremer.tutti:tutti-service:1.3-SNAPSHOT
projectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutti :: UI 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
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-ma…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 37.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ma… (2 KB at 23.5 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.16-…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.… (808 B at 18.4 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.16-… (808 B at 15.5 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ru…
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 34.2 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ru… (2 KB at 30.5 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-co…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 20.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co… (2 KB at 16.1 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-wi…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-wi… (2 KB at 26.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 28.6 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va… (2 KB at 27.8 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 32.9 KB/sec)
mojoStarted org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)
[INFO] Deleting <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target>
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tutti-ui-swing ---
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.16-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.16-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 43.9 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co… (2 KB at 29.9 KB/sec)
[INFO] use project compile scope class-path
[INFO] Detects 34 modified jaxx file(s).
[INFO] Generated 34 file(s) in 31.333s
mojoSucceeded org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
mojoStarted org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.16-SNAPSHOT:generate-help-ids (default) @ tutti-ui-swing ---
[INFO] Store detected help ids to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Merge help ids to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Use input file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/fi…>
[INFO] No keys to add.
[INFO] Use input file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/fi…>
[INFO] No keys to add.
mojoSucceeded org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserJava (scan-sources) @ tutti-ui-swing ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserValidation (scan-sources) @ tutti-ui-swing ---
[INFO] Load rules file validation.rules
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(get)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:get (get) @ tutti-ui-swing ---
[INFO] Copying tutti-ui-swing.properties to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Copying tutti-ui-swing.properties to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(get)
forkedProjectSucceeded fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:gen (scan-sources) @ tutti-ui-swing ---
[WARNING] bundle fr_FR contains 111/1050 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 1046/1046 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(collect-i18n-artifacts)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:collect-i18n-artifacts (collect-i18n-artifacts) @ tutti-ui-swing ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(collect-i18n-artifacts)[INFO] collected 11 i18n artifacts for locale fr_FR stored in <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/i18n…>
[INFO] collected 11 i18n artifacts for locale en_GB stored in <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/i18n…>
forkedProjectSucceeded fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(make-bundle)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:bundle (make-bundle) @ tutti-ui-swing ---
[WARNING] bundle fr_FR contains 110/1281 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 1117/1277 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(make-bundle)
mojoStarted org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
[INFO]
[INFO] --- license-maven-plugin:1.4:update-project-license (attach-licenses) @ tutti-ui-swing ---
mojoSucceeded org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
mojoStarted org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
[INFO]
[INFO] --- license-maven-plugin:1.4:add-third-party (attach-licenses) @ tutti-ui-swing ---
[WARNING] No license name defined for org.hibernate.javax.persistence--hibernate-jpa-2.0-api--1.0.1.Final
[INFO] Load missing file <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/license…>
[INFO] Missing file <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/license…> is up-to-date.
[INFO] Writing third-party file to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Writing bundled third-party file to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Will attach third party file from <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/license…>
mojoSucceeded org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
mojoStarted org.apache.maven.plugins:maven-resources-plugin:2.6(default-resources)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tutti-ui-swing ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 82 resources
[INFO] Copying 4 resources
[INFO] Copying 4 resources
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-ui-swing ---
[INFO] Compiling 262 source files to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/clas…>
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[57,7] error: SpeciesBatchRowModel is not abstract and does not override abstract method setSampleCategoryComputedWeight(Float) in SpeciesBatch
[INFO] 1 error
[INFO] -------------------------------------------------------------
mojoFailed org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-compile)
projectFailed fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
sessionEnded
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Tutti ............................................. SUCCESS [28.175s]
[INFO] Tutti :: Persistence .............................. SUCCESS [1:01.452s]
[INFO] Tutti :: Service .................................. SUCCESS [19.537s]
[INFO] Tutti :: UI ....................................... FAILURE [58.739s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2:53.779s
[INFO] Finished at: Wed Apr 03 11:19:57 CEST 2013
[INFO] Final Memory: 62M/183M
[INFO] ------------------------------------------------------------------------
Projects to build: [MavenProject: fr.ifremer:tutti:1.3-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-persistence:1.3-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-persistence/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-service:1.3-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/pom.xml]>
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-service/builds/2013-04-03_11-16-51/archive/fr.ifremer.tutti/tutti-service/1.3-SNAPSHOT/tutti-service-1.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/tutti…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-service/builds/2013-04-03_11-16-51/archive/fr.ifremer.tutti/tutti-service/1.3-SNAPSHOT/tutti-service-1.3-SNAPSHOT.jar
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-ui-swing/builds/2013-04-03_11-16-51/archive/fr.ifremer.tutti/tutti-ui-swing/1.3-SNAPSHOT/tutti-ui-swing-1.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/license…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-ui-swing/builds/2013-04-03_11-16-51/archive/fr.ifremer.tutti/tutti-ui-swing/1.3-SNAPSHOT/tutti-ui-swing-1.3-SNAPSHOT-third-party.properties
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer$tutti/builds/2013-04-03_11-16-51/archive/fr.ifremer/tutti/1.3-SNAPSHOT/tutti-1.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/target/tutti-1.3-SNAPSHOT-…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer$tutti/builds/2013-04-03_11-16-51/archive/fr.ifremer/tutti/1.3-SNAPSHOT/tutti-1.3-SNAPSHOT-site_fr.xml
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-persistence/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-persistence/builds/2013-04-03_11-16-51/archive/fr.ifremer.tutti/tutti-persistence/1.3-SNAPSHOT/tutti-persistence-1.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-persistence/target/t…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-persistence/builds/2013-04-03_11-16-51/archive/fr.ifremer.tutti/tutti-persistence/1.3-SNAPSHOT/tutti-persistence-1.3-SNAPSHOT.jar
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:compile (default-compile) on project tutti-ui-swing: Compilation failure
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[57,7] error: SpeciesBatchRowModel is not abstract and does not override abstract method setSampleCategoryComputedWeight(Float) in SpeciesBatch
cause : Compilation failure
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[57,7] error: SpeciesBatchRowModel is not abstract and does not override abstract method setSampleCategoryComputedWeight(Float) in SpeciesBatch
Stack trace :
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project tutti-ui-swing: Compilation failure
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[57,7] error: SpeciesBatchRowModel is not abstract and does not override abstract method setSampleCategoryComputedWeight(Float) in 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
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[57,7] error: SpeciesBatchRowModel is not abstract and does not override abstract method setSampleCategoryComputedWeight(Float) in SpeciesBatch
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:729)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
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
channel stopped
1
1
r719 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species
by kmorin@users.forge.codelutin.com 03 Apr '13
by kmorin@users.forge.codelutin.com 03 Apr '13
03 Apr '13
Author: kmorin
Date: 2013-04-03 11:21:33 +0200 (Wed, 03 Apr 2013)
New Revision: 719
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/719
Log:
add computed weights
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-04-03 09:11:00 UTC (rev 718)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-04-03 09:21:33 UTC (rev 719)
@@ -66,9 +66,9 @@
public static final String PROPERTY_SORTED_UNSORTED_CATEGORY_VALUE = "sortedUnsortedCategoryValue";
- public static final String PROPERTY_SORTED_UNSORTED_CATEGORY_WEIGHT = "sortedUnsortedCategoryWeight";
+ public static final String PROPERTY_SORTED_UNSORTED_CATEGORY_WEIGHT = "sortedUnsortedCategoryComputedWeight";
- public static final String PROPERTY_SORTED_UNSORTED_COMPUTED_WEIGHT = "sortedUnsortedComputedWeight";
+ public static final String PROPERTY_SORTED_UNSORTED_CATEGORY_COMPUTED_WEIGHT = "sortedUnsortedCategoryComputedWeight";
public static final String PROPERTY_SIZE_CATEGORY = "sizeCategory";
@@ -76,22 +76,30 @@
public static final String PROPERTY_SIZE_CATEGORY_WEIGHT = "sizeCategoryWeight";
+ public static final String PROPERTY_SIZE_CATEGORY_COMPUTED_WEIGHT = "sexCategoryComputedWeight";
+
public static final String PROPERTY_SEX_CATEGORY = "sexCategory";
public static final String PROPERTY_SEX_CATEGORY_VALUE = "sexCategoryValue";
public static final String PROPERTY_SEX_CATEGORY_WEIGHT = "sexCategoryWeight";
+ public static final String PROPERTY_SEX_CATEGORY_COMPUTED_WEIGHT = "sexCategoryComputedWeight";
+
public static final String PROPERTY_MATURITY_CATEGORY = "maturityCategory";
public static final String PROPERTY_MATURITY_CATEGORY_VALUE = "maturityCategoryValue";
+ public static final String PROPERTY_MATURITY_CATEGORY_COMPUTED_WEIGHT = "maturityCategoryComputedWeight";
+
public static final String PROPERTY_MATURITY_CATEGORY_WEIGHT = "maturityCategoryWeight";
public static final String PROPERTY_AGE_CATEGORY = "ageCategory";
public static final String PROPERTY_AGE_CATEGORY_VALUE = "ageCategoryValue";
+ public static final String PROPERTY_AGE_CATEGORY_COMPUTED_WEIGHT = "ageCategoryComputedWeight";
+
public static final String PROPERTY_AGE_CATEGORY_WEIGHT = "ageCategoryWeight";
public static final String PROPERTY_WEIGHT = "weight";
@@ -342,10 +350,12 @@
Object oldCategory = getSortedUnsortedCategory();
Object oldValue = getSortedUnsortedCategoryValue();
Object oldWeight = getSortedUnsortedCategoryWeight();
+ Object oldComputedWeight = getSortedUnsortedCategoryComputedWeight();
this.sortedUnsortedCategory = sortedUnsortedCategory;
firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY, oldCategory, sortedUnsortedCategory);
firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY_VALUE, oldValue, getSortedUnsortedCategoryValue());
firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY_WEIGHT, oldWeight, getSortedUnsortedCategoryWeight());
+ firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY_COMPUTED_WEIGHT, oldComputedWeight, getSortedUnsortedCategoryComputedWeight());
}
public CaracteristicQualitativeValue getSortedUnsortedCategoryValue() {
@@ -362,6 +372,16 @@
firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY_WEIGHT, oldValue, sortedUnsortedCategoryWeight);
}
+ public Float getSortedUnsortedCategoryComputedWeight() {
+ return sortedUnsortedCategory.getComputedWeight();
+ }
+
+ public void setSortedUnsortedCategoryComputedWeight(Float sortedUnsortedCategoryComputedWeight) {
+ Object oldValue = getSortedUnsortedCategoryComputedWeight();
+ sortedUnsortedCategory.setComputedWeight(sortedUnsortedCategoryComputedWeight);
+ firePropertyChange(PROPERTY_SORTED_UNSORTED_CATEGORY_COMPUTED_WEIGHT, oldValue, sortedUnsortedCategoryComputedWeight);
+ }
+
//------------------------------------------------------------------------//
//-- Size category --//
//------------------------------------------------------------------------//
@@ -374,10 +394,12 @@
Object oldCategory = getSizeCategory();
Object oldValue = getSizeCategoryValue();
Object oldWeight = getSizeCategoryWeight();
+ Object oldComputedWeight = getSizeCategoryComputedWeight();
this.sizeCategory = sizeCategory;
firePropertyChange(PROPERTY_SIZE_CATEGORY, oldCategory, sizeCategory);
firePropertyChange(PROPERTY_SIZE_CATEGORY_VALUE, oldValue, getSizeCategoryValue());
firePropertyChange(PROPERTY_SIZE_CATEGORY_WEIGHT, oldWeight, getSizeCategoryWeight());
+ firePropertyChange(PROPERTY_SIZE_CATEGORY_COMPUTED_WEIGHT, oldComputedWeight, getSizeCategoryComputedWeight());
}
public CaracteristicQualitativeValue getSizeCategoryValue() {
@@ -394,6 +416,16 @@
firePropertyChange(PROPERTY_SIZE_CATEGORY_WEIGHT, oldValue, sizeCategoryWeight);
}
+ public Float getSizeCategoryComputedWeight() {
+ return sizeCategory.getComputedWeight();
+ }
+
+ public void setSizeCategoryComputedWeight(Float sizeCategoryComputedWeight) {
+ Object oldValue = getSizeCategoryComputedWeight();
+ this.sizeCategory.setComputedWeight(sizeCategoryComputedWeight);
+ firePropertyChange(PROPERTY_SIZE_CATEGORY_COMPUTED_WEIGHT, oldValue, sizeCategoryComputedWeight);
+ }
+
//------------------------------------------------------------------------//
//-- Sex category --//
//------------------------------------------------------------------------//
@@ -406,10 +438,12 @@
Object oldCategory = getSexCategory();
Object oldValue = getSexCategoryValue();
Object oldWeight = getSexCategoryWeight();
+ Object oldComputedWeight = getSexCategoryComputedWeight();
this.sexCategory = sexCategory;
firePropertyChange(PROPERTY_SEX_CATEGORY, oldCategory, sexCategory);
firePropertyChange(PROPERTY_SEX_CATEGORY_VALUE, oldValue, getSexCategoryValue());
firePropertyChange(PROPERTY_SEX_CATEGORY_WEIGHT, oldWeight, getSexCategoryWeight());
+ firePropertyChange(PROPERTY_SEX_CATEGORY_COMPUTED_WEIGHT, oldComputedWeight, getSexCategoryComputedWeight());
}
public CaracteristicQualitativeValue getSexCategoryValue() {
@@ -426,6 +460,16 @@
firePropertyChange(PROPERTY_SEX_CATEGORY_WEIGHT, oldValue, sexCategoryWeight);
}
+ public Float getSexCategoryComputedWeight() {
+ return sexCategory.getComputedWeight();
+ }
+
+ public void setSexCategoryComputedWeight(Float sexCategoryComputedWeight) {
+ Object oldValue = getSexCategoryComputedWeight();
+ this.sexCategory.setComputedWeight(sexCategoryComputedWeight);
+ firePropertyChange(PROPERTY_SEX_CATEGORY_COMPUTED_WEIGHT, oldValue, sexCategoryComputedWeight);
+ }
+
//------------------------------------------------------------------------//
//-- Maturity category --//
//------------------------------------------------------------------------//
@@ -438,10 +482,12 @@
Object oldCategory = getMaturityCategory();
Object oldValue = getMaturityCategoryValue();
Object oldWeight = getMaturityCategoryWeight();
+ Object oldComputedWeight = getMaturityCategoryComputedWeight();
this.maturityCategory = maturityCategory;
firePropertyChange(PROPERTY_MATURITY_CATEGORY, oldCategory, maturityCategory);
firePropertyChange(PROPERTY_MATURITY_CATEGORY_VALUE, oldValue, getMaturityCategoryValue());
firePropertyChange(PROPERTY_MATURITY_CATEGORY_WEIGHT, oldWeight, getMaturityCategoryWeight());
+ firePropertyChange(PROPERTY_MATURITY_CATEGORY_COMPUTED_WEIGHT, oldComputedWeight, getMaturityCategoryComputedWeight());
}
public CaracteristicQualitativeValue getMaturityCategoryValue() {
@@ -458,6 +504,16 @@
firePropertyChange(PROPERTY_MATURITY_CATEGORY_WEIGHT, oldValue, maturityCategoryWeight);
}
+ public Float getMaturityCategoryComputedWeight() {
+ return maturityCategory.getComputedWeight();
+ }
+
+ public void setMaturityCategoryComputedWeight(Float maturityCategoryComputedWeight) {
+ Object oldValue = getMaturityCategoryComputedWeight();
+ this.maturityCategory.setComputedWeight(maturityCategoryComputedWeight);
+ firePropertyChange(PROPERTY_MATURITY_CATEGORY_COMPUTED_WEIGHT, oldValue, maturityCategoryComputedWeight);
+ }
+
//------------------------------------------------------------------------//
//-- Age category --//
//------------------------------------------------------------------------//
@@ -470,11 +526,12 @@
Object oldCategory = getAgeCategory();
Object oldValue = getAgeCategoryValue();
Object oldWeight = getAgeCategoryWeight();
+ Object oldComputedWeight = getAgeCategoryComputedWeight();
this.ageCategory = ageCategory;
-
firePropertyChange(PROPERTY_AGE_CATEGORY, oldCategory, ageCategory);
firePropertyChange(PROPERTY_AGE_CATEGORY_VALUE, oldValue, getAgeCategoryValue());
firePropertyChange(PROPERTY_AGE_CATEGORY_WEIGHT, oldWeight, getAgeCategoryWeight());
+ firePropertyChange(PROPERTY_AGE_CATEGORY_COMPUTED_WEIGHT, oldComputedWeight, getAgeCategoryComputedWeight());
}
public Float getAgeCategoryValue() {
@@ -491,6 +548,16 @@
firePropertyChange(PROPERTY_AGE_CATEGORY_WEIGHT, oldValue, ageCategoryWeight);
}
+ public Float getAgeCategoryComputedWeight() {
+ return ageCategory.getComputedWeight();
+ }
+
+ public void setAgeCategoryComputedWeight(Float ageCategoryComputedWeight) {
+ Object oldValue = getAgeCategoryComputedWeight();
+ ageCategory.setComputedWeight(ageCategoryComputedWeight);
+ firePropertyChange(PROPERTY_AGE_CATEGORY_COMPUTED_WEIGHT, oldValue, ageCategoryComputedWeight);
+ }
+
//------------------------------------------------------------------------//
//-- Navigation properties --//
//------------------------------------------------------------------------//
@@ -664,6 +731,15 @@
}
@Override
+ public Float getSampleCategoryComputedWeight() {
+ return null;
+ }
+
+ @Override
+ public void setSampleCategoryComputedWeight(Float sampleCategoryComputedWeight) {
+ }
+
+ @Override
public SpeciesBatch getChildBatchs(int index) {
return null;
}
1
0
03 Apr '13
Author: kmorin
Date: 2013-04-03 11:11:00 +0200 (Wed, 03 Apr 2013)
New Revision: 718
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/718
Log:
add computed weights
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
1
0
See <http://ci.nuiton.org/jenkins/job/tutti/588/changes>
Changes:
[Kevin Morin] - stop using nuiton-widget
- fixes #2136 [ERGO] -Tableau - Cacher les colonnes
- refs #1987 [PROTOCOLE] - Gestion des contrôles/infos obligatoires en validation
- debug NPE
------------------------------------------
[...truncated 448 lines...]
2013-04-02 16:27:27,964 4855 [main] INFO fr.ifremer.tutti.service.referential.TuttiReferentialImportExportService - Will import vessels from file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/suref…>
2013-04-02 16:27:27,980 4871 [main] INFO org.nuiton.util.beans.BinderFactory - No binder model found for <fr.ifremer.tutti.persistence.entities.referential.Vessel - fr.ifremer.tutti.persistence.entities.referential.Vessel > [null] , will create a new default one.
2013-04-02 16:27:27,983 4874 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-02 16:27:27,984 4875 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-02 16:27:27,989 4880 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-02 16:27:27,989 4880 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-02 16:27:27,992 4883 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-02 16:27:27,992 4883 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-02 16:27:27,997 4888 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-02 16:27:27,998 4889 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-02 16:27:27,998 4889 [main] INFO fr.ifremer.tutti.service.referential.TuttiReferentialImportExportService - Will import species from file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/suref…>
2013-04-02 16:27:27,999 4890 [main] INFO org.nuiton.util.beans.BinderFactory - No binder model found for <fr.ifremer.tutti.persistence.entities.referential.Species - fr.ifremer.tutti.persistence.entities.referential.Species > [null] , will create a new default one.
2013-04-02 16:27:28,002 4893 [main] INFO fr.ifremer.tutti.service.PersistenceService - Open persistence service
2013-04-02 16:27:28,002 4893 [main] INFO fr.ifremer.tutti.service.PersistenceService - Persistence driver *Mock persistence service implementation* opened.
2013-04-02 16:27:28,003 4894 [main] INFO fr.ifremer.tutti.service.referential.TuttiReferentialImportExportService - Will import gears from file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/suref…>
2013-04-02 16:27:28,005 4896 [main] INFO org.nuiton.util.beans.BinderFactory - No binder model found for <fr.ifremer.tutti.persistence.entities.referential.Gear - fr.ifremer.tutti.persistence.entities.referential.Gear > [null] , will create a new default one.
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.068 sec
Results :
Tests run: 27, Failures: 0, Errors: 0, Skipped: 1
mojoSucceeded org.apache.maven.plugins:maven-surefire-plugin:2.14(default-test)
[JENKINS] Recording test results
mojoStarted org.apache.maven.plugins:maven-jar-plugin:2.4(default-jar)
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ tutti-service ---
[INFO] Building jar: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/tutti…>
mojoSucceeded org.apache.maven.plugins:maven-jar-plugin:2.4(default-jar)
mojoStarted org.apache.maven.plugins:maven-site-plugin:3.2(attach-descriptor)
[INFO]
[INFO] --- maven-site-plugin:3.2:attach-descriptor (attach-descriptor) @ tutti-service ---
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-service ---
[INFO] Installing <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/tutti…> to /var/local/maven/data/repository/fr/ifremer/tutti/tutti-service/1.3-SNAPSHOT/tutti-service-1.3-SNAPSHOT.jar
[INFO] Installing <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/pom.xml> to /var/local/maven/data/repository/fr/ifremer/tutti/tutti-service/1.3-SNAPSHOT/tutti-service-1.3-SNAPSHOT.pom
mojoSucceeded org.apache.maven.plugins:maven-install-plugin:2.4(default-install)
projectSucceeded fr.ifremer.tutti:tutti-service:1.3-SNAPSHOT
projectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutti :: UI 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
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-ma…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 38.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ma… (2 KB at 32.0 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.16-…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.… (808 B at 27.2 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.16-… (808 B at 24.7 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 50.1 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ru… (2 KB at 36.9 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/public/org/nuiton/jaxx/jaxx-co… (2 KB at 42.5 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 42.5 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 43.8 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-wi… (2 KB at 42.5 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va…
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 55.6 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va… (2 KB at 48.9 KB/sec)
mojoStarted org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)[INFO] Deleting <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target>
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tutti-ui-swing ---
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.16-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.16-SNAPSHOT:generate (default) @ tutti-ui-swing ---
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-co…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co… (2 KB at 41.3 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 32.6 KB/sec)
[INFO] use project compile scope class-path
[INFO] Detects 34 modified jaxx file(s).
[INFO] Generated 34 file(s) in 26.704s
mojoSucceeded org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
mojoStarted org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.16-SNAPSHOT:generate-help-ids (default) @ tutti-ui-swing ---
[INFO] Store detected help ids to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Merge help ids to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Use input file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/fi…>
[INFO] No keys to add.
[INFO] Use input file: <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/fi…>
[INFO] No keys to add.
mojoSucceeded org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserJava (scan-sources) @ tutti-ui-swing ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserValidation (scan-sources) @ tutti-ui-swing ---
[INFO] Load rules file validation.rules
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(get)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:get (get) @ tutti-ui-swing ---
[INFO] Copying tutti-ui-swing.properties to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Copying tutti-ui-swing.properties to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(get)
forkedProjectSucceeded fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:gen (scan-sources) @ tutti-ui-swing ---
[WARNING] bundle fr_FR contains 111/1050 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 1046/1046 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(collect-i18n-artifacts)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:collect-i18n-artifacts (collect-i18n-artifacts) @ tutti-ui-swing ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(collect-i18n-artifacts)[INFO] collected 11 i18n artifacts for locale fr_FR stored in <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/i18n…>
[INFO] collected 11 i18n artifacts for locale en_GB stored in <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/i18n…>
forkedProjectSucceeded fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(make-bundle)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:bundle (make-bundle) @ tutti-ui-swing ---
[WARNING] bundle fr_FR contains 113/1286 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 1117/1277 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(make-bundle)
mojoStarted org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
[INFO]
[INFO] --- license-maven-plugin:1.4:update-project-license (attach-licenses) @ tutti-ui-swing ---
[INFO] Will create or update license file [gpl_v3] to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/LICENSE.txt>
mojoSucceeded org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
mojoStarted org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
[INFO]
[INFO] --- license-maven-plugin:1.4:add-third-party (attach-licenses) @ tutti-ui-swing ---
[WARNING] No license name defined for org.hibernate.javax.persistence--hibernate-jpa-2.0-api--1.0.1.Final
[INFO] Load missing file <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/license…>
[INFO] Missing file <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/license…> is up-to-date.
[INFO] Writing third-party file to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Writing bundled third-party file to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/gene…>
[INFO] Will attach third party file from <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/license…>
mojoSucceeded org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
mojoStarted org.apache.maven.plugins:maven-resources-plugin:2.6(default-resources)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tutti-ui-swing ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 82 resources
[INFO] Copying 4 resources
[INFO] Copying 4 resources
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-ui-swing ---
[INFO] Compiling 262 source files to <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/target/clas…>
mojoFailed org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-compile)[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[51,33] error: package jaxx.runtime.swing.session does not exist
[ERROR] <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[53,33] error: package jaxx.runtime.swing.session does not exist
[ERROR] <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[151,20] error: cannot find symbol
[ERROR] symbol: class SwingSession
location: class TuttiUIContext
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[665,11] error: cannot find symbol
[ERROR] symbol: class SwingSession
location: class TuttiUIContext
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[277,32] error: cannot find symbol
[ERROR] symbol: class SwingSession
location: class TuttiUIContext
<http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/main/ja…>:[164,8] error: cannot find symbol
[INFO] 6 errors
[INFO] -------------------------------------------------------------
projectFailed fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
sessionEnded
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Tutti ............................................. SUCCESS [7.254s]
[INFO] Tutti :: Persistence .............................. SUCCESS [35.772s]
[INFO] Tutti :: Service .................................. SUCCESS [12.613s]
[INFO] Tutti :: UI ....................................... FAILURE [46.670s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:44.122s
[INFO] Finished at: Tue Apr 02 16:28:15 CEST 2013
[INFO] Final Memory: 62M/196M
[INFO] ------------------------------------------------------------------------
Projects to build: [MavenProject: fr.ifremer:tutti:1.3-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-persistence:1.3-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-persistence/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-service:1.3-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/pom.xml,> MavenProject: fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT @ <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/pom.xml]>
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-service/builds/2013-04-02_16-26-26/archive/fr.ifremer.tutti/tutti-service/1.3-SNAPSHOT/tutti-service-1.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-service/target/tutti…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-service/builds/2013-04-02_16-26-26/archive/fr.ifremer.tutti/tutti-service/1.3-SNAPSHOT/tutti-service-1.3-SNAPSHOT.jar
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-ui-swing/builds/2013-04-02_16-26-26/archive/fr.ifremer.tutti/tutti-ui-swing/1.3-SNAPSHOT/tutti-ui-swing-1.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-ui-swing/src/license…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-ui-swing/builds/2013-04-02_16-26-26/archive/fr.ifremer.tutti/tutti-ui-swing/1.3-SNAPSHOT/tutti-ui-swing-1.3-SNAPSHOT-third-party.properties
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer$tutti/builds/2013-04-02_16-26-26/archive/fr.ifremer/tutti/1.3-SNAPSHOT/tutti-1.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/target/tutti-1.3-SNAPSHOT-…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer$tutti/builds/2013-04-02_16-26-26/archive/fr.ifremer/tutti/1.3-SNAPSHOT/tutti-1.3-SNAPSHOT-site_fr.xml
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-persistence/pom.xml> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-persistence/builds/2013-04-02_16-26-26/archive/fr.ifremer.tutti/tutti-persistence/1.3-SNAPSHOT/tutti-persistence-1.3-SNAPSHOT.pom
[JENKINS] Archiving <http://ci.nuiton.org/jenkins/job/tutti/ws/trunk2/tutti-persistence/target/t…> to /var/local/jenkins/data/jobs/tutti/modules/fr.ifremer.tutti$tutti-persistence/builds/2013-04-02_16-26-26/archive/fr.ifremer.tutti/tutti-persistence/1.3-SNAPSHOT/tutti-persistence-1.3-SNAPSHOT.jar
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:compile (default-compile) on project tutti-ui-swing: Compilation failure
cause : Compilation failure
Stack trace :
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project tutti-ui-swing: Compilation failure
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
at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:729)
at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:128)
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 kmorin(a)codelutin.com
channel stopped
1
1
02 Apr '13
See <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/588/…>
Changes:
[Kevin Morin] - stop using nuiton-widget
- fixes #2136 [ERGO] -Tableau - Cacher les colonnes
- refs #1987 [PROTOCOLE] - Gestion des contrôles/infos obligatoires en validation
- debug NPE
------------------------------------------
projectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Tutti :: UI 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
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-ma…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 38.0 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ma… (2 KB at 32.0 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.16-…
Downloading: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/2.… (808 B at 27.2 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/2.5.16-… (808 B at 24.7 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 50.1 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-ru… (2 KB at 36.9 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/public/org/nuiton/jaxx/jaxx-co… (2 KB at 42.5 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 42.5 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 43.8 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-wi… (2 KB at 42.5 KB/sec)
Downloading: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va…
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 55.6 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-va… (2 KB at 48.9 KB/sec)
mojoStarted org.apache.maven.plugins:maven-clean-plugin:2.5(default-clean)[INFO] Deleting <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tutti-ui-swing ---
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.16-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.16-SNAPSHOT:generate (default) @ tutti-ui-swing ---
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-co…
Downloaded: http://nexus.nuiton.org/nexus/content/groups/public/org/nuiton/jaxx/jaxx-co… (2 KB at 41.3 KB/sec)
Downloaded: http://nexus.nuiton.org/nexus/content/groups/tutti-group/org/nuiton/jaxx/ja… (2 KB at 32.6 KB/sec)
[INFO] use project compile scope class-path
[INFO] Detects 34 modified jaxx file(s).
[INFO] Generated 34 file(s) in 26.704s
mojoSucceeded org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
mojoStarted org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
[INFO]
[INFO] --- jaxx-maven-plugin:2.5.16-SNAPSHOT:generate-help-ids (default) @ tutti-ui-swing ---
[INFO] Store detected help ids to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Merge help ids to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Use input file: <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>
[INFO] No keys to add.
[INFO] Use input file: <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>
[INFO] No keys to add.
mojoSucceeded org.nuiton.jaxx:jaxx-maven-plugin:2.5.16-SNAPSHOT(default)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserJava (scan-sources) @ tutti-ui-swing ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:parserValidation (scan-sources) @ tutti-ui-swing ---
[INFO] Load rules file validation.rules
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(get)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:get (get) @ tutti-ui-swing ---
[INFO] Copying tutti-ui-swing.properties to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Copying tutti-ui-swing.properties to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(get)
forkedProjectSucceeded fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:gen (scan-sources) @ tutti-ui-swing ---
[WARNING] bundle fr_FR contains 111/1050 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 1046/1046 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(scan-sources)
forkedProjectStarted fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(collect-i18n-artifacts)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:collect-i18n-artifacts (collect-i18n-artifacts) @ tutti-ui-swing ---
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(collect-i18n-artifacts)[INFO] collected 11 i18n artifacts for locale fr_FR stored in <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] collected 11 i18n artifacts for locale en_GB stored in <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
forkedProjectSucceeded fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
mojoStarted org.nuiton.i18n:i18n-maven-plugin:2.5(make-bundle)
[INFO]
[INFO] --- i18n-maven-plugin:2.5:bundle (make-bundle) @ tutti-ui-swing ---
[WARNING] bundle fr_FR contains 113/1286 empty entries! (use -Di18n.showEmpty to see these entries)
[WARNING] bundle en_GB contains 1117/1277 empty entries! (use -Di18n.showEmpty to see these entries)
mojoSucceeded org.nuiton.i18n:i18n-maven-plugin:2.5(make-bundle)
mojoStarted org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
[INFO]
[INFO] --- license-maven-plugin:1.4:update-project-license (attach-licenses) @ tutti-ui-swing ---
[INFO] Will create or update license file [gpl_v3] to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/L…>
mojoSucceeded org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
mojoStarted org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
[INFO]
[INFO] --- license-maven-plugin:1.4:add-third-party (attach-licenses) @ tutti-ui-swing ---
[WARNING] No license name defined for org.hibernate.javax.persistence--hibernate-jpa-2.0-api--1.0.1.Final
[INFO] Load missing file <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>
[INFO] Missing file <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…> is up-to-date.
[INFO] Writing third-party file to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Writing bundled third-party file to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
[INFO] Will attach third party file from <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>
mojoSucceeded org.codehaus.mojo:license-maven-plugin:1.4(attach-licenses)
mojoStarted org.apache.maven.plugins:maven-resources-plugin:2.6(default-resources)
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ tutti-ui-swing ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 82 resources
[INFO] Copying 4 resources
[INFO] Copying 4 resources
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-ui-swing ---
[INFO] Compiling 262 source files to <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/t…>
mojoFailed org.apache.maven.plugins:maven-compiler-plugin:2.5.1(default-compile)[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:[51,33] error: package jaxx.runtime.swing.session does not exist
[ERROR] <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:[53,33] error: package jaxx.runtime.swing.session does not exist
[ERROR] <http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:[151,20] error: cannot find symbol
[ERROR] symbol: class SwingSession
location: class TuttiUIContext
<http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:[665,11] error: cannot find symbol
[ERROR] symbol: class SwingSession
location: class TuttiUIContext
<http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:[277,32] error: cannot find symbol
[ERROR] symbol: class SwingSession
location: class TuttiUIContext
<http://ci.nuiton.org/jenkins/job/tutti/fr.ifremer.tutti$tutti-ui-swing/ws/s…>:[164,8] error: cannot find symbol
[INFO] 6 errors
[INFO] -------------------------------------------------------------
projectFailed fr.ifremer.tutti:tutti-ui-swing:1.3-SNAPSHOT
1
1
r717 - in trunk: tutti-persistence/src/main/xmi tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches
by tchemit@users.forge.codelutin.com 02 Apr '13
by tchemit@users.forge.codelutin.com 02 Apr '13
02 Apr '13
Author: tchemit
Date: 2013-04-02 17:19:37 +0200 (Tue, 02 Apr 2013)
New Revision: 717
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/717
Log:
add computed fields on CatchBatch
Modified:
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2013-04-02 14:08:05 UTC (rev 716)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2013-04-02 15:19:37 UTC (rev 717)
@@ -54,40 +54,6 @@
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_CATCH_TOTAL_COMPUTED_WEIGHT = "catchTotalComputedWeight";
-
- public static final String PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT = "catchTotalSortedComputedWeight";
-
- public static final String PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT = "catchTotalUnsortedComputedWeight";
-
- public static final String PROPERTY_CATCH_TOTAL_SORTED_CAROUSSEL_WEIGHT = "catchTotalSortedCarousselWeight";
-
- public static final String PROPERTY_CATCH_TOTAL_REJECTED_COMPUTED_WEIGHT = "catchTotalRejectedComputedWeight";
-
- public static final String PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT = "speciesTotalComputedWeight";
-
- public static final String PROPERTY_SPECIES_TOTAL_SORTED_COMPUTED_WEIGHT = "speciesTotalSortedComputedWeight";
-
- public static final String PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT = "speciesTotalUnsortedComputedWeight";
-
- public static final String PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT = "speciesTotalSampleSortedComputedWeight";
-
- public static final String PROPERTY_SPECIES_TOTAL_INERT_COMPUTED_WEIGHT = "speciesTotalInerComputedtWeight";
-
- public static final String PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT = "speciesTotalLivingNotItemizedComputedWeight";
-
- public static final String PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT = "benthosTotalComputedWeight";
-
- public static final String PROPERTY_BENTHOS_TOTAL_SORTED_COMPUTED_WEIGHT = "benthosTotalSortedComputedWeight";
-
- public static final String PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT = "benthosTotalUnsortedComputedWeight";
-
- public static final String PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT = "benthosTotalSampleSortedComputedWeight";
-
- public static final String PROPERTY_BENTHOS_TOTAL_INERT_COMPUTED_WEIGHT = "benthosTotalInerComputedtWeight";
-
- public static final String PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT = "benthosTotalLivingNotItemizedComputedWeight";
-
public static final String PROPERTY_CATCH_BATCH = "catchBatch";
protected static final Binder<CatchBatch, EditCatchesUIModel> fromBeanBinder = BinderFactory.newBinder(CatchBatch.class, EditCatchesUIModel.class);
@@ -244,30 +210,36 @@
firePropertyChange(PROPERTY_CATCH_TOTAL_WEIGHT, oldValue, catchTotalWeight);
}
+ @Override
public Float getCatchTotalComputedWeight() {
return catchTotalComputedOrNotWeight.getComputedData();
}
+ @Override
public void setCatchTotalComputedWeight(Float catchTotalComputedWeight) {
Object oldValue = getCatchTotalComputedWeight();
this.catchTotalComputedOrNotWeight.setComputedData(catchTotalComputedWeight);
firePropertyChange(PROPERTY_CATCH_TOTAL_COMPUTED_WEIGHT, oldValue, catchTotalComputedWeight);
}
+ @Override
public Float getCatchTotalSortedComputedWeight() {
return catchTotalSortedComputedWeight;
}
+ @Override
public void setCatchTotalSortedComputedWeight(Float catchTotalSortedComputedWeight) {
Object oldValue = getCatchTotalSortedComputedWeight();
this.catchTotalSortedComputedWeight = catchTotalSortedComputedWeight;
firePropertyChange(PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT, oldValue, catchTotalSortedComputedWeight);
}
+ @Override
public Float getCatchTotalUnsortedComputedWeight() {
return catchTotalUnsortedComputedWeight;
}
+ @Override
public void setCatchTotalUnsortedComputedWeight(Float catchTotalUnsortedComputedWeight) {
Object oldValue = getCatchTotalUnsortedComputedWeight();
this.catchTotalUnsortedComputedWeight = catchTotalUnsortedComputedWeight;
@@ -314,10 +286,12 @@
firePropertyChange(PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT, oldValue, catchTotalRejectedWeight);
}
+ @Override
public Float getCatchTotalRejectedComputedWeight() {
return catchTotalRejectedComputedOrNotWeight.getComputedData();
}
+ @Override
public void setCatchTotalRejectedComputedWeight(Float catchTotalRejectedComputedWeight) {
Object oldValue = getCatchTotalRejectedComputedWeight();
this.catchTotalRejectedComputedOrNotWeight.setComputedData(catchTotalRejectedComputedWeight);
@@ -328,10 +302,12 @@
//-- Species --//
//------------------------------------------------------------------------//
+ @Override
public Float getSpeciesTotalComputedWeight() {
return speciesTotalComputedWeight;
}
+ @Override
public void setSpeciesTotalComputedWeight(Float speciesTotalComputedWeight) {
Object oldValue = getSpeciesTotalComputedWeight();
this.speciesTotalComputedWeight = speciesTotalComputedWeight;
@@ -354,30 +330,36 @@
firePropertyChange(PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT, oldValue, speciesTotalSortedWeight);
}
+ @Override
public Float getSpeciesTotalSortedComputedWeight() {
return speciesTotalSortedComputedOrNotWeight.getComputedData();
}
+ @Override
public void setSpeciesTotalSortedComputedWeight(Float speciesTotalSortedComputedWeight) {
Object oldValue = getSpeciesTotalSortedComputedWeight();
this.speciesTotalSortedComputedOrNotWeight.setComputedData(speciesTotalSortedComputedWeight);
firePropertyChange(PROPERTY_SPECIES_TOTAL_SORTED_COMPUTED_WEIGHT, oldValue, speciesTotalSortedComputedWeight);
}
+ @Override
public Float getSpeciesTotalSampleSortedComputedWeight() {
return speciesTotalSampleSortedComputedWeight;
}
+ @Override
public void setSpeciesTotalSampleSortedComputedWeight(Float speciesTotalSampleSortedComputedWeight) {
Object oldValue = getSpeciesTotalSampleSortedComputedWeight();
this.speciesTotalSampleSortedComputedWeight = speciesTotalSampleSortedComputedWeight;
firePropertyChange(PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, oldValue, speciesTotalSampleSortedComputedWeight);
}
+ @Override
public Float getSpeciesTotalUnsortedComputedWeight() {
return speciesTotalUnsortedComputedWeight;
}
+ @Override
public void setSpeciesTotalUnsortedComputedWeight(Float speciesTotalUnsortedComputedWeight) {
Object oldValue = getSpeciesTotalUnsortedComputedWeight();
this.speciesTotalUnsortedComputedWeight = speciesTotalUnsortedComputedWeight;
@@ -400,10 +382,12 @@
firePropertyChange(PROPERTY_SPECIES_TOTAL_INERT_WEIGHT, oldValue, speciesTotalInertWeight);
}
+ @Override
public Float getSpeciesTotalInertComputedWeight() {
return speciesTotalInertComputedOrNotWeight.getComputedData();
}
+ @Override
public void setSpeciesTotalInertComputedWeight(Float speciesTotalInertComputedWeight) {
Object oldValue = getSpeciesTotalInertComputedWeight();
this.speciesTotalInertComputedOrNotWeight.setComputedData(speciesTotalInertComputedWeight);
@@ -426,10 +410,12 @@
firePropertyChange(PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT, oldValue, speciesTotalLivingNotItemizedWeight);
}
+ @Override
public Float getSpeciesTotalLivingNotItemizedComputedWeight() {
return speciesTotalLivingNotItemizedComputedOrNotWeight.getComputedData();
}
+ @Override
public void setSpeciesTotalLivingNotItemizedComputedWeight(Float speciesTotalLivingNotItemizedComputedWeight) {
Object oldValue = getSpeciesTotalLivingNotItemizedComputedWeight();
this.speciesTotalLivingNotItemizedComputedOrNotWeight.setComputedData(speciesTotalLivingNotItemizedComputedWeight);
@@ -440,10 +426,12 @@
//-- Benthos --//
//------------------------------------------------------------------------//
+ @Override
public Float getBenthosTotalComputedWeight() {
return benthosTotalComputedWeight;
}
+ @Override
public void setBenthosTotalComputedWeight(Float benthosTotalComputedWeight) {
Object oldValue = getBenthosTotalComputedWeight();
this.benthosTotalComputedWeight = benthosTotalComputedWeight;
@@ -466,30 +454,36 @@
firePropertyChange(PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT, oldValue, benthosTotalSortedWeight);
}
+ @Override
public Float getBenthosTotalSortedComputedWeight() {
return benthosTotalSortedComputedOrNotWeight.getComputedData();
}
+ @Override
public void setBenthosTotalSortedComputedWeight(Float benthosTotalSortedComputedWeight) {
Object oldValue = getBenthosTotalSortedComputedWeight();
this.benthosTotalSortedComputedOrNotWeight.setComputedData(benthosTotalSortedComputedWeight);
firePropertyChange(PROPERTY_BENTHOS_TOTAL_SORTED_COMPUTED_WEIGHT, oldValue, benthosTotalSortedComputedWeight);
}
+ @Override
public Float getBenthosTotalSampleSortedComputedWeight() {
return benthosTotalSampleSortedComputedWeight;
}
+ @Override
public void setBenthosTotalSampleSortedComputedWeight(Float benthosTotalSampleSortedComputedWeight) {
Object oldValue = getBenthosTotalSampleSortedComputedWeight();
this.benthosTotalSampleSortedComputedWeight = benthosTotalSampleSortedComputedWeight;
firePropertyChange(PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT, oldValue, benthosTotalSampleSortedComputedWeight);
}
+ @Override
public Float getBenthosTotalUnsortedComputedWeight() {
return benthosTotalUnsortedComputedWeight;
}
+ @Override
public void setBenthosTotalUnsortedComputedWeight(Float benthosTotalUnsortedComputedWeight) {
Object oldValue = getBenthosTotalUnsortedComputedWeight();
this.benthosTotalUnsortedComputedWeight = benthosTotalUnsortedComputedWeight;
@@ -512,10 +506,12 @@
firePropertyChange(PROPERTY_BENTHOS_TOTAL_INERT_WEIGHT, oldValue, benthosTotalInertWeight);
}
+ @Override
public Float getBenthosTotalInertComputedWeight() {
return benthosTotalInertComputedOrNotWeight.getComputedData();
}
+ @Override
public void setBenthosTotalInertComputedWeight(Float benthosTotalInertComputedWeight) {
Object oldValue = getBenthosTotalInertComputedWeight();
this.benthosTotalInertComputedOrNotWeight.setComputedData(benthosTotalInertComputedWeight);
@@ -538,10 +534,12 @@
firePropertyChange(PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT, oldValue, benthosTotalLivingNotItemizedWeight);
}
+ @Override
public Float getBenthosTotalLivingNotItemizedComputedWeight() {
return benthosTotalLivingNotItemizedComputedOrNotWeight.getComputedData();
}
+ @Override
public void setBenthosTotalLivingNotItemizedComputedWeight(Float benthosTotalLivingNotItemizedComputedWeight) {
Object oldValue = getBenthosTotalLivingNotItemizedComputedWeight();
this.benthosTotalLivingNotItemizedComputedOrNotWeight.setComputedData(benthosTotalLivingNotItemizedComputedWeight);
1
0
r716 - in trunk/tutti-ui-swing: . src/main/java/fr/ifremer/tutti/ui/swing src/main/java/fr/ifremer/tutti/ui/swing/content src/main/java/fr/ifremer/tutti/ui/swing/content/operation src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species
by kmorin@users.forge.codelutin.com 02 Apr '13
by kmorin@users.forge.codelutin.com 02 Apr '13
02 Apr '13
Author: kmorin
Date: 2013-04-02 16:08:05 +0200 (Tue, 02 Apr 2013)
New Revision: 716
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/716
Log:
- stop using nuiton-widget
- fixes #2136 [ERGO] -Tableau - Cacher les colonnes
- refs #1987 [PROTOCOLE] - Gestion des contr?\195?\180les/infos obligatoires en validation
- debug NPE
Modified:
trunk/tutti-ui-swing/pom.xml
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUIHandler.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
Modified: trunk/tutti-ui-swing/pom.xml
===================================================================
--- trunk/tutti-ui-swing/pom.xml 2013-04-01 20:46:21 UTC (rev 715)
+++ trunk/tutti-ui-swing/pom.xml 2013-04-02 14:08:05 UTC (rev 716)
@@ -340,10 +340,6 @@
</dependency>
<!-- swing widgets -->
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-widgets</artifactId>
- </dependency>
<dependency>
<groupId>org.swinglabs.swingx</groupId>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-04-01 20:46:21 UTC (rev 715)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-04-02 14:08:05 UTC (rev 716)
@@ -48,6 +48,7 @@
import jaxx.runtime.JAXXContext;
import jaxx.runtime.swing.help.JAXXHelpBroker;
import jaxx.runtime.swing.help.JAXXHelpUIHandler;
+import jaxx.runtime.swing.session.SwingSession;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -55,7 +56,6 @@
import org.nuiton.i18n.I18n;
import org.nuiton.i18n.init.DefaultI18nInitializer;
import org.nuiton.i18n.init.UserI18nInitializer;
-import org.nuiton.widget.SwingSession;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/MainUIHandler.java 2013-04-02 14:08:05 UTC (rev 716)
@@ -45,27 +45,19 @@
import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUI;
import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIHandler;
import fr.ifremer.tutti.ui.swing.content.referential.ManageTemporaryReferentialUI;
-import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
-import fr.ifremer.tutti.ui.swing.util.CloseableUI;
-import fr.ifremer.tutti.ui.swing.util.RemoveablePropertyChangeListener;
-import fr.ifremer.tutti.ui.swing.util.TuttiUI;
-import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
+import fr.ifremer.tutti.ui.swing.util.*;
import fr.ifremer.tutti.ui.swing.util.action.TuttiActionHelper;
import fr.ifremer.tutti.ui.swing.util.action.TuttiActionUI;
import fr.ifremer.tutti.ui.swing.util.action.TuttiUIAction;
import jaxx.runtime.SwingUtil;
+import jaxx.runtime.swing.session.SwingSession;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.nuiton.i18n.I18n;
-import org.nuiton.widget.SwingSession;
-import javax.swing.Icon;
-import javax.swing.JButton;
-import javax.swing.JComponent;
-import javax.swing.JLabel;
-import javax.swing.JToolBar;
-import java.awt.Cursor;
+import javax.swing.*;
+import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.net.URL;
import java.util.Locale;
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-04-01 20:46:21 UTC (rev 715)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-04-02 14:08:05 UTC (rev 716)
@@ -808,7 +808,11 @@
@Override
public void setRecorderPerson(List<Person> recorderPerson) {
- Object oldValue = Lists.newArrayList(getRecorderPerson());
+ Object oldValue = null;
+ List<Person> oldRecorderPerson = getRecorderPerson();
+ if (oldRecorderPerson != null) {
+ oldValue= Lists.newArrayList(oldRecorderPerson);
+ }
editObject.setRecorderPerson(Lists.<Person>newArrayList());
if (recorderPerson != null) {
getRecorderPerson().addAll(recorderPerson);
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-04-01 20:46:21 UTC (rev 715)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-04-02 14:08:05 UTC (rev 716)
@@ -28,12 +28,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.data.Attachment;
-import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
-import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
-import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
+import fr.ifremer.tutti.persistence.entities.data.*;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
@@ -41,12 +36,7 @@
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchTableUIHandler;
-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.SampleCategoryComponent;
-import fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.*;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUI;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyCellComponent;
@@ -77,14 +67,10 @@
import org.jdesktop.swingx.table.DefaultTableColumnModelExt;
import org.nuiton.util.decorator.Decorator;
-import javax.swing.JOptionPane;
-import javax.swing.RowFilter;
-import javax.swing.UIManager;
+import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
-import java.awt.Color;
-import java.awt.Component;
-import java.awt.Dimension;
+import java.awt.*;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
@@ -276,13 +262,13 @@
if (species.getReferenceTaxonId().equals(
speciesProtocol.getSpeciesReferenceTaxonId())) {
- // TODO kmorin 20130329 check with Vincent what are exactly the countIfNoFrequencyEnabled
- // and weight properties
result = (!speciesProtocol.isSizeEnabled() || row.getSizeCategoryValue() != null)
&& (!speciesProtocol.isSexEnabled() || row.getSexCategoryValue() != null)
&& (!speciesProtocol.isMaturityEnabled() || row.getMaturityCategoryValue() != null)
&& (!speciesProtocol.isAgeEnabled() || row.getAgeCategoryValue() != null)
- && (!speciesProtocol.isCountIfNoFrequencyEnabled() || !CollectionUtils.isEmpty(row.getFrequency()));
+ && (!speciesProtocol.isCountIfNoFrequencyEnabled()
+ || !CollectionUtils.isEmpty(row.getFrequency())
+ || row.getNumber() != null);
}
}
}
1
0
01 Apr '13
Author: tchemit
Date: 2013-04-01 22:46:21 +0200 (Mon, 01 Apr 2013)
New Revision: 715
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/715
Log:
- review bean api (usage of a contract and a *Bean object)
- clean some old unsed bean contract
- add validation service
- improve ui model (using bean contract + reuse a delegate pattern)
- review validation files (use now bean cotnracts)
- move DataContext to service layer
(refs #1987: [PROTOCOLE] - Gestion des contr?\195?\180les/infos obligatoires en validation)
Added:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntity.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntityBean.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDataContext.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/ValidationService.java
trunk/tutti-service/src/main/resources/fr/
trunk/tutti-service/src/main/resources/fr/ifremer/
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/Cruise-error-validation.xml
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-error-validation.xml
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-fatal-validation.xml
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-warning-validation.xml
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-error-validation.xml
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-fatal-validation.xml
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-warning-validation.xml
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/Program-error-validation.xml
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/protocol/
trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocol-error-validation.xml
trunk/tutti-service/src/main/resources/validators.xml
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/BeanValidatorDetectorTest.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java
Removed:
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-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/macrowaste/
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/operation/EditFishingOperationUIModel-edit-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-fatal-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-fatal-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-warning-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml
trunk/tutti-ui-swing/src/main/resources/validators.xml
Modified:
trunk/pom.xml
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BatchContainer.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocols.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.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/MarineLitterBatchPersistenceServiceImpl.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/ProtocolPersistenceServiceImpl.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/SpeciesBatchPersistenceServiceImpl.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java
trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties
trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocolsTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceReadTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceWriteTest.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/ProgramPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceReadTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceWriteTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceReadTest.java
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java
trunk/tutti-service/pom.xml
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDecorator.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfig.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/CaracteristicType.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/SpeciesRow.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportService.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/TrunkRowModel.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TuttiPupitriImportExportService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/GearModel.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/PersonModel.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/SpeciesModel.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialImportExportService.java
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/VesselModel.java
trunk/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportServiceTest.java
trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/referential/TuttiReferentialImportExportServiceTest.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/TuttiUIContext.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java
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/SelectCruiseUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.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/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/NewFishingOperationAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.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/create/CreateSpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java
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/SplitSpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicRowModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java
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/protocol/EditProtocolSpeciesRowModel.java
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/ExportProtocolBenthosAction.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/ExportPupitriAction.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/ImportProtocolSpeciesAction.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/AbstractTuttiBeanUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.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/TabContentModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiUIAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentEditorUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/SelectSpeciesUIModel.java
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-warning-validation.xml
trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml
trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/BeanValidatorDetectorTest.java
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/pom.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -129,7 +129,7 @@
<nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
- <eugenePluginVersion>2.6.1</eugenePluginVersion>
+ <eugenePluginVersion>2.6.2-SNAPSHOT</eugenePluginVersion>
<hibernateVersion>3.6.10.Final</hibernateVersion>
<h2Version>1.3.168</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,80 @@
+package fr.ifremer.tutti;
+
+/*
+ * #%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 org.jdesktop.beans.AbstractBean;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+/**
+ * To listen a bean and propagate some of properties.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class PropagatePropertyChangeListener implements PropertyChangeListener {
+
+ public static interface PropagatePropertyChange {
+ void firePropertyChanged(String propertyName,
+ Object oldValue,
+ Object newValue);
+ }
+
+ public static void listenAndPropagate(AbstractBean producer,
+ PropagatePropertyChange consumer,
+ String propertyNameToListen,
+ String propertyNameToForward) {
+ PropagatePropertyChangeListener listener =
+ new PropagatePropertyChangeListener(propertyNameToForward,
+ consumer);
+ producer.addPropertyChangeListener(propertyNameToListen, listener);
+ }
+
+ public static void listenAndPropagateAll(AbstractBean producer,
+ PropagatePropertyChange consumer) {
+ PropagatePropertyChangeListener listener =
+ new PropagatePropertyChangeListener(null, consumer);
+ producer.addPropertyChangeListener(listener);
+ }
+
+ private String propertyName;
+
+ private PropagatePropertyChange editor;
+
+ public PropagatePropertyChangeListener(String propertyName,
+ PropagatePropertyChange editor) {
+ this.propertyName = propertyName;
+ this.editor = editor;
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ String name = propertyName == null ? evt.getPropertyName() : propertyName;
+ editor.firePropertyChanged(name,
+ evt.getOldValue(),
+ evt.getNewValue());
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/PropagatePropertyChangeListener.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -149,7 +149,7 @@
List<Vessel> getAllFishingVessel();
/**
- * Get all species (referent or synonym) with no {@link Species#surveyCode}
+ * Get all species (referent or synonym) with no {@link Species#getSurveyCode()}
* filled.
*
* @return all species with no {@code surveyCode} filled at all.
@@ -158,7 +158,7 @@
List<Species> getAllSpecies();
/**
- * Get all {@code referent} species with no {@link Species#surveyCode}
+ * Get all {@code referent} species with no {@link Species#getSurveyCode()}
* filled.
*
* @return all species with no {@code surveyCode} filled at all.
@@ -167,7 +167,7 @@
List<Species> getAllReferentSpecies();
/**
- * Get all species (referent or synonym) with {@link Species#surveyCode}
+ * Get all species (referent or synonym) with {@link Species#getSurveyCode()}
* filled by optional protocol.
*
* @param protocol optional protocol to fill some species cruisecode.
@@ -177,7 +177,7 @@
List<Species> getAllSpecies(TuttiProtocol protocol);
/**
- * Get all {@code referent} species with no {@link Species#surveyCode}
+ * Get all {@code referent} species with no {@link Species#getSurveyCode()}
* filled by optional protocol.
*
* @param protocol optional protocol to fill some species cruisecode.
Deleted: 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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,110 +0,0 @@
-package fr.ifremer.tutti.persistence.entities;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $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 org.apache.commons.lang3.ObjectUtils;
-import org.nuiton.util.CollectionUtil;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Abstract tutti entity.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 0.1
- */
-public abstract class AbstractTuttiEntity implements Serializable, IdAware {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_ID = "id";
-
- protected String id;
-
- protected Integer intId;
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public void setId(String id) {
- this.id = id;
- intId = null;
- }
-
- public void setId(Integer id) {
- intId = id;
- this.id = id == null ? null : String.valueOf(id);
- }
-
- public Integer getIdAsInt() {
- if (intId == null && id != null) {
- intId = Integer.valueOf(id);
- }
- return intId;
- }
-
- protected <B> B getChild(Collection<B> child, int index) {
- return CollectionUtil.getOrNull(child, index);
- }
-
- protected <B> B getChild(List<B> child, int index) {
- return CollectionUtil.getOrNull(child, index);
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null) {
- return false;
- }
- if (ObjectUtils.notEqual(o.getClass(), getClass())) {
- // not sale class
- return false;
- }
- if (!(o instanceof AbstractTuttiEntity)) return false;
-
- AbstractTuttiEntity that = (AbstractTuttiEntity) o;
-
- return ObjectUtils.equals(id, that.id);
-
- }
-
- @Override
- public int hashCode() {
- return id == null ? 0 : id.hashCode();
- }
-
- @Override
- public String toString() {
- return super.toString() + ": " + id;
- }
-}
\ No newline at end of file
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntities.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,14 +26,12 @@
import com.google.common.base.Function;
import com.google.common.base.Predicate;
-import com.google.common.base.Throwables;
import com.google.common.collect.Iterables;
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.collect.Sets;
-import fr.ifremer.tutti.persistence.entities.data.FishingOperationAware;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicType;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -100,7 +98,7 @@
// helper class does not instanciate
}
- public static <B extends IdAware> List<String> toIds(List<B> list) {
+ public static <B extends TuttiEntity> List<String> toIds(List<B> list) {
List<String> result = list == null ?
Collections.<String>emptyList() :
Lists.transform(list, GET_ID);
@@ -114,11 +112,11 @@
return result;
}
- public static <B extends IdAware> Map<String, B> splitById(Iterable<B> list) {
+ public static <B extends TuttiEntity> Map<String, B> splitById(Iterable<B> list) {
return Maps.uniqueIndex(list, GET_ID);
}
- public static <B extends IdAware> Map<Integer, B> splitByIdAsInt(Iterable<B> list) {
+ public static <B extends TuttiEntity> Map<Integer, B> splitByIdAsInt(Iterable<B> list) {
return Maps.uniqueIndex(list, GET_ID_AS_INT);
}
@@ -137,38 +135,34 @@
}
};
- public static final Function<IdAware, String> GET_ID = new Function<IdAware, String>() {
+ public static final Function<TuttiEntity, String> GET_ID = new Function<TuttiEntity, String>() {
@Override
- public String apply(IdAware input) {
+ public String apply(TuttiEntity input) {
return input.getId();
}
};
- public static final Function<IdAware, Integer > GET_ID_AS_INT = new Function<IdAware, Integer >() {
+ public static final Function<TuttiEntity, Integer> GET_ID_AS_INT = new Function<TuttiEntity, Integer>() {
@Override
- public Integer apply(IdAware input) {
+ public Integer apply(TuttiEntity input) {
return input.getIdAsInt();
}
};
- public static <B extends IdAware> boolean isNew(B bean) {
+ public static <B extends TuttiEntity> boolean isNew(B bean) {
return bean.getId() == null;
}
- public static <B extends IdAware> Predicate<B> newIdPredicate(String id) {
+ public static <B extends TuttiEntity> Predicate<B> newIdPredicate(String id) {
return new IdPredicate<B>(id);
}
- public static <B extends FishingOperationAware> Predicate<B> newTraitIdPredicate(String id) {
- return new TraitIdPredicate<B>(id);
- }
-
public static Predicate<Caracteristic> newCaracteristicCategoryPredicate(String cateogryId) {
return new CaracteristicCategoryPredicate(cateogryId);
}
- public static <B extends IdAware> B findById(Iterable<B> beans,
- String id) {
+ public static <B extends TuttiEntity> B findById(Iterable<B> beans,
+ String id) {
B result = Iterables.tryFind(beans, newIdPredicate(id)).orNull();
return result;
}
@@ -251,12 +245,15 @@
return connection;
}
- public static <B extends IdAware> List<String> collecIds(List<B> list) {
+ public static <B extends TuttiEntity> List<String> collecIds(List<B> list) {
List<String> result = Lists.transform(list, GET_ID);
return result;
}
- public static void fillConnectionProperties(Properties p, String url, String username, String password) {
+ public static void fillConnectionProperties(Properties p,
+ String url,
+ String username,
+ String password) {
p.put(Environment.URL, url);
p.put(Environment.USER, username);
p.put(Environment.PASS, password);
@@ -266,7 +263,7 @@
return "jdbc:hsqldb:file:" + directory.getAbsolutePath() + "/" + dbName;
}
- protected static class IdPredicate<B extends IdAware> implements Predicate<B> {
+ protected static class IdPredicate<B extends TuttiEntity> implements Predicate<B> {
private final String id;
@@ -294,32 +291,18 @@
}
}
- protected static class TraitIdPredicate<B extends FishingOperationAware> implements Predicate<B> {
+// public static <B extends TuttiEntity> B newEntity(B entity) {
+// return newEntity((Class<B>) entity.getClass());
+// }
- private final String id;
+// public static <B extends TuttiEntity> B newEntity(Class<B> type) {
+// try {
+// return type.newInstance();
+// } catch (Exception e) {
+// throw Throwables.propagate(e);
+// }
+// }
- public TraitIdPredicate(String id) {
- this.id = id;
- }
-
- @Override
- public boolean apply(B input) {
- return id.equals(input.getFishingOperation().getId());
- }
- }
-
- public static <B extends IdAware> B newEntity(B entity) {
- return newEntity((Class<B>) entity.getClass());
- }
-
- public static <B extends IdAware> B newEntity(Class<B> type) {
- try {
- return type.newInstance();
- } catch (Exception e) {
- throw Throwables.propagate(e);
- }
- }
-
public static <K, V> void fillEntries(Map<K, V> map,
Collection<K> keys,
Function<K, V> function) {
Added: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntity.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntity.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntity.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,47 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $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 java.io.Serializable;
+
+/**
+ * Tutti entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public interface TuttiEntity extends Serializable {
+
+ public static final String PROPERTY_ID = "id";
+
+ String getId();
+
+ void setId(String id);
+
+ Integer getIdAsInt();
+
+ void setId(Integer id);
+
+}
\ No newline at end of file
Property changes on: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntity.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntityBean.java (from rev 709, trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/AbstractTuttiEntity.java)
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntityBean.java (rev 0)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/TuttiEntityBean.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,109 @@
+package fr.ifremer.tutti.persistence.entities;
+
+/*
+ * #%L
+ * Tutti :: Persistence API
+ * $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 org.apache.commons.lang3.ObjectUtils;
+import org.nuiton.util.CollectionUtil;
+
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Abstract tutti entity.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.1
+ */
+public abstract class TuttiEntityBean implements Serializable, TuttiEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String id;
+
+ protected Integer intId;
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ intId = null;
+ }
+
+ @Override
+ public void setId(Integer id) {
+ intId = id;
+ this.id = id == null ? null : String.valueOf(id);
+ }
+
+ @Override
+ public Integer getIdAsInt() {
+ if (intId == null && id != null) {
+ intId = Integer.valueOf(id);
+ }
+ return intId;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null) {
+ return false;
+ }
+ if (ObjectUtils.notEqual(o.getClass(), getClass())) {
+ // not sale class
+ return false;
+ }
+ if (!(o instanceof TuttiEntityBean)) return false;
+
+ TuttiEntityBean that = (TuttiEntityBean) o;
+
+ return ObjectUtils.equals(id, that.id);
+ }
+
+ @Override
+ public int hashCode() {
+ return id == null ? 0 : id.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return super.toString() + ": " + id;
+ }
+
+ protected <B> B getChild(Collection<B> child, int index) {
+ return CollectionUtil.getOrNull(child, index);
+ }
+
+ protected <B> B getChild(List<B> child, int index) {
+ return CollectionUtil.getOrNull(child, index);
+ }
+}
\ No newline at end of file
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BatchContainer.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BatchContainer.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/BatchContainer.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiEntityBean;
import java.util.List;
@@ -34,7 +35,8 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0.2
*/
-public class BatchContainer<B extends AbstractBatch> extends AbstractTuttiDataEntity {
+public class BatchContainer<B extends TuttiBatchEntity> extends TuttiEntityBean {
+
private static final long serialVersionUID = 1L;
protected final List<B> children = Lists.newArrayList();
Deleted: 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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/Program.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,73 +0,0 @@
-package fr.ifremer.tutti.persistence.entities.data;
-
-/*
- * #%L
- * Tutti :: Persistence API
- * $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.persistence.entities.referential.TuttiLocation;
-
-public class Program extends AbstractTuttiDataEntity {
-
- private static final long serialVersionUID = 1L;
-
- public static final String PROPERTY_NAME = "name";
-
- public static final String PROPERTY_ZONE = "zone";
-
- public static final String PROPERTY_ZONE_LABEL = "zoneLabel";
-
- protected String name;
-
- protected String description;
-
- protected TuttiLocation zone;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public TuttiLocation getZone() {
- return zone;
- }
-
- public void setZone(TuttiLocation zone) {
- this.zone = zone;
- }
-
- public String getZoneLabel() {
- return zone == null ? null : zone.getLabel();
- }
-
-} //Program
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocols.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocols.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocols.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -30,6 +30,7 @@
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import org.apache.commons.io.IOUtils;
import java.io.BufferedWriter;
@@ -69,7 +70,7 @@
try {
fileReader = Files.newReader(file, Charsets.UTF_8);
YamlReader reader = new YamlReader(fileReader, createConfig());
- TuttiProtocol result = reader.read(TuttiProtocol.class);
+ TuttiProtocol result = reader.read(TuttiBeanFactory.typeOfTuttiProtocol());
fileReader.close();
return result;
} catch (Exception e) {
@@ -82,7 +83,7 @@
protected static YamlConfig createConfig() {
YamlConfig result = new YamlConfig();
result.setClassTag(SpeciesProtocol.class.getSimpleName(),
- SpeciesProtocol.class);
+ TuttiBeanFactory.typeOfSpeciesProtocol());
result.writeConfig.setAlwaysWriteClassname(false);
result.writeConfig.setWriteRootTags(false);
return result;
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -32,6 +32,7 @@
import fr.ifremer.adagio.core.dao.referential.QualityFlagImpl;
import fr.ifremer.adagio.core.dao.referential.pmfm.PmfmImpl;
import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import org.apache.commons.lang3.ObjectUtils;
@@ -97,7 +98,7 @@
List<Attachment> result = Lists.newArrayList();
while (list.hasNext()) {
Object[] source = list.next();
- Attachment target = new Attachment();
+ Attachment target = TuttiBeanFactory.newAttachment();
loadAttachment(source, target);
result.add(target);
}
@@ -114,7 +115,7 @@
throw new DataRetrievalFailureException(
"Could not retrieve Attachment with id=" + attachmentId);
}
- Attachment target = new Attachment();
+ Attachment target = TuttiBeanFactory.newAttachment();
loadAttachment(source, target);
File result = getFile(target);
@@ -232,7 +233,7 @@
throw new DataRetrievalFailureException(
"Could not retrieve Attachment with id=" + attachmentId);
}
- Attachment target = new Attachment();
+ Attachment target = TuttiBeanFactory.newAttachment();
loadAttachment(source, target);
measurementFileDao.remove(id);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -29,6 +29,7 @@
import fr.ifremer.adagio.core.dao.data.batch.Batch;
import fr.ifremer.adagio.core.dao.data.batch.CatchBatchExtendDao;
import fr.ifremer.adagio.core.dao.data.batch.SortingBatch;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
@@ -101,7 +102,7 @@
&& !enumeration.REFERENCE_TAXON_ID_LIFE.equals(source.getReferenceTaxon().getId())
&& !enumeration.REFERENCE_TAXON_ID_INERT.equals(source.getReferenceTaxon().getId())) {
- SpeciesBatch target = new SpeciesBatch();
+ SpeciesBatch target = TuttiBeanFactory.newSpeciesBatch();
batchHelper.entityToSpeciesBatch(source, target);
result.addChildren(target);
if (log.isInfoEnabled()) {
@@ -117,7 +118,7 @@
if (horsVracSpeciesBatch != null) {
for (Batch batch : horsVracSpeciesBatch.getChildBatchs()) {
- SpeciesBatch target = new SpeciesBatch();
+ SpeciesBatch target = TuttiBeanFactory.newSpeciesBatch();
batchHelper.entityToSpeciesBatch((SortingBatch) batch, target);
result.addChildren(target);
if (log.isInfoEnabled()) {
@@ -227,7 +228,7 @@
for (Batch batch : sortingBatch.getChildBatchs()) {
SortingBatch source = (SortingBatch) batch;
- SpeciesBatchFrequency target = new SpeciesBatchFrequency();
+ SpeciesBatchFrequency target = TuttiBeanFactory.newSpeciesBatchFrequency();
batchHelper.entityToSpeciesBatchFrequency(source, target);
results.add(target);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -41,6 +41,7 @@
import fr.ifremer.adagio.core.dao.referential.taxon.ReferenceTaxonImpl;
import fr.ifremer.adagio.core.dao.technical.synchronization.SynchronizationStatus;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
+import fr.ifremer.tutti.persistence.entities.data.CatchBatchBean;
import fr.ifremer.tutti.persistence.service.batch.BatchPersistenceHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -101,7 +102,7 @@
// wenever want to repair anything from Tutti
fr.ifremer.adagio.core.dao.data.batch.CatchBatch source = catchBatchDao.loadFullTree(catchBatchId, true, false);
- CatchBatch result = new CatchBatch();
+ CatchBatch result = new CatchBatchBean();
result.setId(source.getId());
result.setCatchTotalWeight(source.getWeight());
@@ -215,6 +216,17 @@
}
}
+ // Hors Vrac > MarineLitter
+ SortingBatch marineLitterBatch = catchBatchDao.getSortingBatch(horsVracBatch.getChildBatchs(),
+ "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+
+
+ if (marineLitterBatch != null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loaded CatchBatch Hors Vrac> MarineLitter: " + marineLitterBatch.getId());
+ }
+ }
+
// TODO : Plancton...
}
}
@@ -377,6 +389,8 @@
aliveNotItemizedBatch = SortingBatch.Factory.newInstance();
speciesBatch.getChildBatchs().add(aliveNotItemizedBatch);
}
+
+ //TODO beanToEntitySortingBatch avec nouveau psfm
beanToEntityReferenceTaxonBatch(target, speciesBatch, aliveNotItemizedBatch, recorderDepartmentId,
enumeration.REFERENCE_TAXON_ID_LIFE,
source.getSpeciesTotalLivingNotItemizedWeight(), null);
@@ -390,11 +404,14 @@
inertBatch = SortingBatch.Factory.newInstance();
speciesBatch.getChildBatchs().add(inertBatch);
}
+ //TODO beanToEntitySortingBatch avec nouveau psfm
beanToEntityReferenceTaxonBatch(target, speciesBatch, inertBatch, recorderDepartmentId,
enumeration.REFERENCE_TAXON_ID_INERT,
source.getSpeciesTotalInertWeight(),
null);
inertBatch.setRankOrder((short) 2);
+
+ // TODO Créer le noeud Vivant trié
}
// -----------------------------------------------------------------------------
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -53,6 +53,7 @@
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.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -137,7 +138,7 @@
List<Cruise> result = Lists.newArrayList();
while (list.hasNext()) {
Object[] source = list.next();
- Cruise target = new Cruise();
+ Cruise target = TuttiBeanFactory.newCruise();
target.setId(String.valueOf(source[0]));
target.setName((String) source[1]);
target.setBeginDate((Date) source[2]);
@@ -157,7 +158,7 @@
if (source == null) {
throw new DataRetrievalFailureException("Could not retrieve cruise with id=" + id);
}
- Cruise result = new Cruise();
+ Cruise result = TuttiBeanFactory.newCruise();
result.setId(id);
int index = 0;
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -59,6 +59,7 @@
import fr.ifremer.adagio.core.dao.referential.vessel.VesselImpl;
import fr.ifremer.adagio.core.service.referential.location.LocationService;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
@@ -143,7 +144,7 @@
Object[] source = list.next();
fishingOperationRankOrder++;
- FishingOperation fishingOperation = new FishingOperation();
+ FishingOperation fishingOperation = TuttiBeanFactory.newFishingOperation();
int colIndex = 0;
// Id
@@ -210,7 +211,7 @@
if (source == null) {
throw new DataRetrievalFailureException("Could not retrieve fishingOperation with id=" + id);
}
- FishingOperation result = new FishingOperation();
+ FishingOperation result = TuttiBeanFactory.newFishingOperation();
result.setId(id);
// Cruise :
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/MarineLitterBatchPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,24 +25,34 @@
*/
import com.google.common.base.Preconditions;
+import com.google.common.collect.Sets;
import fr.ifremer.adagio.core.dao.data.batch.Batch;
+import fr.ifremer.adagio.core.dao.data.batch.CatchBatch;
import fr.ifremer.adagio.core.dao.data.batch.CatchBatchExtendDao;
import fr.ifremer.adagio.core.dao.data.batch.SortingBatch;
import fr.ifremer.adagio.core.dao.data.measure.QuantificationMeasurement;
+import fr.ifremer.adagio.core.dao.data.measure.SortingMeasurement;
+import fr.ifremer.adagio.core.dao.referential.QualityFlagImpl;
import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValue;
+import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueImpl;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
+import fr.ifremer.tutti.persistence.entities.data.TuttiBatchEntity;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.service.batch.BatchPersistenceHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.hibernate.FlushMode;
+import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Map;
+import java.util.Set;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -64,7 +74,7 @@
@Resource(name = "batchPersistenceHelper")
protected BatchPersistenceHelper batchHelper;
- Integer marineLitterType;
+ Integer marineLitterCategory;
Integer marineLitterSizeCategory;
@@ -77,7 +87,7 @@
super.init();
Caracteristic marineLitterCategoryCaracteristic = referentialService.getMarineLitterCategoryCaracteristic();
- marineLitterType = marineLitterCategoryCaracteristic.getIdAsInt();
+ marineLitterCategory = marineLitterCategoryCaracteristic.getIdAsInt();
marineLitterCategoryCaracteristicValues = TuttiEntities.splitByIdAsInt(marineLitterCategoryCaracteristic.getQualitativeValue());
Caracteristic marineLitterSizeCategoryCaracteristic = referentialService.getMarineLitterSizeCategoryCaracteristic();
@@ -112,8 +122,8 @@
for (Batch batch1 : vracMarineLitterBatch.getChildBatchs()) {
SortingBatch source = (SortingBatch) batch1;
- MarineLitterBatch target = new MarineLitterBatch();
- entityToMacroWasteBatch(source, target);
+ MarineLitterBatch target = TuttiBeanFactory.newMarineLitterBatch();
+ entityToMarineLitterBatch(source, target);
result.addChildren(target);
if (log.isInfoEnabled()) {
@@ -129,20 +139,65 @@
@Override
public MarineLitterBatch createMarineLitterBatch(MarineLitterBatch bean) {
- return null;
+ Preconditions.checkNotNull(bean);
+ Preconditions.checkArgument(bean.getId() == null);
+ Preconditions.checkNotNull(bean.getMarineLitterCategory());
+ Preconditions.checkNotNull(bean.getMarineLitterSizeCategory());
+ Preconditions.checkNotNull(bean.getWeight());
+// Preconditions.checkNotNull(bean.getNumber());
+
+ getCurrentSession().setFlushMode(FlushMode.COMMIT);
+
+ // Load full batch tree
+ Integer catchBatchId = catchBatchDao.getIdByFishingOperationId(bean.getFishingOperation().getIdAsInt());
+ fr.ifremer.adagio.core.dao.data.batch.CatchBatch catchBatch = catchBatchDao.loadFullTree(catchBatchId);
+
+ SortingBatch batch = SortingBatch.Factory.newInstance();
+ marineLitterBatchToEntity(bean, batch, catchBatch);
+ batch = catchBatchDao.createSortingBatch(batch, catchBatch);
+
+ bean.setId(batch.getId());
+
+ getCurrentSession().flush();
+
+ return bean;
}
@Override
public MarineLitterBatch saveMarineLitterBatch(MarineLitterBatch bean) {
- return null;
+ Preconditions.checkNotNull(bean);
+ Preconditions.checkNotNull(bean.getId());
+
+ // Load batch tree
+ Integer catchBatchId = catchBatchDao.getIdBySortingBatchId(bean.getIdAsInt());
+ Preconditions.checkNotNull(catchBatchId);
+
+ fr.ifremer.adagio.core.dao.data.batch.CatchBatch catchBatch = catchBatchDao.loadFullTree(catchBatchId);
+ Preconditions.checkNotNull(catchBatch);
+
+ getCurrentSession().setFlushMode(FlushMode.COMMIT);
+
+ SortingBatch batch = catchBatchDao.getSortingBatchById(catchBatch, bean.getIdAsInt());
+ marineLitterBatchToEntity(bean, batch, catchBatch);
+ catchBatchDao.updateSortingBatch(batch, catchBatch);
+ getCurrentSession().flush();
+
+ return bean;
}
@Override
public void deleteMarineLitterBatch(String id) {
+ Preconditions.checkNotNull(id);
+
+ getCurrentSession().setFlushMode(FlushMode.COMMIT);
+
+ catchBatchDao.removeWithChildren(Integer.valueOf(id));
+
+ getCurrentSession().flush();
}
- public MarineLitterBatch entityToMacroWasteBatch(SortingBatch source,
- MarineLitterBatch target) {
+ public MarineLitterBatch entityToMarineLitterBatch(SortingBatch source,
+ MarineLitterBatch target) {
target.setId(source.getId().toString());
@@ -159,7 +214,7 @@
for (QuantificationMeasurement measurement : source.getQuantificationMeasurements()) {
Integer pmfmId = measurement.getPmfm().getId();
- if (marineLitterType.equals(pmfmId)) {
+ if (marineLitterCategory.equals(pmfmId)) {
QualitativeValue qualitativeValue = measurement.getQualitativeValue();
Integer id = qualitativeValue.getId();
CaracteristicQualitativeValue value = marineLitterCategoryCaracteristicValues.get(id);
@@ -173,4 +228,140 @@
}
return target;
}
+
+ protected void marineLitterBatchToEntity(MarineLitterBatch source,
+ SortingBatch target,
+ fr.ifremer.adagio.core.dao.data.batch.CatchBatch catchBatch) {
+
+ Preconditions.checkNotNull(source.getFishingOperation());
+ Preconditions.checkNotNull(source.getFishingOperation().getId());
+
+ // Retrieve recorder department
+ Integer recorderDepartmentId = batchHelper.getRecorderDepartmentId();
+
+ Collection<QuantificationMeasurement> quantificationMeasurements = target.getQuantificationMeasurements();
+ Collection<SortingMeasurement> sortingMeasurements = target.getSortingMeasurements();
+
+ // Create lists to store all updates, then remove not updated items
+
+ Set<QuantificationMeasurement> notChangedQuantificationMeasurements = Sets.newHashSet();
+ if (quantificationMeasurements != null) {
+ notChangedQuantificationMeasurements.addAll(quantificationMeasurements);
+ }
+ Set<SortingMeasurement> notChangedSortingMeasurements = Sets.newHashSet();
+ if (sortingMeasurements != null) {
+ notChangedSortingMeasurements.addAll(sortingMeasurements);
+ }
+
+
+ // If parent and root need to be set
+ if (target.getId() == null || target.getRootBatch() == null) {
+ setBatchParents(source, target, catchBatch);
+ }
+
+ // RankOrder (initialize once, at creation)
+ if (target.getRankOrder() == null) {
+ // Start rank order at 1, nothing before it
+ short rankOrder = (short) 1;
+ if (target.getParentBatch() != null && target.getParentBatch().getChildBatchs() != null) {
+ rankOrder += (short) target.getParentBatch().getChildBatchs().size();
+ }
+ target.setRankOrder(rankOrder);
+ }
+
+ // Force subgroup count to '1', as Allegro
+ target.setSubgroupCount(1f);
+
+ // Weight
+ if (source.getWeight() == null) {
+ // Nothing to do : will be removed later, using notChangedSortingMeasurements
+ } else {
+ QuantificationMeasurement quantificationMeasurement = catchBatchDao.setQuantificationMeasurement(
+ target,
+ enumeration.PMFM_ID_WEIGHT_MEASURED,
+ recorderDepartmentId,
+ source.getWeight(),
+ true);
+ notChangedQuantificationMeasurements.remove(quantificationMeasurement);
+ }
+
+ // MarineLitterCategory
+ if (source.getMarineLitterCategory() == null) {
+ // Nothing to do : will be removed later, using notChangedQuantificationMeasurements
+ } else {
+ QuantificationMeasurement quantificationMeasurement = catchBatchDao.getQuantificationMeasurement(
+ target,
+ marineLitterCategory,
+ recorderDepartmentId,
+ true);
+ quantificationMeasurement.setQualitativeValue(load(QualitativeValueImpl.class, source.getMarineLitterCategory().getIdAsInt()));
+ notChangedQuantificationMeasurements.remove(quantificationMeasurement);
+ }
+
+ // MarineLitterCategory
+ if (source.getMarineLitterSizeCategory() == null) {
+ // Nothing to do : will be removed later, using notChangedQuantificationMeasurements
+ } else {
+ QuantificationMeasurement quantificationMeasurement = catchBatchDao.getQuantificationMeasurement(
+ target,
+ marineLitterSizeCategory,
+ recorderDepartmentId,
+ true);
+ quantificationMeasurement.setQualitativeValue(load(QualitativeValueImpl.class, source.getMarineLitterSizeCategory().getIdAsInt()));
+ notChangedQuantificationMeasurements.remove(quantificationMeasurement);
+ }
+
+ // Sampling Ratio
+ target.setSamplingRatio(null);
+ target.setSamplingRatioText(null);
+
+ // Individual count
+ target.setIndividualCount(source.getNumber());
+
+ // QualityFlag
+ String qualityFlag;
+ qualityFlag = enumeration.QUALITY_FLAG_CODE_NOT_QUALIFIED;
+ target.setQualityFlag(load(QualityFlagImpl.class, qualityFlag));
+
+ // Comments
+ target.setComments(source.getComment());
+
+ // Exhaustive inventory (always true under a species batch)
+ target.setExhaustiveInventory(true);
+
+ // Removed not changed measurements (in sorting and quantification measurement lists)
+ if (quantificationMeasurements != null) {
+ quantificationMeasurements.removeAll(notChangedQuantificationMeasurements);
+ }
+ if (sortingMeasurements != null) {
+ sortingMeasurements.removeAll(notChangedSortingMeasurements);
+ }
+
+ }
+
+ public void setBatchParents(TuttiBatchEntity source,
+ SortingBatch target,
+ CatchBatch catchBatch) {
+
+ Preconditions.checkNotNull(target);
+ Preconditions.checkNotNull(source.getFishingOperation());
+ Preconditions.checkNotNull(source.getFishingOperation().getId());
+
+ // Load existing parent and root
+ SortingBatch parentBatch;
+
+ parentBatch = catchBatchDao.getSortingBatch(catchBatch.getChildBatchs(),
+ "pmfmId", enumeration.PMFM_ID_SORTING_TYPE, enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+
+ // Parent Batch
+
+ if (parentBatch == null) {
+ throw new DataIntegrityViolationException(
+ "Could not retrieve parent batch, for a given speciesBatch : invalid batch tree structure. Please make sure CatchBatch has been saved before to create a SpeciesBatch.");
+ }
+
+ // Parent Batch
+ target.setParentBatch(parentBatch);
+ target.setRootBatch(catchBatch);
+ }
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -31,6 +31,7 @@
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.taxon.TaxonGroupTypeImpl;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import org.apache.commons.logging.Log;
@@ -84,7 +85,7 @@
List<Program> result = Lists.newArrayList();
while (list.hasNext()) {
Object[] source = list.next();
- Program target = new Program();
+ Program target = TuttiBeanFactory.newProgram();
loadProgram(target, source);
result.add(target);
}
@@ -106,7 +107,7 @@
// Keep only the first row (=the first location, if many found)
Object[] source = list.next();
- result = new Program();
+ result = TuttiBeanFactory.newProgram();
loadProgram(result, source);
} else {
result = null;
@@ -162,7 +163,7 @@
result.setName((String) source[1]);
result.setDescription((String) source[2]);
if (source[3] != null) {
- TuttiLocation zone = new TuttiLocation();
+ TuttiLocation zone = TuttiBeanFactory.newTuttiLocation();
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/ProtocolPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.TuttiIOUtil;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
@@ -113,7 +114,7 @@
Binder<TuttiProtocol, TuttiProtocol> protocolBinder =
BinderFactory.newBinder(TuttiProtocol.class);
- TuttiProtocol result = new TuttiProtocol();
+ TuttiProtocol result = TuttiBeanFactory.newTuttiProtocol();
protocolBinder.copy(bean, result);
result.setId(UUID.randomUUID().toString());
@@ -125,7 +126,7 @@
List<SpeciesProtocol> species = Lists.newArrayList();
if (!bean.isSpeciesEmpty()) {
for (SpeciesProtocol speciesProtocol : bean.getSpecies()) {
- SpeciesProtocol s = new SpeciesProtocol();
+ SpeciesProtocol s = TuttiBeanFactory.newSpeciesProtocol();
speciesProtocolBinder.copy(speciesProtocol, s);
s.setId(UUID.randomUUID().toString());
species.add(s);
@@ -136,7 +137,7 @@
List<SpeciesProtocol> benthos = Lists.newArrayList();
if (!bean.isBenthosEmpty()) {
for (SpeciesProtocol speciesProtocol : bean.getBenthos()) {
- SpeciesProtocol s = new SpeciesProtocol();
+ SpeciesProtocol s = TuttiBeanFactory.newSpeciesProtocol();
speciesProtocolBinder.copy(speciesProtocol, s);
s.setId(UUID.randomUUID().toString());
species.add(s);
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -34,8 +34,8 @@
import fr.ifremer.adagio.core.dao.referential.taxon.TaxonNameExtendDao;
import fr.ifremer.adagio.core.dao.referential.taxon.TaxonRefTaxVO;
import fr.ifremer.adagio.core.service.technical.CacheService;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
-import fr.ifremer.tutti.persistence.entities.referential.AbstractTuttiReferentialEntity;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicType;
@@ -44,7 +44,9 @@
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.StatusBean;
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiReferentialEntity;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -635,7 +637,7 @@
vesselTypeId);
// Fill the result bean
- Vessel result = new Vessel();
+ Vessel result = TuttiBeanFactory.newVessel();
result.setId(target.getCode());
result.setName(source.getName());
result.setRegistrationCode(source.getRegistrationCode());
@@ -653,7 +655,7 @@
fr.ifremer.adagio.core.dao.administration.user.Person target = personDao.createAsTemporary(source.getLastName(), source.getFirstName(), enumeration.DEPARTMENT_ID_UNKNOWN_RECORDER_DEPARTMENT);
// Fill the result bean
- Person result = new Person();
+ Person result = TuttiBeanFactory.newPerson();
result.setId(target.getId().toString());
result.setLastName(source.getLastName());
result.setFirstName(source.getFirstName());
@@ -696,7 +698,7 @@
fr.ifremer.adagio.core.dao.referential.gear.Gear target = fishingGearDao.createAsTemporary(source.getLabel(), source.getName(), gearClassificationId);
// Fill the result bean
- Gear result = new Gear();
+ Gear result = TuttiBeanFactory.newGear();
result.setId(target.getId().toString());
result.setLabel(source.getLabel());
result.setName(source.getName());
@@ -725,7 +727,7 @@
Integer pmfmId = (Integer) source[0];
- Caracteristic result = new Caracteristic();
+ Caracteristic result = TuttiBeanFactory.newCaracteristic();
result.setId(pmfmId.toString());
result.setParameterName((String) source[1]);
result.setMatrixName((String) source[2]);
@@ -751,7 +753,7 @@
List<CaracteristicQualitativeValue> values = Lists.newArrayList();
while (sources.hasNext()) {
Object[] source2 = sources.next();
- CaracteristicQualitativeValue target2 = new CaracteristicQualitativeValue();
+ CaracteristicQualitativeValue target2 = TuttiBeanFactory.newCaracteristicQualitativeValue();
target2.setId(String.valueOf(source2[0]));
target2.setName(String.valueOf(source2[1]));
setStatus((fr.ifremer.adagio.core.dao.referential.Status) source2[2], target2);
@@ -763,7 +765,7 @@
}
protected ObjectType loadObjectType(Object[] source) {
- ObjectType result = new ObjectType();
+ ObjectType result = TuttiBeanFactory.newObjectType();
result.setId((String) source[0]);
result.setName((String) source[1]);
result.setDescription((String) source[2]);
@@ -771,7 +773,7 @@
}
protected Species loadSpecies(TaxonRefTaxVO source) {
- Species target = new Species();
+ Species target = TuttiBeanFactory.newSpecies();
target.setId(String.valueOf(source.getTaxonNameId()));
target.setName(source.getName());
target.setRefTaxCode(source.getRefTaxCode());
@@ -783,7 +785,7 @@
}
protected Vessel loadVessel(Object[] source, boolean scientificVessel) {
- Vessel target = new Vessel();
+ Vessel target = TuttiBeanFactory.newVessel();
target.setId((String) source[0]);
target.setRegistrationCode((String) source[1]);
target.setInternationalRegistrationCode((String) source[2]);
@@ -794,7 +796,7 @@
}
protected Person loadPerson(Object[] source) {
- Person target = new Person();
+ Person target = TuttiBeanFactory.newPerson();
target.setId(String.valueOf(source[0]));
target.setFirstName((String) source[1]);
target.setLastName((String) source[2]);
@@ -804,7 +806,7 @@
}
protected Gear loadGear(Object[] source, boolean scientificGear) {
- Gear result = new Gear();
+ Gear result = TuttiBeanFactory.newGear();
result.setId(String.valueOf(source[0]));
result.setLabel((String) source[1]);
result.setName((String) source[2]);
@@ -815,7 +817,7 @@
}
protected TuttiLocation loadLocation(Object[] source) {
- TuttiLocation target = new TuttiLocation();
+ TuttiLocation target = TuttiBeanFactory.newTuttiLocation();
target.setId(String.valueOf(source[0]));
target.setLabel((String) source[1]);
target.setName((String) source[2]);
@@ -843,8 +845,8 @@
return (Object[]) result;
}
- protected <E extends AbstractTuttiReferentialEntity> void setStatus(fr.ifremer.adagio.core.dao.referential.Status status, E entity) {
- Status newStatus = new Status();
+ protected <E extends TuttiReferentialEntity> void setStatus(fr.ifremer.adagio.core.dao.referential.Status status, E entity) {
+ Status newStatus = new StatusBean();
newStatus.setId(status.getCode());
newStatus.setName(status.getName());
entity.setStatus(newStatus);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -29,6 +29,7 @@
import fr.ifremer.adagio.core.dao.data.batch.Batch;
import fr.ifremer.adagio.core.dao.data.batch.CatchBatchExtendDao;
import fr.ifremer.adagio.core.dao.data.batch.SortingBatch;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
@@ -99,7 +100,7 @@
&& !enumeration.REFERENCE_TAXON_ID_LIFE.equals(source.getReferenceTaxon().getId())
&& !enumeration.REFERENCE_TAXON_ID_INERT.equals(source.getReferenceTaxon().getId())) {
- SpeciesBatch target = new SpeciesBatch();
+ SpeciesBatch target = TuttiBeanFactory.newSpeciesBatch();
batchHelper.entityToSpeciesBatch(source, target);
result.addChildren(target);
@@ -116,7 +117,7 @@
if (horsVracSpeciesBatch != null) {
for (Batch batch : horsVracSpeciesBatch.getChildBatchs()) {
- SpeciesBatch target = new SpeciesBatch();
+ SpeciesBatch target = TuttiBeanFactory.newSpeciesBatch();
batchHelper.entityToSpeciesBatch((SortingBatch) batch, target);
result.addChildren(target);
if (log.isInfoEnabled()) {
@@ -233,7 +234,7 @@
List<SortingBatch> frequencyChilds = batchHelper.getFrequencyChilds(sortingBatch);
for (SortingBatch child : frequencyChilds) {
- SpeciesBatchFrequency target = new SpeciesBatchFrequency();
+ SpeciesBatchFrequency target = TuttiBeanFactory.newSpeciesBatchFrequency();
batchHelper.entityToSpeciesBatchFrequency(child, target);
results.add(target);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -39,6 +39,7 @@
import fr.ifremer.adagio.core.dao.referential.pmfm.QualitativeValueImpl;
import fr.ifremer.adagio.core.dao.referential.taxon.ReferenceTaxon;
import fr.ifremer.adagio.core.dao.referential.taxon.ReferenceTaxonImpl;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
@@ -184,7 +185,7 @@
List<SpeciesBatch> targetChilds = Lists.newArrayList();
for (Batch batch : source.getChildBatchs()) {
SortingBatch sourceChild = (SortingBatch) batch;
- SpeciesBatch targetChild = new SpeciesBatch();
+ SpeciesBatch targetChild = TuttiBeanFactory.newSpeciesBatch();
entityToSpeciesBatch(sourceChild, targetChild);
if (log.isInfoEnabled()) {
log.info("Loaded CatchBatch Hors Vrac > Benthos > " + target.getSpecies().getReferenceTaxonId() + " : " + target.getId());
@@ -207,7 +208,6 @@
target.setNumber(source.getIndividualCount());
target.setWeight(source.getWeight());
- target.setComment(source.getComments());
Preconditions.checkState(source.getSortingMeasurements().size() == 1, "SortingBatch [" + source.getId() + "] need exactly one sortingMeasurement (to store the length step category), but had " + source.getSortingMeasurements().size());
SortingMeasurement sm = source.getSortingMeasurements().iterator().next();
@@ -368,14 +368,14 @@
Preconditions.checkNotNull(source.getFishingOperation());
Preconditions.checkNotNull(source.getFishingOperation().getId());
- // Load existing parent and root
SortingBatch parentBatch;
if (parentBatchIdStr != null) {
+
+ // Load existing parent and root
parentBatch = catchBatchDao.getSortingBatchById(catchBatch, Integer.valueOf(parentBatchIdStr));
- }
+ } else {
- // Or retrieve parent batch, from pmfm id
- else {
+ // Or retrieve parent batch, from pmfm id
// Retrieve category type
Integer pmfmId = source.getSampleCategoryType().getFieldValue();
if (pmfmId == null || !pmfmId.equals(enumeration.PMFM_ID_SORTED_UNSORTED)) {
@@ -519,9 +519,6 @@
// QualityFlag
target.setQualityFlag(parentBatch.getQualityFlag());
- // Comments
- target.setComments(source.getComment());
-
// Exhaustive inventory (always true under a species batch)
target.setExhaustiveInventory(true);
Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java
===================================================================
--- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/ScientificCruiseCatchBatchValidator.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -110,9 +110,10 @@
if (livingNotItemizedBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.vracSpeciesLifeNotFound"));
}
+
+ // TODO verifier que les espèces en haut de grappe ont bien la catégorie voulue (sorted-unsroted)
}
- //FIXME - make this work with data to repair :(
// Vrac > Benthos
SortingBatch benthosBatch = catchBatchDao.getSortingBatch(vracBatch.getChildBatchs(),
"pmfmId", enumeration.PMFM_ID_SORTING_TYPE,
@@ -159,6 +160,15 @@
if (benthosBatch == null) {
addWarning(errors, n_("tutti.persistence.batch.validation.horsVracBenthosNotFound"));
}
+ // Hors Vrac > MarineLitter
+ SortingBatch marineLitterBatch = catchBatchDao.getSortingBatch(horsVracBatch.getChildBatchs(),
+ "pmfmId",
+ enumeration.PMFM_ID_SORTING_TYPE,
+ enumeration.QUALITATIVE_ID_SORTING_TYPE_MARINE_LITTER);
+
+ if (marineLitterBatch == null) {
+ addWarning(errors, n_("tutti.persistence.batch.validation.horsVracMarineLitterNotFound"));
+ }
// TODO : Plancton...
}
Modified: trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_en_GB.properties 2013-04-01 20:46:21 UTC (rev 715)
@@ -15,6 +15,7 @@
tutti.config.option.persistence.jdbc.username.description=
tutti.config.persistence=
tutti.persistence.batch.validation.horsVracBenthosNotFound=
+tutti.persistence.batch.validation.horsVracMarineLitterNotFound=
tutti.persistence.batch.validation.horsVracSpeciesNotFound=
tutti.persistence.batch.validation.onlySpeciesBatchStructure=
tutti.persistence.batch.validation.unsortedNotFound=
Modified: trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties
===================================================================
--- trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/resources/i18n/tutti-persistence_fr_FR.properties 2013-04-01 20:46:21 UTC (rev 715)
@@ -15,6 +15,7 @@
tutti.config.option.persistence.jdbc.username.description=Login de l'utilisateur pour se connecter à la base de données
tutti.config.persistence=Configuration de la persistence de Tutti
tutti.persistence.batch.validation.horsVracBenthosNotFound=Lot 'Hors Vrac > Benthos' non trouvé ou configuré avec d'autres critères de classement.
+tutti.persistence.batch.validation.horsVracMarineLitterNotFound=
tutti.persistence.batch.validation.horsVracSpeciesNotFound=Lot 'Hors Vrac > Espèces' non trouvé ou configuré avec d'autres critères de classement.
tutti.persistence.batch.validation.onlySpeciesBatchStructure=Lot 'Espèces' (données historiques CGFS) détecté.
tutti.persistence.batch.validation.unsortedNotFound=Lot 'Hors Vrac > Espèces' non trouvé ou configuré avec d'autres critères de classement.
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties
===================================================================
--- trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/main/xmi/tutti-persistence.properties 2013-04-01 20:46:21 UTC (rev 715)
@@ -22,23 +22,27 @@
# #L%
###
-model.tagvalue.version=0.3
+model.tagvalue.version=1.2
model.tagvalue.constantPrefix=PROPERTY_
model.tagvalue.doNotGenerateBooleanGetMethods=true
model.tagvalue.noPCS=true
-model.tagvalue.beanSuperClass=fr.ifremer.tutti.persistence.entities.AbstractTuttiEntity
+model.tagvalue.simpleBeanSuperClass=fr.ifremer.tutti.persistence.entities.TuttiEntityBean
+model.tagvalue.simpleBeanInterfaceSuperClass=fr.ifremer.tutti.persistence.entities.TuttiEntity
+model.tagvalue.simpleBeanGenerateInterface=true
+model.tagvalue.simpleBeanGenerateFactory=true
+model.tagvalue.simpleBeanClassNameSuffix=Bean
+model.tagvalue.simpleBeanExtractPojoInterface=true
fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.gear.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfMission.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.Cruise.attribute.headOfSortRoom.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.FishingOperation.attribute.recorderPerson.stereotype=ordered
-fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch.attribute.marineLitterCategory.stereotype=ordered
fr.ifremer.tutti.persistence.entities.data.SpeciesBatch.attribute.childBatchs.stereotype=ordered
+fr.ifremer.tutti.persistence.entities.data.BenthosBatch.attribute.childBatchs.stereotype=ordered
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.gearUseFeaturePmfmId.stereotype=ordered
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.vesselUseFeaturePmfmId.stereotype=ordered
-fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.hydrologyPmfmId.stereotype=ordered
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.lengthClassesPmfmId.stereotype=ordered
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.species.stereotype=ordered
fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol.attribute.benthos.stereotype=ordered
Modified: trunk/tutti-persistence/src/main/xmi/tutti-persistence.zargo
===================================================================
(Binary files differ)
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocolsTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -27,15 +27,13 @@
import com.google.common.base.Charsets;
import com.google.common.collect.Lists;
import com.google.common.io.Files;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.SystemUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TestName;
+import org.nuiton.util.FileUtil;
import java.io.File;
import java.io.IOException;
@@ -46,9 +44,6 @@
*/
public class TuttiProtocolsTest {
- /** Logger. */
- private static final Log log = LogFactory.getLog(TuttiProtocolsTest.class);
-
public static final String PROTOCOL_FILE_CONTENT =
"id: 1\n" +
"name: protocolName\n" +
@@ -119,9 +114,10 @@
@Before
public void setUp() throws Exception {
- datadirectory = getTestSpecificDirectory(getClass(),
- name.getMethodName(),
- null);
+ datadirectory = FileUtil.getTestSpecificDirectory(getClass(),
+ name.getMethodName(),
+ null,
+ TIMESTAMP);
}
@Test
@@ -222,7 +218,7 @@
}
private TuttiProtocol createProtocolFixture() {
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
protocol.setId("1");
protocol.setName("protocolName");
protocol.setComment("Commentaire");
@@ -231,7 +227,7 @@
protocol.setGearUseFeaturePmfmId(Lists.newArrayList("21", "22"));
protocol.setSpecies(Lists.<SpeciesProtocol>newArrayList());
- SpeciesProtocol sp1 = new SpeciesProtocol();
+ SpeciesProtocol sp1 = TuttiBeanFactory.newSpeciesProtocol();
sp1.setId("1");
sp1.setSpeciesReferenceTaxonId(11242);
sp1.setSpeciesSurveyCode("BAR");
@@ -242,7 +238,7 @@
sp1.setWeightEnabled(true);
protocol.addSpecies(sp1);
- SpeciesProtocol sp2 = new SpeciesProtocol();
+ SpeciesProtocol sp2 = TuttiBeanFactory.newSpeciesProtocol();
sp2.setId("2");
sp2.setSpeciesReferenceTaxonId(3835);
sp2.setSpeciesSurveyCode("CHIN");
@@ -257,7 +253,7 @@
protocol.addSpecies(sp2);
protocol.setBenthos(Lists.<SpeciesProtocol>newArrayList());
- SpeciesProtocol b1 = new SpeciesProtocol();
+ SpeciesProtocol b1 = TuttiBeanFactory.newSpeciesProtocol();
b1.setId("1");
b1.setSpeciesReferenceTaxonId(11242);
b1.setSpeciesSurveyCode("BAR");
@@ -268,7 +264,7 @@
b1.setWeightEnabled(true);
protocol.addBenthos(b1);
- SpeciesProtocol b2 = new SpeciesProtocol();
+ SpeciesProtocol b2 = TuttiBeanFactory.newSpeciesProtocol();
b2.setId("2");
b2.setSpeciesReferenceTaxonId(3835);
b2.setSpeciesSurveyCode("CHIN");
@@ -285,32 +281,4 @@
return protocol;
}
- public static File getTestSpecificDirectory(Class<?> testClassName,
- String methodName,
- String classifier) {
- // 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 = SystemUtils.getJavaIoTmpDir();
-
- // create the directory to store database data
- String dataBasePath = testClassName.getName()
- + File.separator // a directory with the test class name
- + methodName; // a sub-directory with the method name
-
- if (StringUtils.isNotBlank(classifier)) {
- dataBasePath += classifier;
- }
- dataBasePath += '_'
- + TIMESTAMP; // and a timestamp
- File databaseFile = new File(tempDirFile, dataBasePath);
- return databaseFile;
- }
-
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceWriteTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/AttachmentPersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,6 +25,7 @@
*/
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import org.junit.Assert;
@@ -67,7 +68,7 @@
// create attachment
//
- Attachment attachment = new Attachment();
+ Attachment attachment = TuttiBeanFactory.newAttachment();
attachment.setObjectType(AttachementObjectTypeEnum.SCIENTIFIC_CRUISE);
attachment.setObjectId(cruiseId);
long buildTime = System.nanoTime();
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceReadTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceReadTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceReadTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -154,7 +154,6 @@
assertEquals(expectedBatchFrequency.getLengthStepCaracteristic().getId(), actualBatchFrequency.getLengthStepCaracteristic().getId());
assertEquals(expectedBatchFrequency.getNumber(), actualBatchFrequency.getNumber());
assertEquals(expectedBatchFrequency.getWeight(), actualBatchFrequency.getWeight());
- assertEquals(expectedBatchFrequency.getComment(), actualBatchFrequency.getComment());
//assertNotNull(expectedBatchFrequency.getBatch());
//assertEquals(expectedBatchFrequency.getBatch().getId(), actualBatchFrequency.getBatch().getId());
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceWriteTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/BenthosBatchPersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -27,6 +27,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -170,7 +171,7 @@
fishingOperationWithEmptyBatch.setGearShootingEndDate(calendar.getTime());
fishingOperationWithEmptyBatch = fishingOperationService.createFishingOperation(fishingOperationWithEmptyBatch);
- catchBacth = new CatchBatch();
+ catchBacth = TuttiBeanFactory.newCatchBatch();
catchBacth.setFishingOperation(fishingOperationWithEmptyBatch);
catchBacth = catchBatchService.createCatchBatch(catchBacth);
@@ -210,7 +211,7 @@
// 1. Test with only mandatory properties
// -----------------------------------------------------------------------------
// batch : "ESP1 - Vrac/5"
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setParentBatch(null);
batch.setFishingOperation(fishingOperationNoCatchBatch);
batch.setSpecies(taxon1);
@@ -227,7 +228,7 @@
// 2. Test child "Male/2"
// -----------------------------------------------------------------------------
// Batch : ESP1 - Vrac/5 Male/2 ss-ech/1 Nombre/7
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setId((String) null);
batch.setParentBatch(esp1Batch);
batch.setSpecies(taxon1);
@@ -244,7 +245,7 @@
// 3. Test child "Female/2"
// -----------------------------------------------------------------------------
// Batch : ESP1 - Vrac/5 Female/3 Nombre/14
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setId((String) null);
batch.setParentBatch(esp1Batch);
batch.setSpecies(taxon1);
@@ -262,7 +263,7 @@
// \- ESP2 - Vrac/7 UNK/2 ss-ech/1 Nombre/11
// -----------------------------------------------------------------------------
// batch : "ESP2 - Vrac/7 "
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setParentBatch(null);
batch.setSpecies(taxon2);
batch.setSampleCategoryType(SampleCategoryEnum.sortedUnsorted);
@@ -273,7 +274,7 @@
esp2Batch = batch;
// Batch : ESP2 - Vrac/7 UNK/2 ss-ech/1 Nombre/11
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setId((String) null);
batch.setParentBatch(esp2Batch);
batch.setSpecies(taxon2);
@@ -334,13 +335,12 @@
List<SpeciesBatchFrequency> frequencies = Lists.newArrayList();
float lengthStep = 0.5f;
for (float length = lengthStep; length < lengthStep * 20; length += lengthStep) {
- SpeciesBatchFrequency frequency = new SpeciesBatchFrequency();
+ SpeciesBatchFrequency frequency = TuttiBeanFactory.newSpeciesBatchFrequency();
frequency.setLengthStep(length);
frequency.setNumber((int) (length * 2));
frequency.setWeight(0.01f * length * 2);
frequency.setLengthStepCaracteristic(frequencyPMFM);
frequency.setBatch(frequenciesParentBatch);
- frequency.setComment("comments");
frequencies.add(frequency);
}
List<SpeciesBatchFrequency> createdFrequencies = assertCreateAndReloadBenthosBatchFrequency(frequencies, frequenciesParentBatch.getId());
@@ -353,7 +353,6 @@
float length = speciesBatchFrequency.getLengthStep();
if ((float) (int) length == length) {
speciesBatchFrequency.setNumber(12);
- speciesBatchFrequency.setComment(null);
}
}
// And remove the last item (should be deleted in DB)
@@ -375,7 +374,7 @@
// 1. Create two batchs (parent + child), then remove the parent batch
// -----------------------------------------------------------------------------
// batch : ESP1 Vrac/5
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setParentBatch(null);
batch.setFishingOperation(fishingOperationWithEmptyBatch);
batch.setSpecies(taxon1);
@@ -386,7 +385,7 @@
esp1Batch = batch;
// batch : ESP1 Vrac/5 Male/2
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setParentBatch(esp1Batch);
batch.setFishingOperation(fishingOperationWithEmptyBatch);
batch.setSpecies(taxon1);
@@ -503,7 +502,6 @@
assertEquals(expectedBatchFrequency.getLengthStepCaracteristic().getId(), actualBatchFrequency.getLengthStepCaracteristic().getId());
assertEquals(expectedBatchFrequency.getNumber(), actualBatchFrequency.getNumber());
assertEquals(expectedBatchFrequency.getWeight(), actualBatchFrequency.getWeight());
- assertEquals(expectedBatchFrequency.getComment(), actualBatchFrequency.getComment());
// assertNotNull(expectedBatchFrequency.getBatch());
// assertEquals(expectedBatchFrequency.getBatch().getId(), actualBatchFrequency.getBatch().getId());
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceWriteTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CatchBatchPersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import fr.ifremer.adagio.core.dao.data.batch.validator.CatchBatchValidationException;
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -159,7 +160,7 @@
fishingOperationWithEmptyBatch.setGearShootingEndDate(calendar.getTime());
fishingOperationWithEmptyBatch = fishingOperationService.createFishingOperation(fishingOperationWithEmptyBatch);
- catchBacth = new CatchBatch();
+ catchBacth = TuttiBeanFactory.newCatchBatch();
catchBacth.setFishingOperation(fishingOperationWithEmptyBatch);
catchBacth = service.createCatchBatch(catchBacth);
@@ -189,7 +190,7 @@
public void createAndSaveCatchBatch() throws Exception {
CatchBatch catchBatch;
- catchBatch = new CatchBatch();
+ catchBatch = TuttiBeanFactory.newCatchBatch();
catchBatch.setFishingOperation(fishingOperationNoCatchBatch);
// -----------------------------------------------------------------------------
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/CruisePersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
@@ -77,7 +78,7 @@
@Test
public void createCruise(/*Cruise bean*/) {
String programCode = dbResource.getFixtures().programCode();
- Cruise cruise = new Cruise();
+ Cruise cruise = TuttiBeanFactory.newCruise();
// -----------------------------------------------------------------------------
// 1. Test with all properties filled
@@ -109,7 +110,7 @@
Person managerPerson = referentialService.getAllPerson().get(0);
cruise.setHeadOfMission(Lists.newArrayList(managerPerson));
- Vessel fishingVessel = new Vessel();
+ Vessel fishingVessel = TuttiBeanFactory.newVessel();
fishingVessel.setId(dbResource.getFixtures().fishingVesselCode());
cruise.setVessel(fishingVessel);
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/FishingOperationPersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -27,6 +27,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.DatabaseResource;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
@@ -174,7 +175,7 @@
// Create new fishing operation :
- FishingOperation fishingOperation = new FishingOperation();
+ FishingOperation fishingOperation = TuttiBeanFactory.newFishingOperation();
// -----------------------------------------------------------------------------
// 1. Test with only mandatory properties
@@ -232,13 +233,13 @@
fishingOperation.setVesselUseFeatures(environmentCaracteristics);
fishingOperation.setGearUseFeatures(gearShootingCaracteristics);
- TuttiLocation strata = new TuttiLocation();
+ TuttiLocation strata = TuttiBeanFactory.newTuttiLocation();
strata.setId(dbResource.getFixtures().strataId());
fishingOperation.setStrata(strata);
- TuttiLocation subStrata = new TuttiLocation();
+ TuttiLocation subStrata = TuttiBeanFactory.newTuttiLocation();
subStrata.setId(dbResource.getFixtures().subStrataId());
fishingOperation.setSubStrata(subStrata);
- TuttiLocation localite = new TuttiLocation();
+ TuttiLocation localite = TuttiBeanFactory.newTuttiLocation();
localite.setId(dbResource.getFixtures().localite());
fishingOperation.setLocation(localite);
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProgramPersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,6 +25,7 @@
*/
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
import org.junit.Before;
@@ -66,7 +67,7 @@
assertNotNull(zones);
assertTrue(zones.size() > 0);
- Program program = new Program();
+ Program program = TuttiBeanFactory.newProgram();
String name = "UniTest" + System.currentTimeMillis();
if (name.length() > 40) {
name = name.substring(0, 39);
@@ -80,7 +81,6 @@
Program createdProgram = service.createProgram(program);
assertNotNull(createdProgram);
assertNotNull(createdProgram.getId());
- assertNull(createdProgram.getComment());
assertNotNull(createdProgram.getDescription());
assertNotNull(createdProgram.getZone());
assertEquals(program.getName(), createdProgram.getName());
@@ -90,7 +90,6 @@
Program reloadedProgram = service.getProgram(createdProgram.getId());
assertNotNull(reloadedProgram);
assertEquals(createdProgram, reloadedProgram);
- assertNull(reloadedProgram.getComment());
assertEquals(program.getName(), reloadedProgram.getName());
assertEquals(program.getDescription(), reloadedProgram.getDescription());
assertNotNull(program.getZone());
@@ -113,7 +112,6 @@
assertEquals(program.getId(), reloadedProgram.getId());
assertEquals(program.getName(), reloadedProgram.getName());
assertEquals(program.getDescription(), reloadedProgram.getDescription());
- assertNull(reloadedProgram.getComment());
assertNotNull(program.getZone());
assertEquals(program.getZone(), reloadedProgram.getZone());
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceReadTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceReadTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceReadTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import org.junit.Assert;
@@ -79,7 +80,7 @@
}
protected TuttiProtocol createProtocolFixture() {
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
protocol.setId("1");
protocol.setName("protocolName");
protocol.setComment("Commentaire");
@@ -88,7 +89,7 @@
protocol.setGearUseFeaturePmfmId(Lists.newArrayList("21", "22"));
protocol.setSpecies(Lists.<SpeciesProtocol>newArrayList());
- SpeciesProtocol sp1 = new SpeciesProtocol();
+ SpeciesProtocol sp1 = TuttiBeanFactory.newSpeciesProtocol();
sp1.setId("1");
sp1.setSpeciesReferenceTaxonId(11242);
sp1.setLengthStepPmfmId("1394");
@@ -98,7 +99,7 @@
sp1.setWeightEnabled(true);
protocol.addSpecies(sp1);
- SpeciesProtocol sp2 = new SpeciesProtocol();
+ SpeciesProtocol sp2 = TuttiBeanFactory.newSpeciesProtocol();
sp2.setId("2");
sp2.setSpeciesReferenceTaxonId(3835);
sp2.setLengthStepPmfmId("323");
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceWriteTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ProtocolPersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import org.junit.Assert;
@@ -128,7 +129,7 @@
}
protected TuttiProtocol createProtocolFixture() {
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
protocol.setId("1");
protocol.setName("protocolName");
protocol.setComment("Commentaire");
@@ -137,7 +138,7 @@
protocol.setGearUseFeaturePmfmId(Lists.newArrayList("21", "22"));
protocol.setSpecies(Lists.<SpeciesProtocol>newArrayList());
- SpeciesProtocol sp1 = new SpeciesProtocol();
+ SpeciesProtocol sp1 = TuttiBeanFactory.newSpeciesProtocol();
sp1.setId("1");
sp1.setSpeciesReferenceTaxonId(11242);
sp1.setLengthStepPmfmId("1394");
@@ -147,7 +148,7 @@
sp1.setWeightEnabled(true);
protocol.addSpecies(sp1);
- SpeciesProtocol sp2 = new SpeciesProtocol();
+ SpeciesProtocol sp2 = TuttiBeanFactory.newSpeciesProtocol();
sp2.setId("2");
sp2.setSpeciesReferenceTaxonId(3835);
sp2.setLengthStepPmfmId("323");
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -27,8 +27,8 @@
import fr.ifremer.adagio.core.service.technical.CacheService;
import fr.ifremer.tutti.persistence.DatabaseFixtures;
import fr.ifremer.tutti.persistence.DatabaseResource;
-import fr.ifremer.tutti.persistence.entities.IdAware;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.persistence.entities.TuttiEntity;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -336,8 +336,8 @@
caracteristic.sizeQualitativeValue());
}
- protected <E extends IdAware> void assertResultList(List<E> result,
- int expectedsize) {
+ protected <E extends TuttiEntity> void assertResultList(List<E> result,
+ int expectedsize) {
// result not null
Assert.assertNotNull(result);
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceWriteTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
@@ -60,7 +61,7 @@
List<Species> species = Lists.newArrayList();
long timestamp1 = System.nanoTime();
- Species sp1 = new Species();
+ Species sp1 = TuttiBeanFactory.newSpecies();
sp1.setReferenceTaxonId((int) timestamp1);
sp1.setId("Don't care" + timestamp1);
sp1.setRefTaxCode("Don't care" + timestamp1);
@@ -69,7 +70,7 @@
species.add(sp1);
long timestamp2 = System.nanoTime();
- Species sp2 = new Species();
+ Species sp2 = TuttiBeanFactory.newSpecies();
sp2.setReferenceTaxonId((int) timestamp2);
sp2.setId("Don't care" + timestamp2);
sp2.setRefTaxCode("Don't care" + timestamp2);
@@ -114,7 +115,7 @@
// scientificVessel
long timestamp1 = System.nanoTime();
- Vessel v1 = new Vessel();
+ Vessel v1 = TuttiBeanFactory.newVessel();
v1.setId("Don't care" + timestamp1);
v1.setName("Name" + timestamp1);
v1.setInternationalRegistrationCode("Immat" + timestamp1);
@@ -123,7 +124,7 @@
// fishingVessel
long timestamp2 = System.nanoTime();
- Vessel v2 = new Vessel();
+ Vessel v2 = TuttiBeanFactory.newVessel();
v2.setId("Don't care" + timestamp2);
v2.setName("Name" + timestamp2);
v2.setInternationalRegistrationCode("Immat" + timestamp2);
@@ -168,7 +169,7 @@
List<Person> persons = Lists.newArrayList();
long timestamp1 = System.nanoTime();
- Person p1 = new Person();
+ Person p1 = TuttiBeanFactory.newPerson();
p1.setId("Don't care" + timestamp1);
p1.setName("Don't care" + timestamp1);
p1.setFirstName("FirstName" + timestamp1);
@@ -178,7 +179,7 @@
persons.add(p1);
long timestamp2 = System.nanoTime();
- Person p2 = new Person();
+ Person p2 = TuttiBeanFactory.newPerson();
p2.setId("Don't care" + timestamp2);
p2.setName("Don't care" + timestamp2);
p2.setFirstName("FirstName" + timestamp2);
@@ -228,7 +229,7 @@
// scientific gear
long timestamp1 = System.nanoTime();
- Gear g1 = new Gear();
+ Gear g1 = TuttiBeanFactory.newGear();
g1.setId("Don't care" + timestamp1);
g1.setDescription("Don't care" + timestamp1);
g1.setName("Name" + timestamp1);
@@ -238,7 +239,7 @@
// fishing gear
long timestamp2 = System.nanoTime();
- Gear g2 = new Gear();
+ Gear g2 = TuttiBeanFactory.newGear();
g2.setId("Don't care" + timestamp2);
g2.setDescription("Don't care" + timestamp2);
g2.setName("Name" + timestamp2);
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceReadTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceReadTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceReadTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -159,7 +159,6 @@
assertEquals(expectedBatchFrequency.getLengthStepCaracteristic().getId(), actualBatchFrequency.getLengthStepCaracteristic().getId());
assertEquals(expectedBatchFrequency.getNumber(), actualBatchFrequency.getNumber());
assertEquals(expectedBatchFrequency.getWeight(), actualBatchFrequency.getWeight());
- assertEquals(expectedBatchFrequency.getComment(), actualBatchFrequency.getComment());
//assertNotNull(expectedBatchFrequency.getBatch());
//assertEquals(expectedBatchFrequency.getBatch().getId(), actualBatchFrequency.getBatch().getId());
}
Modified: trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java
===================================================================
--- trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -27,6 +27,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import fr.ifremer.tutti.persistence.DatabaseResource;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
@@ -171,7 +172,7 @@
fishingOperationWithEmptyBatch.setGearShootingEndDate(calendar.getTime());
fishingOperationWithEmptyBatch = fishingOperationService.createFishingOperation(fishingOperationWithEmptyBatch);
- catchBacth = new CatchBatch();
+ catchBacth = TuttiBeanFactory.newCatchBatch();
catchBacth.setFishingOperation(fishingOperationWithEmptyBatch);
catchBacth = catchBatchService.createCatchBatch(catchBacth);
@@ -211,7 +212,7 @@
// 1. Test with only mandatory properties
// -----------------------------------------------------------------------------
// batch : "ESP1 - Vrac/5"
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setParentBatch(null);
batch.setFishingOperation(fishingOperationNoCatchBatch);
batch.setSpecies(taxon1);
@@ -228,7 +229,7 @@
// 2. Test child "Male/2"
// -----------------------------------------------------------------------------
// Batch : ESP1 - Vrac/5 Male/2 ss-ech/1 Nombre/7
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setId((String) null);
batch.setParentBatch(esp1Batch);
batch.setSpecies(taxon1);
@@ -245,7 +246,7 @@
// 3. Test child "Female/2"
// -----------------------------------------------------------------------------
// Batch : ESP1 - Vrac/5 Female/3 Nombre/14
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setId((String) null);
batch.setParentBatch(esp1Batch);
batch.setSpecies(taxon1);
@@ -263,7 +264,7 @@
// \- ESP2 - Vrac/7 UNK/2 ss-ech/1 Nombre/11
// -----------------------------------------------------------------------------
// batch : "ESP2 - Vrac/7 "
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setParentBatch(null);
batch.setSpecies(taxon2);
batch.setSampleCategoryType(SampleCategoryEnum.sortedUnsorted);
@@ -274,7 +275,7 @@
esp2Batch = batch;
// Batch : ESP2 - Vrac/7 UNK/2 ss-ech/1 Nombre/11
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setId((String) null);
batch.setParentBatch(esp2Batch);
batch.setSpecies(taxon2);
@@ -336,13 +337,12 @@
List<SpeciesBatchFrequency> frequencies = Lists.newArrayList();
float lengthStep = 0.5f;
for (float length = lengthStep; length < lengthStep * 20; length += lengthStep) {
- SpeciesBatchFrequency frequency = new SpeciesBatchFrequency();
+ SpeciesBatchFrequency frequency = TuttiBeanFactory.newSpeciesBatchFrequency();
frequency.setLengthStep(length);
frequency.setNumber((int) (length * 2));
frequency.setWeight(0.01f * length * 2);
frequency.setLengthStepCaracteristic(frequencyPMFM);
frequency.setBatch(frequenciesParentBatch);
- frequency.setComment("comments");
frequencies.add(frequency);
}
List<SpeciesBatchFrequency> createdFrequencies = assertCreateAndReloadSpeciesBatchFrequency(frequencies, frequenciesParentBatch.getId());
@@ -355,7 +355,6 @@
float length = speciesBatchFrequency.getLengthStep();
if ((float) (int) length == length) {
speciesBatchFrequency.setNumber(12);
- speciesBatchFrequency.setComment(null);
}
}
// And remove the last item (should be deleted in DB)
@@ -377,7 +376,7 @@
// 1. Create two batchs (parent + child), then remove the parent batch
// -----------------------------------------------------------------------------
// batch : ESP1 Vrac/5
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setParentBatch(null);
batch.setFishingOperation(fishingOperationWithEmptyBatch);
batch.setSpecies(taxon1);
@@ -388,7 +387,7 @@
esp1Batch = batch;
// batch : ESP1 Vrac/5 Male/2
- batch = new SpeciesBatch();
+ batch = TuttiBeanFactory.newSpeciesBatch();
batch.setParentBatch(esp1Batch);
batch.setFishingOperation(fishingOperationWithEmptyBatch);
batch.setSpecies(taxon1);
@@ -504,7 +503,6 @@
assertEquals(expectedBatchFrequency.getLengthStepCaracteristic().getId(), actualBatchFrequency.getLengthStepCaracteristic().getId());
assertEquals(expectedBatchFrequency.getNumber(), actualBatchFrequency.getNumber());
assertEquals(expectedBatchFrequency.getWeight(), actualBatchFrequency.getWeight());
- assertEquals(expectedBatchFrequency.getComment(), actualBatchFrequency.getComment());
// assertNotNull(expectedBatchFrequency.getBatch());
// assertEquals(expectedBatchFrequency.getBatch().getId(), actualBatchFrequency.getBatch().getId());
}
Modified: trunk/tutti-service/pom.xml
===================================================================
--- trunk/tutti-service/pom.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/pom.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -69,6 +69,18 @@
</dependency>
<dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-validator</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-validator</artifactId>
+ <scope>test</scope>
+ <classifier>tests</classifier>
+ </dependency>
+
+ <dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
@@ -128,8 +140,20 @@
<executions>
<execution>
<id>scan-sources</id>
+ <configuration>
+ <entries>
+ <entry>
+ <specificGoal>parserValidation</specificGoal>
+ <basedir>${maven.src.dir}/main/java/</basedir>
+ <includes>
+ <param>**/**-validation.xml</param>
+ </includes>
+ </entry>
+ </entries>
+ </configuration>
<goals>
<goal>parserJava</goal>
+ <goal>parserValidation</goal>
<goal>gen</goal>
</goals>
</execution>
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/DecoratorService.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -147,7 +147,6 @@
n_("tutti.property.fishingOperation");
n_("tutti.property.fishingOperationLocation");
n_("tutti.property.zone");
- n_("tutti.property.zoneLabel");
n_("tutti.property.vessel");
n_("tutti.property.country");
n_("tutti.property.gear");
@@ -217,13 +216,22 @@
private static final long serialVersionUID = 1L;
public ProgramDecorator() throws IllegalArgumentException, NullPointerException {
- super(Program.class, "${name}$s#${zoneLabel}$s", DecoratorService.SEPARATOR, " - ");
+ super(Program.class, "${name}$s#${zone}$s", DecoratorService.SEPARATOR, " - ");
}
@Override
+ protected Object getValue(Program bean, String token) {
+ Object result = super.getValue(bean, token);
+ if ("zone".equals(token) && result != null) {
+ result = ((TuttiLocation) result).getLabel();
+ }
+ return result;
+ }
+
+ @Override
protected Object onNullValue(Program bean, String token) {
Object result = null;
- if ("zoneLabel".equals(token)) {
+ if ("zone".equals(token)) {
result = _("tutti.propety.no.zone");
}
return result;
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,7 +24,7 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.IdAware;
+import fr.ifremer.tutti.persistence.entities.TuttiEntity;
import org.apache.commons.lang3.StringUtils;
import org.nuiton.util.csv.Common;
import org.nuiton.util.csv.ValueParserFormatter;
@@ -48,15 +48,15 @@
super(separator);
}
- public <E extends IdAware> void newForeignKeyColumn(String headerName, String propertyName, Class<E> entityType, String foreignKeyName, Map<String, E> universe) {
+ public <E extends TuttiEntity> void newForeignKeyColumn(String headerName, String propertyName, Class<E> entityType, String foreignKeyName, Map<String, E> universe) {
newMandatoryColumn(headerName, propertyName, newForeignKeyValue(entityType, foreignKeyName, universe));
}
- public <E extends IdAware> void newForeignKeyColumn(String propertyName, Class<E> entityType, String foreignKeyName, Map<String, E> universe) {
+ public <E extends TuttiEntity> void newForeignKeyColumn(String propertyName, Class<E> entityType, String foreignKeyName, Map<String, E> universe) {
newMandatoryColumn(propertyName, propertyName, newForeignKeyValue(entityType, foreignKeyName, universe));
}
- public <E extends IdAware> ForeignKeyValue<E> newForeignKeyValue(Class<E> type, String propertyName, Map<String, E> universe) {
+ public <E extends TuttiEntity> ForeignKeyValue<E> newForeignKeyValue(Class<E> type, String propertyName, Map<String, E> universe) {
return new ForeignKeyValue<E>(type, propertyName, universe);
}
@@ -95,7 +95,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0
*/
- public static class ForeignKeyValue<E extends IdAware> implements ValueParserFormatter<E> {
+ public static class ForeignKeyValue<E extends TuttiEntity> implements ValueParserFormatter<E> {
protected final String propertyName;
Copied: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDataContext.java (from rev 714, trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java)
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDataContext.java (rev 0)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDataContext.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,698 @@
+package fr.ifremer.tutti.service;
+
+/*
+ * #%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.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+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.Gear;
+import fr.ifremer.tutti.persistence.entities.referential.Person;
+import fr.ifremer.tutti.persistence.entities.referential.Species;
+import fr.ifremer.tutti.persistence.entities.referential.Vessel;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.beans.AbstractBean;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.Closeable;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Data context of ui.
+ * <p/>
+ * All shared data must be there to avoid reloading some stuff.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.0.2
+ */
+public class TuttiDataContext extends AbstractBean implements Closeable {
+
+ /** Logger. */
+ private static final Log log = LogFactory.getLog(TuttiDataContext.class);
+
+ public static final String PROPERTY_PROGRAM_ID = "programId";
+
+ public static final String PROPERTY_CRUISE_ID = "cruiseId";
+
+ public static final String PROPERTY_PROTOCOL_ID = "protocolId";
+
+ public static final String PROPERTY_FISHING_OPERATION_ID = "fihsingOperationID";
+
+ public static final String PROPERTY_PROGRAM_FILLED = "programFilled";
+
+ public static final String PROPERTY_CRUISE__FILLED = "cruiseFilled";
+
+ public static final String PROPERTY_PROTOCOL_FILLED = "protocolFilled";
+
+ public static final String PROPERTY_FISHING_OPERATION_FILLED = "fishingOperationFilled";
+
+ /**
+ * Id of last selected program (can be null if none ever selected).
+ *
+ * @since 0.1
+ */
+ protected String programId;
+
+ /**
+ * Id of last selected cruise (can be null if none ever selected).
+ *
+ * @since 0.1
+ */
+ protected String cruiseId;
+
+ /**
+ * Id of last selected protocol (can be null if none ever selected).
+ *
+ * @since 0.1
+ */
+ protected String protocolId;
+
+ /**
+ * Id of last selected fishing operation (can be null if none ever selected).
+ *
+ * @since 1.2
+ */
+ protected String fishingOperationId;
+
+
+ protected Program program;
+
+ protected Cruise cruise;
+
+ protected TuttiProtocol protocol;
+
+ protected FishingOperation fishingOperation;
+
+ protected List<Caracteristic> caracteristics;
+
+ protected List<Caracteristic> lengthStepCaracteristics;
+
+ protected List<Person> persons;
+
+ protected List<Species> species;
+
+ protected List<Species> referentSpeciesWithSurveyCode;
+
+ protected List<Species> referentBenthosWithSurveyCode;
+
+ protected List<Species> referentSpecies;
+
+ protected List<Vessel> fishingVessels;
+
+ protected List<Vessel> scientificVessels;
+
+ protected List<Gear> fishingGears;
+
+ protected List<Gear> scientificGears;
+
+ protected PersistenceService service;
+
+ TuttiDataContext() {
+ addPropertyChangeListener(PROPERTY_PROGRAM_ID, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ program = null;
+ }
+ });
+ addPropertyChangeListener(PROPERTY_CRUISE_ID, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ cruise = null;
+ }
+ });
+ addPropertyChangeListener(PROPERTY_PROTOCOL_ID, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ resetProtocol();
+ resetSpecies();
+ }
+ });
+ addPropertyChangeListener(PROPERTY_FISHING_OPERATION_ID, new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ fishingOperation = null;
+ }
+ });
+ }
+
+ public void open(PersistenceService persistenceService) {
+ close();
+ this.service = persistenceService;
+ }
+
+ @Override
+ public void close() {
+ service = null;
+ clearContext();
+ }
+
+ public void clearContext() {
+ program = null;
+ cruise = null;
+ protocolId = null;
+ fishingOperationId = null;
+ resetProtocol();
+ resetVessels();
+ resetGears();
+ resetPersons();
+ resetSpecies();
+ resetValidationDataContext();
+ }
+
+ public void checkDbContext() {
+
+ if (isProtocolFilled()) {
+
+ if (!service.isProtocolExist(getProtocolId())) {
+
+ // not found in this db
+
+ if (log.isWarnEnabled()) {
+ log.warn("Remove invalid protocolId: " + getProtocolId());
+ }
+
+ setProtocolId(null);
+ }
+ }
+
+ if (isProgramFilled()) {
+
+ Program program = service.getProgram(getProgramId());
+ if (program == null) {
+
+ // not found in this db
+
+ if (log.isWarnEnabled()) {
+ log.warn("Remove invalid programId: " + getProgramId());
+ }
+
+ setProgramId(null);
+ setCruiseId(null);
+
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("ProgramId valid: " + getProgramId());
+ }
+
+ setProgramId(getProgramId());
+
+ // test cruiseId
+ if (isCruiseFilled()) {
+
+ Cruise cruise = service.getCruise(getCruiseId());
+
+ if (cruise != null &&
+ !cruise.getProgram().getId().equals(getProgramId())) {
+
+ // not matchin program, reset cruise id
+ cruise = null;
+ }
+
+ if (cruise == null) {
+
+ // not found in this db
+
+ if (log.isWarnEnabled()) {
+ log.warn("Remove invalid cruiseId: " + getCruiseId());
+ }
+ setCruiseId(null);
+
+ } else {
+
+ if (log.isInfoEnabled()) {
+ log.info("CruiseId valid: " + getCruiseId());
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public String getProgramId() {
+ return programId;
+ }
+
+ public String getCruiseId() {
+ return cruiseId;
+ }
+
+ public String getProtocolId() {
+ return protocolId;
+ }
+
+ public String getFishingOperationId() {
+ return fishingOperationId;
+ }
+
+ public boolean isCruiseFilled() {
+ return isProgramFilled() && StringUtils.isNotBlank(cruiseId);
+ }
+
+ public boolean isProtocolFilled() {
+ return StringUtils.isNotBlank(protocolId);
+ }
+
+ public boolean isProgramFilled() {
+ return StringUtils.isNotBlank(programId);
+ }
+
+ public boolean isFishingOperationFilled() {
+ return StringUtils.isNotBlank(fishingOperationId);
+ }
+
+ public void setProgramId(String programId) {
+ boolean oldProgramFilled = isProgramFilled();
+ boolean oldCruiseFilled = isCruiseFilled();
+
+ this.programId = programId;
+
+ // always propagate the change
+ firePropertyChange(PROPERTY_PROGRAM_ID, -1, programId);
+ firePropertyChange(PROPERTY_PROGRAM_FILLED, oldProgramFilled, isProgramFilled());
+ firePropertyChange(PROPERTY_CRUISE__FILLED, oldCruiseFilled, isCruiseFilled());
+ }
+
+ public void setCruiseId(String cruiseId) {
+ boolean oldValue = isCruiseFilled();
+
+ this.cruiseId = cruiseId;
+
+ // always propagate the change
+ firePropertyChange(PROPERTY_CRUISE_ID, -1, cruiseId);
+ firePropertyChange(PROPERTY_CRUISE__FILLED,
+ oldValue, isCruiseFilled());
+ }
+
+ public void setProtocolId(String protocolId) {
+ boolean oldValue = isProtocolFilled();
+ this.protocolId = protocolId;
+
+ // always propagate the change
+ firePropertyChange(PROPERTY_PROTOCOL_ID, -1, protocolId);
+ firePropertyChange(PROPERTY_PROTOCOL_FILLED,
+ oldValue, isProtocolFilled());
+ }
+
+ public void setFishingOperationId(String fishingOperationId) {
+ boolean oldValue = isFishingOperationFilled();
+ this.fishingOperationId = fishingOperationId;
+
+ // always propagate the change
+ firePropertyChange(PROPERTY_FISHING_OPERATION_ID, -1, fishingOperationId);
+ firePropertyChange(PROPERTY_FISHING_OPERATION_FILLED,
+ oldValue, isFishingOperationFilled());
+ }
+
+ public Program getProgram() {
+ checkOpened();
+ if (program == null) {
+ if (isProgramFilled()) {
+ String id = getProgramId();
+ if (log.isInfoEnabled()) {
+ log.info("Loading program: " + id);
+ }
+ program = service.getProgram(id);
+ }
+ }
+ return program;
+ }
+
+ public Cruise getCruise() {
+ checkOpened();
+ if (cruise == null) {
+ if (isCruiseFilled()) {
+ String id = getCruiseId();
+ if (log.isInfoEnabled()) {
+ log.info("Loading cruise: " + id);
+ }
+ cruise = service.getCruise(id);
+ }
+ }
+ return cruise;
+ }
+
+ public TuttiProtocol getProtocol() {
+ checkOpened();
+ if (protocol == null) {
+ if (isProtocolFilled()) {
+ String id = getProtocolId();
+ if (log.isInfoEnabled()) {
+ log.info("Loading cruise: " + id);
+ }
+ protocol = service.getProtocol(id);
+ }
+ }
+ return protocol;
+ }
+
+ public FishingOperation getFishingOperation() {
+ checkOpened();
+ if (fishingOperation == null) {
+ if (isFishingOperationFilled()) {
+ String id = getFishingOperationId();
+ if (log.isInfoEnabled()) {
+ log.info("Loading fishingOperation: " + id);
+ }
+ fishingOperation = service.getFishingOperation(id);
+ }
+ }
+ return fishingOperation;
+ }
+
+ public List<Caracteristic> getCaracteristics() {
+ checkOpened();
+ if (caracteristics == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loading allCaracteristic");
+ }
+ caracteristics = service.getAllCaracteristic();
+ }
+ return caracteristics;
+ }
+
+ public List<Caracteristic> getLengthStepCaracteristics() {
+ checkOpened();
+ if (lengthStepCaracteristics == null) {
+
+ if (isProtocolFilled()) {
+
+ // get loaded protocol
+ protocol = getProtocol();
+ lengthStepCaracteristics = Lists.newArrayListWithCapacity(
+ protocol.sizeLengthClassesPmfmId());
+
+ Map<String, Caracteristic> allCaractericsById =
+ TuttiEntities.splitById(getCaracteristics());
+
+ if (!protocol.isLengthClassesPmfmIdEmpty()) {
+ for (String id : protocol.getLengthClassesPmfmId()) {
+ lengthStepCaracteristics.add(allCaractericsById.get(id));
+ }
+ }
+ } else {
+ lengthStepCaracteristics = Lists.newArrayList(
+ getCaracteristics());
+ }
+
+ lengthStepCaracteristics = Collections.unmodifiableList(lengthStepCaracteristics);
+ }
+ return lengthStepCaracteristics;
+ }
+
+ public List<Species> getReferentSpeciesWithSurveyCode() {
+ checkOpened();
+ if (referentSpeciesWithSurveyCode == null) {
+
+ if (isProtocolFilled()) {
+
+ // get loaded protocol
+
+ TuttiProtocol protocol = getProtocol();
+ Preconditions.checkNotNull(protocol,
+ "Could not find protocol in ui context");
+
+ // fill available species from protocol
+ referentSpeciesWithSurveyCode = Lists.newArrayList();
+ if (!protocol.isSpeciesEmpty()) {
+
+ // split by taxonId
+ Map<String, Species> map = TuttiEntities.splitByTaxonId(getReferentSpecies());
+
+ for (SpeciesProtocol protocolSpecy : protocol.getSpecies()) {
+ String taxonId = String.valueOf(protocolSpecy.getSpeciesReferenceTaxonId());
+ Species species = map.get(taxonId);
+ species.setSurveyCode(protocolSpecy.getSpeciesSurveyCode());
+ referentSpeciesWithSurveyCode.add(species);
+ }
+ }
+
+ } else {
+
+ // no protocol, use default values
+ referentSpeciesWithSurveyCode = Lists.newArrayList(getReferentSpecies());
+ }
+
+ referentSpeciesWithSurveyCode = Collections.unmodifiableList(referentSpeciesWithSurveyCode);
+ }
+ return referentSpeciesWithSurveyCode;
+ }
+
+ public List<Species> getReferentBenthosWithSurveyCode() {
+ checkOpened();
+ if (referentBenthosWithSurveyCode == null) {
+
+ if (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()) {
+ log.info("Loading allSpecies");
+ }
+ species = service.getAllSpecies(protocol);
+ }
+ return species;
+ }
+
+ public List<Species> getReferentSpecies() {
+ if (referentSpecies == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loading allReferentSpecies");
+ }
+ referentSpecies = service.getAllReferentSpecies(protocol);
+ }
+ return referentSpecies;
+ }
+
+ public List<Person> getPersons() {
+ checkOpened();
+ if (persons == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loading allPerson");
+ }
+ persons = service.getAllPerson();
+ }
+ return persons;
+ }
+
+ public List<Vessel> getFishingVessels() {
+ checkOpened();
+ if (fishingVessels == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loading allfishingVessel");
+ }
+ fishingVessels = service.getAllFishingVessel();
+ }
+ return fishingVessels;
+ }
+
+ public List<Vessel> getScientificVessels() {
+ checkOpened();
+ if (scientificVessels == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loading allScientificVessel");
+ }
+ scientificVessels = service.getAllScientificVessel();
+ }
+ return scientificVessels;
+ }
+
+ public List<Gear> getFishingGears() {
+ checkOpened();
+ if (fishingGears == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loading allFishingGear");
+ }
+ fishingGears = service.getAllFishingGear();
+ }
+ return fishingGears;
+ }
+
+ public List<Gear> getScientificGears() {
+ checkOpened();
+ if (scientificGears == null) {
+ if (log.isInfoEnabled()) {
+ log.info("Loading allScientificGear");
+ }
+ scientificGears = service.getAllScientificGear();
+ }
+ return scientificGears;
+ }
+
+ public void resetProtocol() {
+ protocol = null;
+ lengthStepCaracteristics = null;
+ }
+
+ public void resetGears() {
+ fishingGears = null;
+ scientificGears = null;
+ }
+
+ public void resetVessels() {
+ fishingVessels = null;
+ scientificVessels = null;
+ }
+
+ public void resetPersons() {
+ persons = null;
+ }
+
+ public void resetSpecies() {
+ species = null;
+ referentSpecies = null;
+ referentSpeciesWithSurveyCode = null;
+ referentBenthosWithSurveyCode = null;
+ }
+
+ public void resetCaracteristics() {
+ caracteristics = null;
+ }
+
+ protected void checkOpened() {
+ Preconditions.checkState(service != null, "No persistence service assigned!");
+ }
+
+ public PersistenceService getService() {
+ return service;
+ }
+
+ protected final TuttiValidationDataContext validationContext =
+ new TuttiValidationDataContext();
+
+ public void resetValidationDataContext() {
+ validationContext.reset();
+ }
+
+ public TuttiValidationDataContext getValidationContext() {
+ return validationContext;
+ }
+
+ /**
+ * Data to shared by validators.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+ public class TuttiValidationDataContext {
+
+ protected List<Program> existingPrograms = Lists.newArrayList();
+
+ protected List<TuttiProtocol> existingProtocols = Lists.newArrayList();
+
+ protected List<FishingOperation> existingFishingOperations = Lists.newArrayList();
+
+ public List<Program> getExistingPrograms() {
+ checkOpened();
+ if (existingPrograms == null) {
+ existingPrograms = Lists.newArrayList(service.getAllProgram());
+
+ if (isProgramFilled()) {
+
+ // remove current program
+ existingPrograms.remove(getProgram());
+ }
+ }
+ return existingPrograms;
+ }
+
+ public List<TuttiProtocol> getExistingProtocols() {
+ checkOpened();
+ if (existingProtocols == null) {
+ existingProtocols = Lists.newArrayList(service.getAllProtocol());
+
+ if (isProtocolFilled()) {
+
+ // remove current protocol
+ existingProtocols.remove(getProtocol());
+ }
+ }
+ return existingProtocols;
+ }
+
+ public List<FishingOperation> getExistingFishingOperations() {
+ checkOpened();
+ if (existingFishingOperations == null) {
+ existingFishingOperations = Lists.newArrayList(service.getAllFishingOperation(getCruiseId()));
+
+ if (isFishingOperationFilled()) {
+
+ // remove current protocol
+ existingFishingOperations.remove(getFishingOperation());
+ }
+ }
+ return existingFishingOperations;
+ }
+
+ public void reset() {
+ existingPrograms = null;
+ existingProtocols = null;
+ existingFishingOperations = null;
+ }
+ }
+}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDecorator.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDecorator.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiDecorator.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -32,6 +32,7 @@
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.beans.BeanUtil;
import org.nuiton.util.decorator.JXPathDecorator;
import org.nuiton.util.decorator.MultiJXPathDecorator;
@@ -41,6 +42,7 @@
import java.util.Arrays;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
/**
@@ -78,8 +80,9 @@
separator,
separatorReplacement);
tokenMethods = Maps.newHashMap();
- PropertyDescriptor[] descriptors =
- PropertyUtils.getPropertyDescriptors(type);
+ Set<PropertyDescriptor> descriptors = BeanUtil.getDescriptors(type, BeanUtil.IS_READ_DESCRIPTOR);
+// PropertyDescriptor[] descriptors =
+// PropertyUtils.getPropertyDescriptors(type);
for (String token : getTokens()) {
Method m = null;
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiServiceContext.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -28,12 +28,14 @@
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
+import com.opensymphony.xwork2.util.ValueStack;
import fr.ifremer.tutti.TuttiTechnicalException;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.apache.commons.io.IOUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.nuiton.validator.xwork2.XWork2ValidatorUtil;
import java.io.Closeable;
import java.io.IOException;
@@ -57,14 +59,26 @@
protected final TuttiServiceConfig config;
+ protected final TuttiDataContext dataContext;
+
protected final RessourceClassLoader resourceLoader;
protected final LoadingCache<Class<? extends TuttiService>, TuttiService> services;
public TuttiServiceContext(RessourceClassLoader resourceLoader,
TuttiServiceConfig config) {
+ this(resourceLoader, config, new TuttiDataContext());
+ }
+
+ public TuttiServiceContext(RessourceClassLoader resourceLoader,
+ TuttiServiceConfig config,
+ TuttiDataContext dataContext) {
this.resourceLoader = resourceLoader;
this.config = config;
+ this.dataContext = dataContext;
+ // add datacontext in shared valueStack
+ ValueStack sharedValueStack = XWork2ValidatorUtil.getSharedValueStack();
+ sharedValueStack.push(dataContext.getValidationContext());
this.services = CacheBuilder.newBuilder().build(new CacheLoader<Class<? extends TuttiService>, TuttiService>() {
@Override
public TuttiService load(Class<? extends TuttiService> key) throws Exception {
@@ -89,6 +103,10 @@
return resourceLoader;
}
+ public TuttiDataContext getDataContext() {
+ return dataContext;
+ }
+
public Date currentDate() {
return new Date();
}
Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/ValidationService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/ValidationService.java (rev 0)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/ValidationService.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,66 @@
+package fr.ifremer.tutti.service;
+
+/*
+ * #%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.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.protocol.TuttiProtocol;
+import org.nuiton.validator.NuitonValidator;
+import org.nuiton.validator.NuitonValidatorFactory;
+import org.nuiton.validator.NuitonValidatorResult;
+
+/**
+ * To validate some incoming data using nuiton-validators.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class ValidationService extends AbstractTuttiService {
+
+ public NuitonValidatorResult validateCruise(Cruise cruise) {
+ NuitonValidator<Cruise> validator = NuitonValidatorFactory.newValidator(Cruise.class);
+ NuitonValidatorResult result = validator.validate(cruise);
+ return result;
+ }
+
+ public NuitonValidatorResult validateProgram(Program program) {
+ NuitonValidator<Program> validator = NuitonValidatorFactory.newValidator(Program.class);
+ NuitonValidatorResult result = validator.validate(program);
+ return result;
+ }
+
+ public NuitonValidatorResult validateProtocol(TuttiProtocol protocol) {
+ NuitonValidator<TuttiProtocol> validator = NuitonValidatorFactory.newValidator(TuttiProtocol.class);
+ NuitonValidatorResult result = validator.validate(protocol);
+ return result;
+ }
+
+ public NuitonValidatorResult validateFishingOperation(FishingOperation fishingOperation) {
+ NuitonValidator<FishingOperation> validator = NuitonValidatorFactory.newValidator(FishingOperation.class);
+ NuitonValidatorResult result = validator.validate(fishingOperation);
+ return result;
+ }
+}
Property changes on: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/ValidationService.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfig.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfig.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/config/TuttiServiceConfig.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -124,4 +124,9 @@
tmpDirectory,
"Could not create temp directory " + tmpDirectory);
}
+
+ public void setCsvSeparator(char c) {
+ applicationConfig.setOption(
+ TuttiServiceConfigOption.CSV_SEPARATOR.getKey(), c+"");
+ }
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/CaracteristicType.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/CaracteristicType.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/CaracteristicType.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -34,6 +34,5 @@
LENGTH_STEP,
VESSEL_USE_FEATURE,
- HYDROLOGY,
GEAR_USE_FEATURE
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/SpeciesRow.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/SpeciesRow.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/SpeciesRow.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
@@ -84,7 +85,7 @@
protected Caracteristic lengthStepPmfm;
public SpeciesRow() {
- delegate = new SpeciesProtocol();
+ delegate = TuttiBeanFactory.newSpeciesProtocol();
delegate.setMadeFromAReferentTaxon(true);
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportService.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -33,6 +33,7 @@
import com.google.common.collect.TreeMultimap;
import com.google.common.io.Files;
import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocols;
@@ -251,7 +252,7 @@
if (sp == null) {
// create a new species protocol
- sp = new SpeciesProtocol();
+ sp = TuttiBeanFactory.newSpeciesProtocol();
}
binder.copy(bean, sp);
@@ -318,7 +319,7 @@
if (sp == null) {
// create a new species protocol
- sp = new SpeciesProtocol();
+ sp = TuttiBeanFactory.newSpeciesProtocol();
}
binder.copy(bean, sp);
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/CarrouselRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,8 +26,6 @@
import fr.ifremer.tutti.service.TuttiCsvUtil;
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;
@@ -38,8 +36,6 @@
*/
public class CarrouselRowModel extends TuttiCsvUtil.AbstractTuttiImportExportModel<CarrouselRow> {
- private static final Log log = LogFactory.getLog(CarrouselRowModel.class);
-
public CarrouselRowModel(char separator) {
super(separator);
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TrunkRowModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TrunkRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TrunkRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,8 +25,6 @@
*/
import fr.ifremer.tutti.service.TuttiCsvUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.nuiton.util.csv.ValueParser;
import java.text.ParseException;
@@ -37,8 +35,6 @@
*/
public class TrunkRowModel extends TuttiCsvUtil.AbstractTuttiImportExportModel<TrunkRow> {
- private static final Log log = LogFactory.getLog(TrunkRowModel.class);
-
public TrunkRowModel(char separator) {
super(separator);
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/pupitri/TuttiPupitriImportExportService.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -33,6 +33,7 @@
import com.google.common.collect.Multimaps;
import com.google.common.io.Files;
import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
@@ -131,7 +132,7 @@
}
protected void addFileAsAttachment(File f, CatchBatch catchBatch) {
- Attachment attachment = new Attachment();
+ Attachment attachment = TuttiBeanFactory.newAttachment();
attachment.setObjectType(AttachementObjectTypeEnum.CATCH_BATCH);
attachment.setObjectId(Integer.valueOf(catchBatch.getId()));
attachment.setName(f.getName());
@@ -343,7 +344,7 @@
CaracteristicQualitativeValue cqv = pupitriCatch.isSorted() ?
sortedCaracteristic : unsortedCaracteristic;
- SpeciesBatch batch = new SpeciesBatch();
+ SpeciesBatch batch = TuttiBeanFactory.newSpeciesBatch();
batch.setFishingOperation(operation);
batch.setSampleCategoryType(SampleCategoryEnum.sortedUnsorted);
batch.setSampleCategoryValue(cqv);
@@ -384,7 +385,7 @@
break;
}
- SpeciesBatch childBatch = new SpeciesBatch();
+ SpeciesBatch childBatch = TuttiBeanFactory.newSpeciesBatch();
childBatch.setFishingOperation(operation);
childBatch.setSampleCategoryType(category);
childBatch.setSampleCategoryValue(splitCqv);
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/GearModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/GearModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/GearModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.service.TuttiCsvUtil;
import org.nuiton.util.csv.Common;
@@ -56,7 +57,7 @@
@Override
public Gear newEmptyInstance() {
- return new Gear();
+ return TuttiBeanFactory.newGear();
}
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/PersonModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/PersonModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/PersonModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.service.TuttiCsvUtil;
@@ -51,7 +52,7 @@
@Override
public Person newEmptyInstance() {
- return new Person();
+ return TuttiBeanFactory.newPerson();
}
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/SpeciesModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/SpeciesModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/SpeciesModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.TuttiCsvUtil;
@@ -51,7 +52,7 @@
@Override
public Species newEmptyInstance() {
- return new Species();
+ return TuttiBeanFactory.newSpecies();
}
}
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialImportExportService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialImportExportService.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/TuttiReferentialImportExportService.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -31,6 +31,7 @@
import com.google.common.collect.Sets;
import com.google.common.io.Files;
import fr.ifremer.tutti.TuttiTechnicalException;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
import fr.ifremer.tutti.persistence.entities.referential.Person;
import fr.ifremer.tutti.persistence.entities.referential.Species;
@@ -248,15 +249,15 @@
Species s;
- s = new Species();
+ s = TuttiBeanFactory.newSpecies();
s.setName("Temporary Species name 1");
toExport.add(s);
- s = new Species();
+ s = TuttiBeanFactory.newSpecies();
s.setName("Temporary Species name 2");
toExport.add(s);
- s = new Species();
+ s = TuttiBeanFactory.newSpecies();
s.setName("Temporary Species name 3");
toExport.add(s);
@@ -282,25 +283,25 @@
Vessel v;
- v = new Vessel();
+ v = TuttiBeanFactory.newVessel();
v.setName("Temporary fishing vessel name 1");
v.setInternationalRegistrationCode("International registration code F1");
v.setScientificVessel(false);
toExport.add(v);
- v = new Vessel();
+ v = TuttiBeanFactory.newVessel();
v.setName("Temporary fishing vessel name 2");
v.setInternationalRegistrationCode("International registration code F2");
v.setScientificVessel(false);
toExport.add(v);
- v = new Vessel();
+ v = TuttiBeanFactory.newVessel();
v.setName("Temporary scientific vessel name 3");
v.setInternationalRegistrationCode("International registration code S3");
v.setScientificVessel(true);
toExport.add(v);
- v = new Vessel();
+ v = TuttiBeanFactory.newVessel();
v.setName("Temporary scientific vessel name 4");
v.setInternationalRegistrationCode("International registration code S4");
v.setScientificVessel(true);
@@ -327,17 +328,17 @@
Person p;
- p = new Person();
+ p = TuttiBeanFactory.newPerson();
p.setFirstName("First name 1");
p.setLastName("Last name 1");
toExport.add(p);
- p = new Person();
+ p = TuttiBeanFactory.newPerson();
p.setFirstName("First name 2");
p.setLastName("Last name 2");
toExport.add(p);
- p = new Person();
+ p = TuttiBeanFactory.newPerson();
p.setFirstName("First name 3");
p.setLastName("Last name 3");
toExport.add(p);
@@ -364,23 +365,23 @@
Gear g;
- g = new Gear();
+ g = TuttiBeanFactory.newGear();
g.setName("Gear fishing name 1");
g.setLabel("Gear fishing label 1");
toExport.add(g);
- g = new Gear();
+ g = TuttiBeanFactory.newGear();
g.setName("Gear fishing name 2");
g.setLabel("Gear fishing label 2");
toExport.add(g);
- g = new Gear();
+ g = TuttiBeanFactory.newGear();
g.setName("Gear scientific name 3");
g.setLabel("Gear scientific label 3");
g.setScientificGear(true);
toExport.add(g);
- g = new Gear();
+ g = TuttiBeanFactory.newGear();
g.setName("Gear scientific name 4");
g.setLabel("Gear scientific label 4");
g.setScientificGear(true);
Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/VesselModel.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/VesselModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/referential/VesselModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.referential.Vessel;
import fr.ifremer.tutti.service.TuttiCsvUtil;
import org.nuiton.util.csv.Common;
@@ -56,7 +57,7 @@
@Override
public Vessel newEmptyInstance() {
- return new Vessel();
+ return TuttiBeanFactory.newVessel();
}
}
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/Cruise-error-validation.xml (from rev 709, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/Cruise-error-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/Cruise-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.cruise.name.required</message>
+ </field-validator>
+ </field>
+
+ <field name="program">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.program.required</message>
+ </field-validator>
+ </field>
+
+ <field name="departureLocation">
+ <field-validator type="required" short-circuit="true">
+ <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>
+ </field-validator>
+ </field>
+
+ <field name="beginDate">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.beginDate.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ endDate == null || beginDate.compareTo(endDate) < 0 ]]>
+ </param>
+ <message>tutti.validator.error.cruise.dates.endBeforeStart</message>
+ </field-validator>
+ </field>
+
+ <field name="endDate">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.endDate.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ beginDate == null || beginDate.compareTo(endDate) < 0 ]]>
+ </param>
+ <message>tutti.validator.error.cruise.dates.endBeforeStart</message>
+ </field-validator>
+ </field>
+
+ <field name="vessel">
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.cruise.vessel.required</message>
+ </field-validator>
+ </field>
+
+ <field name="gear">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gear != null && !gear.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.gear.required</message>
+ </field-validator>
+ </field>
+
+ <field name="headOfMission">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ headOfMission != null && !headOfMission.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.headOfMission.required</message>
+ </field-validator>
+ </field>
+
+ <field name="headOfSortRoom">
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]>
+ </param>
+ <message>tutti.validator.error.cruise.headOfSortRoom.required</message>
+ </field-validator>
+ </field>
+
+ <field name="comment">
+ <field-validator type="stringlength" short-circuit="true">
+ <param name="maxLength">2000</param>
+ <message>tutti.validator.error.comment.too.long##${maxLength}</message>
+ </field-validator>
+ </field>
+
+</validators>
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-error-validation.xml (from rev 714, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-error-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-error-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="gearShootingStartDate">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingEndDate == null || !gearShootingStartDate.after(gearShootingEndDate) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.endBeforeStart</message>
+ </field-validator>
+
+ </field>
+
+ <field name="gearShootingEndDate">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingEndDate == null || gearShootingStartDate == null || !gearShootingStartDate.after(gearShootingEndDate) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.endBeforeStart</message>
+ </field-validator>
+
+ </field>
+
+ <field name="comment">
+ <field-validator type="stringlength" short-circuit="true">
+ <param name="maxLength">2000</param>
+ <message>tutti.validator.error.comment.too.long##${maxLength}</message>
+ </field-validator>
+ </field>
+</validators>
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-fatal-validation.xml (from rev 714, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-fatal-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-fatal-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-fatal-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="stationNumber">
+
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>
+ tutti.validator.error.fishingOperation.stationNumber.required
+ </message>
+ </field-validator>
+
+ <field-validator type="stringlength" short-circuit="true">
+ <param name="maxLength">40</param>
+ <message>
+ tutti.validator.error.fishingOperation.stationNumber.too.long##${maxLength}
+ </message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingOperations</param>
+ <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.fishingOperation.existingKey</message>
+ </field-validator>
+
+ </field>
+
+ <field name="fishingOperationNumber">
+
+ <field-validator type="required" short-circuit="true">
+ <message>
+ tutti.validator.error.fishingOperation.fishingOperationNumber.required
+ </message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingOperations</param>
+ <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.fishingOperation.existingKey</message>
+ </field-validator>
+
+ </field>
+
+ <field name="multirigAggregation">
+
+ <field-validator type="required" short-circuit="true">
+ <message>
+ tutti.validator.error.fishingOperation.trawlNetNumber.required
+ </message>
+ </field-validator>
+
+ </field>
+
+ <field name="gearShootingStartDate">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.date.start.required</message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingOperations</param>
+ <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.fishingOperation.existingKey</message>
+ </field-validator>
+
+ </field>
+</validators>
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-warning-validation.xml (from rev 714, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-warning-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-warning-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-edit-warning-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,275 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+
+<validators>
+
+ <field name='strata'>
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ strata != null || subStrata != null || location != null ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
+ </field-validator>
+ </field>
+
+ <field name='subStrata'>
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ strata != null || subStrata != null || location != null ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
+ </field-validator>
+ </field>
+
+ <field name='location'>
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ strata != null || subStrata != null || location != null ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
+ </field-validator>
+ </field>
+
+ <field name="gearShootingStartDate">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingStartDate == null || isDateInCruise(gearShootingStartDate) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.startOutOfCruiseDates</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingStartDate == null || gearShootingEndDate == null
+ || isValidDuration()
+ ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.wrongTime</message>
+ </field-validator>
+
+ </field>
+
+ <field name="gearShootingEndDate">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.date.end.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingEndDate == null || isDateInCruise(gearShootingEndDate) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.endOutOfCruiseDates</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingStartDate == null || gearShootingEndDate == null
+ || isValidDuration()
+ ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.wrongTime</message>
+ </field-validator>
+
+ </field>
+
+ <!--gear shooting start latitude validation -->
+
+ <field name="gearShootingStartLatitude">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) || gearShootingStartLatitude != null
+ ]]>
+ </param>
+
+ <message>tutti.validator.error.latitude.start.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpressionwithparams">
+ <param name="doubleParams">min:90.0|max:90.0</param>
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) ||
+ ( -doubles.min <= gearShootingStartLatitude && gearShootingStartLatitude <= doubles.max )
+ ]]>
+ </param>
+
+ <message>tutti.validator.warning.latitude.outOfBounds</message>
+ </field-validator>
+
+ </field>
+
+ <!--gear shooting start longitude validation -->
+
+ <field name="gearShootingStartLongitude">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) || gearShootingStartLongitude != null
+ ]]>
+ </param>
+
+ <message>tutti.validator.error.longitude.start.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpressionwithparams">
+ <param name="doubleParams">min:180.0|max:180.0</param>
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) ||
+ ( -doubles.min <= gearShootingStartLongitude && gearShootingStartLongitude <= doubles.max )
+ ]]>
+ </param>
+
+ <message>tutti.validator.warning.longitude.outOfBounds</message>
+
+ </field-validator>
+
+ </field>
+
+ <!--gear shooting end latitude validation -->
+
+ <field name="gearShootingEndLatitude">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) || gearShootingEndLatitude != null
+ ]]>
+ </param>
+
+ <message>tutti.validator.error.latitude.end.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpressionwithparams">
+ <param name="doubleParams">min:90.0|max:90.0</param>
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) ||
+ ( -doubles.min <= gearShootingEndLatitude && gearShootingEndLatitude <= doubles.max )
+ ]]>
+ </param>
+
+ <message>tutti.validator.warning.latitude.outOfBounds</message>
+
+ </field-validator>
+
+ </field>
+
+ <!--gear shooting end longitude validation -->
+
+ <field name="gearShootingEndLongitude">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) || gearShootingEndLongitude != null
+ ]]>
+ </param>
+
+ <message>tutti.validator.error.longitude.end.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpressionwithparams">
+ <param name="doubleParams">min:180.0|max:180.0</param>
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) ||
+ ( -doubles.min <= gearShootingEndLongitude && gearShootingEndLongitude <= doubles.max )
+ ]]>
+ </param>
+
+ <message>tutti.validator.warning.longitude.outOfBounds</message>
+
+ </field-validator>
+
+ </field>
+
+ <field name="trawlDistance">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ trawlDistance == null || trawlDistance <= 5556 ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.trawlDistance.tooLong</message>
+ </field-validator>
+
+ </field>
+
+ <field name="fishingOperationValid">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.fishingOperationValid.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="recorderPerson">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ recorderPerson != null && !recorderPerson.isEmpty() ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.catcher.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="vessel">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.vessel.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="gear">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.gear.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="comment">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ fishingOperationValid == null || fishingOperationValid || (comment != null && !comment.isEmpty()) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.comment.required</message>
+ </field-validator>
+
+ </field>
+
+</validators>
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-error-validation.xml (from rev 714, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-error-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,281 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name='strata'>
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ strata != null || subStrata != null || location != null ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
+ </field-validator>
+ </field>
+
+ <field name='subStrata'>
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ strata != null || subStrata != null || location != null ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
+ </field-validator>
+ </field>
+
+ <field name='location'>
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ strata != null || subStrata != null || location != null ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
+ </field-validator>
+ </field>
+
+ <field name="gearShootingStartDate">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingEndDate == null || gearShootingStartDate.before(gearShootingEndDate) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.endBeforeStart</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ isDateInCruise(gearShootingStartDate) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.startOutOfCruiseDates</message>
+ </field-validator>
+
+ </field>
+
+ <field name="gearShootingEndDate">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.date.end.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingStartDate == null || gearShootingStartDate.before(gearShootingEndDate) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.endBeforeStart</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingEndDate == null || isDateInCruise(gearShootingEndDate) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.startOutOfCruiseDates</message>
+ </field-validator>
+
+ </field>
+
+ <!--gear shooting start latitude validation -->
+
+ <field name="gearShootingStartLatitude">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) || gearShootingStartLatitude != null
+ ]]>
+ </param>
+
+ <message>tutti.validator.error.latitude.start.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpressionwithparams">
+ <param name="doubleParams">min:90.0|max:90.0</param>
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) ||
+ ( gearShootingStartLatitude != null
+ && -doubles.min <= gearShootingStartLatitude
+ && gearShootingStartLatitude <= doubles.max )
+ ]]>
+ </param>
+
+ <message>tutti.validator.warning.latitude.outOfBounds</message>
+
+ </field-validator>
+
+ </field>
+
+ <!--gear shooting start longitude validation -->
+
+ <field name="gearShootingStartLongitude">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) || gearShootingStartLongitude != null
+ ]]>
+ </param>
+
+ <message>tutti.validator.error.longitude.start.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpressionwithparams">
+ <param name="doubleParams">min:180.0|max:180.0</param>
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) ||
+ ( gearShootingStartLongitude != null
+ && -doubles.min <= gearShootingStartLongitude
+ && gearShootingStartLongitude <= doubles.max )
+ ]]>
+ </param>
+
+ <message>tutti.validator.warning.longitude.outOfBounds</message>
+
+ </field-validator>
+
+ </field>
+
+ <!--gear shooting end latitude validation -->
+
+ <field name="gearShootingEndLatitude">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) || gearShootingEndLatitude != null
+ ]]>
+ </param>
+
+ <message>tutti.validator.error.latitude.end.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpressionwithparams">
+ <param name="doubleParams">min:90.0|max:90.0</param>
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) ||
+ ( gearShootingEndLatitude != null
+ && -doubles.min <= gearShootingEndLatitude
+ && gearShootingEndLatitude <= doubles.max )
+ ]]>
+ </param>
+
+ <message>tutti.validator.warning.latitude.outOfBounds</message>
+
+ </field-validator>
+
+ </field>
+
+ <!--gear shooting end longitude validation -->
+
+ <field name="gearShootingEndLongitude">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) || gearShootingEndLongitude != null
+ ]]>
+ </param>
+
+ <message>tutti.validator.error.longitude.end.required</message>
+ </field-validator>
+
+ <field-validator type="fieldexpressionwithparams">
+ <param name="doubleParams">min:180.0|max:180.0</param>
+ <param name="expression">
+ <![CDATA[
+ !"DD".equals(coordinateEditorType.toString()) ||
+ ( gearShootingEndLongitude != null
+ && -doubles.min <= gearShootingEndLongitude
+ && gearShootingEndLongitude <= doubles.max )
+ ]]>
+ </param>
+
+ <message>tutti.validator.warning.longitude.outOfBounds</message>
+
+ </field-validator>
+
+ </field>
+
+ <field name="trawlDistance">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.trawlDistance.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="fishingOperationValid">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.fishingOperationValid.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="recorderPerson">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ recorderPerson != null && !recorderPerson.isEmpty() ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.catcher.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="vessel">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.vessel.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="gear">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.gear.required</message>
+ </field-validator>
+
+ </field>
+
+ <field name="comment">
+
+ <field-validator type="stringlength" short-circuit="true">
+ <param name="maxLength">2000</param>
+ <message>tutti.validator.error.comment.too.long##${maxLength}</message>
+ </field-validator>
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ fishingOperationValid == null || fishingOperationValid || (comment != null && !comment.isEmpty()) ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.comment.required</message>
+ </field-validator>
+
+ </field>
+
+</validators>
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-fatal-validation.xml (from rev 714, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-fatal-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-fatal-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-fatal-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="stationNumber">
+
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>
+ tutti.validator.error.fishingOperation.stationNumber.required
+ </message>
+ </field-validator>
+
+ <field-validator type="stringlength" short-circuit="true">
+ <param name="maxLength">40</param>
+ <message>
+ tutti.validator.error.fishingOperation.stationNumber.too.long##${maxLength}
+ </message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingOperations</param>
+ <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.fishingOperation.existingKey</message>
+ </field-validator>
+
+ </field>
+
+ <field name="fishingOperationNumber">
+
+ <field-validator type="required" short-circuit="true">
+ <message>
+ tutti.validator.error.fishingOperation.fishingOperationNumber.required
+ </message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingOperations</param>
+ <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.fishingOperation.existingKey</message>
+ </field-validator>
+
+ </field>
+
+ <field name="multirigAggregation">
+
+ <field-validator type="required" short-circuit="true">
+ <message>
+ tutti.validator.error.fishingOperation.trawlNetNumber.required
+ </message>
+ </field-validator>
+
+ </field>
+
+ <field name="gearShootingStartDate">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.fishingOperation.date.start.required</message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingOperations</param>
+ <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.fishingOperation.existingKey</message>
+ </field-validator>
+
+ </field>
+</validators>
Property changes on: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-fatal-validation.xml
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-warning-validation.xml (from rev 714, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-warning-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-warning-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/FishingOperation-validate-warning-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+
+<validators>
+
+ <field name="gearShootingStartDate">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingStartDate == null || gearShootingEndDate == null
+ || org.nuiton.util.DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate) <= 45
+ && org.nuiton.util.DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate) >= 20 )
+ ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.wrongTime</message>
+ </field-validator>
+
+ </field>
+
+ <field name="gearShootingEndDate">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ gearShootingStartDate == null || gearShootingEndDate == null
+ || org.nuiton.util.DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate) <= 45
+ && org.nuiton.util.DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate) >= 20 )
+ ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.dates.wrongTime</message>
+ </field-validator>
+
+ </field>
+
+ <field name="trawlDistance">
+
+ <field-validator type="fieldexpression" short-circuit="true">
+ <param name="expression">
+ <![CDATA[ trawlDistance == null || trawlDistance <= 5556 ]]>
+ </param>
+ <message>tutti.validator.error.fishingOperation.trawlDistance.tooLong</message>
+ </field-validator>
+
+ </field>
+
+</validators>
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/Program-error-validation.xml (from rev 714, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/Program-error-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/data/Program-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.program.name.required</message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingPrograms</param>
+ <param name="keys">name, zone</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.program.existingKey</message>
+ </field-validator>
+
+ </field>
+
+ <field name="zone">
+
+ <field-validator type="required" short-circuit="true">
+ <message>tutti.validator.error.program.zone.required</message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingPrograms</param>
+ <param name="keys">name, zone</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.program.existingKey</message>
+ </field-validator>
+
+ </field>
+
+ <field name="description">
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.program.description.required</message>
+ </field-validator>
+ <field-validator type="stringlength" short-circuit="true">
+ <param name="maxLength">2000</param>
+ <message>
+ tutti.validator.error.program.description.too.long##${maxLength}
+ </message>
+ </field-validator>
+ </field>
+
+</validators>
Copied: trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocol-error-validation.xml (from rev 714, trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocol-error-validation.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/fr/ifremer/tutti/persistence/entities/protocol/TuttiProtocol-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator 1.0.3//EN"
+ "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
+<validators>
+
+ <field name="name">
+ <field-validator type="requiredstring" short-circuit="true">
+ <message>tutti.validator.error.protocol.name.required</message>
+ </field-validator>
+
+ <field-validator type="collectionUniqueKey" short-circuit="true">
+ <param name="collectionFieldName">existingProtocols</param>
+ <param name="keys">name</param>
+ <param name="againstMe">true</param>
+ <param name="nullValueSkipped">true</param>
+ <message>tutti.validator.error.protocol.name.alreadyUsed</message>
+ </field-validator>
+
+ </field>
+
+ <field name="comment">
+ <field-validator type="stringlength" short-circuit="true">
+ <param name="maxLength">2000</param>
+ <message>tutti.validator.error.comment.too.long##${maxLength}</message>
+ </field-validator>
+ </field>
+
+</validators>
\ No newline at end of file
Modified: trunk/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
===================================================================
--- trunk/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2013-04-01 20:46:21 UTC (rev 715)
@@ -39,11 +39,52 @@
tutti.property.user=
tutti.property.vessel=
tutti.property.zone=
-tutti.property.zoneLabel=
-tutti.propety.no.species.refTaxCode=
tutti.propety.no.species.speciesCode=
-tutti.propety.no.species.surveyCode=
tutti.propety.no.vessel.name=
tutti.propety.no.zone=
tutti.propety.vessel.nation.registrationCode=
-tutti.service.config=
+tutti.validator.error.comment.too.long=
+tutti.validator.error.cruise.beginDate.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=
+tutti.validator.error.cruise.headOfSortRoom.required=
+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.fishingOperation.catcher.required=
+tutti.validator.error.fishingOperation.comment.required=
+tutti.validator.error.fishingOperation.date.end.required=
+tutti.validator.error.fishingOperation.date.start.required=
+tutti.validator.error.fishingOperation.dates.endBeforeStart=
+tutti.validator.error.fishingOperation.dates.endOutOfCruiseDates=
+tutti.validator.error.fishingOperation.dates.startOutOfCruiseDates=
+tutti.validator.error.fishingOperation.dates.wrongTime=
+tutti.validator.error.fishingOperation.existingKey=
+tutti.validator.error.fishingOperation.fishingOperationNumber.required=
+tutti.validator.error.fishingOperation.fishingOperationValid.required=
+tutti.validator.error.fishingOperation.gear.required=
+tutti.validator.error.fishingOperation.stationNumber.required=
+tutti.validator.error.fishingOperation.stationNumber.too.long=
+tutti.validator.error.fishingOperation.strataLocation.required=
+tutti.validator.error.fishingOperation.trawlDistance.required=
+tutti.validator.error.fishingOperation.trawlDistance.tooLong=
+tutti.validator.error.fishingOperation.trawlNetNumber.required=
+tutti.validator.error.fishingOperation.vessel.required=
+tutti.validator.error.latitude.end.required=
+tutti.validator.error.latitude.start.required=
+tutti.validator.error.longitude.end.required=
+tutti.validator.error.longitude.start.required=
+tutti.validator.error.program.description.required=
+tutti.validator.error.program.description.too.long=
+tutti.validator.error.program.existingKey=
+tutti.validator.error.program.name.required=
+tutti.validator.error.program.zone.required=
+tutti.validator.error.protocol.name.alreadyUsed=
+tutti.validator.error.protocol.name.required=
+tutti.validator.warning.latitude.outOfBounds=
+tutti.validator.warning.longitude.outOfBounds=
Modified: trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
===================================================================
--- trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-04-01 20:46:21 UTC (rev 715)
@@ -39,8 +39,52 @@
tutti.property.user=Utilisateur
tutti.property.vessel=Navire
tutti.property.zone=Zone
-tutti.property.zoneLabel=Zone
tutti.propety.no.species.speciesCode=\#
tutti.propety.no.vessel.name=Nom inconnu
tutti.propety.no.zone=Pas de zone
tutti.propety.vessel.nation.registrationCode=%s (nat.)
+tutti.validator.error.comment.too.long=Taille de commentaire trop longue (limitée à %s caractères)
+tutti.validator.error.cruise.beginDate.required=La date de début 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é
+tutti.validator.error.cruise.headOfSortRoom.required=Au moins un responsable de salle de tri doit être sélectionné
+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.fishingOperation.catcher.required=Au moins un saisisseur est obligatoire
+tutti.validator.error.fishingOperation.comment.required=Le commentaire est obligatoire si le traît est invalide
+tutti.validator.error.fishingOperation.date.end.required=La date de la fin du trait est obligatoire
+tutti.validator.error.fishingOperation.date.start.required=La date du début du trait est obligatoire
+tutti.validator.error.fishingOperation.dates.endBeforeStart=La date de fin doit être après la date de début
+tutti.validator.error.fishingOperation.dates.endOutOfCruiseDates=La date de fin est en dehors des dates de la campagne
+tutti.validator.error.fishingOperation.dates.startOutOfCruiseDates=La date de début est en dehors des dates de la campagne
+tutti.validator.error.fishingOperation.dates.wrongTime=La durée du trait dépasse 45 minutes ou est inférieure à 20 minutes, merci de vérifier les dates/heures du trait
+tutti.validator.error.fishingOperation.existingKey=La clé code station/numéro de trait/date de début existe déjà
+tutti.validator.error.fishingOperation.fishingOperationNumber.required=Le numéro de trait est obligatoire
+tutti.validator.error.fishingOperation.fishingOperationValid.required=La validité du traît est obligatoire
+tutti.validator.error.fishingOperation.gear.required=L'engin est obligatoire
+tutti.validator.error.fishingOperation.stationNumber.required=Le numéro de station est obligatoire
+tutti.validator.error.fishingOperation.stationNumber.too.long=Valeur trop longue (limitée à %s caractères)
+tutti.validator.error.fishingOperation.strataLocation.required=La strate, sous-strate ou localité doit être renseignée
+tutti.validator.error.fishingOperation.trawlDistance.required=La distance est obligatoire
+tutti.validator.error.fishingOperation.trawlDistance.tooLong=La distance du trait dépasse 3 milles marin (5556 m), merci de vérifier les coordonnées
+tutti.validator.error.fishingOperation.trawlNetNumber.required=Le numéro de poche est obligatoire
+tutti.validator.error.fishingOperation.vessel.required=Le navire est obligatoire
+tutti.validator.error.latitude.end.required=La latitude de fin de traîne est obligatoire
+tutti.validator.error.latitude.start.required=La latitude de début de traîne est obligatoire
+tutti.validator.error.longitude.end.required=La longitude de fin de traîne est obligatoire
+tutti.validator.error.longitude.start.required=La longitude de début de traîne est obligatoire
+tutti.validator.error.program.description.required=La description de la série est obligatoire
+tutti.validator.error.program.description.too.long=Taille de la description trop longue (limitée à %s caractères)
+tutti.validator.error.program.existingKey=Le couple nom/zone existe déjà
+tutti.validator.error.program.name.required=Le nom de la série est obligatoire
+tutti.validator.error.program.zone.required=La zone de la série est obligatoire
+tutti.validator.error.protocol.name.alreadyUsed=Le nom du protocol est déjà utilisé
+tutti.validator.error.protocol.name.required=Le nom du protocol est obligatoire
+tutti.validator.warning.latitude.outOfBounds=La Latitude doit être comprise entre -90.0 et 90.0
+tutti.validator.warning.longitude.outOfBounds=La longitude doit être comprise entre -180.0 et 180.0
Copied: trunk/tutti-service/src/main/resources/validators.xml (from rev 709, trunk/tutti-ui-swing/src/main/resources/validators.xml)
===================================================================
--- trunk/tutti-service/src/main/resources/validators.xml (rev 0)
+++ trunk/tutti-service/src/main/resources/validators.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ #%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%
+ -->
+
+
+<!DOCTYPE validators PUBLIC
+ "-//Apache Struts//XWork Validator Config 1.0//EN"
+ "http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd">
+<validators>
+
+ <!-- les validateurs fournis par XWork -->
+ <validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
+ <validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
+ <validator name="regex" class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/>
+ <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/>
+ <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
+ <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/>
+ <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
+ <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
+ <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
+ <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/>
+ <validator name="email" class="com.opensymphony.xwork2.validator.validators.EmailValidator"/>
+
+ <!-- les validateurs fournis par nuiton-validator -->
+ <validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/>
+ <validator name="fieldexpressionwithparams" class="org.nuiton.validator.xwork2.field.FieldExpressionWithParamsValidator"/>
+
+</validators>
Added: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java (rev 0)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,91 @@
+package fr.ifremer.tutti.service;
+
+/*
+ * #%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.persistence.RessourceClassLoader;
+import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfigOption;
+import fr.ifremer.tutti.service.config.TuttiServiceConfig;
+import org.apache.commons.io.FileUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+import org.nuiton.util.FileUtil;
+import org.nuiton.util.config.ApplicationConfig;
+
+import java.io.File;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.2
+ */
+public abstract class AbstractServiceTest {
+
+ public static final long TIMESTAMP = System.nanoTime();
+
+ @Rule
+ public final TestName name = new TestName();
+
+ protected File datadirectory;
+
+ protected TuttiServiceContext serviceContext;
+
+ protected abstract TuttiServiceContext createServiceContext(RessourceClassLoader loader,
+ TuttiServiceConfig config);
+
+ @Before
+ public void setUp() throws Exception {
+
+
+ datadirectory = FileUtil.getTestSpecificDirectory(getClass(),
+ name.getMethodName(),
+ null,
+ TIMESTAMP);
+
+ FileUtils.forceMkdir(datadirectory);
+
+ ApplicationConfig applicationConfig =
+ new ApplicationConfig("tutti-test.properties");
+ applicationConfig.loadDefaultOptions(
+ TuttiPersistenceConfigOption.values());
+ applicationConfig.setDefaultOption("tutti.data.directory",
+ new File(datadirectory, "data").getAbsolutePath());
+ applicationConfig.parse();
+
+ RessourceClassLoader loader =
+ new RessourceClassLoader(getClass().getClassLoader());
+
+ TuttiServiceConfig config =
+ new TuttiServiceConfig(applicationConfig);
+
+ serviceContext = createServiceContext(loader, config);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+
+ serviceContext.close();
+ }
+}
Property changes on: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/AbstractServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Copied: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/BeanValidatorDetectorTest.java (from rev 709, trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/BeanValidatorDetectorTest.java)
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/BeanValidatorDetectorTest.java (rev 0)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/BeanValidatorDetectorTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,125 @@
+/*
+ * #%L
+ * ObServe :: Validation
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2008 - 2010 IRD, Codelutin, Tony Chemit
+ * %%
+ * 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%
+ */
+package fr.ifremer.tutti.service;
+
+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.protocol.TuttiProtocol;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.nuiton.validator.AbstractValidatorDetectorTest;
+import org.nuiton.validator.NuitonValidator;
+import org.nuiton.validator.xwork2.XWork2NuitonValidatorProvider;
+
+import java.io.File;
+import java.util.SortedSet;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 0.3
+ */
+public class BeanValidatorDetectorTest extends AbstractValidatorDetectorTest {
+
+ private static final String EDIT_CONTEXT_NAME = "edit";
+
+ private static final String VALIDATE_CONTEXT_NAME = "validate";
+
+ SortedSet<NuitonValidator<?>> validators;
+
+ public BeanValidatorDetectorTest() {
+ super(XWork2NuitonValidatorProvider.PROVIDER_NAME);
+ }
+
+ static Class<?>[] ALL_TYPES;
+
+ @BeforeClass
+ public static void setUpClass() throws Exception {
+ ALL_TYPES = new Class[]{
+ Cruise.class,
+ Program.class,
+ TuttiProtocol.class,
+ FishingOperation.class
+ };
+ }
+
+ @Override
+ protected File getRootDirectory(File basedir) {
+ return new File(basedir,
+ "src" + File.separator + "main" + File.separator + "resources");
+ }
+
+ @Test
+ public void detectAll() {
+
+ SortedSet<NuitonValidator<?>> validators = detectValidators(ALL_TYPES);
+ assertFalse(validators.isEmpty());
+ assertEquals(5, validators.size());
+ }
+
+ @Test
+ public void detectWithNoContext() {
+
+ String contextName = "";
+
+ validators = detectValidators(Pattern.compile(contextName), ALL_TYPES);
+
+ assertValidatorSetWithSameContextName(validators, null,
+ Cruise.class,
+ Program.class,
+ TuttiProtocol.class
+ );
+ }
+
+ @Test
+ public void detectWithEditContext() {
+
+ String contextName = EDIT_CONTEXT_NAME;
+
+ validators = detectValidators(Pattern.compile(contextName), ALL_TYPES);
+
+ assertValidatorSetWithSameContextName(validators,
+ contextName,
+ FishingOperation.class
+ );
+ }
+
+ @Test
+ public void detectWithValidateContext() {
+ String contextName = VALIDATE_CONTEXT_NAME;
+
+ validators = detectValidators(Pattern.compile(contextName), ALL_TYPES);
+
+ assertValidatorSetWithSameContextName(validators,
+ contextName,
+ FishingOperation.class
+ );
+
+ }
+}
Added: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java (rev 0)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,141 @@
+package fr.ifremer.tutti.service;
+
+/*
+ * #%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.LabelAware;
+import fr.ifremer.tutti.persistence.RessourceClassLoader;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
+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.data.Program;
+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.CaracteristicQualitativeValue;
+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.service.config.TuttiServiceConfig;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.nuiton.util.decorator.Decorator;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class DecoratorServiceTest extends AbstractServiceTest {
+
+ private DecoratorService service;
+
+ @Override
+ protected TuttiServiceContext createServiceContext(RessourceClassLoader loader, TuttiServiceConfig config) {
+ return new TuttiServiceContext(loader, config);
+ }
+
+ @Before
+ public void setUp() throws Exception {
+
+ super.setUp();
+
+ service = serviceContext.getService(DecoratorService.class);
+
+ }
+
+ @Test
+ public void getDecoratorByType() {
+
+ assertDecoratorByTypeFound(TuttiLocation.class);
+ assertDecoratorByTypeFound(Cruise.class);
+ assertDecoratorByTypeFound(TuttiProtocol.class);
+ assertDecoratorByTypeFound(FishingOperation.class);
+ assertDecoratorByTypeFound(Gear.class);
+ assertDecoratorByTypeFound(Person.class);
+ assertDecoratorByTypeFound(Caracteristic.class);
+ assertDecoratorByTypeFound(DecoratorService.CARACTERISTIC_PARAMETER_ONLY, Caracteristic.class);
+ assertDecoratorByTypeFound(SpeciesProtocol.class);
+ assertDecoratorByTypeFound(CaracteristicQualitativeValue.class);
+ assertDecoratorByTypeFound(Attachment.class);
+ assertDecoratorByTypeFound(LabelAware.class);
+ assertDecoratorByTypeFound(Vessel.class);
+ assertDecoratorByTypeFound(Program.class);
+ assertDecoratorByTypeFound(Float.class);
+ assertDecoratorByTypeFound(Species.class);
+ assertDecoratorByTypeFound(DecoratorService.FROM_PROTOCOL, Species.class);
+ assertDecoratorByTypeFound(DecoratorService.CARACTERISTIC_WITH_UNIT, Caracteristic.class);
+
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfTuttiLocation());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfCruise());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfTuttiProtocol());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfFishingOperation());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfGear());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfPerson());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfCaracteristic());
+ assertDecoratorByTypeFound(DecoratorService.CARACTERISTIC_PARAMETER_ONLY, TuttiBeanFactory.typeOfCaracteristic());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfCaracteristicQualitativeValue());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfSpeciesProtocol());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfAttachment());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfVessel());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfProgram());
+ assertDecoratorByTypeFound(TuttiBeanFactory.typeOfSpecies());
+ assertDecoratorByTypeFound(DecoratorService.FROM_PROTOCOL, TuttiBeanFactory.typeOfSpecies());
+ assertDecoratorByTypeFound(DecoratorService.CARACTERISTIC_WITH_UNIT, TuttiBeanFactory.typeOfCaracteristic());
+ }
+
+ @Test
+ public void decorateProgram() {
+
+ Decorator<Program> d = assertDecoratorByTypeFound(Program.class);
+ Program p = TuttiBeanFactory.newProgram();
+ p.setName("pName");
+ String s;
+ s = d.toString(p);
+ Assert.assertEquals("pName - " + _("tutti.propety.no.zone"), s);
+
+ TuttiLocation z = TuttiBeanFactory.newTuttiLocation();
+ z.setLabel("pLabel");
+ p.setZone(z);
+ s = d.toString(p);
+ Assert.assertEquals("pName - pLabel", s);
+
+ }
+
+ protected <O> Decorator<O> assertDecoratorByTypeFound(Class<O> type) {
+ return assertDecoratorByTypeFound(null, type);
+ }
+
+ protected <O> Decorator<O> assertDecoratorByTypeFound(String context, Class<O> type) {
+ Decorator<O> decorator = service.getDecoratorByType(type);
+ Assert.assertNotNull(context, decorator);
+ return decorator;
+ }
+
+}
Property changes on: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/DecoratorServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Added: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java (rev 0)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -0,0 +1,212 @@
+package fr.ifremer.tutti.service;
+
+/*
+ * #%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 com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.RessourceClassLoader;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
+import fr.ifremer.tutti.persistence.entities.data.Cruise;
+import fr.ifremer.tutti.persistence.entities.data.Program;
+import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
+import fr.ifremer.tutti.persistence.entities.referential.TuttiLocation;
+import fr.ifremer.tutti.service.config.TuttiServiceConfig;
+import org.apache.commons.lang.time.DateUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.nuiton.validator.NuitonValidatorResult;
+
+import java.util.List;
+
+/**
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class ValidationServiceTest extends AbstractServiceTest {
+
+ private ValidationService service;
+
+ private TuttiDataContextFake dataContext;
+
+ @Override
+ protected TuttiServiceContext createServiceContext(RessourceClassLoader loader,
+ TuttiServiceConfig config) {
+ return new TuttiServiceContext(loader, config, dataContext = new TuttiDataContextFake());
+ }
+
+ @Before
+ public void setUp() throws Exception {
+
+ super.setUp();
+
+ service = serviceContext.getService(ValidationService.class);
+ }
+
+ @Test
+ public void validateCruise() throws Exception {
+
+ Cruise c = TuttiBeanFactory.newCruise();
+
+ assertIsNotValid(service.validateCruise(c));
+
+ c.setName("cName");
+ c.setMultirigNumber(1);
+ c.setBeginDate(serviceContext.currentDate());
+ c.setEndDate(DateUtils.addDays(serviceContext.currentDate(), 1));
+ c.setDepartureLocation(TuttiBeanFactory.newTuttiLocation());
+ c.setReturnLocation(TuttiBeanFactory.newTuttiLocation());
+ c.setProgram(TuttiBeanFactory.newProgram());
+ c.setVessel(TuttiBeanFactory.newVessel());
+ c.setGear(Lists.newArrayList(TuttiBeanFactory.newGear()));
+ c.setHeadOfMission(Lists.newArrayList(TuttiBeanFactory.newPerson()));
+ c.setHeadOfSortRoom(Lists.newArrayList(TuttiBeanFactory.newPerson()));
+ assertIsValid(service.validateCruise(c));
+ }
+
+ @Test
+ public void validateProgram() throws Exception {
+
+ Program p = TuttiBeanFactory.newProgram();
+
+ // no name / no zone / no description
+ assertIsNotValid(service.validateProgram(p));
+
+ p.setName("pName");
+ p.setDescription("pDescription");
+ TuttiLocation z = TuttiBeanFactory.newTuttiLocation();
+ z.setId("z0");
+ z.setLabel("z0Label");
+ p.setZone(z);
+
+ // valid
+ assertIsValid(service.validateProgram(p));
+
+ // adding two programs
+ Program p2 = TuttiBeanFactory.newProgram();
+ p2.setId("p2");
+ p2.setName("pName");
+ p2.setZone(z);
+ Program p3 = TuttiBeanFactory.newProgram();
+ p3.setId("p3");
+ p3.setName("pName2");
+ p3.setZone(z);
+
+ // now program in data context
+ dataContext.setExistingPrograms(Lists.newArrayList(p2, p3));
+
+ // no more valid
+ assertIsNotValid(service.validateProgram(p));
+
+ // change name of p
+ p.setName("pName3");
+
+ // back to valid
+ assertIsValid(service.validateProgram(p));
+
+ // reput bad name and same id of an existant p (so should be ok)
+ p.setName("pName");
+ p.setId("p2");
+
+ // still valid
+ assertIsValid(service.validateProgram(p));
+ }
+
+ @Test
+ public void validateProtocol() throws Exception {
+
+ TuttiProtocol p = TuttiBeanFactory.newTuttiProtocol();
+
+ // no name
+ assertIsNotValid(service.validateProtocol(p));
+
+ p.setName("pName");
+
+ // valid
+ assertIsValid(service.validateProtocol(p));
+
+ // add two protocol in dataContext
+ TuttiProtocol p2 = TuttiBeanFactory.newTuttiProtocol();
+ p2.setId("p2");
+ p2.setName("pName");
+ TuttiProtocol p3 = TuttiBeanFactory.newTuttiProtocol();
+ p3.setId("p3");
+ p3.setName("pName2");
+
+ // now program in data context
+ dataContext.setExistingProtocols(Lists.newArrayList(p2, p3));
+
+ // no more valid
+ assertIsNotValid(service.validateProtocol(p));
+
+ // change name of p
+ p.setName("pName3");
+
+ // back to valid
+ assertIsValid(service.validateProtocol(p));
+
+ // reput bad name and same id of an existant p (so should be ok)
+ p.setName("pName");
+ p.setId("p2");
+
+ // still valid
+ assertIsValid(service.validateProtocol(p));
+ }
+
+ @Ignore
+ @Test
+ public void validateFishingOperation() throws Exception {
+
+ //TODO
+ }
+
+
+ private void assertIsNotValid(NuitonValidatorResult validatorResult) {
+ Assert.assertNotNull(validatorResult);
+ Assert.assertTrue(validatorResult.hasErrorMessagess());
+ Assert.assertFalse(validatorResult.isValid());
+ }
+
+ private void assertIsValid(NuitonValidatorResult validatorResult) {
+ Assert.assertNotNull(validatorResult);
+ Assert.assertFalse(validatorResult.hasErrorMessagess());
+ Assert.assertTrue(validatorResult.isValid());
+ }
+
+ class TuttiDataContextFake extends TuttiDataContext {
+
+ @Override
+ protected void checkOpened() {
+ }
+
+ public void setExistingPrograms(List<Program> existingPrograms) {
+ getValidationContext().existingPrograms = existingPrograms;
+ }
+
+ public void setExistingProtocols(List<TuttiProtocol> existingProtocols) {
+ getValidationContext().existingProtocols = existingProtocols;
+ }
+ }
+}
Property changes on: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/ValidationServiceTest.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/protocol/TuttiProtocolImportExportServiceTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -28,16 +28,18 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.io.Files;
+import fr.ifremer.tutti.persistence.RessourceClassLoader;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
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.Species;
+import fr.ifremer.tutti.service.AbstractServiceTest;
+import fr.ifremer.tutti.service.TuttiServiceContext;
+import fr.ifremer.tutti.service.config.TuttiServiceConfig;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.TestName;
-import org.nuiton.util.FileUtil;
import java.io.File;
import java.util.Map;
@@ -46,15 +48,8 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0
*/
-public class TuttiProtocolImportExportServiceTest {
+public class TuttiProtocolImportExportServiceTest extends AbstractServiceTest {
- public static final long TIMESTAMP = System.nanoTime();
-
- @Rule
- public final TestName name = new TestName();
-
- protected File datadirectory;
-
protected TuttiProtocolImportExportService service;
public static final String PROTOCOL_FILE_CONTENT =
@@ -134,19 +129,20 @@
"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;";
+
+ @Override
+ protected TuttiServiceContext createServiceContext(RessourceClassLoader loader, TuttiServiceConfig config) {
+ return new TuttiServiceContext(loader, config);
+ }
+
@Before
public void setUp() throws Exception {
- datadirectory = FileUtil.getTestSpecificDirectory(getClass(),
- name.getMethodName(),
- null, TIMESTAMP);
+ super.setUp();
- service = new TuttiProtocolImportExportService() {
+ serviceContext.getConfig().setCsvSeparator(';');
- @Override
- protected char getCsvSeparator() {
- return ';';
- }
- };
+ service = serviceContext.getService(
+ TuttiProtocolImportExportService.class);
}
@Test
@@ -157,7 +153,7 @@
Files.createParentDirs(exportFile);
Assert.assertFalse(exportFile.exists());
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
protocol.setId("1");
protocol.setName("protocolName");
protocol.setComment("Commentaire");
@@ -166,7 +162,7 @@
protocol.setGearUseFeaturePmfmId(Lists.newArrayList("21", "22"));
protocol.setSpecies(Lists.<SpeciesProtocol>newArrayList());
- SpeciesProtocol sp1 = new SpeciesProtocol();
+ SpeciesProtocol sp1 = TuttiBeanFactory.newSpeciesProtocol();
sp1.setSpeciesReferenceTaxonId(11242);
sp1.setSpeciesSurveyCode("cruiseCode1");
sp1.setLengthStepPmfmId("1394");
@@ -176,7 +172,7 @@
sp1.setWeightEnabled(true);
protocol.addSpecies(sp1);
- SpeciesProtocol sp2 = new SpeciesProtocol();
+ SpeciesProtocol sp2 = TuttiBeanFactory.newSpeciesProtocol();
sp2.setSpeciesReferenceTaxonId(3835);
sp2.setLengthStepPmfmId("323");
sp2.setAgeEnabled(true);
@@ -189,7 +185,7 @@
protocol.addSpecies(sp2);
protocol.setBenthos(Lists.<SpeciesProtocol>newArrayList());
- SpeciesProtocol b1 = new SpeciesProtocol();
+ SpeciesProtocol b1 = TuttiBeanFactory.newSpeciesProtocol();
b1.setSpeciesReferenceTaxonId(11242);
b1.setSpeciesSurveyCode("cruiseCode1");
b1.setLengthStepPmfmId("1394");
@@ -199,7 +195,7 @@
b1.setWeightEnabled(true);
protocol.addBenthos(b1);
- SpeciesProtocol b2 = new SpeciesProtocol();
+ SpeciesProtocol b2 = TuttiBeanFactory.newSpeciesProtocol();
b2.setSpeciesReferenceTaxonId(3835);
b2.setLengthStepPmfmId("323");
b2.setAgeEnabled(true);
@@ -301,7 +297,7 @@
Files.write(PROTOCOL_CARACTERISTIC_FILE_CONTENT, file, Charsets.UTF_8);
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
Map<String, Caracteristic> caracteristicMap = createCaracteristics();
service.importProtocolCaracteristic(file,
@@ -324,7 +320,7 @@
Files.createParentDirs(file);
Map<String, Caracteristic> caracteristicMap = createCaracteristics();
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
protocol.setLengthClassesPmfmId(Lists.newArrayList("1"));
protocol.setVesselUseFeaturePmfmId(Lists.newArrayList("2"));
@@ -368,7 +364,7 @@
Files.write(PROTOCOL_SPECIES_FILE_CONTENT, file, Charsets.UTF_8);
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
Map<String, Species> speciesMap = createSpecies();
Map<String, Caracteristic> caracteristicMap = createCaracteristics();
@@ -415,10 +411,10 @@
Map<String, Species> speciesMap = createSpecies();
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
protocol.setSpecies(Lists.<SpeciesProtocol>newArrayList());
- SpeciesProtocol sp1 = new SpeciesProtocol();
+ SpeciesProtocol sp1 = TuttiBeanFactory.newSpeciesProtocol();
sp1.setSpeciesReferenceTaxonId(1);
sp1.setSpeciesSurveyCode("cruiseCode1");
sp1.setAgeEnabled(true);
@@ -432,7 +428,7 @@
protocol.addSpecies(sp1);
- SpeciesProtocol sp2 = new SpeciesProtocol();
+ SpeciesProtocol sp2 = TuttiBeanFactory.newSpeciesProtocol();
sp2.setSpeciesReferenceTaxonId(2);
sp2.setAgeEnabled(true);
sp1.setSizeEnabled(true);
@@ -466,7 +462,7 @@
Files.write(PROTOCOL_BENTHOS_FILE_CONTENT, file, Charsets.UTF_8);
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
Map<String, Species> speciesMap = createSpecies();
Map<String, Caracteristic> caracteristicMap = createCaracteristics();
@@ -513,10 +509,10 @@
Map<String, Species> speciesMap = createSpecies();
- TuttiProtocol protocol = new TuttiProtocol();
+ TuttiProtocol protocol = TuttiBeanFactory.newTuttiProtocol();
protocol.setBenthos(Lists.<SpeciesProtocol>newArrayList());
- SpeciesProtocol sp1 = new SpeciesProtocol();
+ SpeciesProtocol sp1 = TuttiBeanFactory.newSpeciesProtocol();
sp1.setSpeciesReferenceTaxonId(1);
sp1.setSpeciesSurveyCode("cruiseCode1");
sp1.setAgeEnabled(true);
@@ -530,7 +526,7 @@
protocol.addBenthos(sp1);
- SpeciesProtocol sp2 = new SpeciesProtocol();
+ SpeciesProtocol sp2 = TuttiBeanFactory.newSpeciesProtocol();
sp2.setSpeciesReferenceTaxonId(2);
sp2.setAgeEnabled(true);
sp1.setSizeEnabled(true);
@@ -558,7 +554,7 @@
protected Map<String, Caracteristic> createCaracteristics() {
Map<String, Caracteristic> result = Maps.newTreeMap();
for (int i = 1; i < 6; i++) {
- Caracteristic c = new Caracteristic();
+ Caracteristic c = TuttiBeanFactory.newCaracteristic();
c.setId("" + i);
c.setParameterName("parameterName" + i);
c.setMatrixName("matrixName" + i);
@@ -572,7 +568,7 @@
protected Map<String, Species> createSpecies() {
Map<String, Species> result = Maps.newTreeMap();
for (int i = 1; i < 3; i++) {
- Species c = new Species();
+ Species c = TuttiBeanFactory.newSpecies();
c.setId("" + i);
c.setReferenceTaxonId(i);
c.setName("speciesName" + i);
Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/referential/TuttiReferentialImportExportServiceTest.java
===================================================================
--- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/referential/TuttiReferentialImportExportServiceTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/referential/TuttiReferentialImportExportServiceTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -28,25 +28,20 @@
import com.google.common.collect.Lists;
import com.google.common.io.Files;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
-import fr.ifremer.tutti.persistence.config.TuttiPersistenceConfigOption;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
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.Vessel;
+import fr.ifremer.tutti.service.AbstractServiceTest;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.service.TuttiServiceContext;
import fr.ifremer.tutti.service.config.TuttiServiceConfig;
-import org.apache.commons.io.FileUtils;
-import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
-import org.junit.Rule;
import org.junit.Test;
-import org.junit.rules.TestName;
-import org.nuiton.util.FileUtil;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
-import org.nuiton.util.config.ApplicationConfig;
import java.io.File;
import java.util.List;
@@ -55,19 +50,8 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 1.0
*/
-public class TuttiReferentialImportExportServiceTest {
+public class TuttiReferentialImportExportServiceTest extends AbstractServiceTest {
- public static final long TIMESTAMP = System.nanoTime();
-
- @Rule
- public final TestName name = new TestName();
-
- protected File datadirectory;
-
- protected TuttiReferentialImportExportService service;
-
- private ClassLoader oldClassLoader;
-
public static final String SPECIES_FILE_CONTENT =
"name\n" +
"Temporary Species name 1;\n" +
@@ -94,6 +78,117 @@
"Temporary scientific vessel name 3;International registration code S3;Y;\n" +
"Temporary scientific vessel name 4;International registration code S4;Y;";
+ protected TuttiReferentialImportExportService service;
+
+ @Override
+ protected TuttiServiceContext createServiceContext(RessourceClassLoader loader, TuttiServiceConfig config) {
+ return new TuttiServiceContext(loader, config);
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ serviceContext.getConfig().setCsvSeparator(';');
+ service = new TuttiReferentialImportExportService() {
+
+ @Override
+ public void setServiceContext(TuttiServiceContext context) {
+ this.context = context;
+ persistenceService = new PersistenceService() {
+
+ @Override
+ public List<Species> getAllSpecies() {
+ return Lists.newArrayList();
+ }
+
+ @Override
+ public List<Person> getAllPerson() {
+ return Lists.newArrayList();
+ }
+
+ @Override
+ public List<Gear> getAllScientificGear() {
+ return Lists.newArrayList();
+ }
+
+ @Override
+ public List<Gear> getAllFishingGear() {
+ return Lists.newArrayList();
+ }
+
+ @Override
+ public List<Vessel> getAllScientificVessel() {
+ return Lists.newArrayList();
+ }
+
+ @Override
+ public List<Vessel> getAllFishingVessel() {
+ return Lists.newArrayList();
+ }
+
+ @Override
+ public List<Species> importTemporarySpecies(List<Species> species) {
+ Binder<Species, Species> binder = BinderFactory.newBinder(Species.class);
+ List<Species> result = Lists.newArrayList();
+ int i = 1;
+ for (Species source : species) {
+ Species target = TuttiBeanFactory.newSpecies();
+ binder.copy(source, target);
+ target.setId(i++);
+ result.add(target);
+ }
+ return result;
+ }
+
+ @Override
+ public List<Vessel> importTemporaryVessel(List<Vessel> vessels) {
+ Binder<Vessel, Vessel> binder = BinderFactory.newBinder(Vessel.class);
+ List<Vessel> result = Lists.newArrayList();
+ int i = 1;
+ for (Vessel source : vessels) {
+ Vessel target = TuttiBeanFactory.newVessel();
+ binder.copy(source, target);
+ target.setId(i++);
+ result.add(target);
+ }
+ return result;
+ }
+
+ @Override
+ public List<Person> importTemporaryPerson(List<Person> persons) {
+ Binder<Person, Person> binder = BinderFactory.newBinder(Person.class);
+ List<Person> result = Lists.newArrayList();
+ int i = 1;
+ for (Person source : persons) {
+ Person target = TuttiBeanFactory.newPerson();
+ binder.copy(source, target);
+ target.setId(i++);
+ result.add(target);
+ }
+ return result;
+ }
+
+ @Override
+ public List<Gear> importTemporaryGear(List<Gear> gears) {
+ Binder<Gear, Gear> binder = BinderFactory.newBinder(Gear.class);
+ List<Gear> result = Lists.newArrayList();
+ int i = 1;
+ for (Gear source : gears) {
+ Gear target = TuttiBeanFactory.newGear();
+ binder.copy(source, target);
+ target.setId(i++);
+ result.add(target);
+ }
+ return result;
+ }
+ };
+ persistenceService.setServiceContext(context);
+ }
+ };
+ service.setServiceContext(serviceContext);
+ }
+
@Test
public void importTemporarySpecies() throws Exception {
@@ -245,143 +340,4 @@
Assert.assertEquals(GEAR_FILE_CONTENT, exportFileToString);
}
- @Before
- public void setUp() throws Exception {
- datadirectory = FileUtil.getTestSpecificDirectory(getClass(),
- name.getMethodName(),
- null, TIMESTAMP);
-
- FileUtils.forceMkdir(datadirectory);
-
- ApplicationConfig applicationConfig =
- new ApplicationConfig("tutti-test.properties");
- applicationConfig.loadDefaultOptions(
- TuttiPersistenceConfigOption.values());
- applicationConfig.setDefaultOption("tutti.data.directory",
- new File(datadirectory, "data").getAbsolutePath());
- applicationConfig.parse();
-
- RessourceClassLoader loader =
- new RessourceClassLoader(getClass().getClassLoader());
-
- oldClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(loader);
-
- TuttiServiceConfig config =
- new TuttiServiceConfig(applicationConfig);
-
- TuttiServiceContext serviceContext =
- new TuttiServiceContext(loader, config);
-
- service = new TuttiReferentialImportExportService() {
-
- @Override
- protected char getCsvSeparator() {
- return ';';
- }
-
- @Override
- public void setServiceContext(TuttiServiceContext context) {
- this.context = context;
- persistenceService = new PersistenceService() {
-
- @Override
- public List<Species> getAllSpecies() {
- return Lists.newArrayList();
- }
-
- @Override
- public List<Person> getAllPerson() {
- return Lists.newArrayList();
- }
-
- @Override
- public List<Gear> getAllScientificGear() {
- return Lists.newArrayList();
- }
-
- @Override
- public List<Gear> getAllFishingGear() {
- return Lists.newArrayList();
- }
-
- @Override
- public List<Vessel> getAllScientificVessel() {
- return Lists.newArrayList();
- }
-
- @Override
- public List<Vessel> getAllFishingVessel() {
- return Lists.newArrayList();
- }
-
- @Override
- public List<Species> importTemporarySpecies(List<Species> species) {
- Binder<Species, Species> binder = BinderFactory.newBinder(Species.class);
- List<Species> result = Lists.newArrayList();
- int i = 1;
- for (Species source : species) {
- Species target = new Species();
- binder.copy(source, target);
- target.setId("" + i++);
- result.add(target);
- }
- return result;
- }
-
- @Override
- public List<Vessel> importTemporaryVessel(List<Vessel> vessels) {
- Binder<Vessel, Vessel> binder = BinderFactory.newBinder(Vessel.class);
- List<Vessel> result = Lists.newArrayList();
- int i = 1;
- for (Vessel source : vessels) {
- Vessel target = new Vessel();
- binder.copy(source, target);
- target.setId("" + i++);
- result.add(target);
- }
- return result;
- }
-
- @Override
- public List<Person> importTemporaryPerson(List<Person> persons) {
- Binder<Person, Person> binder = BinderFactory.newBinder(Person.class);
- List<Person> result = Lists.newArrayList();
- int i = 1;
- for (Person source : persons) {
- Person target = new Person();
- binder.copy(source, target);
- target.setId("" + i++);
- result.add(target);
- }
- return result;
- }
-
- @Override
- public List<Gear> importTemporaryGear(List<Gear> gears) {
- Binder<Gear, Gear> binder = BinderFactory.newBinder(Gear.class);
- List<Gear> result = Lists.newArrayList();
- int i = 1;
- for (Gear source : gears) {
- Gear target = new Gear();
- binder.copy(source, target);
- target.setId("" + i++);
- result.add(target);
- }
- return result;
- }
- };
- persistenceService.setServiceContext(context);
- }
- };
- service.setServiceContext(serviceContext);
- }
-
- @After
- public void tearDown() throws Exception {
- // push back old classLoader
- if (oldClassLoader != null) {
- Thread.currentThread().setContextClassLoader(oldClassLoader);
- }
- }
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,3 +1,26 @@
+###
+# #%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
#Fri Mar 29 10:09:57 CET 2013
tutti.createBenthosBatch.action.addSpecies.help=createBenthosBatch.html\#actions
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,3 +1,26 @@
+###
+# #%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
#Fri Mar 29 10:09:57 CET 2013
tutti.createBenthosBatch.action.addSpecies.help=createBenthosBatch.html\#actions
Deleted: 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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiDataContext.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,402 +0,0 @@
-package fr.ifremer.tutti.ui.swing;
-
-/*
- * #%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.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.Program;
-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.Gear;
-import fr.ifremer.tutti.persistence.entities.referential.Person;
-import fr.ifremer.tutti.persistence.entities.referential.Species;
-import fr.ifremer.tutti.persistence.entities.referential.Vessel;
-import fr.ifremer.tutti.service.PersistenceService;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.Closeable;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Data context of ui.
- * <p/>
- * All shared data must be there to avoid reloading some stuff.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.0.2
- */
-public class TuttiDataContext implements Closeable {
-
- /** Logger. */
- private static final Log log = LogFactory.getLog(TuttiDataContext.class);
-
- protected Program program;
-
- protected Cruise cruise;
-
- protected TuttiProtocol protocol;
-
- protected List<Caracteristic> caracteristics;
-
- protected List<Caracteristic> lengthStepCaracteristics;
-
- protected List<Person> persons;
-
- protected List<Species> species;
-
- protected List<Species> referentSpeciesWithSurveyCode;
-
- protected List<Species> referentBenthosWithSurveyCode;
-
- protected List<Species> referentSpecies;
-
- protected List<Vessel> fishingVessels;
-
- protected List<Vessel> scientificVessels;
-
- protected List<Gear> fishingGears;
-
- protected List<Gear> scientificGears;
-
- protected PersistenceService service;
-
- protected final TuttiUIContext uiContext;
-
- public TuttiDataContext(TuttiUIContext uiContext) {
- this.uiContext = uiContext;
- this.uiContext.addPropertyChangeListener(TuttiUIContext.PROPERTY_PROGRAM_ID, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- program = null;
- }
- });
- this.uiContext.addPropertyChangeListener(TuttiUIContext.PROPERTY_CRUISE_ID, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- cruise = null;
- }
- });
- this.uiContext.addPropertyChangeListener(TuttiUIContext.PROPERTY_PROTOCOL_ID, new PropertyChangeListener() {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- resetProtocol();
- resetSpecies();
- }
- });
- }
-
- public Program getProgram() {
- checkOpened();
- if (program == null) {
- if (uiContext.isProgramFilled()) {
- String id = uiContext.getProgramId();
- if (log.isInfoEnabled()) {
- log.info("Loading program: " + id);
- }
- program = service.getProgram(id);
- }
- }
- return program;
- }
-
- public Cruise getCruise() {
- checkOpened();
- if (cruise == null) {
- if (uiContext.isCruiseFilled()) {
- String id = uiContext.getCruiseId();
- if (log.isInfoEnabled()) {
- log.info("Loading cruise: " + id);
- }
- cruise = service.getCruise(id);
- }
- }
- return cruise;
- }
-
- public TuttiProtocol getProtocol() {
- checkOpened();
- if (protocol == null) {
- if (uiContext.isProtocolFilled()) {
- String id = uiContext.getProtocolId();
- if (log.isInfoEnabled()) {
- log.info("Loading cruise: " + id);
- }
- protocol = service.getProtocol(id);
- }
- }
- return protocol;
- }
-
- public List<Caracteristic> getCaracteristics() {
- checkOpened();
- if (caracteristics == null) {
- if (log.isInfoEnabled()) {
- log.info("Loading allCaracteristic");
- }
- caracteristics = service.getAllCaracteristic();
- }
- return caracteristics;
- }
-
- public List<Caracteristic> getLengthStepCaracteristics() {
- checkOpened();
- if (lengthStepCaracteristics == null) {
-
- if (uiContext.isProtocolFilled()) {
-
- // get loaded protocol
- protocol = getProtocol();
- lengthStepCaracteristics = Lists.newArrayListWithCapacity(
- protocol.sizeLengthClassesPmfmId());
-
- Map<String, Caracteristic> allCaractericsById =
- TuttiEntities.splitById(getCaracteristics());
-
- if (!protocol.isLengthClassesPmfmIdEmpty()) {
- for (String id : protocol.getLengthClassesPmfmId()) {
- lengthStepCaracteristics.add(allCaractericsById.get(id));
- }
- }
- } else {
- lengthStepCaracteristics = Lists.newArrayList(
- getCaracteristics());
- }
-
- lengthStepCaracteristics = Collections.unmodifiableList(lengthStepCaracteristics);
- }
- return lengthStepCaracteristics;
- }
-
- public List<Species> getReferentSpeciesWithSurveyCode() {
- checkOpened();
- if (referentSpeciesWithSurveyCode == 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
- referentSpeciesWithSurveyCode = Lists.newArrayList();
- if (!protocol.isSpeciesEmpty()) {
-
- // split by taxonId
- Map<String, Species> map = TuttiEntities.splitByTaxonId(getReferentSpecies());
-
- for (SpeciesProtocol protocolSpecy : protocol.getSpecies()) {
- String taxonId = String.valueOf(protocolSpecy.getSpeciesReferenceTaxonId());
- Species species = map.get(taxonId);
- species.setSurveyCode(protocolSpecy.getSpeciesSurveyCode());
- referentSpeciesWithSurveyCode.add(species);
- }
- }
-
- } else {
-
- // no protocol, use default values
- referentSpeciesWithSurveyCode = Lists.newArrayList(getReferentSpecies());
- }
-
- referentSpeciesWithSurveyCode = Collections.unmodifiableList(referentSpeciesWithSurveyCode);
- }
- return referentSpeciesWithSurveyCode;
- }
-
- public List<Species> getReferentBenthosWithSurveyCode() {
- checkOpened();
- 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()) {
- log.info("Loading allSpecies");
- }
- species = service.getAllSpecies(protocol);
- }
- return species;
- }
-
- public List<Species> getReferentSpecies() {
- if (referentSpecies == null) {
- if (log.isInfoEnabled()) {
- log.info("Loading allReferentSpecies");
- }
- referentSpecies = service.getAllReferentSpecies(protocol);
- }
- return referentSpecies;
- }
-
- public List<Person> getPersons() {
- checkOpened();
- if (persons == null) {
- if (log.isInfoEnabled()) {
- log.info("Loading allPerson");
- }
- persons = service.getAllPerson();
- }
- return persons;
- }
-
- public List<Vessel> getFishingVessels() {
- checkOpened();
- if (fishingVessels == null) {
- if (log.isInfoEnabled()) {
- log.info("Loading allfishingVessel");
- }
- fishingVessels = service.getAllFishingVessel();
- }
- return fishingVessels;
- }
-
- public List<Vessel> getScientificVessels() {
- checkOpened();
- if (scientificVessels == null) {
- if (log.isInfoEnabled()) {
- log.info("Loading allScientificVessel");
- }
- scientificVessels = service.getAllScientificVessel();
- }
- return scientificVessels;
- }
-
- public List<Gear> getFishingGears() {
- checkOpened();
- if (fishingGears == null) {
- if (log.isInfoEnabled()) {
- log.info("Loading allFishingGear");
- }
- fishingGears = service.getAllFishingGear();
- }
- return fishingGears;
- }
-
- public List<Gear> getScientificGears() {
- checkOpened();
- if (scientificGears == null) {
- if (log.isInfoEnabled()) {
- log.info("Loading allScientificGear");
- }
- scientificGears = service.getAllScientificGear();
- }
- return scientificGears;
- }
-
- public void open(PersistenceService persistenceService) {
- close();
- this.service = persistenceService;
- }
-
- @Override
- public void close() {
- service = null;
- program = null;
- cruise = null;
- resetProtocol();
- resetVessels();
- resetGears();
- resetPersons();
- resetSpecies();
- }
-
- public void resetProtocol() {
- protocol = null;
- lengthStepCaracteristics = null;
- }
-
- public void resetGears() {
- fishingGears = null;
- scientificGears = null;
- }
-
- public void resetVessels() {
- fishingVessels = null;
- scientificVessels = null;
- }
-
- public void resetPersons() {
- persons = null;
- }
-
- public void resetSpecies() {
- species = null;
- referentSpecies = null;
- referentSpeciesWithSurveyCode = null;
- referentBenthosWithSurveyCode = null;
- }
-
- public void resetCaracteristics() {
- caracteristics = null;
- }
-
- protected void checkOpened() {
- Preconditions.checkState(service != null, "No persistence service assigned!");
- }
-}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,14 +26,14 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
+import fr.ifremer.tutti.PropagatePropertyChangeListener;
import fr.ifremer.tutti.TuttiIOUtil;
import fr.ifremer.tutti.TuttiTechnicalException;
import fr.ifremer.tutti.persistence.RessourceClassLoader;
-import fr.ifremer.tutti.persistence.entities.data.Cruise;
-import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.service.ClosedPersistenceService;
import fr.ifremer.tutti.service.DecoratorService;
import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.service.TuttiDataContext;
import fr.ifremer.tutti.service.TuttiServiceContext;
import fr.ifremer.tutti.service.protocol.TuttiProtocolImportExportService;
import fr.ifremer.tutti.service.pupitri.TuttiPupitriImportExportService;
@@ -49,7 +49,6 @@
import jaxx.runtime.swing.help.JAXXHelpBroker;
import jaxx.runtime.swing.help.JAXXHelpUIHandler;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.beans.AbstractBean;
@@ -75,7 +74,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class TuttiUIContext extends AbstractBean implements Closeable, UIMessageNotifier, JAXXHelpUIHandler {
+public class TuttiUIContext extends AbstractBean implements Closeable, UIMessageNotifier, JAXXHelpUIHandler, PropagatePropertyChangeListener.PropagatePropertyChange {
public static final String VALIDATION_CONTEXT_EDIT = "edit";
@@ -158,28 +157,28 @@
*/
protected final TuttiErrorHelper errorHelper;
- /**
- * Id of last selected program (can be null if none ever selected).
- *
- * @since 0.1
- */
- protected String programId;
+// /**
+// * Id of last selected program (can be null if none ever selected).
+// *
+// * @since 0.1
+// */
+// protected String programId;
+//
+// /**
+// * Id of last selected cruise (can be null if none ever selected).
+// *
+// * @since 0.1
+// */
+// protected String cruiseId;
+//
+// /**
+// * Id of last selected protocol (can be null if none ever selected).
+// *
+// * @since 0.1
+// */
+// protected String protocolId;
/**
- * Id of last selected cruise (can be null if none ever selected).
- *
- * @since 0.1
- */
- protected String cruiseId;
-
- /**
- * Id of last selected protocol (can be null if none ever selected).
- *
- * @since 0.1
- */
- protected String protocolId;
-
- /**
* Shared data context.
*
* @since 1.0.2
@@ -277,7 +276,8 @@
this.serviceContext = new TuttiServiceContext(resourceLoader, config.getServiceConfig());
this.swingSession = new SwingSession(getConfig().getUIConfigFile(), false);
this.errorHelper = new TuttiErrorHelper(this);
- this.dataContext = new TuttiDataContext(this);
+ this.dataContext = serviceContext.getDataContext();
+ PropagatePropertyChangeListener.listenAndPropagateAll(dataContext, this);
UIMessageNotifier logMessageNotifier = new UIMessageNotifier() {
@Override
@@ -291,195 +291,10 @@
addMessageNotifier(logMessageNotifier);
}
- public PersistenceService getPersistenceService() {
+ //------------------------------------------------------------------------//
+ //-- Open / close methods --//
+ //------------------------------------------------------------------------//
- PersistenceService service;
-
- if (useRealPersistenceService()) {
- service = dataContext.service;
- if (service == null) {
-
- // use real service
- service = serviceContext.getService(PersistenceService.class);
-
- dataContext.open(service);
- }
- } else {
- service = serviceContext.getService(ClosedPersistenceService.class);
- }
- return service;
- }
-
- public DecoratorService getDecoratorService() {
- return serviceContext.getService(DecoratorService.class);
- }
-
- public TuttiReferentialSynchronizeService getTuttiReferentialSynchronizeService() {
- return serviceContext.getService(TuttiReferentialSynchronizeService.class);
- }
-
- public TuttiProtocolImportExportService getTuttiProtocolImportExportService() {
- return serviceContext.getService(TuttiProtocolImportExportService.class);
- }
-
- public TuttiPupitriImportExportService getTuttiPupitriImportExportService() {
- return serviceContext.getService(TuttiPupitriImportExportService.class);
- }
-
- public TuttiReferentialImportExportService getTuttiReferentialImportExportService() {
- return serviceContext.getService(TuttiReferentialImportExportService.class);
- }
-
- public boolean useRealPersistenceService() {
- return isDbExist() && isDbLoaded();
- }
-
- public PersistenceService reloadPersistenceService() {
-
- try {
- serviceContext.close();
- } catch (IOException e) {
- throw new TuttiTechnicalException("Could not close services", e);
- }
- dataContext.close();
-
- return getPersistenceService();
- }
-
- public TuttiApplicationConfig getConfig() {
- return config;
- }
-
- public SwingSession getSwingSession() {
- return swingSession;
- }
-
- public String getProgramId() {
- return programId;
- }
-
- public String getCruiseId() {
- return cruiseId;
- }
-
- public String getProtocolId() {
- return protocolId;
- }
-
- public boolean isCruiseFilled() {
- return isProgramFilled() && StringUtils.isNotBlank(cruiseId);
- }
-
- public boolean isProtocolFilled() {
- return StringUtils.isNotBlank(protocolId);
- }
-
- public boolean isProgramFilled() {
- return StringUtils.isNotBlank(programId);
- }
-
- public TuttiScreen getScreen() {
- return screen;
- }
-
- public boolean isDbExist() {
- return dbExist;
- }
-
- public void setDbExist(boolean dbExist) {
- this.dbExist = dbExist;
- firePropertyChange(PROPERTY_DB_EXIST, null, dbExist);
- }
-
- public boolean isBusy() {
- return busy;
- }
-
- public void setBusy(boolean busy) {
- this.busy = busy;
- firePropertyChange(PROPERTY_BUSY, null, busy);
- }
-
- public boolean isHideBody() {
- return hideBody;
- }
-
- public void setHideBody(boolean hideBody) {
- this.hideBody = hideBody;
- firePropertyChange(PROPERTY_HIDE_BODY, null, hideBody);
- }
-
- public Locale getLocale() {
- return locale;
- }
-
- public void setLocale(Locale locale) {
- this.locale = locale;
- firePropertyChange(PROPERTY_LOCALE, null, locale);
- }
-
- public boolean isDbLoaded() {
- return dbLoaded;
- }
-
- public void setDbLoaded(boolean dbLoaded) {
- this.dbLoaded = dbLoaded;
- firePropertyChange(PROPERTY_DB_LOADED, null, dbLoaded);
- }
-
- public void setProgramId(String programId) {
- boolean oldProgramFilled = isProgramFilled();
- boolean oldCruiseFilled = isCruiseFilled();
-
- this.programId = programId;
-
- // always propagate the change
- firePropertyChange(PROPERTY_PROGRAM_ID, -1, programId);
- firePropertyChange(PROPERTY_PROGRAM_FILLED, oldProgramFilled, isProgramFilled());
- firePropertyChange(PROPERTY_CRUISE__FILLED, oldCruiseFilled, isCruiseFilled());
- }
-
- public void setCruiseId(String cruiseId) {
- boolean oldValue = isCruiseFilled();
-
- this.cruiseId = cruiseId;
-
- // always propagate the change
- firePropertyChange(PROPERTY_CRUISE_ID, -1, cruiseId);
- firePropertyChange(PROPERTY_CRUISE__FILLED,
- oldValue, isCruiseFilled());
- }
-
- public void setProtocolId(String protocolId) {
- boolean oldValue = isProtocolFilled();
- this.protocolId = protocolId;
-
- // always propagate the change
- firePropertyChange(PROPERTY_PROTOCOL_ID, -1, protocolId);
- firePropertyChange(PROPERTY_PROTOCOL_FILLED,
- oldValue, isProtocolFilled());
- }
-
- public void setValidationContext(String validationContext) {
- Object oldValue = getValidationContext();
- this.validationContext = validationContext;
- firePropertyChange(PROPERTY_VALIDATION_CONTEXT, oldValue, validationContext);
- }
-
- public String getValidationContext() {
- return validationContext;
- }
-
- public void setScreen(TuttiScreen screen) {
- Object oldValue = getScreen();
- this.screen = screen;
- firePropertyChange(PROPERTY_SCREEN, oldValue, screen);
- }
-
- public TuttiDataContext getDataContext() {
- return dataContext;
- }
-
public void init() {
config.getServiceConfig().prepareDirectories();
@@ -583,19 +398,19 @@
setLocale(config.getI18nLocale());
- if (programId == null) {
+ if (getProgramId() == null) {
// load it from config
setProgramId(config.getProgramId());
}
- if (cruiseId == null) {
+ if (getCruiseId() == null) {
// load it from config
setCruiseId(config.getCruiseId());
}
- if (protocolId == null) {
+ if (getProtocolId() == null) {
// load it from config
setProtocolId(config.getProtocolId());
@@ -635,10 +450,6 @@
// Clear data references
messageNotifiers.clear();
-
- programId = null;
- cruiseId = null;
- protocolId = null;
validationContext = null;
IOUtils.closeQuietly(dataContext);
@@ -663,136 +474,253 @@
setActionUI(null);
}
- protected void saveContextToConfig() {
- if (log.isInfoEnabled()) {
- log.info("Save config (programId: " + programId + ", cruiseId: " +
- cruiseId + ", protocolId: " + protocolId + ", locale: " +
- locale + ")");
+ //------------------------------------------------------------------------//
+ //-- Service methods --//
+ //------------------------------------------------------------------------//
+
+ public PersistenceService getPersistenceService() {
+
+ PersistenceService service;
+
+ if (useRealPersistenceService()) {
+ service = dataContext.getService();
+ if (service == null) {
+
+ // use real service
+ service = serviceContext.getService(PersistenceService.class);
+
+ dataContext.open(service);
+ }
+ } else {
+ service = serviceContext.getService(ClosedPersistenceService.class);
}
- config.setProgramId(programId);
- config.setCruiseId(cruiseId);
- config.setProtocolId(protocolId);
- config.setI18nLocale(locale);
- config.save();
+ return service;
}
- public void addMessageNotifier(UIMessageNotifier messageNotifier) {
- this.messageNotifiers.add(messageNotifier);
+ public DecoratorService getDecoratorService() {
+ return serviceContext.getService(DecoratorService.class);
}
- public void removeMessageNotifier(UIMessageNotifier messageNotifier) {
- this.messageNotifiers.remove(messageNotifier);
+ public TuttiReferentialSynchronizeService getTuttiReferentialSynchronizeService() {
+ return serviceContext.getService(TuttiReferentialSynchronizeService.class);
}
- @Override
- public void showInformationMessage(String message) {
- for (UIMessageNotifier messageNotifier : messageNotifiers) {
- messageNotifier.showInformationMessage(message);
+ public TuttiProtocolImportExportService getTuttiProtocolImportExportService() {
+ return serviceContext.getService(TuttiProtocolImportExportService.class);
+ }
+
+ public TuttiPupitriImportExportService getTuttiPupitriImportExportService() {
+ return serviceContext.getService(TuttiPupitriImportExportService.class);
+ }
+
+ public TuttiReferentialImportExportService getTuttiReferentialImportExportService() {
+ return serviceContext.getService(TuttiReferentialImportExportService.class);
+ }
+
+ public boolean useRealPersistenceService() {
+ return isDbExist() && isDbLoaded();
+ }
+
+ public PersistenceService reloadPersistenceService() {
+
+ try {
+ serviceContext.close();
+ } catch (IOException e) {
+ throw new TuttiTechnicalException("Could not close services", e);
}
+ dataContext.close();
+
+ return getPersistenceService();
}
- public RessourceClassLoader getResourceLoader() {
- return resourceLoader;
+ public void reloadDecoratorService() {
+ serviceContext.reloadService(DecoratorService.class);
}
- public void setMainUI(MainUI mainUI) {
- this.mainUI = mainUI;
+ //------------------------------------------------------------------------//
+ //-- DataContext methods --//
+ //------------------------------------------------------------------------//
+
+ public TuttiDataContext getDataContext() {
+ return dataContext;
}
- public MainUI getMainUI() {
- return mainUI;
+ public boolean isCruiseFilled() {
+ return dataContext.isCruiseFilled();
}
- public void setActionUI(TuttiActionUI actionUI) {
- this.actionUI = actionUI;
+ public String getProgramId() {
+ return dataContext.getProgramId();
}
- public TuttiActionUI getActionUI() {
- return actionUI;
+ public boolean isProtocolFilled() {
+ return dataContext.isProtocolFilled();
}
+ public String getProtocolId() {
+ return dataContext.getProtocolId();
+ }
+
+ public String getCruiseId() {
+ return dataContext.getCruiseId();
+ }
+
+ public boolean isProgramFilled() {
+ return dataContext.isProgramFilled();
+ }
+
+ public void setProgramId(String programId) {
+ dataContext.setProgramId(programId);
+ }
+
+ public void setCruiseId(String cruiseId) {
+ dataContext.setCruiseId(cruiseId);
+ }
+
+ public void setProtocolId(String protocolId) {
+ dataContext.setProtocolId(protocolId);
+ }
+
public void clearDbContext() {
- protocolId = null;
- programId = null;
- cruiseId = null;
+ dataContext.clearContext();
+
saveContextToConfig();
}
public void checkDbContext() {
- //check if programId is sane
- PersistenceService service = getPersistenceService();
+ // make sure persistence serivce is loaded
+ getPersistenceService();
- if (isProtocolFilled()) {
+ // ask data context to check his ids
+ dataContext.checkDbContext();
- if (!service.isProtocolExist(protocolId)) {
+ // save config
+ saveContextToConfig();
+ }
- // not found in this db
+ //------------------------------------------------------------------------//
+ //-- Db methods --//
+ //------------------------------------------------------------------------//
- if (log.isWarnEnabled()) {
- log.warn("Remove invalid protocolId: " + protocolId);
- }
+ public boolean isDbExist() {
+ return dbExist;
+ }
- setProtocolId(null);
- }
- }
+ public void setDbExist(boolean dbExist) {
+ this.dbExist = dbExist;
+ firePropertyChange(PROPERTY_DB_EXIST, null, dbExist);
+ }
- if (isProgramFilled()) {
+ public boolean isDbLoaded() {
+ return dbLoaded;
+ }
- Program program = service.getProgram(programId);
- if (program == null) {
+ public void setDbLoaded(boolean dbLoaded) {
+ this.dbLoaded = dbLoaded;
+ firePropertyChange(PROPERTY_DB_LOADED, null, dbLoaded);
+ }
- // not found in this db
+ //------------------------------------------------------------------------//
+ //-- Config methods --//
+ //------------------------------------------------------------------------//
- if (log.isWarnEnabled()) {
- log.warn("Remove invalid programId: " + programId);
- }
+ public TuttiApplicationConfig getConfig() {
+ return config;
+ }
- setProgramId(null);
- setCruiseId(null);
+ protected void saveContextToConfig() {
+ if (log.isInfoEnabled()) {
+ log.info("Save config (programId: " + getProgramId() + ", cruiseId: " +
+ getCruiseId() + ", protocolId: " + getProtocolId() + ", locale: " +
+ getLocale() + ")");
+ }
+ config.setProgramId(getProgramId());
+ config.setCruiseId(getCruiseId());
+ config.setProtocolId(getProtocolId());
+ config.setI18nLocale(getLocale());
+ config.save();
+ }
- } else {
+ //------------------------------------------------------------------------//
+ //-- UI methods --//
+ //------------------------------------------------------------------------//
- if (log.isInfoEnabled()) {
- log.info("ProgramId valid: " + programId);
- }
+ public MainUI getMainUI() {
+ return mainUI;
+ }
- setProgramId(programId);
+ public void setMainUI(MainUI mainUI) {
+ this.mainUI = mainUI;
+ }
- // test cruiseId
- if (isCruiseFilled()) {
+ public TuttiActionUI getActionUI() {
+ return actionUI;
+ }
- Cruise cruise = service.getCruise(cruiseId);
+ public void setActionUI(TuttiActionUI actionUI) {
+ this.actionUI = actionUI;
+ }
- if (cruise != null &&
- !cruise.getProgram().getId().equals(programId)) {
+ public SwingSession getSwingSession() {
+ return swingSession;
+ }
- // not matchin program, reset cruise id
- cruise = null;
- }
+ public TuttiScreen getScreen() {
+ return screen;
+ }
- if (cruise == null) {
+ public void setScreen(TuttiScreen screen) {
+ Object oldValue = getScreen();
+ this.screen = screen;
+ firePropertyChange(PROPERTY_SCREEN, oldValue, screen);
+ }
- // not found in this db
+ public boolean isBusy() {
+ return busy;
+ }
- if (log.isWarnEnabled()) {
- log.warn("Remove invalid cruiseId: " + cruiseId);
- }
- setCruiseId(null);
+ public void setBusy(boolean busy) {
+ this.busy = busy;
+ firePropertyChange(PROPERTY_BUSY, null, busy);
+ }
- } else {
+ public boolean isHideBody() {
+ return hideBody;
+ }
- if (log.isInfoEnabled()) {
- log.info("CruiseId valid: " + cruiseId);
- }
- }
- }
- }
+ public void setHideBody(boolean hideBody) {
+ this.hideBody = hideBody;
+ firePropertyChange(PROPERTY_HIDE_BODY, null, hideBody);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- UIMessageNotifier methods --//
+ //------------------------------------------------------------------------//
+
+ public void addMessageNotifier(UIMessageNotifier messageNotifier) {
+ this.messageNotifiers.add(messageNotifier);
+ }
+
+ public void removeMessageNotifier(UIMessageNotifier messageNotifier) {
+ this.messageNotifiers.remove(messageNotifier);
+ }
+
+ @Override
+ public void showInformationMessage(String message) {
+ for (UIMessageNotifier messageNotifier : messageNotifiers) {
+ messageNotifier.showInformationMessage(message);
}
+ }
- saveContextToConfig();
+ public RessourceClassLoader getResourceLoader() {
+ return resourceLoader;
}
+ //------------------------------------------------------------------------//
+ //-- Help methods --//
+ //------------------------------------------------------------------------//
+
public TuttiHelpBroker getHelpBroker() {
return helpBroker;
}
@@ -825,7 +753,33 @@
TuttiUIUtil.openLink(resolvedUri);
}
- public void reloadDecoratorService() {
- serviceContext.reloadService(DecoratorService.class);
+ //------------------------------------------------------------------------//
+ //-- Other methods --//
+ //------------------------------------------------------------------------//
+
+ public Locale getLocale() {
+ return locale;
}
+
+ public void setLocale(Locale locale) {
+ this.locale = locale;
+ firePropertyChange(PROPERTY_LOCALE, null, locale);
+ }
+
+ public void setValidationContext(String validationContext) {
+ Object oldValue = getValidationContext();
+ this.validationContext = validationContext;
+ firePropertyChange(PROPERTY_VALIDATION_CONTEXT, oldValue, validationContext);
+ }
+
+ public String getValidationContext() {
+ return validationContext;
+ }
+
+ @Override
+ public void firePropertyChanged(String propertyName,
+ Object oldValue,
+ Object newValue) {
+ firePropertyChange(propertyName, oldValue, newValue);
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/ImportTemporaryReferentialAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -28,7 +28,8 @@
import org.apache.commons.lang3.StringUtils;
import org.nuiton.util.StringUtil;
-import javax.swing.*;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
import static org.nuiton.i18n.I18n._;
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -84,6 +84,8 @@
@Override
public void beforeInitUI() {
+ getDataContext().resetValidationDataContext();
+
EditCruiseUIModel model = new EditCruiseUIModel();
if (context.isCruiseFilled()) {
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
@@ -50,304 +51,426 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class EditCruiseUIModel extends AbstractTuttiBeanUIModel<Cruise, EditCruiseUIModel> implements AttachmentModelAware {
+public class EditCruiseUIModel extends AbstractTuttiBeanUIModel<Cruise, EditCruiseUIModel> implements AttachmentModelAware, Cruise {
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_PROGRAM = "program";
+ public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName";
- public static final String PROPERTY_NAME = "name";
+ public static final String PROPERTY_VESSEL_TYPE = "vesselType";
- public static final String PROPERTY_COMMENT = "comment";
+ public static final String PROPERTY_VESSEL_TYPE_ALL = "vesselTypeAll";
- public static final String PROPERTY_DEPARTURE_LOCATION = "departureLocation";
+ public static final String PROPERTY_VESSEL_TYPE_SCIENTIFIC = "vesselTypeScientific";
- public static final String PROPERTY_LANDING_LOCATION = "returnLocation";
+ public static final String PROPERTY_VESSEL_TYPE_FISHING = "vesselTypeFishing";
- public static final String PROPERTY_SURVEY_PART = "surveyPart";
+ /**
+ * Delegate edit object.
+ *
+ * @since 1.3
+ */
+ protected final Cruise editObject = TuttiBeanFactory.newCruise();
- public static final String PROPERTY_VESSEL = "vessel";
+ protected VesselTypeEnum vesselType;
- public static final String PROPERTY_GEAR = "gear";
+ protected final List<Attachment> attachment = Lists.newArrayList();
- public static final String PROPERTY_HEAD_OF_MISSION = "headOfMission";
+ protected static Binder<EditCruiseUIModel, Cruise> toBeanBinder =
+ BinderFactory.newBinder(EditCruiseUIModel.class,
+ Cruise.class);
- public static final String PROPERTY_HEAD_OF_SORT_ROOM = "headOfSortRoom";
+ protected static Binder<Cruise, EditCruiseUIModel> fromBeanBinder =
+ BinderFactory.newBinder(Cruise.class, EditCruiseUIModel.class);
- public static final String PROPERTY_MULTIRIG_NUMBER = "multirigNumber";
+ public EditCruiseUIModel() {
+ super(Cruise.class, fromBeanBinder, toBeanBinder);
+ }
- public static final String PROPERTY_BEGIN_DATE = "beginDate";
+ @Override
+ protected Cruise newEntity() {
+ return TuttiBeanFactory.newCruise();
+ }
- public static final String PROPERTY_END_DATE = "endDate";
+ public VesselTypeEnum getVesselType() {
+ return vesselType;
+ }
- public static final String PROPERTY_CAN_GENERATE_NAME = "canGenerateName";
+ public void setVesselType(VesselTypeEnum vesselType) {
+ boolean oldAll = isVesselTypeAll();
+ boolean oldScientific = isVesselTypeScientific();
+ boolean oldFishing = isVesselTypeFishing();
+ Object oldValue = getVesselType();
+ this.vesselType = vesselType;
+ firePropertyChange(PROPERTY_VESSEL_TYPE, oldValue, vesselType);
+ firePropertyChange(PROPERTY_VESSEL_TYPE_ALL, oldAll, isVesselTypeAll());
+ firePropertyChange(PROPERTY_VESSEL_TYPE_SCIENTIFIC, oldScientific, isVesselTypeScientific());
+ firePropertyChange(PROPERTY_VESSEL_TYPE_FISHING, oldFishing, isVesselTypeFishing());
+ }
- public static final String PROPERTY_VESSEL_TYPE = "vesselType";
+ public boolean isVesselTypeAll() {
+ return VesselTypeEnum.ALL.equals(vesselType);
+ }
- public static final String PROPERTY_VESSEL_TYPE_ALL = "vesselTypeAll";
+ public boolean isVesselTypeScientific() {
+ return VesselTypeEnum.SCIENTIFIC.equals(vesselType);
+ }
- public static final String PROPERTY_VESSEL_TYPE_SCIENTIFIC = "vesselTypeScientific";
+ public boolean isVesselTypeFishing() {
+ return VesselTypeEnum.FISHING.equals(vesselType);
+ }
- public static final String PROPERTY_VESSEL_TYPE_FISHING = "vesselTypeFishing";
+ public boolean isCanGenerateName() {
+ return getProgram() != null && getBeginDate() != null;
+ }
- protected Program program;
+ public static final String CRUISE_NAME_FORMAT = "%1$s_%2$s";
- protected TuttiLocation departureLocation;
+ public String getGeneratedCampaignName() {
+ int year;
+ if (getBeginDate() == null) {
+ year = 0;
+ } else {
+ Calendar c = Calendar.getInstance();
+ c.setTime(getBeginDate());
+ year = c.get(Calendar.YEAR);
+ }
+ String result = String.format(CRUISE_NAME_FORMAT, getProgram().getName(), year);
+ if (StringUtils.isNotEmpty(getSurveyPart())) {
+ result += "_" + getSurveyPart();
+ }
+ return result;
+ }
- protected TuttiLocation returnLocation;
+ //------------------------------------------------------------------------//
+ //-- AttachmentModelAware methods --//
+ //------------------------------------------------------------------------//
- protected String name;
+ @Override
+ public AttachementObjectTypeEnum getObjectType() {
+ return AttachementObjectTypeEnum.SCIENTIFIC_CRUISE;
+ }
- protected String surveyPart;
+ @Override
+ public String getObjectId() {
+ return getId();
+ }
- protected Vessel vessel;
+ @Override
+ public List<Attachment> getAttachment() {
+ return attachment;
+ }
- protected List<Gear> gear;
+ @Override
+ public void addAllAttachment(Collection<Attachment> attachments) {
+ this.attachment.addAll(attachments);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ }
- protected List<Person> headOfMission;
+ @Override
+ public void addAttachment(Attachment attachment) {
+ this.attachment.add(attachment);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ }
- protected List<Person> headOfSortRoom;
+ @Override
+ public void removeAllAttachment(Collection<Attachment> attachments) {
+ this.attachment.removeAll(attachments);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ }
- protected String comment;
+ @Override
+ public void removeAttachment(Attachment attachment) {
+ this.attachment.remove(attachment);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ }
- protected Integer multirigNumber;
+ //------------------------------------------------------------------------//
+ //-- Cruise methods --//
+ //------------------------------------------------------------------------//
- protected Date beginDate;
-
- protected Date endDate;
-
- protected VesselTypeEnum vesselType;
-
- protected final List<Attachment> attachment = Lists.newArrayList();
-
- protected static Binder<EditCruiseUIModel, Cruise> toBeanBinder =
- BinderFactory.newBinder(EditCruiseUIModel.class,
- Cruise.class);
-
- protected static Binder<Cruise, EditCruiseUIModel> fromBeanBinder =
- BinderFactory.newBinder(Cruise.class, EditCruiseUIModel.class);
-
- public EditCruiseUIModel() {
- super(Cruise.class, fromBeanBinder, toBeanBinder);
- }
-
+ @Override
public Program getProgram() {
- return program;
+ return editObject.getProgram();
}
+ @Override
public void setProgram(Program program) {
Object oldValue = getProgram();
- this.program = program;
+ editObject.setProgram(program);
firePropertyChange(PROPERTY_PROGRAM, oldValue, program);
firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
}
+ @Override
public String getName() {
- return name;
+ return editObject.getName();
}
+ @Override
public void setName(String name) {
Object oldValue = getName();
- this.name = name;
+ editObject.setName(name);
firePropertyChange(PROPERTY_NAME, oldValue, name);
}
+ @Override
public String getComment() {
- return comment;
+ return editObject.getComment();
}
+ @Override
public void setComment(String comment) {
Object oldValue = getComment();
- this.comment = comment;
+ editObject.setComment(comment);
firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
}
+ @Override
public TuttiLocation getDepartureLocation() {
- return departureLocation;
+ return editObject.getDepartureLocation();
}
+ @Override
public void setDepartureLocation(TuttiLocation departureLocation) {
Object oldValue = getDepartureLocation();
- this.departureLocation = departureLocation;
+ editObject.setDepartureLocation(departureLocation);
firePropertyChange(PROPERTY_DEPARTURE_LOCATION, oldValue, departureLocation);
}
+ @Override
public TuttiLocation getReturnLocation() {
- return returnLocation;
+ return editObject.getReturnLocation();
}
+ @Override
public void setReturnLocation(TuttiLocation returnLocation) {
Object oldValue = getReturnLocation();
- this.returnLocation = returnLocation;
- firePropertyChange(PROPERTY_LANDING_LOCATION, oldValue, returnLocation);
+ editObject.setReturnLocation(returnLocation);
+ firePropertyChange(PROPERTY_RETURN_LOCATION, oldValue, returnLocation);
}
+ @Override
public String getSurveyPart() {
- return surveyPart;
+ return editObject.getSurveyPart();
}
+ @Override
public void setSurveyPart(String surveyPart) {
Object oldValue = getSurveyPart();
- this.surveyPart = surveyPart;
+ editObject.setSurveyPart(surveyPart);
firePropertyChange(PROPERTY_SURVEY_PART, oldValue, surveyPart);
firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
}
+ @Override
public Integer getMultirigNumber() {
- return multirigNumber;
+ return editObject.getMultirigNumber();
}
+ @Override
public void setMultirigNumber(Integer multirigNumber) {
Object oldValue = getMultirigNumber();
- this.multirigNumber = multirigNumber;
+ editObject.setMultirigNumber(multirigNumber);
firePropertyChange(PROPERTY_MULTIRIG_NUMBER, oldValue, multirigNumber);
}
+ @Override
public Date getBeginDate() {
- return beginDate;
+ return editObject.getBeginDate();
}
+ @Override
public void setBeginDate(Date beginDate) {
Object oldValue = getBeginDate();
- this.beginDate = beginDate;
+ editObject.setBeginDate(beginDate);
firePropertyChange(PROPERTY_BEGIN_DATE, oldValue, beginDate);
firePropertyChange(PROPERTY_CAN_GENERATE_NAME, null, isCanGenerateName());
}
+ @Override
public Date getEndDate() {
- return endDate;
+ return editObject.getEndDate();
}
+ @Override
public void setEndDate(Date endDate) {
Object oldValue = getEndDate();
- this.endDate = endDate;
+ editObject.setEndDate(endDate);
firePropertyChange(PROPERTY_END_DATE, oldValue, endDate);
}
+ @Override
public Vessel getVessel() {
- return vessel;
+ return editObject.getVessel();
}
+ @Override
public void setVessel(Vessel vessel) {
Object oldValue = getVessel();
- this.vessel = vessel;
+ editObject.setVessel(vessel);
firePropertyChange(PROPERTY_VESSEL, oldValue, vessel);
}
+ @Override
public List<Gear> getGear() {
- return gear;
+ return editObject.getGear();
}
+ @Override
public void setGear(List<Gear> gear) {
- this.gear = gear;
+ editObject.setGear(gear);
firePropertyChange(PROPERTY_GEAR, null, gear);
}
+ @Override
public List<Person> getHeadOfMission() {
- return headOfMission;
+ return editObject.getHeadOfMission();
}
+ @Override
public void setHeadOfMission(List<Person> headOfMission) {
- this.headOfMission = headOfMission;
+ editObject.setHeadOfMission(headOfMission);
firePropertyChange(PROPERTY_HEAD_OF_MISSION, null, headOfMission);
}
+ @Override
public List<Person> getHeadOfSortRoom() {
- return headOfSortRoom;
+ return editObject.getHeadOfSortRoom();
}
+ @Override
public void setHeadOfSortRoom(List<Person> headOfSortRoom) {
- this.headOfSortRoom = headOfSortRoom;
+ editObject.setHeadOfSortRoom(headOfSortRoom);
firePropertyChange(PROPERTY_HEAD_OF_SORT_ROOM, null, headOfSortRoom);
}
- public VesselTypeEnum getVesselType() {
- return vesselType;
+ @Override
+ public Gear getGear(int index) {
+ return null;
}
- public void setVesselType(VesselTypeEnum vesselType) {
- boolean oldAll = isVesselTypeAll();
- boolean oldScientific = isVesselTypeScientific();
- boolean oldFishing = isVesselTypeFishing();
- Object oldValue = getVesselType();
- this.vesselType = vesselType;
- firePropertyChange(PROPERTY_VESSEL_TYPE, oldValue, vesselType);
- firePropertyChange(PROPERTY_VESSEL_TYPE_ALL, oldAll, isVesselTypeAll());
- firePropertyChange(PROPERTY_VESSEL_TYPE_SCIENTIFIC, oldScientific, isVesselTypeScientific());
- firePropertyChange(PROPERTY_VESSEL_TYPE_FISHING, oldFishing, isVesselTypeFishing());
+ @Override
+ public boolean isGearEmpty() {
+ return false;
+ }
+ @Override
+ public int sizeGear() {
+ return 0;
}
- public boolean isVesselTypeAll() {
- return VesselTypeEnum.ALL.equals(vesselType);
+ @Override
+ public void addGear(Gear gear) {
}
- public boolean isVesselTypeScientific() {
- return VesselTypeEnum.SCIENTIFIC.equals(vesselType);
+ @Override
+ public void addAllGear(Collection<Gear> gear) {
}
- public boolean isVesselTypeFishing() {
- return VesselTypeEnum.FISHING.equals(vesselType);
+ @Override
+ public boolean removeGear(Gear gear) {
+ return false;
}
- public boolean isCanGenerateName() {
- return program != null && beginDate != null;
+ @Override
+ public boolean removeAllGear(Collection<Gear> gear) {
+ return false;
}
- public static final String CRUISE_NAME_FORMAT = "%1$s_%2$s";
+ @Override
+ public boolean containsGear(Gear gear) {
+ return false;
+ }
- 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;
- }
- return result;
+ @Override
+ public boolean containsAllGear(Collection<Gear> gear) {
+ return false;
}
@Override
- public AttachementObjectTypeEnum getObjectType() {
- return AttachementObjectTypeEnum.SCIENTIFIC_CRUISE;
+ public Person getHeadOfMission(int index) {
+ return null;
}
@Override
- public String getObjectId() {
- return getId();
+ public boolean isHeadOfMissionEmpty() {
+ return false;
}
@Override
- public List<Attachment> getAttachment() {
- return attachment;
+ public int sizeHeadOfMission() {
+ return 0;
}
@Override
- public void addAllAttachment(Collection<Attachment> attachments) {
- this.attachment.addAll(attachments);
- firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ public void addHeadOfMission(Person headOfMission) {
}
@Override
- public void addAttachment(Attachment attachment) {
- this.attachment.add(attachment);
- firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ public void addAllHeadOfMission(Collection<Person> headOfMission) {
}
@Override
- public void removeAllAttachment(Collection<Attachment> attachments) {
- this.attachment.removeAll(attachments);
- firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ public boolean removeHeadOfMission(Person headOfMission) {
+ return false;
}
@Override
- public void removeAttachment(Attachment attachment) {
- this.attachment.remove(attachment);
- firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ public boolean removeAllHeadOfMission(Collection<Person> headOfMission) {
+ return false;
}
+
+ @Override
+ public boolean containsHeadOfMission(Person headOfMission) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAllHeadOfMission(Collection<Person> headOfMission) {
+ return false;
+ }
+
+ @Override
+ public Person getHeadOfSortRoom(int index) {
+ return null;
+ }
+
+ @Override
+ public boolean isHeadOfSortRoomEmpty() {
+ return false;
+ }
+
+ @Override
+ public int sizeHeadOfSortRoom() {
+ return 0;
+ }
+
+ @Override
+ public void addHeadOfSortRoom(Person headOfSortRoom) {
+ }
+
+ @Override
+ public void addAllHeadOfSortRoom(Collection<Person> headOfSortRoom) {
+ }
+
+ @Override
+ public boolean removeHeadOfSortRoom(Person headOfSortRoom) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAllHeadOfSortRoom(Collection<Person> headOfSortRoom) {
+ return false;
+ }
+
+ @Override
+ public boolean containsHeadOfSortRoom(Person headOfSortRoom) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAllHeadOfSortRoom(Collection<Person> headOfSortRoom) {
+ return false;
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol;
@@ -157,4 +158,8 @@
return protocol != null;
}
+ @Override
+ protected Cruise newEntity() {
+ return TuttiBeanFactory.newCruise();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/AbstractTuttiBatchUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -40,7 +40,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public class AbstractTuttiBatchUIModel<R extends AbstractTuttiBeanUIModel, B extends AbstractTuttiBatchUIModel<R, B>> extends AbstractTuttiTableUIModel<FishingOperation, R, B> {
+public abstract class AbstractTuttiBatchUIModel<R extends AbstractTuttiBeanUIModel, B extends AbstractTuttiBatchUIModel<R, B>> extends AbstractTuttiTableUIModel<FishingOperation, R, B> {
private static final long serialVersionUID = 1L;
@@ -76,4 +76,9 @@
public final FishingOperation getFishingOperation() {
return catchesUIModel == null ? null : catchesUIModel.getFishingOperation();
}
+
+ @Override
+ protected FishingOperation newEntity() {
+ return null;
+ }
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.InvalidBatchModelException;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
@@ -388,7 +389,8 @@
if (bean == null) {
- editFishingOperationUIModel.fromBean(new FishingOperation());
+ editFishingOperationUIModel.fromBean(
+ TuttiBeanFactory.newFishingOperation());
editFishingOperationUIModel.setFishingOperation(bean);
@@ -507,7 +509,7 @@
if (log.isInfoEnabled()) {
log.info("Create a new CatchBatch (fishing operation is null)");
}
- batch = new CatchBatch();
+ batch = TuttiBeanFactory.newCatchBatch();
batch.setFishingOperation(bean);
attachments = Collections.emptyList();
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUI.jaxx 2013-04-01 20:46:21 UTC (rev 715)
@@ -458,7 +458,8 @@
<row weighty='0.2'>
<cell columns='6'>
<JPanel layout='{new GridLayout(1,0)}'>
- <BeanDoubleList id='recorderPersonList' genericType='Person'/>
+ <BeanDoubleList id='recorderPersonList'
+ genericType='Person'/>
<Table fill="both" weightx='1' id='traitVesselPanel'>
<row>
<cell anchor='west'>
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -175,6 +175,10 @@
EditFishingOperationUIModel.PROPERTY_COMMENT);
}
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiUIHandler methods --//
+ //------------------------------------------------------------------------//
+
@Override
public void beforeInitUI() {
@@ -356,12 +360,43 @@
}
@Override
+ public SwingValidator<EditFishingOperationUIModel> getValidator() {
+ return ui.getValidator();
+ }
+
+ @Override
+ public void setDate(ActionEvent event, String property) {
+ JXDatePicker field = (JXDatePicker) event.getSource();
+ Date value = field.getDate();
+ Date date = (Date) TuttiUIUtil.getProperty(getModel(), property);
+ if (value != null && date != null) {
+ Calendar cal = DateUtils.toCalendar(date);
+ value = DateUtils.setHours(value, cal.get(Calendar.HOUR_OF_DAY));
+ value = DateUtils.setMinutes(value, cal.get(Calendar.MINUTE));
+ }
+ TuttiUIUtil.setProperty(getModel(), property, value);
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AbstractTuttiTabContainerUIHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
protected boolean onTabChanged(int currentIndex, int newIndex) {
ui.getFishingOperationAttachmentsButton().onCloseUI();
return super.onTabChanged(currentIndex, newIndex);
}
@Override
+ protected JTabbedPane getTabPanel() {
+ return ui.getFishingOperationTabPane();
+ }
+
+ //------------------------------------------------------------------------//
+ //-- TabHandler methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
public boolean onHideTab(int currentIndex, int newIndex) {
boolean result;
ui.getFishingOperationAttachmentsButton().onCloseUI();
@@ -384,7 +419,7 @@
}
int answer = askSaveBeforeLeaving(message);
- ActionEvent event = new ActionEvent(this, newIndex, null);
+// ActionEvent event = new ActionEvent(this, newIndex, null);
switch (answer) {
case JOptionPane.OK_OPTION:
TuttiActionHelper.runAction(ui.getSaveButton());
@@ -426,24 +461,14 @@
registerValidators(ui.getValidator());
}
+ //------------------------------------------------------------------------//
+ //-- Public methods --//
+ //------------------------------------------------------------------------//
+
public void registerValidator() {
registerValidators(ui.getValidator());
}
- @Override
- protected JTabbedPane getTabPanel() {
- return ui.getFishingOperationTabPane();
- }
-
- @Override
- public SwingValidator<EditFishingOperationUIModel> getValidator() {
- return ui.getValidator();
- }
-
- //------------------------------------------------------------------------//
- //-- Public methods --//
- //------------------------------------------------------------------------//
-
public AbstractCaracteristicTabUIModel[] getSubModels() {
return new AbstractCaracteristicTabUIModel[]{
ui.getGearUseFeatureTabContent().getModel(),
@@ -492,19 +517,6 @@
return result;
}
- @Override
- public void setDate(ActionEvent event, String property) {
- JXDatePicker field = (JXDatePicker) event.getSource();
- Date value = field.getDate();
- Date date = (Date) TuttiUIUtil.getProperty(getModel(), property);
- if (value != null && date != null) {
- Calendar cal = DateUtils.toCalendar(date);
- value = DateUtils.setHours(value, cal.get(Calendar.HOUR_OF_DAY));
- value = DateUtils.setMinutes(value, cal.get(Calendar.MINUTE));
- }
- TuttiUIUtil.setProperty(getModel(), property, value);
- }
-
public String getDuration(Date startDate, Date endDate) {
String duration = "";
if (startDate != null && endDate != null && !startDate.after(endDate)) {
@@ -516,6 +528,10 @@
return duration;
}
+ public String decorateVessel(Vessel vessel) {
+ return decorate(vessel);
+ }
+
//------------------------------------------------------------------------//
//-- Protected methods --//
//------------------------------------------------------------------------//
@@ -626,8 +642,4 @@
getModel().removeAllAttachment(getModel().getAttachment());
getModel().addAllAttachment(attachments);
}
-
- public String decorateVessel(Vessel vessel) {
- return decorate(vessel);
- }
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,6 +25,8 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
@@ -60,7 +62,7 @@
* @since 0.1
*/
public class EditFishingOperationUIModel extends AbstractTuttiBeanUIModel<FishingOperation, EditFishingOperationUIModel>
- implements AttachmentModelAware, TabContentModel {
+ implements AttachmentModelAware, TabContentModel, FishingOperation {
private static final long serialVersionUID = 1L;
@@ -68,16 +70,6 @@
public static final String PROPERTY_PERSISTED = "persisted";
- public static final String PROPERTY_STATION_NUMBER = "stationNumber";
-
- public static final String PROPERTY_FISHING_OPERATION_NUMBER = "fishingOperationNumber";
-
- public static final String PROPERTY_STRATA = "strata";
-
- public static final String PROPERTY_SUB_STRATA = "subStrata";
-
- public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = "gearShootingStartLatitude";
-
public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE_DEGREE = "gearShootingStartLatitudeDegree";
public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE_MINUTE = "gearShootingStartLatitudeMinute";
@@ -86,8 +78,6 @@
public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE_SECOND = "gearShootingStartLatitudeSecond";
- public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = "gearShootingStartLongitude";
-
public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DEGREE = "gearShootingStartLongitudeDegree";
public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE_MINUTE = "gearShootingStartLongitudeMinute";
@@ -96,10 +86,6 @@
public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE_SECOND = "gearShootingStartLongitudeSecond";
- public static final String PROPERTY_GEAR_SHOOTING_START_DATE = "gearShootingStartDate";
-
- public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = "gearShootingEndLatitude";
-
public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE_DEGREE = "gearShootingEndLatitudeDegree";
public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE_MINUTE = "gearShootingEndLatitudeMinute";
@@ -108,8 +94,6 @@
public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE_SECOND = "gearShootingEndLatitudeSecond";
- public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = "gearShootingEndLongitude";
-
public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE_DEGREE = "gearShootingEndLongitudeDegree";
public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE_MINUTE = "gearShootingEndLongitudeMinute";
@@ -118,42 +102,15 @@
public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE_SECOND = "gearShootingEndLongitudeSecond";
- public static final String PROPERTY_GEAR_SHOOTING_END_DATE = "gearShootingEndDate";
-
- public static final String PROPERTY_FISHING_OPERATION_RECTILIGNE = "fishingOperationRectiligne";
-
- public static final String PROPERTY_TRAWL_DISTANCE = "trawlDistance";
-
- public static final String PROPERTY_MULTIRIG_AGGREGATION = "multirigAggregation";
-
- public static final String PROPERTY_FISHING_OPERATION_VALID = "fishingOperationValid";
-
- public static final String PROPERTY_LOCATION = "location";
-
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_RECORDER_PERSON = "recorderPerson";
-
- public static final String PROPERTY_VESSEL = "vessel";
-
- public static final String PROPERTY_GEAR = "gear";
-
-// public static final String PROPERTY_ATTACHMENT = "attachment";
-
public static final String PROPERTY_VALIDATION_CONTEXT = "validationContext";
- protected Cruise cruise;
+ /**
+ * Delegate edit object.
+ *
+ * @since 1.3
+ */
+ protected final FishingOperation editObject = TuttiBeanFactory.newFishingOperation();
- protected String stationNumber;
-
- protected Integer fishingOperationNumber;
-
- protected TuttiLocation strata;
-
- protected TuttiLocation subStrata;
-
- protected TuttiLocation location;
-
protected SexagecimalPosition gearShootingStartLatitudeAsSexagecimal;
protected SexagecimalPosition gearShootingStartLongitudeAsSexagecimal;
@@ -162,44 +119,14 @@
protected SexagecimalPosition gearShootingEndLongitudeAsSexagecimal;
- protected Float gearShootingStartLatitude;
-
- protected Float gearShootingStartLongitude;
-
- protected Date gearShootingStartDate;
-
- protected Float gearShootingEndLatitude;
-
- protected Float gearShootingEndLongitude;
-
- protected Date gearShootingEndDate;
-
- protected boolean fishingOperationRectiligne;
-
- protected Float trawlDistance;
-
- protected Boolean fishingOperationValid;
-
- protected String comment;
-
- protected List<Person> recorderPerson = Lists.newArrayList();
-
protected final List<Attachment> attachment = Lists.newArrayList();
protected FishingOperation fishingOperation;
protected String validationContext;
- protected Gear gear;
-
- protected Vessel vessel;
-
- protected String multirigAggregation;
-
protected CoordinateEditorType coordinateEditorType;
- protected List<FishingOperation> existingOperations;
-
protected static Binder<EditFishingOperationUIModel, FishingOperation> toBeanBinder =
BinderFactory.newBinder(EditFishingOperationUIModel.class,
FishingOperation.class);
@@ -209,10 +136,10 @@
public EditFishingOperationUIModel() {
super(FishingOperation.class, fromBeanBinder, toBeanBinder);
- gearShootingStartLatitudeAsSexagecimal = SexagecimalPosition.valueOf(gearShootingStartLatitude);
- gearShootingStartLongitudeAsSexagecimal = SexagecimalPosition.valueOf(gearShootingStartLongitude);
- gearShootingEndLatitudeAsSexagecimal = SexagecimalPosition.valueOf(gearShootingEndLatitude);
- gearShootingEndLongitudeAsSexagecimal = SexagecimalPosition.valueOf(gearShootingEndLongitude);
+ gearShootingStartLatitudeAsSexagecimal = SexagecimalPosition.valueOf(getGearShootingStartLatitude());
+ gearShootingStartLongitudeAsSexagecimal = SexagecimalPosition.valueOf(getGearShootingStartLongitude());
+ gearShootingEndLatitudeAsSexagecimal = SexagecimalPosition.valueOf(getGearShootingEndLatitude());
+ gearShootingEndLongitudeAsSexagecimal = SexagecimalPosition.valueOf(getGearShootingEndLongitude());
}
@Override
@@ -225,26 +152,31 @@
return null;
}
+ @Override
public boolean isEmpty() {
- return StringUtils.isEmpty(stationNumber)
- && fishingOperationNumber == null
- && strata == null
- && subStrata == null
- && location == null
+ return StringUtils.isEmpty(getStationNumber())
+ && getFishingOperationNumber() == null
+ && getStrata() == null
+ && getSubStrata() == null
+ && getLocation() == null
&& gearShootingStartLatitudeAsSexagecimal.isNull()
&& gearShootingStartLongitudeAsSexagecimal.isNull()
- && gearShootingStartDate == null
+ && getGearShootingStartDate() == null
&& gearShootingEndLatitudeAsSexagecimal.isNull()
&& gearShootingEndLongitudeAsSexagecimal.isNull()
- && gearShootingEndDate == null
- && !fishingOperationRectiligne
- && trawlDistance == null
- && fishingOperationValid == null
- && CollectionUtils.isEmpty(recorderPerson)
- && gear == null
- && StringUtils.isEmpty(comment)
+ && getGearShootingEndDate() == null
+ && !isFishingOperationRectiligne()
+ && getTrawlDistance() == null
+ && getFishingOperationValid() == null
+ && CollectionUtils.isEmpty(getRecorderPerson())
+ && getGear() == null
+ && StringUtils.isEmpty(getComment())
&& CollectionUtils.isEmpty(getAttachment());
+ }
+ @Override
+ protected FishingOperation newEntity() {
+ return fishingOperation;
}
public FishingOperation getFishingOperation() {
@@ -260,103 +192,6 @@
return fishingOperation != null && !TuttiEntities.isNew(fishingOperation);
}
- public Cruise getCruise() {
- return cruise;
- }
-
- public void setCruise(Cruise cruise) {
- this.cruise = cruise;
- }
-
- @Override
- public AttachementObjectTypeEnum getObjectType() {
- return AttachementObjectTypeEnum.OPERATION;
- }
-
- @Override
- public String getObjectId() {
- return getId();
- }
-
- @Override
- public List<Attachment> getAttachment() {
- return attachment;
- }
-
- @Override
- public void addAllAttachment(Collection<Attachment> attachments) {
- this.attachment.addAll(attachments);
- firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
- }
-
- @Override
- public void addAttachment(Attachment attachment) {
- this.attachment.add(attachment);
- firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
- }
-
- @Override
- public void removeAllAttachment(Collection<Attachment> attachments) {
- this.attachment.removeAll(attachments);
- firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
- }
-
- @Override
- public void removeAttachment(Attachment attachment) {
- this.attachment.remove(attachment);
- firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
- }
-
- public String getStationNumber() {
- return stationNumber;
- }
-
- public void setStationNumber(String stationNumber) {
- Object oldValue = getStationNumber();
- this.stationNumber = stationNumber;
- firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
- }
-
- public Integer getFishingOperationNumber() {
- return fishingOperationNumber;
- }
-
- public void setFishingOperationNumber(Integer fishingOperationNumber) {
- Object oldValue = getFishingOperationNumber();
- this.fishingOperationNumber = fishingOperationNumber;
- firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
- }
-
- public TuttiLocation getStrata() {
- return strata;
- }
-
- public void setStrata(TuttiLocation strata) {
- Object oldValue = getStrata();
- this.strata = strata;
- firePropertyChange(PROPERTY_STRATA, oldValue, strata);
- }
-
- public TuttiLocation getSubStrata() {
- return subStrata;
- }
-
- public void setSubStrata(TuttiLocation subStrata) {
- Object oldValue = getSubStrata();
- this.subStrata = subStrata;
- firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
- }
-
- public Float getGearShootingStartLatitude() {
- return gearShootingStartLatitude;
- }
-
- public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
- Object oldValue = getGearShootingStartLatitude();
- this.gearShootingStartLatitude = gearShootingStartLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
- }
-
public Integer getGearShootingStartLatitudeDegree() {
Integer result = gearShootingStartLatitudeAsSexagecimal.getDegre();
if (gearShootingStartLatitudeAsSexagecimal.isSign()) {
@@ -415,17 +250,6 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE_SECOND, oldValue, second);
}
- public Float getGearShootingStartLongitude() {
- return gearShootingStartLongitude;
- }
-
- public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
- Object oldValue = getGearShootingStartLongitude();
- this.gearShootingStartLongitude = gearShootingStartLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
- }
-
-
public Integer getGearShootingStartLongitudeDegree() {
Integer result = gearShootingStartLongitudeAsSexagecimal.getDegre();
if (gearShootingStartLongitudeAsSexagecimal.isSign()) {
@@ -469,7 +293,7 @@
public void setGearShootingStartLongitudeDecimalMinute(Float decimalMinute) {
gearShootingStartLongitudeAsSexagecimal.setMinuteDecimale(decimalMinute);
- // 2013-01-22 kmorin: pass null as previous value,
+ // 2013-01-22 kmorin: pass null as previous value,
// otherwise the filed is not filled with the value (I cannot explain why... :()
firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE_DECIMAL_MINUTE, null, decimalMinute);
}
@@ -484,23 +308,6 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE_SECOND, oldValue, second);
}
- public Date getGearShootingStartDate() {
- return gearShootingStartDate;
- }
-
- public void setGearShootingStartDate(Date gearShootingStartDate) {
- Object oldValue = getGearShootingStartDate();
- if (gearShootingStartDate != null) {
- Calendar calendar = DateUtil.getDefaultCalendar(gearShootingStartDate);
- calendar.set(Calendar.SECOND, 0);
- this.gearShootingStartDate = calendar.getTime();
-
- } else {
- this.gearShootingStartDate = null;
- }
- firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, this.gearShootingStartDate);
- }
-
public void setGearShootingStartTime(Date gearShootingStartDate) {
Object oldValue = getGearShootingStartDate();
if (oldValue != null) {
@@ -508,16 +315,6 @@
}
}
- public Float getGearShootingEndLatitude() {
- return gearShootingEndLatitude;
- }
-
- public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
- Object oldValue = getGearShootingEndLatitude();
- this.gearShootingEndLatitude = gearShootingEndLatitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
- }
-
public Integer getGearShootingEndLatitudeDegree() {
Integer result = gearShootingEndLatitudeAsSexagecimal.getDegre();
if (gearShootingEndLatitudeAsSexagecimal.isSign()) {
@@ -561,7 +358,7 @@
public void setGearShootingEndLatitudeDecimalMinute(Float decimalMinute) {
gearShootingEndLatitudeAsSexagecimal.setMinuteDecimale(decimalMinute);
- // 2013-01-22 kmorin: pass null as previous value,
+ // 2013-01-22 kmorin: pass null as previous value,
// otherwise the filed is not filled with the value (I cannot explain why... :()
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE_DECIMAL_MINUTE, null, decimalMinute);
}
@@ -576,16 +373,6 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE_SECOND, oldValue, second);
}
- public Float getGearShootingEndLongitude() {
- return gearShootingEndLongitude;
- }
-
- public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
- Object oldValue = getGearShootingEndLongitude();
- this.gearShootingEndLongitude = gearShootingEndLongitude;
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
- }
-
public Integer getGearShootingEndLongitudeDegree() {
Integer result = gearShootingEndLongitudeAsSexagecimal.getDegre();
if (gearShootingEndLongitudeAsSexagecimal.isSign()) {
@@ -644,234 +431,503 @@
firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE_SECOND, oldValue, second);
}
+// public void setGearShootingEndTime(Date gearShootingEndDate) {
+// Object oldValue = getGearShootingEndDate();
+// if (oldValue != null) {
+// setGearShootingEndDate(gearShootingEndDate);
+// }
+// }
+
+ public String getValidationContext() {
+ return validationContext;
+ }
+
+ public void setValidationContext(String validationContext) {
+ Object oldValue = getValidationContext();
+ this.validationContext = validationContext;
+ firePropertyChange(PROPERTY_VALIDATION_CONTEXT, oldValue, validationContext);
+ }
+
+ public CoordinateEditorType getCoordinateEditorType() {
+ return coordinateEditorType;
+ }
+
+ public void setCoordinateEditorType(CoordinateEditorType coordinateEditorType) {
+ this.coordinateEditorType = coordinateEditorType;
+ }
+
+ public boolean isDateInCruise(Date date) {
+ return DateUtil.between(date, getCruise().getBeginDate(), getCruise().getEndDate());
+ }
+
+ public boolean isValidDuration() {
+ int minutes = DateUtil.getDifferenceInMinutes(getGearShootingStartDate(), getGearShootingEndDate());
+ return minutes <= 45 && minutes >= 20;
+ }
+
+// public List<FishingOperation> getExistingOperations() {
+// return existingOperations;
+// }
+
+// public void setExistingOperations(List<FishingOperation> existingOperations) {
+// this.existingOperations = existingOperations;
+// }
+
+ public void convertGearShootingCoordinatesDDToDMS() {
+ SexagecimalPosition position;
+ Integer degree;
+
+ position = SexagecimalPosition.valueOf(getGearShootingStartLatitude());
+ degree = position.getDegre();
+ if (degree != null) {
+ degree *= position.isSign() ? -1 : 1;
+ }
+ setGearShootingStartLatitudeDegree(degree);
+ setGearShootingStartLatitudeMinute(position.getMinute());
+ setGearShootingStartLatitudeSecond(position.getSeconde());
+ setGearShootingStartLatitudeDecimalMinute(position.getMinuteDecimale());
+
+ position = SexagecimalPosition.valueOf(getGearShootingStartLongitude());
+ degree = position.getDegre();
+ if (degree != null) {
+ degree *= position.isSign() ? -1 : 1;
+ }
+ setGearShootingStartLongitudeDegree(degree);
+ setGearShootingStartLongitudeMinute(position.getMinute());
+ setGearShootingStartLongitudeSecond(position.getSeconde());
+ setGearShootingStartLongitudeDecimalMinute(position.getMinuteDecimale());
+
+ position = SexagecimalPosition.valueOf(getGearShootingEndLatitude());
+ degree = position.getDegre();
+ if (degree != null) {
+ degree *= position.isSign() ? -1 : 1;
+ }
+ if (position.getDegre() != null) {
+
+ }
+ setGearShootingEndLatitudeDegree(degree);
+ setGearShootingEndLatitudeMinute(position.getMinute());
+ setGearShootingEndLatitudeSecond(position.getSeconde());
+ setGearShootingEndLatitudeDecimalMinute(position.getMinuteDecimale());
+
+ position = SexagecimalPosition.valueOf(getGearShootingEndLongitude());
+ degree = position.getDegre();
+ if (degree != null) {
+ degree *= position.isSign() ? -1 : 1;
+ }
+ setGearShootingEndLongitudeDegree(degree);
+ setGearShootingEndLongitudeMinute(position.getMinute());
+ setGearShootingEndLongitudeSecond(position.getSeconde());
+ setGearShootingEndLongitudeDecimalMinute(position.getMinuteDecimale());
+ }
+
+ public void convertGearShootingCoordinatesDMSToDD() {
+ Float decimalValue = gearShootingStartLatitudeAsSexagecimal.toDecimal();
+ editObject.setGearShootingStartLatitude(decimalValue);
+
+ decimalValue = gearShootingStartLongitudeAsSexagecimal.toDecimal();
+ editObject.setGearShootingStartLongitude(decimalValue);
+
+ decimalValue = gearShootingEndLatitudeAsSexagecimal.toDecimal();
+ editObject.setGearShootingEndLatitude(decimalValue);
+
+ decimalValue = gearShootingEndLongitudeAsSexagecimal.toDecimal();
+ editObject.setGearShootingEndLongitude(decimalValue);
+ }
+
+ public void computeDistance() {
+ if (coordinateEditorType != CoordinateEditorType.DD) {
+ convertGearShootingCoordinatesDMSToDD();
+ }
+ if (getGearShootingStartLatitude() != null && getGearShootingStartLongitude() != null
+ && getGearShootingEndLatitude() != null && getGearShootingEndLongitude() != null) {
+ Integer distance = TuttiUIUtil.computeDistanceInMeters(
+ getGearShootingStartLatitude(),
+ getGearShootingStartLongitude(),
+ getGearShootingEndLatitude(),
+ getGearShootingEndLongitude());
+ setTrawlDistance(distance.floatValue());
+ }
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AttachmentModelAware methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public AttachementObjectTypeEnum getObjectType() {
+ return AttachementObjectTypeEnum.OPERATION;
+ }
+
+ @Override
+ public String getObjectId() {
+ return getId();
+ }
+
+ @Override
+ public List<Attachment> getAttachment() {
+ return attachment;
+ }
+
+ @Override
+ public void addAllAttachment(Collection<Attachment> attachments) {
+ this.attachment.addAll(attachments);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ }
+
+ @Override
+ public void addAttachment(Attachment attachment) {
+ this.attachment.add(attachment);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ }
+
+ @Override
+ public void removeAllAttachment(Collection<Attachment> attachments) {
+ this.attachment.removeAll(attachments);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ }
+
+ @Override
+ public void removeAttachment(Attachment attachment) {
+ this.attachment.remove(attachment);
+ firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
+ }
+
+ //------------------------------------------------------------------------//
+ //-- FishingOperation methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public Cruise getCruise() {
+ return editObject.getCruise();
+ }
+
+ @Override
+ public void setCruise(Cruise cruise) {
+ editObject.setCruise(cruise);
+ }
+
+ @Override
+ public String getStationNumber() {
+ return editObject.getStationNumber();
+ }
+
+ @Override
+ public void setStationNumber(String stationNumber) {
+ Object oldValue = getStationNumber();
+ editObject.setStationNumber(stationNumber);
+ firePropertyChange(PROPERTY_STATION_NUMBER, oldValue, stationNumber);
+ }
+
+ @Override
+ public Integer getFishingOperationNumber() {
+ return editObject.getFishingOperationNumber();
+ }
+
+ @Override
+ public void setFishingOperationNumber(Integer fishingOperationNumber) {
+ Object oldValue = getFishingOperationNumber();
+ editObject.setFishingOperationNumber(fishingOperationNumber);
+ firePropertyChange(PROPERTY_FISHING_OPERATION_NUMBER, oldValue, fishingOperationNumber);
+ }
+
+ @Override
+ public TuttiLocation getStrata() {
+ return editObject.getStrata();
+ }
+
+ @Override
+ public void setStrata(TuttiLocation strata) {
+ Object oldValue = getStrata();
+ editObject.setStrata(strata);
+ firePropertyChange(PROPERTY_STRATA, oldValue, strata);
+ }
+
+ @Override
+ public TuttiLocation getSubStrata() {
+ return editObject.getSubStrata();
+ }
+
+ @Override
+ public void setSubStrata(TuttiLocation subStrata) {
+ Object oldValue = getSubStrata();
+ editObject.setSubStrata(subStrata);
+ firePropertyChange(PROPERTY_SUB_STRATA, oldValue, subStrata);
+ }
+
+ @Override
+ public Float getGearShootingStartLatitude() {
+ return editObject.getGearShootingStartLatitude();
+ }
+
+ @Override
+ public void setGearShootingStartLatitude(Float gearShootingStartLatitude) {
+ Object oldValue = getGearShootingStartLatitude();
+ editObject.setGearShootingStartLatitude(gearShootingStartLatitude);
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LATITUDE, oldValue, gearShootingStartLatitude);
+ }
+
+ @Override
+ public Float getGearShootingStartLongitude() {
+ return editObject.getGearShootingStartLongitude();
+ }
+
+ @Override
+ public void setGearShootingStartLongitude(Float gearShootingStartLongitude) {
+ Object oldValue = getGearShootingStartLongitude();
+ editObject.setGearShootingStartLongitude(gearShootingStartLongitude);
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_LONGITUDE, oldValue, gearShootingStartLongitude);
+ }
+
+ @Override
+ public Date getGearShootingStartDate() {
+ return editObject.getGearShootingStartDate();
+ }
+
+ @Override
+ public void setGearShootingStartDate(Date gearShootingStartDate) {
+ Object oldValue = getGearShootingStartDate();
+ if (gearShootingStartDate != null) {
+ Calendar calendar = DateUtil.getDefaultCalendar(gearShootingStartDate);
+ calendar.set(Calendar.SECOND, 0);
+ editObject.setGearShootingStartDate(calendar.getTime());
+
+ } else {
+ editObject.setGearShootingStartDate(null);
+ }
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_START_DATE, oldValue, getGearShootingStartDate());
+ }
+
+ @Override
+ public Float getGearShootingEndLatitude() {
+ return editObject.getGearShootingEndLatitude();
+ }
+
+ @Override
+ public void setGearShootingEndLatitude(Float gearShootingEndLatitude) {
+ Object oldValue = getGearShootingEndLatitude();
+ editObject.setGearShootingEndLatitude(gearShootingEndLatitude);
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LATITUDE, oldValue, gearShootingEndLatitude);
+ }
+
+ @Override
+ public Float getGearShootingEndLongitude() {
+ return editObject.getGearShootingEndLongitude();
+ }
+
+ @Override
+ public void setGearShootingEndLongitude(Float gearShootingEndLongitude) {
+ Object oldValue = getGearShootingEndLongitude();
+ editObject.setGearShootingEndLongitude(gearShootingEndLongitude);
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_LONGITUDE, oldValue, gearShootingEndLongitude);
+ }
+
+ @Override
public Date getGearShootingEndDate() {
- return gearShootingEndDate;
+ return editObject.getGearShootingEndDate();
}
+ @Override
public void setGearShootingEndDate(Date gearShootingEndDate) {
Object oldValue = getGearShootingEndDate();
if (gearShootingEndDate != null) {
Calendar calendar = DateUtil.getDefaultCalendar(gearShootingEndDate);
calendar.set(Calendar.SECOND, 0);
- this.gearShootingEndDate = calendar.getTime();
+ editObject.setGearShootingEndDate(calendar.getTime());
} else {
- this.gearShootingEndDate = null;
+ editObject.setGearShootingEndDate(null);
}
- firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, this.gearShootingEndDate);
+ firePropertyChange(PROPERTY_GEAR_SHOOTING_END_DATE, oldValue, getGearShootingEndDate());
}
- public void setGearShootingEndTime(Date gearShootingEndDate) {
- Object oldValue = getGearShootingEndDate();
- if (oldValue != null) {
- setGearShootingEndDate(gearShootingEndDate);
- }
- }
-
+ @Override
public boolean isFishingOperationRectiligne() {
- return fishingOperationRectiligne;
+ return editObject.isFishingOperationRectiligne();
}
+ @Override
public void setFishingOperationRectiligne(boolean fishingOperationRectiligne) {
Object oldValue = isFishingOperationRectiligne();
- this.fishingOperationRectiligne = fishingOperationRectiligne;
+ editObject.setFishingOperationRectiligne(fishingOperationRectiligne);
firePropertyChange(PROPERTY_FISHING_OPERATION_RECTILIGNE, oldValue, fishingOperationRectiligne);
}
+ @Override
public Float getTrawlDistance() {
- return trawlDistance;
+ return editObject.getTrawlDistance();
}
+ @Override
public void setTrawlDistance(Float trawlDistance) {
Object oldValue = getTrawlDistance();
- this.trawlDistance = trawlDistance;
+ editObject.setTrawlDistance(trawlDistance);
firePropertyChange(PROPERTY_TRAWL_DISTANCE, oldValue, trawlDistance);
}
+ @Override
public Boolean getFishingOperationValid() {
- return fishingOperationValid;
+ return editObject.getFishingOperationValid();
}
+ @Override
public void setFishingOperationValid(Boolean fishingOperationValid) {
Object oldValue = getFishingOperationValid();
- this.fishingOperationValid = fishingOperationValid;
+ editObject.setFishingOperationValid(fishingOperationValid);
firePropertyChange(PROPERTY_FISHING_OPERATION_VALID, oldValue, fishingOperationValid);
}
+ @Override
public TuttiLocation getLocation() {
- return location;
+ return editObject.getLocation();
}
+ @Override
public void setLocation(TuttiLocation location) {
Object oldValue = getLocation();
- this.location = location;
+ editObject.setLocation(location);
firePropertyChange(PROPERTY_LOCATION, oldValue, location);
}
+ @Override
public String getComment() {
- return comment;
+ return editObject.getComment();
}
+ @Override
public void setComment(String comment) {
Object oldValue = getComment();
- this.comment = comment;
+ editObject.setComment(comment);
firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
}
+ @Override
public List<Person> getRecorderPerson() {
- return recorderPerson;
+ return editObject.getRecorderPerson();
}
+ @Override
public void setRecorderPerson(List<Person> recorderPerson) {
Object oldValue = Lists.newArrayList(getRecorderPerson());
- this.recorderPerson = Lists.newArrayList();
+ editObject.setRecorderPerson(Lists.<Person>newArrayList());
if (recorderPerson != null) {
- this.recorderPerson.addAll(recorderPerson);
+ getRecorderPerson().addAll(recorderPerson);
}
firePropertyChange(PROPERTY_RECORDER_PERSON, oldValue, recorderPerson);
}
- public String getValidationContext() {
- return validationContext;
- }
-
- public void setValidationContext(String validationContext) {
- Object oldValue = getValidationContext();
- this.validationContext = validationContext;
- firePropertyChange(PROPERTY_VALIDATION_CONTEXT, oldValue, validationContext);
- }
-
+ @Override
public Gear getGear() {
- return gear;
+ return editObject.getGear();
}
+ @Override
public void setGear(Gear gear) {
Object oldValue = getGear();
- this.gear = gear;
+ editObject.setGear(gear);
firePropertyChange(PROPERTY_GEAR, oldValue, gear);
}
+ @Override
public Vessel getVessel() {
- return vessel;
+ return editObject.getVessel();
}
+ @Override
public void setVessel(Vessel vessel) {
Object oldValue = getVessel();
- this.vessel = vessel;
+ editObject.setVessel(vessel);
firePropertyChange(PROPERTY_VESSEL, oldValue, vessel);
}
+ @Override
public String getMultirigAggregation() {
- return multirigAggregation;
+ return editObject.getMultirigAggregation();
}
+ @Override
public void setMultirigAggregation(String multirigAggregation) {
Object oldValue = getMultirigAggregation();
- this.multirigAggregation = multirigAggregation;
+ editObject.setMultirigAggregation(multirigAggregation);
firePropertyChange(PROPERTY_MULTIRIG_AGGREGATION, oldValue, multirigAggregation);
}
- public CoordinateEditorType getCoordinateEditorType() {
- return coordinateEditorType;
+ @Override
+ public boolean isPlanktonObserved() {
+ return false;
}
- public void setCoordinateEditorType(CoordinateEditorType coordinateEditorType) {
- this.coordinateEditorType = coordinateEditorType;
+ @Override
+ public void setPlanktonObserved(boolean planktonObserved) {
}
@Override
- protected FishingOperation newEntity() {
- return fishingOperation;
+ public CaracteristicMap getVesselUseFeatures() {
+ return null;
}
- public boolean isDateInCruise(Date date) {
- return DateUtil.between(date, cruise.getBeginDate(), cruise.getEndDate());
+ @Override
+ public void setVesselUseFeatures(CaracteristicMap vesselUseFeatures) {
}
- public boolean isValidDuration() {
- int minutes = DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate);
- return minutes <= 45 && minutes >= 20;
+ @Override
+ public CaracteristicMap getGearUseFeatures() {
+ return null;
}
- public List<FishingOperation> getExistingOperations() {
- return existingOperations;
+ @Override
+ public void setGearUseFeatures(CaracteristicMap gearUseFeatures) {
}
- public void setExistingOperations(List<FishingOperation> existingOperations) {
- this.existingOperations = existingOperations;
+ @Override
+ public boolean isAccidentalObserved() {
+ return false;
}
- public void convertGearShootingCoordinatesDDToDMS() {
- SexagecimalPosition position;
- Integer degree;
+ @Override
+ public void setAccidentalObserved(boolean accidentalObserved) {
+ }
- position = SexagecimalPosition.valueOf(gearShootingStartLatitude);
- degree = position.getDegre();
- if (degree != null) {
- degree *= position.isSign() ? -1 : 1;
- }
- setGearShootingStartLatitudeDegree(degree);
- setGearShootingStartLatitudeMinute(position.getMinute());
- setGearShootingStartLatitudeSecond(position.getSeconde());
- setGearShootingStartLatitudeDecimalMinute(position.getMinuteDecimale());
+ @Override
+ public Person getRecorderPerson(int index) {
+ return null;
+ }
- position = SexagecimalPosition.valueOf(gearShootingStartLongitude);
- degree = position.getDegre();
- if (degree != null) {
- degree *= position.isSign() ? -1 : 1;
- }
- setGearShootingStartLongitudeDegree(degree);
- setGearShootingStartLongitudeMinute(position.getMinute());
- setGearShootingStartLongitudeSecond(position.getSeconde());
- setGearShootingStartLongitudeDecimalMinute(position.getMinuteDecimale());
+ @Override
+ public boolean isRecorderPersonEmpty() {
+ return false;
+ }
- position = SexagecimalPosition.valueOf(gearShootingEndLatitude);
- degree = position.getDegre();
- if (degree != null) {
- degree *= position.isSign() ? -1 : 1;
- }
- if (position.getDegre() != null) {
+ @Override
+ public int sizeRecorderPerson() {
+ return 0;
+ }
- }
- setGearShootingEndLatitudeDegree(degree);
- setGearShootingEndLatitudeMinute(position.getMinute());
- setGearShootingEndLatitudeSecond(position.getSeconde());
- setGearShootingEndLatitudeDecimalMinute(position.getMinuteDecimale());
+ @Override
+ public void addRecorderPerson(Person recorderPerson) {
+ }
- position = SexagecimalPosition.valueOf(gearShootingEndLongitude);
- degree = position.getDegre();
- if (degree != null) {
- degree *= position.isSign() ? -1 : 1;
- }
- setGearShootingEndLongitudeDegree(degree);
- setGearShootingEndLongitudeMinute(position.getMinute());
- setGearShootingEndLongitudeSecond(position.getSeconde());
- setGearShootingEndLongitudeDecimalMinute(position.getMinuteDecimale());
+ @Override
+ public void addAllRecorderPerson(Collection<Person> recorderPerson) {
}
- public void convertGearShootingCoordinatesDMSToDD() {
- Float decimalValue = gearShootingStartLatitudeAsSexagecimal.toDecimal();
- gearShootingStartLatitude = decimalValue;
+ @Override
+ public boolean removeRecorderPerson(Person recorderPerson) {
+ return false;
+ }
- decimalValue = gearShootingStartLongitudeAsSexagecimal.toDecimal();
- gearShootingStartLongitude = decimalValue;
+ @Override
+ public boolean removeAllRecorderPerson(Collection<Person> recorderPerson) {
+ return false;
+ }
- decimalValue = gearShootingEndLatitudeAsSexagecimal.toDecimal();
- gearShootingEndLatitude = decimalValue;
-
- decimalValue = gearShootingEndLongitudeAsSexagecimal.toDecimal();
- gearShootingEndLongitude = decimalValue;
+ @Override
+ public boolean containsRecorderPerson(Person recorderPerson) {
+ return false;
}
- public void computeDistance() {
- if (coordinateEditorType != CoordinateEditorType.DD) {
- convertGearShootingCoordinatesDMSToDD();
- }
- if (gearShootingStartLatitude != null && gearShootingStartLongitude != null
- && gearShootingEndLatitude != null && gearShootingEndLongitude != null) {
- Integer distance = TuttiUIUtil.computeDistanceInMeters(gearShootingStartLatitude, gearShootingStartLongitude, gearShootingEndLatitude, gearShootingEndLongitude);
- setTrawlDistance(distance.floatValue());
- }
+ @Override
+ public boolean containsAllRecorderPerson(Collection<Person> recorderPerson) {
+ return false;
}
-
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/NewFishingOperationAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/NewFishingOperationAction.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/NewFishingOperationAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Cruise;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Gear;
@@ -61,7 +62,8 @@
// creates a empty bean
- FishingOperation newFishingOperation = new FishingOperation();
+ FishingOperation newFishingOperation =
+ TuttiBeanFactory.newFishingOperation();
Cruise cruise = getDataContext().getCruise();
newFishingOperation.setCruise(cruise);
newFishingOperation.setVessel(cruise.getVessel());
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/SaveFishingOperationAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
*/
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.CatchBatch;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
@@ -149,7 +150,7 @@
savedFishingOperation = service.createFishingOperation(toSave);
// create then the CatchBatch
- CatchBatch catchBatch = new CatchBatch();
+ CatchBatch catchBatch = TuttiBeanFactory.newCatchBatch();
catchBatch.setFishingOperation(savedFishingOperation);
service.createCatchBatch(catchBatch);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-04-01 20:46:21 UTC (rev 715)
@@ -206,8 +206,8 @@
</cell>
<cell weightx='1.0'>
<TuttiComputedOrNotDataEditor
- id='speciesTotalSortedWeightField'
- constructorParams='this'/>
+ id='speciesTotalSortedWeightField'
+ constructorParams='this'/>
</cell>
</row>
@@ -252,8 +252,8 @@
</cell>
<cell weightx='1.0'>
<TuttiComputedOrNotDataEditor
- id='benthosTotalSortedWeightField'
- constructorParams='this'/>
+ id='benthosTotalSortedWeightField'
+ constructorParams='this'/>
</cell>
</row>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -50,70 +50,44 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public class EditCatchesUIModel extends AbstractTuttiBeanUIModel<CatchBatch, EditCatchesUIModel> implements AttachmentModelAware, TabContentModel {
+public class EditCatchesUIModel extends AbstractTuttiBeanUIModel<CatchBatch, EditCatchesUIModel> implements AttachmentModelAware, TabContentModel, CatchBatch {
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_CATCH_TOTAL_WEIGHT = "catchTotalWeight";
-
public static final String PROPERTY_CATCH_TOTAL_COMPUTED_WEIGHT = "catchTotalComputedWeight";
public static final String PROPERTY_CATCH_TOTAL_SORTED_COMPUTED_WEIGHT = "catchTotalSortedComputedWeight";
public static final String PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT = "catchTotalUnsortedComputedWeight";
- public static final String PROPERTY_CATCH_TOTAL_SORTED_TREMIS_WEIGHT = "catchTotalSortedTremisWeight";
-
public static final String PROPERTY_CATCH_TOTAL_SORTED_CAROUSSEL_WEIGHT = "catchTotalSortedCarousselWeight";
- public static final String PROPERTY_CATCH_TOTAL_REJECTED_WEIGHT = "catchTotalRejectedWeight";
-
public static final String PROPERTY_CATCH_TOTAL_REJECTED_COMPUTED_WEIGHT = "catchTotalRejectedComputedWeight";
public static final String PROPERTY_SPECIES_TOTAL_COMPUTED_WEIGHT = "speciesTotalComputedWeight";
- public static final String PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT = "speciesTotalSortedWeight";
-
public static final String PROPERTY_SPECIES_TOTAL_SORTED_COMPUTED_WEIGHT = "speciesTotalSortedComputedWeight";
public static final String PROPERTY_SPECIES_TOTAL_UNSORTED_COMPUTED_WEIGHT = "speciesTotalUnsortedComputedWeight";
public static final String PROPERTY_SPECIES_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT = "speciesTotalSampleSortedComputedWeight";
- public static final String PROPERTY_SPECIES_TOTAL_INERT_WEIGHT = "speciesTotalInertWeight";
-
public static final String PROPERTY_SPECIES_TOTAL_INERT_COMPUTED_WEIGHT = "speciesTotalInerComputedtWeight";
- public static final String PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT = "speciesTotalLivingNotItemizedWeight";
-
public static final String PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT = "speciesTotalLivingNotItemizedComputedWeight";
public static final String PROPERTY_BENTHOS_TOTAL_COMPUTED_WEIGHT = "benthosTotalComputedWeight";
- public static final String PROPERTY_BENTHOS_TOTAL_SORTED_WEIGHT = "benthosTotalSortedWeight";
-
public static final String PROPERTY_BENTHOS_TOTAL_SORTED_COMPUTED_WEIGHT = "benthosTotalSortedComputedWeight";
public static final String PROPERTY_BENTHOS_TOTAL_UNSORTED_COMPUTED_WEIGHT = "benthosTotalUnsortedComputedWeight";
public static final String PROPERTY_BENTHOS_TOTAL_SAMPLE_SORTED_COMPUTED_WEIGHT = "benthosTotalSampleSortedComputedWeight";
- public static final String PROPERTY_BENTHOS_TOTAL_INERT_WEIGHT = "benthosTotalInertWeight";
-
public static final String PROPERTY_BENTHOS_TOTAL_INERT_COMPUTED_WEIGHT = "benthosTotalInerComputedtWeight";
- public static final String PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT = "benthosTotalLivingNotItemizedWeight";
-
public static final String PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_COMPUTED_WEIGHT = "benthosTotalLivingNotItemizedComputedWeight";
- public static final String PROPERTY_PLANKTON_TOTAL_WEIGHT = "planktonTotalWeight";
-
- public static final String PROPERTY_PLANKTON_TOTAL_SAMPLE_WEIGHT = "planktonTotalSampleWeight";
-
- public static final String PROPERTY_MARINE_LITTER_TOTAL_WEIGHT = "marineLitterTotalWeight";
-
- public static final String PROPERTY_FISHING_OPERATION = "fishingOperation";
-
public static final String PROPERTY_CATCH_BATCH = "catchBatch";
protected static final Binder<CatchBatch, EditCatchesUIModel> fromBeanBinder = BinderFactory.newBinder(CatchBatch.class, EditCatchesUIModel.class);
@@ -205,6 +179,23 @@
return _("tutti.label.tab.catchesCaracteristics");
}
+ @Override
+ protected CatchBatch newEntity() {
+ return catchBatch;
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return getCatchTotalWeight() == null
+ && getCatchTotalRejectedWeight() == null
+ && CollectionUtils.isEmpty(getAttachment());
+ }
+
+ @Override
+ public String getIcon() {
+ return null;
+ }
+
public CatchBatch getCatchBatch() {
return catchBatch;
}
@@ -217,10 +208,12 @@
firePropertyChange(PROPERTY_OBJECT_ID, oldObjectId, getObjectId());
}
+ @Override
public FishingOperation getFishingOperation() {
return fishingOperation;
}
+ @Override
public void setFishingOperation(FishingOperation fishingOperation) {
Object oldValue = getFishingOperation();
this.fishingOperation = fishingOperation;
@@ -239,10 +232,12 @@
return catchTotalComputedOrNotWeight;
}
+ @Override
public Float getCatchTotalWeight() {
return catchTotalComputedOrNotWeight.getData();
}
+ @Override
public void setCatchTotalWeight(Float catchTotalWeight) {
Object oldValue = getCatchTotalWeight();
this.catchTotalComputedOrNotWeight.setData(catchTotalWeight);
@@ -279,20 +274,24 @@
firePropertyChange(PROPERTY_CATCH_TOTAL_UNSORTED_COMPUTED_WEIGHT, oldValue, catchTotalUnsortedComputedWeight);
}
+ @Override
public Float getCatchTotalSortedTremisWeight() {
return catchTotalSortedTremisWeight;
}
+ @Override
public void setCatchTotalSortedTremisWeight(Float catchTotalSortedTremisWeight) {
Object oldValue = getCatchTotalSortedTremisWeight();
this.catchTotalSortedTremisWeight = catchTotalSortedTremisWeight;
firePropertyChange(PROPERTY_CATCH_TOTAL_SORTED_TREMIS_WEIGHT, oldValue, catchTotalSortedTremisWeight);
}
+ @Override
public Float getCatchTotalSortedCarousselWeight() {
return catchTotalSortedCarousselWeight;
}
+ @Override
public void setCatchTotalSortedCarousselWeight(Float catchTotalSortedCarousselWeight) {
Object oldValue = getCatchTotalSortedCarousselWeight();
this.catchTotalSortedCarousselWeight = catchTotalSortedCarousselWeight;
@@ -303,10 +302,12 @@
return catchTotalRejectedComputedOrNotWeight;
}
+ @Override
public Float getCatchTotalRejectedWeight() {
return catchTotalRejectedComputedOrNotWeight.getData();
}
+ @Override
public void setCatchTotalRejectedWeight(Float catchTotalRejectedWeight) {
Object oldValue = getCatchTotalRejectedWeight();
this.catchTotalRejectedComputedOrNotWeight.setData(catchTotalRejectedWeight);
@@ -341,10 +342,12 @@
return speciesTotalSortedComputedOrNotWeight;
}
+ @Override
public Float getSpeciesTotalSortedWeight() {
return speciesTotalSortedComputedOrNotWeight.getData();
}
+ @Override
public void setSpeciesTotalSortedWeight(Float speciesTotalSortedWeight) {
Object oldValue = getSpeciesTotalSortedWeight();
this.speciesTotalSortedComputedOrNotWeight.setData(speciesTotalSortedWeight);
@@ -385,10 +388,12 @@
return speciesTotalInertComputedOrNotWeight;
}
+ @Override
public Float getSpeciesTotalInertWeight() {
return speciesTotalInertComputedOrNotWeight.getData();
}
+ @Override
public void setSpeciesTotalInertWeight(Float speciesTotalInertWeight) {
Object oldValue = getSpeciesTotalInertWeight();
this.speciesTotalInertComputedOrNotWeight.setData(speciesTotalInertWeight);
@@ -409,10 +414,12 @@
return speciesTotalLivingNotItemizedComputedOrNotWeight;
}
+ @Override
public Float getSpeciesTotalLivingNotItemizedWeight() {
return speciesTotalLivingNotItemizedComputedOrNotWeight.getData();
}
+ @Override
public void setSpeciesTotalLivingNotItemizedWeight(Float speciesTotalLivingNotItemizedWeight) {
Object oldValue = getSpeciesTotalLivingNotItemizedComputedWeight();
this.speciesTotalLivingNotItemizedComputedOrNotWeight.setData(speciesTotalLivingNotItemizedWeight);
@@ -447,10 +454,12 @@
return benthosTotalSortedComputedOrNotWeight;
}
+ @Override
public Float getBenthosTotalSortedWeight() {
return benthosTotalSortedComputedOrNotWeight.getData();
}
+ @Override
public void setBenthosTotalSortedWeight(Float benthosTotalSortedWeight) {
Object oldValue = getBenthosTotalSortedWeight();
this.benthosTotalSortedComputedOrNotWeight.setData(benthosTotalSortedWeight);
@@ -491,10 +500,12 @@
return benthosTotalInertComputedOrNotWeight;
}
+ @Override
public Float getBenthosTotalInertWeight() {
return benthosTotalInertComputedOrNotWeight.getData();
}
+ @Override
public void setBenthosTotalInertWeight(Float benthosTotalInertWeight) {
Object oldValue = getBenthosTotalInertWeight();
this.benthosTotalInertComputedOrNotWeight.setData(benthosTotalInertWeight);
@@ -515,10 +526,12 @@
return benthosTotalLivingNotItemizedComputedOrNotWeight;
}
+ @Override
public Float getBenthosTotalLivingNotItemizedWeight() {
return benthosTotalLivingNotItemizedComputedOrNotWeight.getData();
}
+ @Override
public void setBenthosTotalLivingNotItemizedWeight(Float benthosTotalLivingNotItemizedWeight) {
Object oldValue = getBenthosTotalLivingNotItemizedComputedWeight();
this.benthosTotalLivingNotItemizedComputedOrNotWeight.setData(benthosTotalLivingNotItemizedWeight);
@@ -539,21 +552,24 @@
//-- Plankton --//
//------------------------------------------------------------------------//
-
+ @Override
public Float getPlanktonTotalWeight() {
return planktonTotalWeight;
}
+ @Override
public void setPlanktonTotalWeight(Float planktonTotalWeight) {
Object oldValue = getPlanktonTotalWeight();
this.planktonTotalWeight = planktonTotalWeight;
firePropertyChange(PROPERTY_PLANKTON_TOTAL_WEIGHT, oldValue, planktonTotalWeight);
}
+ @Override
public Float getPlanktonTotalSampleWeight() {
return planktonTotalSampleWeight;
}
+ @Override
public void setPlanktonTotalSampleWeight(Float planktonTotalSampleWeight) {
Object oldValue = getPlanktonTotalSampleWeight();
this.planktonTotalSampleWeight = planktonTotalSampleWeight;
@@ -564,10 +580,12 @@
//-- Marine Litter --//
//------------------------------------------------------------------------//
+ @Override
public Float getMarineLitterTotalWeight() {
return marineLitterTotalWeight;
}
+ @Override
public void setMarineLitterTotalWeight(Float marineLitterTotalWeight) {
Object oldValue = getMarineLitterTotalWeight();
this.marineLitterTotalWeight = marineLitterTotalWeight;
@@ -637,22 +655,4 @@
removeAllAttachment(getAttachment());
getSpeciesUsed().clear();
}
-
- @Override
- protected CatchBatch newEntity() {
- return catchBatch;
- }
-
- @Override
- public boolean isEmpty() {
- return getCatchTotalWeight() == null
- && getCatchTotalRejectedWeight() == null
- && CollectionUtils.isEmpty(getAttachment());
- }
-
- @Override
- public String getIcon() {
- return null;
- }
-
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,13 +25,14 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
-import fr.ifremer.tutti.ui.swing.util.comment.CommentModelAware;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -44,7 +45,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class AccidentalBatchRowModel extends AbstractTuttiBeanUIModel<AccidentalBatch, AccidentalBatchRowModel> implements AttachmentModelAware, CommentModelAware {
+public class AccidentalBatchRowModel extends AbstractTuttiBeanUIModel<AccidentalBatch, AccidentalBatchRowModel> implements AccidentalBatch, AttachmentModelAware {
private static final long serialVersionUID = 1L;
@@ -107,6 +108,15 @@
firePropertyChange(PROPERTY_SPECIES, oldValue, species);
}
+ @Override
+ public FishingOperation getFishingOperation() {
+ return null;
+ }
+
+ @Override
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ }
+
public Float getWeight() {
return weight;
}
@@ -175,4 +185,9 @@
this.attachment.remove(attachment);
firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
}
+
+ @Override
+ protected AccidentalBatch newEntity() {
+ return TuttiBeanFactory.newAccidentalBatch();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
@@ -654,4 +655,8 @@
this.computedOrNotWeight = computedOrNotWeight;
}
+ @Override
+ protected SpeciesBatch newEntity() {
+ return TuttiBeanFactory.newSpeciesBatch();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/create/CreateBenthosBatchUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -156,4 +156,9 @@
boolean result = !speciesUsed.containsEntry(sortedUnsortedCategory, species);
return result;
}
+
+ @Override
+ protected CreateBenthosBatchUIModel newEntity() {
+ return new CreateBenthosBatchUIModel();
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
@@ -41,7 +42,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, BenthosFrequencyRowModel> implements Comparable<BenthosFrequencyRowModel> {
+public class BenthosFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, BenthosFrequencyRowModel> implements Comparable<BenthosFrequencyRowModel>, SpeciesBatchFrequency {
private static final long serialVersionUID = 1L;
@@ -104,7 +105,8 @@
public static List<SpeciesBatchFrequency> toBeans(List<BenthosFrequencyRowModel> frequency, SpeciesBatch batch) {
List<SpeciesBatchFrequency> result = Lists.newArrayList();
for (BenthosFrequencyRowModel b : frequency) {
- SpeciesBatchFrequency model = new SpeciesBatchFrequency();
+ SpeciesBatchFrequency model =
+ TuttiBeanFactory.newSpeciesBatchFrequency();
toBeanBinder.copy(b, model);
model.setBatch(batch);
result.add(model);
@@ -116,40 +118,48 @@
super(SpeciesBatchFrequency.class, fromBeanBinder, toBeanBinder);
}
+ @Override
public Float getLengthStep() {
return lengthStep;
}
+ @Override
public void setLengthStep(Float lengthStep) {
Object oldValue = getLengthStep();
this.lengthStep = lengthStep;
firePropertyChange(PROPERTY_LENGTH_STEP, oldValue, lengthStep);
}
+ @Override
public Integer getNumber() {
return number;
}
+ @Override
public void setNumber(Integer number) {
Object oldValue = getNumber();
this.number = number;
firePropertyChange(PROPERTY_NUMBER, oldValue, number);
}
+ @Override
public Float getWeight() {
return weight;
}
+ @Override
public void setWeight(Float weight) {
Object oldValue = getWeight();
this.weight = weight;
firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
}
+ @Override
public Caracteristic getLengthStepCaracteristic() {
return lengthStepCaracteristic;
}
+ @Override
public void setLengthStepCaracteristic(Caracteristic lengthStepCaracteristic) {
Object oldValue = getLengthStepCaracteristic();
this.lengthStepCaracteristic = lengthStepCaracteristic;
@@ -157,8 +167,22 @@
}
@Override
+ public SpeciesBatch getBatch() {
+ return null;
+ }
+
+ @Override
+ public void setBatch(SpeciesBatch batch) {
+ }
+
+ @Override
public int compareTo(BenthosFrequencyRowModel o) {
int result = ordering.compare(lengthStep, o.lengthStep);
return result;
}
+
+ @Override
+ protected SpeciesBatchFrequency newEntity() {
+ return TuttiBeanFactory.newSpeciesBatchFrequency();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -235,4 +235,9 @@
}
return result;
}
+
+ @Override
+ protected SpeciesBatchRowModel newEntity() {
+ return new SpeciesBatchRowModel();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -108,4 +108,8 @@
firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
}
+ @Override
+ protected SplitBenthosBatchRowModel newEntity() {
+ return new SplitBenthosBatchRowModel();
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/split/SplitBenthosBatchUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -134,4 +134,9 @@
this.sampleWeight = sampleWeight;
firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
}
+
+ @Override
+ protected BenthosBatchRowModel newEntity() {
+ return new BenthosBatchRowModel();
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,13 +25,14 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.MarineLitterBatch;
import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
-import fr.ifremer.tutti.ui.swing.util.comment.CommentModelAware;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -44,7 +45,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class MarineLitterBatchRowModel extends AbstractTuttiBeanUIModel<MarineLitterBatch, MarineLitterBatchRowModel> implements AttachmentModelAware, CommentModelAware {
+public class MarineLitterBatchRowModel extends AbstractTuttiBeanUIModel<MarineLitterBatch, MarineLitterBatchRowModel> implements AttachmentModelAware, MarineLitterBatch {
private static final long serialVersionUID = 1L;
@@ -135,6 +136,15 @@
firePropertyChange(PROPERTY_MARINE_LITTER_SIZE_CATEGORY, oldValue, marineLitterSizeCategory);
}
+ @Override
+ public FishingOperation getFishingOperation() {
+ return null;
+ }
+
+ @Override
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ }
+
public Float getWeight() {
return weight;
}
@@ -213,4 +223,9 @@
this.attachment.remove(attachment);
firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
}
+
+ @Override
+ protected MarineLitterBatch newEntity() {
+ return TuttiBeanFactory.newMarineLitterBatch();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx 2013-04-01 20:46:21 UTC (rev 715)
@@ -54,14 +54,15 @@
]]></script>
<MarineLitterBatchUIHandler id='handler'
- initializer='getContextValue(MarineLitterBatchUIHandler.class)'/>
+ initializer='getContextValue(MarineLitterBatchUIHandler.class)'/>
<MarineLitterBatchUIModel id='model'
- initializer='getContextValue(MarineLitterBatchUIModel.class)'/>
+ initializer='getContextValue(MarineLitterBatchUIModel.class)'/>
<BeanValidator id='validator' bean='model'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
- <field name='marineLitterTotalWeight' component='marineLitterTotalWeightField'/>
+ <field name='marineLitterTotalWeight'
+ component='marineLitterTotalWeightField'/>
</BeanValidator>
<TuttiHelpBroker id='broker'
@@ -75,7 +76,8 @@
<JLabel id='marineLitterTotalWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <NumberEditor id='marineLitterTotalWeightField' constructorParams='this'/>
+ <NumberEditor id='marineLitterTotalWeightField'
+ constructorParams='this'/>
</cell>
</row>
</Table>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,13 +25,14 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.PlanktonBatch;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
-import fr.ifremer.tutti.ui.swing.util.comment.CommentModelAware;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
@@ -44,7 +45,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class PlanktonBatchRowModel extends AbstractTuttiBeanUIModel<PlanktonBatch, PlanktonBatchRowModel> implements AttachmentModelAware, CommentModelAware {
+public class PlanktonBatchRowModel extends AbstractTuttiBeanUIModel<PlanktonBatch, PlanktonBatchRowModel> implements AttachmentModelAware, PlanktonBatch {
private static final long serialVersionUID = 1L;
@@ -135,6 +136,15 @@
firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
}
+ @Override
+ public FishingOperation getFishingOperation() {
+ return null;
+ }
+
+ @Override
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ }
+
public Float getWeight() {
return weight;
}
@@ -213,4 +223,9 @@
this.attachment.remove(attachment);
firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
}
+
+ @Override
+ protected PlanktonBatch newEntity() {
+ return TuttiBeanFactory.newPlanktonBatch();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,8 +25,10 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
+import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
@@ -37,11 +39,11 @@
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiComputedOrNotData;
import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
-import fr.ifremer.tutti.ui.swing.util.comment.CommentModelAware;
import org.apache.commons.collections.CollectionUtils;
import org.nuiton.util.beans.Binder;
import org.nuiton.util.beans.BinderFactory;
+import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -52,7 +54,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> implements AttachmentModelAware, CommentModelAware {
+public class SpeciesBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, SpeciesBatchRowModel> implements SpeciesBatch, AttachmentModelAware {
private static final long serialVersionUID = 1L;
@@ -497,6 +499,10 @@
return parentBatch;
}
+ @Override
+ public void setParentBatch(SpeciesBatch parentBatch) {
+ }
+
public void setParentBatch(SpeciesBatchRowModel parentBatch) {
Object oldValue = getParentBatch();
this.parentBatch = parentBatch;
@@ -596,6 +602,15 @@
firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
}
+ @Override
+ public FishingOperation getFishingOperation() {
+ return null;
+ }
+
+ @Override
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ }
+
public Float getWeight() {
return computedOrNotWeight.getData();
}
@@ -604,6 +619,33 @@
this.computedOrNotWeight.setData(weight);
}
+ @Override
+ public SampleCategoryEnum getSampleCategoryType() {
+ return null;
+ }
+
+ @Override
+ public void setSampleCategoryType(SampleCategoryEnum sampleCategoryType) {
+ }
+
+ @Override
+ public Serializable getSampleCategoryValue() {
+ return null;
+ }
+
+ @Override
+ public void setSampleCategoryValue(Serializable sampleCategoryValue) {
+ }
+
+ @Override
+ public Float getSampleCategoryWeight() {
+ return null;
+ }
+
+ @Override
+ public void setSampleCategoryWeight(Float sampleCategoryWeight) {
+ }
+
public Integer getNumber() {
return computedOrNotNumber.getData();
}
@@ -612,6 +654,67 @@
computedOrNotNumber.setData(number);
}
+ @Override
+ public boolean isSpeciesToConfirm() {
+ return false;
+ }
+
+ @Override
+ public void setSpeciesToConfirm(boolean speciesToConfirm) {
+ }
+
+ @Override
+ public SpeciesBatch getChildBatchs(int index) {
+ return null;
+ }
+
+ @Override
+ public boolean isChildBatchsEmpty() {
+ return false;
+ }
+
+ @Override
+ public int sizeChildBatchs() {
+ return 0;
+ }
+
+ @Override
+ public void addChildBatchs(SpeciesBatch childBatchs) {
+ }
+
+ @Override
+ public void addAllChildBatchs(Collection<SpeciesBatch> childBatchs) {
+ }
+
+ @Override
+ public boolean removeChildBatchs(SpeciesBatch childBatchs) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAllChildBatchs(Collection<SpeciesBatch> childBatchs) {
+ return false;
+ }
+
+ @Override
+ public boolean containsChildBatchs(SpeciesBatch childBatchs) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAllChildBatchs(Collection<SpeciesBatch> childBatchs) {
+ return false;
+ }
+
+ @Override
+ public List<SpeciesBatch> getChildBatchs() {
+ return null;
+ }
+
+ @Override
+ public void setChildBatchs(List<SpeciesBatch> childBatchs) {
+ }
+
public List<SpeciesFrequencyRowModel> getFrequency() {
return frequency;
}
@@ -654,4 +757,8 @@
this.computedOrNotWeight = computedOrNotWeight;
}
+ @Override
+ protected SpeciesBatch newEntity() {
+ return TuttiBeanFactory.newSpeciesBatch();
+ }
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -279,10 +279,10 @@
// TODO kmorin 20130329 check with Vincent what are exactly the countIfNoFrequencyEnabled
// and weight properties
result = (!speciesProtocol.isSizeEnabled() || row.getSizeCategoryValue() != null)
- && (!speciesProtocol.isSexEnabled() || row.getSexCategoryValue() != null)
- && (!speciesProtocol.isMaturityEnabled() || row.getMaturityCategoryValue() != null)
- && (!speciesProtocol.isAgeEnabled() || row.getAgeCategoryValue() != null)
- && (!speciesProtocol.isCountIfNoFrequencyEnabled() || !CollectionUtils.isEmpty(row.getFrequency()));
+ && (!speciesProtocol.isSexEnabled() || row.getSexCategoryValue() != null)
+ && (!speciesProtocol.isMaturityEnabled() || row.getMaturityCategoryValue() != null)
+ && (!speciesProtocol.isAgeEnabled() || row.getAgeCategoryValue() != null)
+ && (!speciesProtocol.isCountIfNoFrequencyEnabled() || !CollectionUtils.isEmpty(row.getFrequency()));
}
}
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/create/CreateSpeciesBatchUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -155,4 +155,9 @@
boolean result = !speciesUsed.containsEntry(sortedUnsortedCategory, species);
return result;
}
+
+ @Override
+ protected CreateSpeciesBatchUIModel newEntity() {
+ return new CreateSpeciesBatchUIModel();
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,6 +26,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch;
import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
@@ -41,7 +42,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> implements Comparable<SpeciesFrequencyRowModel> {
+public class SpeciesFrequencyRowModel extends AbstractTuttiBeanUIModel<SpeciesBatchFrequency, SpeciesFrequencyRowModel> implements SpeciesBatchFrequency, Comparable<SpeciesFrequencyRowModel> {
private static final long serialVersionUID = 1L;
@@ -104,7 +105,8 @@
public static List<SpeciesBatchFrequency> toBeans(List<SpeciesFrequencyRowModel> frequency, SpeciesBatch batch) {
List<SpeciesBatchFrequency> result = Lists.newArrayList();
for (SpeciesFrequencyRowModel b : frequency) {
- SpeciesBatchFrequency model = new SpeciesBatchFrequency();
+ SpeciesBatchFrequency model =
+ TuttiBeanFactory.newSpeciesBatchFrequency();
toBeanBinder.copy(b, model);
model.setBatch(batch);
result.add(model);
@@ -116,40 +118,48 @@
super(SpeciesBatchFrequency.class, fromBeanBinder, toBeanBinder);
}
+ @Override
public Float getLengthStep() {
return lengthStep;
}
+ @Override
public void setLengthStep(Float lengthStep) {
Object oldValue = getLengthStep();
this.lengthStep = lengthStep;
firePropertyChange(PROPERTY_LENGTH_STEP, oldValue, lengthStep);
}
+ @Override
public Integer getNumber() {
return number;
}
+ @Override
public void setNumber(Integer number) {
Object oldValue = getNumber();
this.number = number;
firePropertyChange(PROPERTY_NUMBER, oldValue, number);
}
+ @Override
public Float getWeight() {
return weight;
}
+ @Override
public void setWeight(Float weight) {
Object oldValue = getWeight();
this.weight = weight;
firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
}
+ @Override
public Caracteristic getLengthStepCaracteristic() {
return lengthStepCaracteristic;
}
+ @Override
public void setLengthStepCaracteristic(Caracteristic lengthStepCaracteristic) {
Object oldValue = getLengthStepCaracteristic();
this.lengthStepCaracteristic = lengthStepCaracteristic;
@@ -157,8 +167,22 @@
}
@Override
+ public SpeciesBatch getBatch() {
+ return null;
+ }
+
+ @Override
+ public void setBatch(SpeciesBatch batch) {
+ }
+
+ @Override
public int compareTo(SpeciesFrequencyRowModel o) {
int result = ordering.compare(lengthStep, o.lengthStep);
return result;
}
+
+ @Override
+ protected SpeciesBatchFrequency newEntity() {
+ return TuttiBeanFactory.newSpeciesBatchFrequency();
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -28,7 +28,6 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.SpeciesBatchRowModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import java.util.Collections;
import java.util.List;
/**
@@ -243,4 +242,8 @@
return isOneRowValid();
}
+ @Override
+ protected SpeciesBatchRowModel newEntity() {
+ return new SpeciesBatchRowModel();
+ }
}
Modified: 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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -3,8 +3,8 @@
/*
* #%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… $
+ * $Id$
+ * $HeadURL$
* %%
* Copyright (C) 2012 Ifremer
* %%
@@ -97,4 +97,8 @@
firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
}
+ @Override
+ protected SplitSpeciesBatchRowModel newEntity() {
+ return new SplitSpeciesBatchRowModel();
+ }
}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchRowModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/split/SplitSpeciesBatchUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -134,4 +134,9 @@
this.sampleWeight = sampleWeight;
firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
}
+
+ @Override
+ protected SpeciesBatchRowModel newEntity() {
+ return new SpeciesBatchRowModel();
+ }
}
\ No newline at end of file
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -75,4 +75,9 @@
this.value = value;
firePropertyChange(PROPERTY_VALUE, oldValue, value);
}
+
+ @Override
+ protected Serializable newEntity() {
+ return null;
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/fishing/AbstractCaracteristicTabUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -25,21 +25,17 @@
* #L%
*/
-import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
-import com.google.common.collect.Sets;
import fr.ifremer.tutti.persistence.entities.CaracteristicMap;
import fr.ifremer.tutti.persistence.entities.data.FishingOperation;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TabContentModel;
import fr.ifremer.tutti.ui.swing.util.table.AbstractTuttiTableUIModel;
-import org.apache.commons.lang3.ObjectUtils;
import java.io.Serializable;
import java.util.List;
-import java.util.Set;
/**
* @author kmorin <kmorin(a)codelutin.com>
@@ -109,7 +105,7 @@
@Override
public boolean isEmpty() {
return caracteristicMap == null
- || Iterables.all(caracteristicMap.values(), Predicates.isNull());
+ || Iterables.all(caracteristicMap.values(), Predicates.isNull());
}
@Override
@@ -117,4 +113,8 @@
return null;
}
+ @Override
+ protected FishingOperation newEntity() {
+ return null;
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,7 +24,6 @@
* #L%
*/
-import com.google.common.collect.Lists;
import fr.ifremer.tutti.persistence.entities.data.Program;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
@@ -34,8 +33,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import java.util.List;
-
import static org.nuiton.i18n.I18n._;
/**
@@ -76,13 +73,10 @@
@Override
public void beforeInitUI() {
+ getDataContext().resetValidationDataContext();
+
EditProgramUIModel model = new EditProgramUIModel();
- List<Program> programs =
- Lists.newArrayList(persistenceService.getAllProgram());
-
- model.setExistingPrograms(programs);
-
String programId = context.getProgramId();
if (programId == null) {
@@ -98,8 +92,6 @@
Program program = persistenceService.getProgram(programId);
model.fromBean(program);
-
- model.getExistingPrograms().remove(program);
}
listModelIsModify(model);
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,38 +24,30 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Program;
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;
-import java.util.List;
-
/**
* Bean to edit a program.
*
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> {
+public class EditProgramUIModel extends AbstractTuttiBeanUIModel<Program, EditProgramUIModel> implements Program {
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_ZONE = "zone";
+ /**
+ * Delegate edit object.
+ *
+ * @since 1.3
+ */
+ protected final Program editObject = TuttiBeanFactory.newProgram();
- public static final String PROPERTY_COMMENT = "comment";
-
- public static final String PROPERTY_NAME = "name";
-
- protected String name;
-
- protected String description;
-
- protected TuttiLocation zone;
-
- private List<Program> existingPrograms;
-
protected static Binder<EditProgramUIModel, Program> toBeanBinder =
BinderFactory.newBinder(EditProgramUIModel.class,
Program.class);
@@ -68,42 +60,48 @@
super(Program.class, fromBeanBinder, toBeanBinder);
}
+ @Override
+ protected Program newEntity() {
+ return TuttiBeanFactory.newProgram();
+ }
+
+ //------------------------------------------------------------------------//
+ //-- Program methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
public String getName() {
- return name;
+ return editObject.getName();
}
+ @Override
public void setName(String name) {
Object oldValue = getName();
- this.name = name;
+ editObject.setName(name);
firePropertyChange(PROPERTY_NAME, oldValue, name);
}
+ @Override
public String getDescription() {
- return description;
+ return editObject.getDescription();
}
+ @Override
public void setDescription(String description) {
Object oldValue = getDescription();
- this.description = description;
- firePropertyChange(PROPERTY_COMMENT, oldValue, description);
+ editObject.setDescription(description);
+ firePropertyChange(PROPERTY_DESCRIPTION, oldValue, description);
}
+ @Override
public TuttiLocation getZone() {
- return zone;
+ return editObject.getZone();
}
+ @Override
public void setZone(TuttiLocation zone) {
Object oldValue = getZone();
- this.zone = zone;
+ editObject.setZone(zone);
firePropertyChange(PROPERTY_ZONE, oldValue, zone);
}
-
- public List<Program> getExistingPrograms() {
- return existingPrograms;
- }
-
- public void setExistingPrograms(List<Program> existingPrograms) {
- this.existingPrograms = existingPrograms;
- }
-
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolSpeciesRowModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol;
import fr.ifremer.tutti.persistence.entities.referential.Caracteristic;
import fr.ifremer.tutti.persistence.entities.referential.Species;
@@ -35,7 +36,7 @@
* @author kmorin
* @since 0.3
*/
-public class EditProtocolSpeciesRowModel extends AbstractTuttiBeanUIModel<SpeciesProtocol, EditProtocolSpeciesRowModel> {
+public class EditProtocolSpeciesRowModel extends AbstractTuttiBeanUIModel<SpeciesProtocol, EditProtocolSpeciesRowModel> implements SpeciesProtocol {
private static final long serialVersionUID = 1L;
@@ -90,11 +91,15 @@
public EditProtocolSpeciesRowModel() {
super(SpeciesProtocol.class, fromBeanBinder, toBeanBinder);
}
-
+ @Override
public Integer getSpeciesReferenceTaxonId() {
return species.getReferenceTaxonId();
}
+ @Override
+ public void setSpeciesReferenceTaxonId(Integer speciesReferenceTaxonId) {
+ }
+
public Species getSpecies() {
return species;
}
@@ -105,60 +110,75 @@
firePropertyChange(PROPERTY_SPECIES, oldValue, species);
}
+ @Override
public String getSpeciesSurveyCode() {
return speciesSurveyCode;
}
+ @Override
public void setSpeciesSurveyCode(String speciesSurveyCode) {
Object oldValue = getSpeciesSurveyCode();
this.speciesSurveyCode = speciesSurveyCode;
firePropertyChange(PROPERTY_SPECIES_SURVEY_CODE, oldValue, speciesSurveyCode);
}
+ @Override
public boolean isSizeEnabled() {
return sizeEnabled;
}
+ @Override
public void setSizeEnabled(boolean sizeEnabled) {
Object oldValue = isSizeEnabled();
this.sizeEnabled = sizeEnabled;
firePropertyChange(PROPERTY_SIZE_ENABLED, oldValue, sizeEnabled);
}
+ @Override
public boolean isSexEnabled() {
return sexEnabled;
}
+ @Override
public void setSexEnabled(boolean sexEnabled) {
Object oldValue = isSexEnabled();
this.sexEnabled = sexEnabled;
firePropertyChange(PROPERTY_SEX_ENABLED, oldValue, sexEnabled);
}
+ @Override
public boolean isMaturityEnabled() {
return maturityEnabled;
}
+ @Override
public void setMaturityEnabled(boolean maturityEnabled) {
Object oldValue = isMaturityEnabled();
this.maturityEnabled = maturityEnabled;
firePropertyChange(PROPERTY_MATURITY_ENABLED, oldValue, maturityEnabled);
}
+ @Override
public boolean isAgeEnabled() {
return ageEnabled;
}
+ @Override
public void setAgeEnabled(boolean ageEnabled) {
Object oldValue = isAgeEnabled();
this.ageEnabled = ageEnabled;
firePropertyChange(PROPERTY_AGE_ENABLED, oldValue, ageEnabled);
}
+ @Override
public String getLengthStepPmfmId() {
return lengthStepPmfm != null ? lengthStepPmfm.getId() : null;
}
+ @Override
+ public void setLengthStepPmfmId(String lengthStepPmfmId) {
+ }
+
public Caracteristic getLengthStepPmfm() {
return lengthStepPmfm;
}
@@ -169,34 +189,62 @@
firePropertyChange(PROPERTY_LENGTH_STEP_PMFM, oldValue, lengthStepPmfm);
}
+ @Override
public boolean isWeightEnabled() {
return weightEnabled;
}
+ @Override
public void setWeightEnabled(boolean weightEnabled) {
Object oldValue = isWeightEnabled();
this.weightEnabled = weightEnabled;
firePropertyChange(PROPERTY_WEIGHT_ENABLED, oldValue, weightEnabled);
}
+ @Override
public boolean isCountIfNoFrequencyEnabled() {
return countIfNoFrequencyEnabled;
}
+ @Override
public void setCountIfNoFrequencyEnabled(boolean countIfNoFrequencyEnabled) {
Object oldValue = isCountIfNoFrequencyEnabled();
this.countIfNoFrequencyEnabled = countIfNoFrequencyEnabled;
firePropertyChange(PROPERTY_COUNT_IF_NO_FREQUENCY_ENABLED, oldValue, countIfNoFrequencyEnabled);
}
+ @Override
public boolean isCalcifySampleEnabled() {
return calcifySampleEnabled;
}
+ @Override
public void setCalcifySampleEnabled(boolean calcifySampleEnabled) {
Object oldValue = isCalcifySampleEnabled();
this.calcifySampleEnabled = calcifySampleEnabled;
firePropertyChange(PROPERTY_CALCIFY_SAMPLE_ENABLED, oldValue, calcifySampleEnabled);
}
+ @Override
+ public Float getLengthStep() {
+ return null;
+ }
+
+ @Override
+ public void setLengthStep(Float lengthStep) {
+ }
+
+ @Override
+ public boolean isMadeFromAReferentTaxon() {
+ return false;
+ }
+
+ @Override
+ public void setMadeFromAReferentTaxon(boolean madeFromAReferentTaxon) {
+ }
+
+ @Override
+ protected SpeciesProtocol newEntity() {
+ return TuttiBeanFactory.newSpeciesProtocol();
+ }
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -186,6 +186,8 @@
@Override
public void beforeInitUI() {
+ getDataContext().resetValidationDataContext();
+
EditProtocolUIModel model = new EditProtocolUIModel();
// load cache data
@@ -201,8 +203,8 @@
getDataContext().getReferentSpecies());
model.setAllReferentSpeciesByTaxonId(allReferentSpeciesByTaxonId);
- List<TuttiProtocol> protocols = Lists.newArrayList(persistenceService.getAllProtocol());
- model.setExistingProtocols(protocols);
+// List<TuttiProtocol> protocols = Lists.newArrayList(persistenceService.getAllProtocol());
+// model.setExistingProtocols(protocols);
List<Caracteristic> caracteristics = Lists.newArrayList(getDataContext().getCaracteristics());
model.setCaracteristics(caracteristics);
@@ -232,11 +234,9 @@
// load existing protocol
- protocol = persistenceService.getProtocol(context.getProtocolId());
+ protocol = getDataContext().getProtocol();
model.fromBean(protocol);
- log.debug(model.getExistingProtocols());
- model.getExistingProtocols().remove(protocol);
} else if ((protocol = ImportProtocolAction.IMPORT_PROTOCOL_ENTRY.getContextValue(ui)) != null) {
@@ -252,7 +252,7 @@
// clone protocol
- CloneProtocolAction.CLONE_PROTOCOL_ENTRY.getContextValue(ui);
+ CloneProtocolAction.CLONE_PROTOCOL_ENTRY.removeContextValue(ui);
model.fromBean(protocol);
model.setCloned(true);
@@ -300,8 +300,8 @@
}
// set to model ( will propagate to tableModel)
- model.setSpecies(speciesRows);
- model.setBenthos(benthosRows);
+ model.setSpeciesRow(speciesRows);
+ model.setBenthosRow(benthosRows);
ui.getSpeciesComboBox().getHandler().reset();
ui.getBenthosComboBox().getHandler().reset();
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,7 +26,9 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+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.Species;
@@ -42,24 +44,14 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.3
*/
-public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, EditProtocolUIModel> {
+public class EditProtocolUIModel extends AbstractTuttiBeanUIModel<TuttiProtocol, EditProtocolUIModel> implements TuttiProtocol {
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_COMMENT = "comment";
+ public static final String PROPERTY_SPECIES_ROW = "speciesRow";
- public static final String PROPERTY_NAME = "name";
+ public static final String PROPERTY_BENTHOS_ROW = "benthosRow";
- 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";
-
- public static final String PROPERTY_VESSEL_USE_FEATURE_PMFM_ID = "vesselUseFeaturePmfmId";
-
public static final String PROPERTY_REMOVE_SPECIES_ENABLED = "removeSpeciesEnabled";
public static final String PROPERTY_REMOVE_BENTHOS_ENABLED = "removeBenthosEnabled";
@@ -68,16 +60,13 @@
public static final String PROPERTY_CLONED = "cloned";
- protected String name;
+ /**
+ * Delegate edit object.
+ *
+ * @since 1.3
+ */
+ protected final TuttiProtocol editObject = TuttiBeanFactory.newTuttiProtocol();
- protected String comment;
-
- protected List<String> lengthClassesPmfmId;
-
- protected List<String> gearUseFeaturePmfmId;
-
- protected List<String> vesselUseFeaturePmfmId;
-
/**
* Flag when a incoming protocol is imported.
*
@@ -118,9 +107,9 @@
protected Map<String, Caracteristic> allCaracteristic;
- protected List<EditProtocolSpeciesRowModel> species;
+ protected List<EditProtocolSpeciesRowModel> speciesRow;
- protected List<EditProtocolSpeciesRowModel> benthos;
+ protected List<EditProtocolSpeciesRowModel> benthosRow;
protected static Binder<EditProtocolUIModel, TuttiProtocol> toBeanBinder =
BinderFactory.newBinder(EditProtocolUIModel.class,
@@ -129,95 +118,48 @@
protected static Binder<TuttiProtocol, EditProtocolUIModel> fromBeanBinder =
BinderFactory.newBinder(TuttiProtocol.class, EditProtocolUIModel.class);
- private List<TuttiProtocol> existingProtocols;
-
public EditProtocolUIModel() {
super(TuttiProtocol.class, fromBeanBinder, toBeanBinder);
}
- public String getName() {
- return name;
+ @Override
+ protected TuttiProtocol newEntity() {
+ return TuttiBeanFactory.newTuttiProtocol();
}
- public void setName(String name) {
- Object oldValue = getName();
- this.name = name;
- firePropertyChange(PROPERTY_NAME, oldValue, name);
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- Object oldValue = getComment();
- this.comment = comment;
- firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
- }
-
- public List<String> getLengthClassesPmfmId() {
- return lengthClassesPmfmId;
- }
-
- public void setLengthClassesPmfmId(List<String> lengthClassesPmfmId) {
- this.lengthClassesPmfmId = lengthClassesPmfmId;
- // force to always propagates (need to recompte data of combobox in species table)
- firePropertyChange(PROPERTY_LENGTH_CLASSES_PMFM_ID, null, lengthClassesPmfmId);
- }
-
public void setLengthClassesPmfm(List<Caracteristic> lengthClassesPmfm) {
List<String> ids = TuttiEntities.collecIds(lengthClassesPmfm);
setLengthClassesPmfmId(ids);
}
- public List<String> getGearUseFeaturePmfmId() {
- return gearUseFeaturePmfmId;
- }
-
- public void setGearUseFeaturePmfmId(List<String> gearUseFeaturePmfmId) {
- Object oldValue = getGearUseFeaturePmfmId();
- this.gearUseFeaturePmfmId = gearUseFeaturePmfmId;
- firePropertyChange(PROPERTY_GEAR_USE_FEATURE_PMFM_ID, oldValue, gearUseFeaturePmfmId);
- }
-
public void setGearUseFeaturePmfm(List<Caracteristic> gearUseFeaturePmfm) {
List<String> ids = TuttiEntities.collecIds(gearUseFeaturePmfm);
setGearUseFeaturePmfmId(ids);
}
- public List<String> getVesselUseFeaturePmfmId() {
- return vesselUseFeaturePmfmId;
- }
-
- public void setVesselUseFeaturePmfmId(List<String> vesselUseFeaturePmfmId) {
- Object oldValue = getVesselUseFeaturePmfmId();
- this.vesselUseFeaturePmfmId = vesselUseFeaturePmfmId;
- firePropertyChange(PROPERTY_VESSEL_USE_FEATURE_PMFM_ID, oldValue, vesselUseFeaturePmfmId);
- }
-
public void setVesselUseFeaturePmfm(List<Caracteristic> vesselUseFeaturePmfm) {
List<String> ids = TuttiEntities.collecIds(vesselUseFeaturePmfm);
setVesselUseFeaturePmfmId(ids);
}
- public List<EditProtocolSpeciesRowModel> getSpecies() {
- return species;
+ public List<EditProtocolSpeciesRowModel> getSpeciesRow() {
+ return speciesRow;
}
- public void setSpecies(List<EditProtocolSpeciesRowModel> species) {
- Object oldValue = getSpecies();
- this.species = species;
- firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ public void setSpeciesRow(List<EditProtocolSpeciesRowModel> speciesRow) {
+ Object oldValue = getSpeciesRow();
+ this.speciesRow = speciesRow;
+ firePropertyChange(PROPERTY_SPECIES_ROW, oldValue, speciesRow);
}
- public List<EditProtocolSpeciesRowModel> getBenthos() {
- return benthos;
+ public List<EditProtocolSpeciesRowModel> getBenthosRow() {
+ return benthosRow;
}
- public void setBenthos(List<EditProtocolSpeciesRowModel> benthos) {
- Object oldValue = getBenthos();
- this.benthos = benthos;
- firePropertyChange(PROPERTY_BENTHOS, oldValue, species);
+ public void setBenthosRow(List<EditProtocolSpeciesRowModel> benthosRow) {
+ Object oldValue = getBenthosRow();
+ this.benthosRow = benthosRow;
+ firePropertyChange(PROPERTY_BENTHOS_ROW, oldValue, benthosRow);
}
public boolean isRemoveSpeciesEnabled() {
@@ -260,14 +202,6 @@
firePropertyChange(PROPERTY_CLONED, oldValue, cloned);
}
- public List<TuttiProtocol> getExistingProtocols() {
- return existingProtocols;
- }
-
- public void setExistingProtocols(List<TuttiProtocol> existingProtocols) {
- this.existingProtocols = existingProtocols;
- }
-
public List<Species> getAllSpecies() {
return allSpecies;
}
@@ -323,4 +257,301 @@
public void setAllCaracteristic(Map<String, Caracteristic> allCaracteristic) {
this.allCaracteristic = allCaracteristic;
}
+
+ //------------------------------------------------------------------------//
+ //-- TuttiProtocol methods --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public String getName() {
+ return editObject.getName();
+ }
+
+ @Override
+ public void setName(String name) {
+ Object oldValue = getName();
+ editObject.setName(name);
+ firePropertyChange(PROPERTY_NAME, oldValue, name);
+ }
+
+ @Override
+ public String getComment() {
+ return editObject.getComment();
+ }
+
+ @Override
+ public void setComment(String comment) {
+ Object oldValue = getComment();
+ editObject.setComment(comment);
+ firePropertyChange(PROPERTY_COMMENT, oldValue, comment);
+ }
+
+ @Override
+ public List<String> getLengthClassesPmfmId() {
+ return editObject.getLengthClassesPmfmId();
+ }
+
+ @Override
+ public void setLengthClassesPmfmId(List<String> lengthClassesPmfmId) {
+ editObject.setLengthClassesPmfmId(lengthClassesPmfmId);
+ // force to always propagates (need to recompte data of combobox in species table)
+ firePropertyChange(PROPERTY_LENGTH_CLASSES_PMFM_ID, null, lengthClassesPmfmId);
+ }
+
+ @Override
+ public List<String> getGearUseFeaturePmfmId() {
+ return editObject.getGearUseFeaturePmfmId();
+ }
+
+ @Override
+ public void setGearUseFeaturePmfmId(List<String> gearUseFeaturePmfmId) {
+ Object oldValue = getGearUseFeaturePmfmId();
+ editObject.setGearUseFeaturePmfmId(gearUseFeaturePmfmId);
+ firePropertyChange(PROPERTY_GEAR_USE_FEATURE_PMFM_ID, oldValue, gearUseFeaturePmfmId);
+ }
+
+ @Override
+ public List<String> getVesselUseFeaturePmfmId() {
+ return editObject.getVesselUseFeaturePmfmId();
+ }
+
+ @Override
+ public void setVesselUseFeaturePmfmId(List<String> vesselUseFeaturePmfmId) {
+ Object oldValue = getVesselUseFeaturePmfmId();
+ editObject.setVesselUseFeaturePmfmId(vesselUseFeaturePmfmId);
+ firePropertyChange(PROPERTY_VESSEL_USE_FEATURE_PMFM_ID, oldValue, vesselUseFeaturePmfmId);
+ }
+
+ @Override
+ public String getGearUseFeaturePmfmId(int index) {
+ return null;
+ }
+
+ @Override
+ public boolean isGearUseFeaturePmfmIdEmpty() {
+ return false;
+ }
+
+ @Override
+ public int sizeGearUseFeaturePmfmId() {
+ return 0;
+ }
+
+ @Override
+ public void addGearUseFeaturePmfmId(String gearUseFeaturePmfmId) {
+ }
+
+ @Override
+ public void addAllGearUseFeaturePmfmId(Collection<String> gearUseFeaturePmfmId) {
+ }
+
+ @Override
+ public boolean removeGearUseFeaturePmfmId(String gearUseFeaturePmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAllGearUseFeaturePmfmId(Collection<String> gearUseFeaturePmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean containsGearUseFeaturePmfmId(String gearUseFeaturePmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAllGearUseFeaturePmfmId(Collection<String> gearUseFeaturePmfmId) {
+ return false;
+ }
+
+ @Override
+ public String getVesselUseFeaturePmfmId(int index) {
+ return null;
+ }
+
+ @Override
+ public boolean isVesselUseFeaturePmfmIdEmpty() {
+ return false;
+ }
+
+ @Override
+ public int sizeVesselUseFeaturePmfmId() {
+ return 0;
+ }
+
+ @Override
+ public void addVesselUseFeaturePmfmId(String vesselUseFeaturePmfmId) {
+ }
+
+ @Override
+ public void addAllVesselUseFeaturePmfmId(Collection<String> vesselUseFeaturePmfmId) {
+ }
+
+ @Override
+ public boolean removeVesselUseFeaturePmfmId(String vesselUseFeaturePmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAllVesselUseFeaturePmfmId(Collection<String> vesselUseFeaturePmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean containsVesselUseFeaturePmfmId(String vesselUseFeaturePmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAllVesselUseFeaturePmfmId(Collection<String> vesselUseFeaturePmfmId) {
+ return false;
+ }
+
+ @Override
+ public String getLengthClassesPmfmId(int index) {
+ return null;
+ }
+
+ @Override
+ public boolean isLengthClassesPmfmIdEmpty() {
+ return false;
+ }
+
+ @Override
+ public int sizeLengthClassesPmfmId() {
+ return 0;
+ }
+
+ @Override
+ public void addLengthClassesPmfmId(String lengthClassesPmfmId) {
+ }
+
+ @Override
+ public void addAllLengthClassesPmfmId(Collection<String> lengthClassesPmfmId) {
+ }
+
+ @Override
+ public boolean removeLengthClassesPmfmId(String lengthClassesPmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAllLengthClassesPmfmId(Collection<String> lengthClassesPmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean containsLengthClassesPmfmId(String lengthClassesPmfmId) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAllLengthClassesPmfmId(Collection<String> lengthClassesPmfmId) {
+ return false;
+ }
+
+ @Override
+ public SpeciesProtocol getSpecies(int index) {
+ return null;
+ }
+
+ @Override
+ public boolean isSpeciesEmpty() {
+ return false;
+ }
+
+ @Override
+ public int sizeSpecies() {
+ return 0;
+ }
+
+ @Override
+ public void addSpecies(SpeciesProtocol species) {
+ }
+
+ @Override
+ public void addAllSpecies(Collection<SpeciesProtocol> species) {
+ }
+
+ @Override
+ public boolean removeSpecies(SpeciesProtocol species) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAllSpecies(Collection<SpeciesProtocol> species) {
+ return false;
+ }
+
+ @Override
+ public boolean containsSpecies(SpeciesProtocol species) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAllSpecies(Collection<SpeciesProtocol> species) {
+ return false;
+ }
+
+ @Override
+ public List<SpeciesProtocol> getSpecies() {
+ return null;
+ }
+
+ @Override
+ public void setSpecies(List<SpeciesProtocol> species) {
+ }
+
+ @Override
+ public SpeciesProtocol getBenthos(int index) {
+ return null;
+ }
+
+ @Override
+ public boolean isBenthosEmpty() {
+ return false;
+ }
+
+ @Override
+ public int sizeBenthos() {
+ return 0;
+ }
+
+ @Override
+ public void addBenthos(SpeciesProtocol benthos) {
+ }
+
+ @Override
+ public void addAllBenthos(Collection<SpeciesProtocol> benthos) {
+ }
+
+ @Override
+ public boolean removeBenthos(SpeciesProtocol benthos) {
+ return false;
+ }
+
+ @Override
+ public boolean removeAllBenthos(Collection<SpeciesProtocol> benthos) {
+ return false;
+ }
+
+ @Override
+ public boolean containsBenthos(SpeciesProtocol benthos) {
+ return false;
+ }
+
+ @Override
+ public boolean containsAllBenthos(Collection<SpeciesProtocol> benthos) {
+ return false;
+ }
+
+ @Override
+ public List<SpeciesProtocol> getBenthos() {
+ return null;
+ }
+
+ @Override
+ public void setBenthos(List<SpeciesProtocol> benthos) {
+ }
}
\ No newline at end of file
Modified: 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/ExportProtocolBenthosAction.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolBenthosAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -105,7 +105,7 @@
// build benthos protocol to export
List<SpeciesProtocol> protocols = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getBenthos()) {
+ for (EditProtocolSpeciesRowModel row : model.getBenthosRow()) {
if (row.isValid()) {
protocols.add(row.toBean());
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportProtocolSpeciesAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -105,7 +105,7 @@
// build species protocol to export
List<SpeciesProtocol> protocols = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getSpecies()) {
+ for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
if (row.isValid()) {
protocols.add(row.toBean());
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ExportPupitriAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -105,7 +105,7 @@
// build species protocol to export
List<Species> speciesList = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getSpecies()) {
+ for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
if (row.isValid()) {
Species species = row.getSpecies();
species.setSurveyCode(row.getSpeciesSurveyCode());
Modified: 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/ImportProtocolBenthosAction.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolBenthosAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -117,7 +117,7 @@
getUI().getBenthosComboBox().getHandler().reset();
// update rows in model
- model.setBenthos(rows);
+ model.setBenthosRow(rows);
int nbSynonym = 0;
for (SpeciesProtocol speciesProtocol : protocol.getSpecies()) {
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/ImportProtocolSpeciesAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -117,7 +117,7 @@
getUI().getBenthosComboBox().getHandler().reset();
// update rows in model
- model.setSpecies(rows);
+ model.setSpeciesRow(rows);
int nbSynonym = 0;
for (SpeciesProtocol speciesProtocol : protocol.getSpecies()) {
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/protocol/SaveProtocolAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -70,7 +70,7 @@
// get the species protocols from the table
List<SpeciesProtocol> speciesProtocols = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getSpecies()) {
+ for (EditProtocolSpeciesRowModel row : model.getSpeciesRow()) {
if (row.isValid()) {
SpeciesProtocol protocol = row.toBean();
speciesProtocols.add(protocol);
@@ -80,7 +80,7 @@
List<SpeciesProtocol> benthosProtocols = Lists.newArrayList();
- for (EditProtocolSpeciesRowModel row : model.getBenthos()) {
+ for (EditProtocolSpeciesRowModel row : model.getBenthosRow()) {
if (row.isValid()) {
SpeciesProtocol protocol = row.toBean();
benthosProtocols.add(protocol);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiBeanUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,8 +24,8 @@
* #L%
*/
-import fr.ifremer.tutti.TuttiTechnicalException;
-import fr.ifremer.tutti.persistence.entities.IdAware;
+import fr.ifremer.tutti.PropagatePropertyChangeListener;
+import fr.ifremer.tutti.persistence.entities.TuttiEntity;
import org.jdesktop.beans.AbstractSerializableBean;
import org.nuiton.util.beans.Binder;
@@ -35,11 +35,11 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.1
*/
-public abstract class AbstractTuttiBeanUIModel<E, B extends AbstractTuttiBeanUIModel<E, B>> extends AbstractSerializableBean implements IdAware {
+public abstract class AbstractTuttiBeanUIModel<E, B extends AbstractTuttiBeanUIModel<E, B>> extends AbstractSerializableBean implements TuttiEntity, PropagatePropertyChangeListener.PropagatePropertyChange {
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_ID = "id";
+// public static final String PROPERTY_ID = "id";
public static final String PROPERTY_MODIFY = "modify";
@@ -51,7 +51,7 @@
protected boolean valid;
- private final Class<E> entityType;
+// private final Class<E> entityType;
private final Binder<E, B> fromBeanBinder;
@@ -60,7 +60,7 @@
protected AbstractTuttiBeanUIModel(Class<E> entityType,
Binder<E, B> fromBeanBinder,
Binder<B, E> toBeanBinder) {
- this.entityType = entityType;
+// this.entityType = entityType;
this.fromBeanBinder = fromBeanBinder;
this.toBeanBinder = toBeanBinder;
}
@@ -75,6 +75,36 @@
return result;
}
+ protected abstract E newEntity();
+
+ public boolean isModify() {
+ return modify;
+ }
+
+ public void setModify(boolean modify) {
+ Object oldValue = isModify();
+ this.modify = modify;
+ firePropertyChange(PROPERTY_MODIFY, oldValue, modify);
+ }
+
+ public boolean isValid() {
+ return valid;
+ }
+
+ public void setValid(boolean valid) {
+ Object oldValue = isValid();
+ this.valid = valid;
+ firePropertyChange(PROPERTY_VALID, oldValue, valid);
+ }
+
+ public boolean isCreate() {
+ return id == null;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- TuttiEntity methods --//
+ //------------------------------------------------------------------------//
+
@Override
public Integer getIdAsInt() {
return id == null ? null : Integer.valueOf(id);
@@ -89,51 +119,23 @@
}
}
- protected E newEntity() {
- try {
- E result = entityType.newInstance();
- return result;
- } catch (Exception e) {
- throw new TuttiTechnicalException(
- "Could not instanciate entity of type " +
- entityType.getName(), e);
- }
- }
-
+ @Override
public String getId() {
return id;
}
+ @Override
public void setId(String id) {
Object oldValue = getId();
this.id = id;
firePropertyChange(PROPERTY_ID, oldValue, id);
}
- public boolean isModify() {
- return modify;
- }
+ //------------------------------------------------------------------------//
+ //-- PropagatePropertyChangeListener methods --//
+ //------------------------------------------------------------------------//
- public void setModify(boolean modify) {
- Object oldValue = isModify();
- this.modify = modify;
- firePropertyChange(PROPERTY_MODIFY, oldValue, modify);
- }
-
- public boolean isValid() {
- return valid;
- }
-
- public void setValid(boolean valid) {
- Object oldValue = isValid();
- this.valid = valid;
- firePropertyChange(PROPERTY_VALID, oldValue, valid);
- }
-
- public boolean isCreate() {
- return id == null;
- }
-
+ @Override
public void firePropertyChanged(String propertyName,
Object oldValue,
Object newValue) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiTabContainerUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,8 +26,6 @@
*/
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import javax.swing.DefaultSingleSelectionModel;
import javax.swing.JTabbedPane;
@@ -41,9 +39,9 @@
* @since 0.3
*/
public abstract class AbstractTuttiTabContainerUIHandler<M, UI extends TuttiUI<M, ?>> extends AbstractTuttiUIHandler<M, UI> {
+//
+// private final static Log log = LogFactory.getLog(AbstractTuttiTabContainerUIHandler.class);
- private final static Log log = LogFactory.getLog(AbstractTuttiTabContainerUIHandler.class);
-
protected AbstractTuttiTabContainerUIHandler(TuttiUIContext context, UI ui) {
super(context, ui);
}
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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -28,9 +28,9 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import fr.ifremer.tutti.LabelAware;
-import fr.ifremer.tutti.persistence.entities.IdAware;
+import fr.ifremer.tutti.persistence.entities.TuttiEntity;
import fr.ifremer.tutti.service.DecoratorService;
-import fr.ifremer.tutti.ui.swing.TuttiDataContext;
+import fr.ifremer.tutti.service.TuttiDataContext;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.content.MainUI;
@@ -63,9 +63,34 @@
import org.nuiton.util.decorator.JXPathDecorator;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
-import javax.swing.*;
+import javax.swing.AbstractAction;
+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.JScrollPane;
+import javax.swing.JSpinner;
+import javax.swing.JTable;
+import javax.swing.JTextField;
+import javax.swing.JViewport;
+import javax.swing.KeyStroke;
+import javax.swing.ListCellRenderer;
+import javax.swing.ListSelectionModel;
+import javax.swing.ScrollPaneConstants;
+import javax.swing.SwingUtilities;
import javax.swing.border.LineBorder;
-import javax.swing.event.*;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumnModel;
@@ -490,7 +515,7 @@
* @param data la liste des données à mettre dans la liste de gauche
* @param selectedData la liste des données à mettre dans la liste de droite
*/
- protected <E extends IdAware> void initBeanList(
+ protected <E extends TuttiEntity> void initBeanList(
BeanDoubleList<E> list,
List<E> data,
List<E> selectedData) {
@@ -588,7 +613,7 @@
@Override
public void stateChanged(ChangeEvent e) {
Dimension newDimension = new Dimension(viewport.getExtentSize().width,
- viewport.getViewSize().height);
+ viewport.getViewSize().height);
viewport.setViewSize(newDimension);
}
});
@@ -753,7 +778,7 @@
boolean valid = !validator.hasFatalErrors();
if (log.isDebugEnabled()) {
log.debug("Model [" + model +
- "] pass to valid state [" + valid + "]");
+ "] pass to valid state [" + valid + "]");
}
model.setValid(valid);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,5 +1,29 @@
package fr.ifremer.tutti.ui.swing.util;
+/*
+ * #%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%
+ */
+
/**
* Interface defining the models of the tab content UIs.
*
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TabContentModel.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/TuttiComputedOrNotData.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -10,26 +10,24 @@
* %%
* 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
+ * 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
+ *
+ * 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.PropagatePropertyChangeListener;
import org.jdesktop.beans.AbstractSerializableBean;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
/** @author kmorin <kmorin(a)codelutin.com> */
public class TuttiComputedOrNotData<N extends Number> extends AbstractSerializableBean {
@@ -92,25 +90,33 @@
* @param otherBean bean that will fires
* @since 1.2
*/
- public void addPropagateListener(String propertyName, AbstractTuttiBeanUIModel otherBean) {
- PropagatePropertyChangeListener listener = new PropagatePropertyChangeListener(propertyName, otherBean);
- addPropertyChangeListener(PROPERTY_DATA, listener);
- }
+ public void addPropagateListener(String propertyName,
+ PropagatePropertyChangeListener.PropagatePropertyChange otherBean) {
- private static class PropagatePropertyChangeListener implements PropertyChangeListener {
+ PropagatePropertyChangeListener.listenAndPropagate(this,
+ otherBean,
+ PROPERTY_DATA,
+ propertyName);
- private String propertyName;
+// PropagatePropertyChangeListener listener = new PropagatePropertyChangeListener(propertyName, otherBean);
+// addPropertyChangeListener(PROPERTY_DATA, listener);
+ }
- private AbstractTuttiBeanUIModel otherBean;
-
- public PropagatePropertyChangeListener(String propertyName, AbstractTuttiBeanUIModel otherBean) {
- this.propertyName = propertyName;
- this.otherBean = otherBean;
- }
-
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- otherBean.firePropertyChanged(propertyName, evt.getOldValue(), evt.getNewValue());
- }
- }
+// private static class PropagateProperyChangeListener implements PropertyChangeListener {
+//
+// private String propertyName;
+//
+// private AbstractTuttiBeanUIModel otherBean;
+//
+// public PropagatePropertyChangeLstener(String propertyName,
+// AbstractTuttiBeanUIModel otherBean) {
+// this.propertyName = propertyName;
+// this.otherBean = otherBean;
+// }
+//
+// @Override
+// public void propertyChange(PropertyChangeEvent evt) {
+// otherBean.firePropertyChanged(propertyName, evt.getOldValue(), evt.getNewValue());
+// }
+// }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/AbstractTuttiAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -26,7 +26,7 @@
import com.google.common.base.Preconditions;
import fr.ifremer.tutti.persistence.ProgressionModel;
-import fr.ifremer.tutti.ui.swing.TuttiDataContext;
+import fr.ifremer.tutti.service.TuttiDataContext;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.config.TuttiApplicationConfig;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiUIHandler;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiUIAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiUIAction.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/action/TuttiUIAction.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,7 +24,6 @@
* #L%
*/
-import fr.ifremer.tutti.persistence.entities.referential.ObjectType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -56,7 +55,7 @@
private static final String LOGIC_ACTION = "logicAction";
- private final Object lock = new ObjectType();
+ private final Object lock = new Object();
private boolean wait;
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentEditorUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/attachment/AttachmentEditorUIHandler.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.TuttiBeanFactory;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.service.PersistenceService;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
@@ -203,7 +204,7 @@
public void addAttachment() {
AttachmentModelAware bean = ui.getBean();
- Attachment attachment = new Attachment();
+ Attachment attachment = TuttiBeanFactory.newAttachment();
File file = ui.getFile().getSelectedFile();
if (file != null) {
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/SelectSpeciesUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/SelectSpeciesUIModel.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/species/SelectSpeciesUIModel.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -69,4 +69,8 @@
firePropertyChange(PROPERTY_SELECTED_SPECIES, oldValue, selectedSpecies);
}
+ @Override
+ protected SelectSpeciesUIModel newEntity() {
+ return new SelectSpeciesUIModel();
+ }
}
Deleted: 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-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/cruise/EditCruiseUIModel-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,126 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.cruise.name.required</message>
- </field-validator>
- </field>
-
- <field name="program">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.cruise.program.required</message>
- </field-validator>
- </field>
-
- <field name="departureLocation">
- <field-validator type="required" short-circuit="true">
- <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>
- </field-validator>
- </field>
-
- <field name="beginDate">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.cruise.beginDate.required</message>
- </field-validator>
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ endDate == null || beginDate.compareTo(endDate) < 0 ]]>
- </param>
- <message>tutti.validator.error.cruise.dates.endBeforeStart</message>
- </field-validator>
- </field>
-
- <field name="endDate">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.cruise.endDate.required</message>
- </field-validator>
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ beginDate == null || beginDate.compareTo(endDate) < 0 ]]>
- </param>
- <message>tutti.validator.error.cruise.dates.endBeforeStart</message>
- </field-validator>
- </field>
-
- <field name="vessel">
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.cruise.vessel.required</message>
- </field-validator>
- </field>
-
- <field name="gear">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gear != null && !gear.empty ]]>
- </param>
- <message>tutti.validator.error.cruise.gear.required</message>
- </field-validator>
- </field>
-
- <field name="headOfMission">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ headOfMission != null && !headOfMission.empty ]]>
- </param>
- <message>tutti.validator.error.cruise.headOfMission.required</message>
- </field-validator>
- </field>
-
- <field name="headOfSortRoom">
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ headOfSortRoom != null && !headOfSortRoom.empty ]]>
- </param>
- <message>tutti.validator.error.cruise.headOfSortRoom.required</message>
- </field-validator>
- </field>
-
- <field name="comment">
- <field-validator type="stringlength" short-circuit="true">
- <param name="maxLength">2000</param>
- <message>tutti.validator.error.comment.too.long##${maxLength}</message>
- </field-validator>
- </field>
-
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-error-validation.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="gearShootingStartDate">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gearShootingEndDate == null || !gearShootingStartDate.after(gearShootingEndDate) ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.dates.endBeforeStart</message>
- </field-validator>
-
- </field>
-
- <field name="gearShootingEndDate">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gearShootingEndDate == null || gearShootingStartDate == null || !gearShootingStartDate.after(gearShootingEndDate) ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.dates.endBeforeStart</message>
- </field-validator>
-
- </field>
-
- <field name="comment">
- <field-validator type="stringlength" short-circuit="true">
- <param name="maxLength">2000</param>
- <message>tutti.validator.error.comment.too.long##${maxLength}</message>
- </field-validator>
- </field>
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-fatal-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-fatal-validation.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-fatal-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="stationNumber">
-
- <field-validator type="requiredstring" short-circuit="true">
- <message>
- tutti.validator.error.fishingOperation.stationNumber.required
- </message>
- </field-validator>
-
- <field-validator type="stringlength" short-circuit="true">
- <param name="maxLength">40</param>
- <message>
- tutti.validator.error.fishingOperation.stationNumber.too.long##${maxLength}
- </message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingOperations</param>
- <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.fishingOperation.existingKey</message>
- </field-validator>
-
- </field>
-
- <field name="fishingOperationNumber">
-
- <field-validator type="required" short-circuit="true">
- <message>
- tutti.validator.error.fishingOperation.fishingOperationNumber.required
- </message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingOperations</param>
- <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.fishingOperation.existingKey</message>
- </field-validator>
-
- </field>
-
- <field name="multirigAggregation">
-
- <field-validator type="required" short-circuit="true">
- <message>
- tutti.validator.error.fishingOperation.trawlNetNumber.required
- </message>
- </field-validator>
-
- </field>
-
- <field name="gearShootingStartDate">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.date.start.required</message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingOperations</param>
- <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.fishingOperation.existingKey</message>
- </field-validator>
-
- </field>
-</validators>
Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-warning-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-warning-validation.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-edit-warning-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -23,40 +23,12 @@
#L%
-->
-
<!DOCTYPE validators PUBLIC
"-//Apache Struts//XWork Validator 1.0.3//EN"
"http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
<validators>
- <field name='strata'>
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ strata != null || subStrata != null || location != null ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
- </field-validator>
- </field>
-
- <field name='subStrata'>
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ strata != null || subStrata != null || location != null ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
- </field-validator>
- </field>
-
- <field name='location'>
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ strata != null || subStrata != null || location != null ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
- </field-validator>
- </field>
-
<field name="gearShootingStartDate">
<field-validator type="fieldexpression" short-circuit="true">
@@ -101,34 +73,6 @@
</field>
- <!--gear shooting start latitude validation -->
-
- <field name="gearShootingStartLatitude">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) || gearShootingStartLatitude != null
- ]]>
- </param>
-
- <message>tutti.validator.error.latitude.start.required</message>
- </field-validator>
-
- <field-validator type="fieldexpressionwithparams">
- <param name="doubleParams">min:90.0|max:90.0</param>
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) ||
- ( -doubles.min <= gearShootingStartLatitude && gearShootingStartLatitude <= doubles.max )
- ]]>
- </param>
-
- <message>tutti.validator.warning.latitude.outOfBounds</message>
- </field-validator>
-
- </field>
-
<field name="gearShootingStartLatitudeDegree">
<field-validator type="fieldexpression" short-circuit="true">
@@ -274,35 +218,6 @@
</field>
- <!--gear shooting start longitude validation -->
-
- <field name="gearShootingStartLongitude">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) || gearShootingStartLongitude != null
- ]]>
- </param>
-
- <message>tutti.validator.error.longitude.start.required</message>
- </field-validator>
-
- <field-validator type="fieldexpressionwithparams">
- <param name="doubleParams">min:180.0|max:180.0</param>
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) ||
- ( -doubles.min <= gearShootingStartLongitude && gearShootingStartLongitude <= doubles.max )
- ]]>
- </param>
-
- <message>tutti.validator.warning.longitude.outOfBounds</message>
-
- </field-validator>
-
- </field>
-
<field name="gearShootingStartLongitudeDegree">
<field-validator type="fieldexpression" short-circuit="true">
@@ -448,36 +363,6 @@
</field>
- <!--gear shooting end latitude validation -->
-
- <field name="gearShootingEndLatitude">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) || gearShootingEndLatitude != null
- ]]>
- </param>
-
- <message>tutti.validator.error.latitude.end.required</message>
- </field-validator>
-
- <field-validator type="fieldexpressionwithparams">
- <param name="doubleParams">min:90.0|max:90.0</param>
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) ||
- ( -doubles.min <= gearShootingEndLatitude && gearShootingEndLatitude <= doubles.max )
- ]]>
- </param>
-
- <message>tutti.validator.warning.latitude.outOfBounds</message>
-
- </field-validator>
-
- </field>
-
-
<field name="gearShootingEndLatitudeDegree">
<field-validator type="fieldexpression" short-circuit="true">
@@ -623,35 +508,6 @@
</field>
- <!--gear shooting end longitude validation -->
-
- <field name="gearShootingEndLongitude">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) || gearShootingEndLongitude != null
- ]]>
- </param>
-
- <message>tutti.validator.error.longitude.end.required</message>
- </field-validator>
-
- <field-validator type="fieldexpressionwithparams">
- <param name="doubleParams">min:180.0|max:180.0</param>
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) ||
- ( -doubles.min <= gearShootingEndLongitude && gearShootingEndLongitude <= doubles.max )
- ]]>
- </param>
-
- <message>tutti.validator.warning.longitude.outOfBounds</message>
-
- </field-validator>
-
- </field>
-
<field name="gearShootingEndLongitudeDegree">
<field-validator type="fieldexpression" short-circuit="true">
@@ -797,61 +653,4 @@
</field>
- <field name="trawlDistance">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ trawlDistance == null || trawlDistance <= 5556 ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.trawlDistance.tooLong</message>
- </field-validator>
-
- </field>
-
- <field name="fishingOperationValid">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.fishingOperationValid.required</message>
- </field-validator>
-
- </field>
-
- <field name="recorderPerson">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ recorderPerson != null && !recorderPerson.isEmpty() ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.catcher.required</message>
- </field-validator>
-
- </field>
-
- <field name="vessel">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.vessel.required</message>
- </field-validator>
-
- </field>
-
- <field name="gear">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.gear.required</message>
- </field-validator>
-
- </field>
-
- <field name="comment">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ fishingOperationValid == null || fishingOperationValid || (comment != null && !comment.isEmpty()) ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.comment.required</message>
- </field-validator>
-
- </field>
-
</validators>
Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -27,104 +27,6 @@
"http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
<validators>
- <field name='strata'>
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ strata != null || subStrata != null || location != null ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
- </field-validator>
- </field>
-
- <field name='subStrata'>
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ strata != null || subStrata != null || location != null ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
- </field-validator>
- </field>
-
- <field name='location'>
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ strata != null || subStrata != null || location != null ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.strataLocation.required</message>
- </field-validator>
- </field>
-
- <field name="gearShootingStartDate">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gearShootingEndDate == null || gearShootingStartDate.before(gearShootingEndDate) ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.dates.endBeforeStart</message>
- </field-validator>
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ isDateInCruise(gearShootingStartDate) ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.dates.startOutOfCruiseDates</message>
- </field-validator>
-
- </field>
-
- <field name="gearShootingEndDate">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.date.end.required</message>
- </field-validator>
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gearShootingStartDate == null || gearShootingStartDate.before(gearShootingEndDate) ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.dates.endBeforeStart</message>
- </field-validator>
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gearShootingEndDate == null || isDateInCruise(gearShootingEndDate) ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.dates.startOutOfCruiseDates</message>
- </field-validator>
-
- </field>
-
- <!--gear shooting start latitude validation -->
-
- <field name="gearShootingStartLatitude">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) || gearShootingStartLatitude != null
- ]]>
- </param>
-
- <message>tutti.validator.error.latitude.start.required</message>
- </field-validator>
-
- <field-validator type="fieldexpressionwithparams">
- <param name="doubleParams">min:90.0|max:90.0</param>
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) ||
- ( gearShootingStartLatitude != null
- && -doubles.min <= gearShootingStartLatitude
- && gearShootingStartLatitude <= doubles.max )
- ]]>
- </param>
-
- <message>tutti.validator.warning.latitude.outOfBounds</message>
-
- </field-validator>
-
- </field>
-
<field name="gearShootingStartLatitudeDegree">
<field-validator type="fieldexpression" short-circuit="true">
@@ -278,37 +180,6 @@
</field>
- <!--gear shooting start longitude validation -->
-
- <field name="gearShootingStartLongitude">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) || gearShootingStartLongitude != null
- ]]>
- </param>
-
- <message>tutti.validator.error.longitude.start.required</message>
- </field-validator>
-
- <field-validator type="fieldexpressionwithparams">
- <param name="doubleParams">min:180.0|max:180.0</param>
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) ||
- ( gearShootingStartLongitude != null
- && -doubles.min <= gearShootingStartLongitude
- && gearShootingStartLongitude <= doubles.max )
- ]]>
- </param>
-
- <message>tutti.validator.warning.longitude.outOfBounds</message>
-
- </field-validator>
-
- </field>
-
<field name="gearShootingStartLongitudeDegree">
<field-validator type="fieldexpression" short-circuit="true">
@@ -462,38 +333,6 @@
</field>
- <!--gear shooting end latitude validation -->
-
- <field name="gearShootingEndLatitude">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) || gearShootingEndLatitude != null
- ]]>
- </param>
-
- <message>tutti.validator.error.latitude.end.required</message>
- </field-validator>
-
- <field-validator type="fieldexpressionwithparams">
- <param name="doubleParams">min:90.0|max:90.0</param>
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) ||
- ( gearShootingEndLatitude != null
- && -doubles.min <= gearShootingEndLatitude
- && gearShootingEndLatitude <= doubles.max )
- ]]>
- </param>
-
- <message>tutti.validator.warning.latitude.outOfBounds</message>
-
- </field-validator>
-
- </field>
-
-
<field name="gearShootingEndLatitudeDegree">
<field-validator type="fieldexpression" short-circuit="true">
@@ -647,37 +486,6 @@
</field>
- <!--gear shooting end longitude validation -->
-
- <field name="gearShootingEndLongitude">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) || gearShootingEndLongitude != null
- ]]>
- </param>
-
- <message>tutti.validator.error.longitude.end.required</message>
- </field-validator>
-
- <field-validator type="fieldexpressionwithparams">
- <param name="doubleParams">min:180.0|max:180.0</param>
- <param name="expression">
- <![CDATA[
- !"DD".equals(coordinateEditorType.toString()) ||
- ( gearShootingEndLongitude != null
- && -doubles.min <= gearShootingEndLongitude
- && gearShootingEndLongitude <= doubles.max )
- ]]>
- </param>
-
- <message>tutti.validator.warning.longitude.outOfBounds</message>
-
- </field-validator>
-
- </field>
-
<field name="gearShootingEndLongitudeDegree">
<field-validator type="fieldexpression" short-circuit="true">
@@ -831,63 +639,4 @@
</field>
- <field name="trawlDistance">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.trawlDistance.required</message>
- </field-validator>
-
- </field>
-
- <field name="fishingOperationValid">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.fishingOperationValid.required</message>
- </field-validator>
-
- </field>
-
- <field name="recorderPerson">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ recorderPerson != null && !recorderPerson.isEmpty() ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.catcher.required</message>
- </field-validator>
-
- </field>
-
- <field name="vessel">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.vessel.required</message>
- </field-validator>
-
- </field>
-
- <field name="gear">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.gear.required</message>
- </field-validator>
-
- </field>
-
- <field name="comment">
-
- <field-validator type="stringlength" short-circuit="true">
- <param name="maxLength">2000</param>
- <message>tutti.validator.error.comment.too.long##${maxLength}</message>
- </field-validator>
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ fishingOperationValid == null || fishingOperationValid || (comment != null && !comment.isEmpty()) ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.comment.required</message>
- </field-validator>
-
- </field>
-
</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-fatal-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-fatal-validation.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-fatal-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,98 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%L
- Tutti :: UI
- $Id: EditFishingOperationUIModel-edit-error-validation.xml 553 2013-03-06 17:22:48Z kmorin $
- $HeadURL: http://svn.forge.codelutin.com/svn/tutti/trunk/tutti-ui-swing/src/main/reso… $
- %%
- 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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="stationNumber">
-
- <field-validator type="requiredstring" short-circuit="true">
- <message>
- tutti.validator.error.fishingOperation.stationNumber.required
- </message>
- </field-validator>
-
- <field-validator type="stringlength" short-circuit="true">
- <param name="maxLength">40</param>
- <message>
- tutti.validator.error.fishingOperation.stationNumber.too.long##${maxLength}
- </message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingOperations</param>
- <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.fishingOperation.existingKey</message>
- </field-validator>
-
- </field>
-
- <field name="fishingOperationNumber">
-
- <field-validator type="required" short-circuit="true">
- <message>
- tutti.validator.error.fishingOperation.fishingOperationNumber.required
- </message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingOperations</param>
- <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.fishingOperation.existingKey</message>
- </field-validator>
-
- </field>
-
- <field name="multirigAggregation">
-
- <field-validator type="required" short-circuit="true">
- <message>
- tutti.validator.error.fishingOperation.trawlNetNumber.required
- </message>
- </field-validator>
-
- </field>
-
- <field name="gearShootingStartDate">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.fishingOperation.date.start.required</message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingOperations</param>
- <param name="keys">stationNumber, fishingOperationNumber, gearShootingStartDate</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.fishingOperation.existingKey</message>
- </field-validator>
-
- </field>
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-warning-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-warning-validation.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationUIModel-validate-warning-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-
-
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-
-<validators>
-
- <field name="gearShootingStartDate">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gearShootingStartDate == null || gearShootingEndDate == null
- || org.nuiton.util.DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate) <= 45
- && org.nuiton.util.DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate) >= 20 )
- ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.dates.wrongTime</message>
- </field-validator>
-
- </field>
-
- <field name="gearShootingEndDate">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ gearShootingStartDate == null || gearShootingEndDate == null
- || org.nuiton.util.DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate) <= 45
- && org.nuiton.util.DateUtil.getDifferenceInMinutes(gearShootingStartDate, gearShootingEndDate) >= 20 )
- ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.dates.wrongTime</message>
- </field-validator>
-
- </field>
-
- <field name="trawlDistance">
-
- <field-validator type="fieldexpression" short-circuit="true">
- <param name="expression">
- <![CDATA[ trawlDistance == null || trawlDistance <= 5556 ]]>
- </param>
- <message>tutti.validator.error.fishingOperation.trawlDistance.tooLong</message>
- </field-validator>
-
- </field>
-
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/program/EditProgramUIModel-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
-
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.program.name.required</message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingPrograms</param>
- <param name="keys">name, zone</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.program.existingKey</message>
- </field-validator>
-
- </field>
-
- <field name="zone">
-
- <field-validator type="required" short-circuit="true">
- <message>tutti.validator.error.program.zone.required</message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingPrograms</param>
- <param name="keys">name, zone</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.program.existingKey</message>
- </field-validator>
-
- </field>
-
- <field name="description">
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.program.description.required</message>
- </field-validator>
- <field-validator type="stringlength" short-circuit="true">
- <param name="maxLength">2000</param>
- <message>tutti.validator.error.program.description.too.long##${maxLength}</message>
- </field-validator>
- </field>
-
-</validators>
Deleted: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/protocol/EditProtocolUIModel-error-validation.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,51 +0,0 @@
-<!--
- #%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%
- -->
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator 1.0.3//EN"
- "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd">
-<validators>
-
- <field name="name">
- <field-validator type="requiredstring" short-circuit="true">
- <message>tutti.validator.error.protocol.name.required</message>
- </field-validator>
-
- <field-validator type="collectionUniqueKey" short-circuit="true">
- <param name="collectionFieldName">existingProtocols</param>
- <param name="keys">name</param>
- <param name="againstMe">true</param>
- <param name="nullValueSkipped">true</param>
- <message>tutti.validator.error.protocol.name.alreadyUsed</message>
- </field-validator>
-
- </field>
-
- <field name="comment">
- <field-validator type="stringlength" short-circuit="true">
- <param name="maxLength">2000</param>
- <message>tutti.validator.error.comment.too.long##${maxLength}</message>
- </field-validator>
- </field>
-
-</validators>
\ No newline at end of file
Deleted: trunk/tutti-ui-swing/src/main/resources/validators.xml
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/validators.xml 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/main/resources/validators.xml 2013-04-01 20:46:21 UTC (rev 715)
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- #%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%
- -->
-
-
-<!DOCTYPE validators PUBLIC
- "-//Apache Struts//XWork Validator Config 1.0//EN"
- "http://struts.apache.org/dtds/xwork-validator-config-1.0.dtd">
-<validators>
-
- <!-- les validateurs fournis par XWork -->
- <validator name="required" class="com.opensymphony.xwork2.validator.validators.RequiredFieldValidator"/>
- <validator name="requiredstring" class="com.opensymphony.xwork2.validator.validators.RequiredStringValidator"/>
- <validator name="regex" class="com.opensymphony.xwork2.validator.validators.RegexFieldValidator"/>
- <validator name="stringlength" class="com.opensymphony.xwork2.validator.validators.StringLengthFieldValidator"/>
- <validator name="int" class="com.opensymphony.xwork2.validator.validators.IntRangeFieldValidator"/>
- <validator name="long" class="com.opensymphony.xwork2.validator.validators.LongRangeFieldValidator"/>
- <validator name="short" class="com.opensymphony.xwork2.validator.validators.ShortRangeFieldValidator"/>
- <validator name="double" class="com.opensymphony.xwork2.validator.validators.DoubleRangeFieldValidator"/>
- <validator name="date" class="com.opensymphony.xwork2.validator.validators.DateRangeFieldValidator"/>
- <validator name="fieldexpression" class="com.opensymphony.xwork2.validator.validators.FieldExpressionValidator"/>
- <validator name="email" class="com.opensymphony.xwork2.validator.validators.EmailValidator"/>
-
- <!-- les validateurs fournis par nuiton-validator -->
- <validator name="collectionUniqueKey" class="org.nuiton.validator.xwork2.field.CollectionUniqueKeyValidator"/>
- <validator name="fieldexpressionwithparams" class="org.nuiton.validator.xwork2.field.FieldExpressionWithParamsValidator"/>
-
-</validators>
Modified: trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/BeanValidatorDetectorTest.java
===================================================================
--- trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/BeanValidatorDetectorTest.java 2013-03-29 16:53:13 UTC (rev 714)
+++ trunk/tutti-ui-swing/src/test/java/fr/ifremer/tutti/ui/swing/BeanValidatorDetectorTest.java 2013-04-01 20:46:21 UTC (rev 715)
@@ -32,8 +32,6 @@
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.CreateSpeciesBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.frequency.SpeciesFrequencyUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.species.split.SplitSpeciesBatchUIModel;
-import fr.ifremer.tutti.ui.swing.content.program.EditProgramUIModel;
-import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolUIModel;
import org.junit.BeforeClass;
import org.junit.Test;
import org.nuiton.validator.AbstractValidatorDetectorTest;
@@ -69,8 +67,6 @@
public static void setUpClass() throws Exception {
ALL_TYPES = new Class[]{
EditCruiseUIModel.class,
- EditProgramUIModel.class,
- EditProtocolUIModel.class,
EditFishingOperationUIModel.class,
CreateBenthosBatchUIModel.class,
CreateSpeciesBatchUIModel.class,
@@ -92,7 +88,7 @@
SortedSet<NuitonValidator<?>> validators = detectValidators(ALL_TYPES);
assertFalse(validators.isEmpty());
- assertEquals(11, validators.size());
+ assertEquals(9, validators.size());
}
@Test
@@ -107,8 +103,6 @@
CreateBenthosBatchUIModel.class,
CreateSpeciesBatchUIModel.class,
EditCruiseUIModel.class,
- EditProgramUIModel.class,
- EditProtocolUIModel.class,
SpeciesFrequencyUIModel.class,
SplitBenthosBatchUIModel.class,
SplitSpeciesBatchUIModel.class
1
0