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
- 4058 discussions
r726 - trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service
by tchemit@users.forge.codelutin.com 04 Apr '13
by tchemit@users.forge.codelutin.com 04 Apr '13
04 Apr '13
Author: tchemit
Date: 2013-04-04 09:47:59 +0200 (Thu, 04 Apr 2013)
New Revision: 726
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/726
Log:
improve tests
Modified:
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java
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-04-04 06:12:12 UTC (rev 725)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceWriteTest.java 2013-04-04 07:47:59 UTC (rev 726)
@@ -71,19 +71,9 @@
protected SpeciesBatchPersistenceService service;
- protected CatchBatchPersistenceService catchBatchService;
-
- protected CruisePersistenceService cruiseService;
-
- protected FishingOperationPersistenceService fishingOperationService;
-
- protected ReferentialPersistenceService referentialService;
-
/*
* Entities prepared in setUp() :
* */
- protected Cruise cruise;
-
protected FishingOperation fishingOperationNoCatchBatch;
protected FishingOperation fishingOperationWithEmptyBatch;
@@ -116,16 +106,17 @@
public void setUp() throws Exception {
service = TuttiPersistenceServiceLocator.getSpeciesBatchPersistenceService();
- cruiseService = TuttiPersistenceServiceLocator.getCruisePersistenceService();
- catchBatchService = TuttiPersistenceServiceLocator.getCatchBatchPersistenceService();
- fishingOperationService = TuttiPersistenceServiceLocator.getFishingOperationPersistenceService();
- referentialService = TuttiPersistenceServiceLocator.getReferentialPersistenceService();
+ CruisePersistenceService cruiseService = TuttiPersistenceServiceLocator.getCruisePersistenceService();
+ CatchBatchPersistenceService catchBatchService = TuttiPersistenceServiceLocator.getCatchBatchPersistenceService();
+ FishingOperationPersistenceService fishingOperationService = TuttiPersistenceServiceLocator.getFishingOperationPersistenceService();
+ ReferentialPersistenceService referentialService = TuttiPersistenceServiceLocator.getReferentialPersistenceService();
+
species = referentialService.getAllSpecies();
assertNotNull(species);
assertTrue(species.size() > 2);
- cruise = cruiseService.getCruise(dbResource.getFixtures().cruiseId());
+ Cruise cruise = cruiseService.getCruise(dbResource.getFixtures().cruiseId());
cruise.setId((String) null);
Calendar calendar = new GregorianCalendar();
cruise.setBeginDate(calendar.getTime());
1
0
r725 - trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service
by tchemit@users.forge.codelutin.com 04 Apr '13
by tchemit@users.forge.codelutin.com 04 Apr '13
04 Apr '13
Author: tchemit
Date: 2013-04-04 08:12:12 +0200 (Thu, 04 Apr 2013)
New Revision: 725
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/725
Log:
fix test
Modified:
trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java
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-04 05:49:42 UTC (rev 724)
+++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java 2013-04-04 06:12:12 UTC (rev 725)
@@ -129,12 +129,12 @@
String zoneId = dbResource.getFixtures().zoneId();
List<TuttiLocation> result =
service.getAllFishingOperationSubStrata(zoneId, null);
- assertResultList(result, 76);
+ assertResultList(result, 0);
// try with a strataId
String strataId = dbResource.getFixtures().strataId();
result = service.getAllFishingOperationSubStrata(zoneId, strataId);
- assertResultList(result, 1);
+ assertResultList(result, 0);
}
@Test
1
0
r724 - trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch
by tchemit@users.forge.codelutin.com 04 Apr '13
by tchemit@users.forge.codelutin.com 04 Apr '13
04 Apr '13
Author: tchemit
Date: 2013-04-04 07:49:42 +0200 (Thu, 04 Apr 2013)
New Revision: 724
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/724
Log:
refs #2227: [CAPTURE] Revoir la structure de l'arbre d'?\195?\169chantillonage (fix SpeciesBatch)
Modified:
trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java
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 18:25:40 UTC (rev 723)
+++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/batch/BatchPersistenceHelper.java 2013-04-04 05:49:42 UTC (rev 724)
@@ -347,17 +347,6 @@
if (sortingMeasurements != null) {
sortingMeasurements.removeAll(notChangedSortingMeasurements);
}
-// if (target.getQuantificationMeasurements() != null && notChangedQuantificationMeasurements.size() > 0) {
-// for (QuantificationMeasurement qm : notChangedQuantificationMeasurements) {
-// target.getQuantificationMeasurements().remove(qm);
-// }
-// }
-//
-// if (target.getSortingMeasurements() != null && notChangedSortingMeasurements.size() > 0) {
-// for (SortingMeasurement sm : notChangedSortingMeasurements) {
-// target.getSortingMeasurements().remove(sm);
-// }
-// }
}
protected void setBatchParents(SpeciesBatch source,
@@ -388,18 +377,11 @@
}
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(),
+ BATCH_PMFM_ID, pmfmId, qualitativeValueId, // vrac | hors vrac
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);
+ BATCH_PMFM_ID, enumeration.PMFM_ID_SORTING_TYPE_2, enumeration.QUALITATIVE_ID_SORTING_TYPE_2_ALIVE_ITEMIZED // vivant trié
+ );
}
@@ -487,17 +469,6 @@
if (sortingMeasurements != null) {
sortingMeasurements.removeAll(notChangedSortingMeasurements);
}
-
-// if (target.getQuantificationMeasurements() != null && notChangedQuantificationMeasurements.size() > 0) {
-// for (QuantificationMeasurement qm : notChangedQuantificationMeasurements) {
-// target.getQuantificationMeasurements().remove(qm);
-// }
-// }
-// if (target.getSortingMeasurements() != null && notChangedSortingMeasurements.size() > 0) {
-// for (SortingMeasurement sm : notChangedSortingMeasurements) {
-// target.getSortingMeasurements().remove(sm);
-// }
-// }
}
protected Integer convertSampleCategoryValueIntoQualitativeId(Serializable value) {
1
0
03 Apr '13
Author: tchemit
Date: 2013-04-03 20:25:40 +0200 (Wed, 03 Apr 2013)
New Revision: 723
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/723
Log:
- fix speciesToConfirm (Species and Benthos)
- refs #1865: [MACRODECHET] - Gestion de la saisie des Macrod?\195?\169chets (contienu on ui)
- remove CommentModelAware
- continue to refactor models (using entity contract?\195?\160
Added:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java
Removed:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentModelAware.java
Modified:
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/content/operation/EditFishingOperationAction.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
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/EditCatchesUIHandler.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/accidental/AccidentalBatchTableModel.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/BenthosBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.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/MarineLitterBatchTableModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css
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/MarineLitterBatchUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java
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/PlanktonBatchTableModel.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/SpeciesBatchUI.jaxx
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/SpeciesBatchUIModel.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/ButtonComment.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentCellEditor.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentEditorUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentEditorUIHandler.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-04-03 18:25:40 UTC (rev 723)
@@ -1,28 +1,5 @@
-###
-# #%L
-# Tutti :: UI
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2012 - 2013 Ifremer
-# %%
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this program. If not, see
-# <http://www.gnu.org/licenses/gpl-3.0.html>.
-# #L%
-###
#Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo
-#Fri Mar 29 10:09:57 CET 2013
+#Wed Apr 03 18:09:43 CEST 2013
tutti.createBenthosBatch.action.addSpecies.help=createBenthosBatch.html\#actions
tutti.createBenthosBatch.action.cancel.help=createBenthosBatch.html\#actions
tutti.createBenthosBatch.action.save.help=createBenthosBatch.html\#actions
@@ -141,6 +118,7 @@
tutti.editFishingOperation.field.trawlDistance.help=editFishingOperation.html\#fields
tutti.editFishingOperation.field.vessel.help=editFishingOperation.html\#fields
tutti.editFishingOperation.help=editFishingOperation.html
+tutti.editMarineLitterBatch.field.marineLitterTotalWeight.help=
tutti.editProgram.action.cancelProgram.help=editProgram.html\#actions
tutti.editProgram.action.saveProgram.help=editProgram.html\#actions
tutti.editProgram.field.description.help=editProgram.html\#fields
Modified: trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-04-03 18:25:40 UTC (rev 723)
@@ -1,28 +1,5 @@
-###
-# #%L
-# Tutti :: UI
-# $Id$
-# $HeadURL$
-# %%
-# Copyright (C) 2012 - 2013 Ifremer
-# %%
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with this program. If not, see
-# <http://www.gnu.org/licenses/gpl-3.0.html>.
-# #L%
-###
#Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo
-#Fri Mar 29 10:09:57 CET 2013
+#Wed Apr 03 18:09:43 CEST 2013
tutti.createBenthosBatch.action.addSpecies.help=createBenthosBatch.html\#actions
tutti.createBenthosBatch.action.cancel.help=createBenthosBatch.html\#actions
tutti.createBenthosBatch.action.save.help=createBenthosBatch.html\#actions
@@ -150,6 +127,7 @@
tutti.editFishingOperation.field.trawlDistance.help=editFishingOperation.html\#fields
tutti.editFishingOperation.field.vessel.help=editFishingOperation.html\#fields
tutti.editFishingOperation.help=editFishingOperation.html
+tutti.editMarineLitterBatch.field.marineLitterTotalWeight.help=
tutti.editProgram.action.cancelProgram.help=editProgram.html\#actions
tutti.editProgram.action.saveProgram.help=editProgram.html\#actions
tutti.editProgram.field.description.help=editProgram.html\#fields
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-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/EditFishingOperationAction.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -559,8 +559,8 @@
ui.getCatchesCaracteristicsTabPane().setTitle(fishingOperationText);
ui.getSpeciesTabFishingOperationReminderLabel().setTitle(fishingOperationText);
ui.getBenthosTabFishingOperationReminderLabel().setTitle(fishingOperationText);
+ ui.getMarineLitterTabFishingOperationReminderLabel().setTitle(fishingOperationText);
// ui.getPlanktonTabFishingOperationReminderLabel().setTitle(fishingOperationText);
-// ui.getMarineLitterTabFishingOperationReminderLabel().setTitle(fishingOperationText);
// ui.getAccidentalTabFishingOperationReminderLabel().setTitle(fishingOperationText);
if (loadOtherTabs) {
@@ -569,8 +569,8 @@
ui.getSpeciesTabContent().getHandler().selectFishingOperation(batch == null ? null : bean);
ui.getBenthosTabContent().getHandler().selectFishingOperation(batch == null ? null : bean);
+ ui.getMarineLitterTabContent().getHandler().selectFishingOperation(batch == null ? null : bean);
// ui.getPlanktonTabContent().getHandler().selectFishingOperation(bean);
-// ui.getMarineLitterTabContent().getHandler().selectFishingOperation(bean);
// ui.getAccidentalTabContent().getHandler().selectFishingOperation(bean);
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2013-04-03 18:25:40 UTC (rev 723)
@@ -68,6 +68,10 @@
rightDecoration: {benthosTabContent.getBenthosBatchTabToolBar()};
}
+#marineLitterTabFishingOperationReminderLabel {
+ rightDecoration: {marineLitterTabContent.getMarineLitterBatchTabToolBar()};
+}
+
#catchTable {
border: {BorderFactory.createTitledBorder(_("tutti.editCatchBatch.legend.total"))};
}
@@ -263,7 +267,6 @@
_computed: true;
}
-
#marineLitterTable {
border: {BorderFactory.createTitledBorder(_("tutti.editCatchBatch.legend.marineLitter"))};
}
@@ -277,17 +280,16 @@
}
#marineLitterTotalWeightField {
- _computed: true;
+ property: marineLitterTotalWeight;
+ model: {model.getMarineLitterTotalWeight()};
+ useFloat: false;
+ numberPattern: {INT_6_DIGITS_PATTERN};
}
#planktonTab {
enabled: {false};
}
-#marineLitterTab {
- enabled: {false};
-}
-
#accidentalTab {
enabled: {false};
}
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-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2013-04-03 18:25:40 UTC (rev 723)
@@ -30,6 +30,7 @@
fr.ifremer.tutti.ui.swing.content.operation.FishingOperationsUI
fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.AccidentalBatchUI
fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchUI
+ fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter.MarineLitterBatchUI
fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency.BenthosFrequencyUI
fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.create.CreateBenthosBatchUI
fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.split.SplitBenthosBatchUI
@@ -75,10 +76,7 @@
<BeanValidator id='validator' bean='model'
uiClass='jaxx.runtime.validator.swing.ui.ImageValidationUI'>
<field name='catchTotalWeight' component='catchTotalWeightField'/>
- <!-- <field name='catchTotalSortedTremisWeight'
- component='catchTotalSortedTremisWeightField'/>
- <field name='catchTotalSortedCarousselWeight'
- component='catchTotalSortedCarousselWeightField'/>-->
+
<field name='catchTotalRejectedWeight'
component='catchTotalRejectedWeightField'/>
@@ -288,7 +286,8 @@
<JLabel id='marineLitterTotalWeightLabel'/>
</cell>
<cell weightx='1.0'>
- <JTextField id='marineLitterTotalWeightField'/>
+ <NumberEditor id='marineLitterTotalWeightField'
+ constructorParams='this'/>
</cell>
</row>
@@ -347,16 +346,18 @@
</JXTitledPanel>
</JPanel>
</tab>
+ <tab id='marineLitterTab' title='tutti.label.tab.marineLitter'>
+ <JXTitledPanel id='marineLitterTabFishingOperationReminderLabel'>
+ <MarineLitterBatchUI id='marineLitterTabContent'
+ constructorParams='this'/>
+ </JXTitledPanel>
+ </tab>
<tab id='planktonTab' title='tutti.label.tab.plancton'>
<!--JXTitledPanel id='planktonTabFishingOperationReminderLabel'>
<PlanktonBatchUI id='planktonTabContent' constructorParams='this'/>
</JXTitledPanel-->
</tab>
- <tab id='marineLitterTab' title='tutti.label.tab.marineLitter'>
- <!--JXTitledPanel id='marineLitterTabFishingOperationReminderLabel'>
- <MarineLitterBatchUI id='marineLitterTabContent' constructorParams='this'/>
- </JXTitledPanel-->
- </tab>
+
<tab id='accidentalTab' title='tutti.label.tab.accidentel'>
<!--JXTitledPanel id='accidentalTabFishingOperationReminderLabel'>
<AccidentalBatchUI id='accidentalTabContent' constructorParams='this'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -86,6 +86,7 @@
super(parentUi.getHandler().getContext(), ui);
this.parentUi = parentUi;
this.catchBatchMonitor = new TuttiBeanMonitor<EditCatchesUIModel>(
+ EditCatchesUIModel.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT,
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_SORTED_WEIGHT,
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_INERT_WEIGHT,
EditCatchesUIModel.PROPERTY_SPECIES_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT,
@@ -120,6 +121,7 @@
setCustomTab(0, model);
setCustomTab(1, ui.getSpeciesTabContent().getModel());
setCustomTab(2, ui.getBenthosTabContent().getModel());
+ setCustomTab(3, ui.getMarineLitterTabContent().getModel());
getParentUi().getFishingOperationTabContent().getModel()
.addPropertyChangeListener(EditFishingOperationUIModel.PROPERTY_VESSEL, new PropertyChangeListener() {
@@ -141,8 +143,8 @@
// close batches tabs, then general tab
closeUI(ui.getSpeciesTabContent());
closeUI(ui.getBenthosTabContent());
+ closeUI(ui.getMarineLitterTabContent());
// closeUI(ui.getPlanktonTabContent());
-// closeUI(ui.getMarineLitterTabContent());
// closeUI(ui.getAccidentalTabContent());
}
@@ -185,6 +187,7 @@
ui.getCatchesCaracteristicsAttachmentsButton().onCloseUI();
ui.getSpeciesTabContent().getSpeciesBatchAttachmentsButton().onCloseUI();
ui.getBenthosTabContent().getBenthosBatchAttachmentsButton().onCloseUI();
+ ui.getMarineLitterTabContent().getMarineLitterBatchAttachmentsButton().onCloseUI();
return super.onTabChanged(currentIndex, newIndex);
}
@@ -194,6 +197,7 @@
ui.getCatchesCaracteristicsAttachmentsButton().onCloseUI();
ui.getSpeciesTabContent().getSpeciesBatchAttachmentsButton().onCloseUI();
ui.getBenthosTabContent().getBenthosBatchAttachmentsButton().onCloseUI();
+ ui.getMarineLitterTabContent().getMarineLitterBatchAttachmentsButton().onCloseUI();
//FIXME 20130203 kmorin: cannot change tab if model is modified
// (I do not even know why it is set to modified and have no time
// before the demo)
@@ -275,7 +279,9 @@
protected void registerValidators() {
registerValidators(getValidator(),
ui.getSpeciesTabContent().getHandler().getValidator(),
- ui.getBenthosTabContent().getHandler().getValidator());
+ ui.getBenthosTabContent().getHandler().getValidator(),
+ ui.getMarineLitterTabContent().getHandler().getValidator()
+ );
}
public void setSpeciesSelectedCard(String card) {
@@ -293,20 +299,24 @@
TuttiUI tuttiUi = null;
JXTitledPanel titlePanel = null;
String title = "";
- if (CREATE_BATCH_CARD.equals(card)) {
- tuttiUi = ui.getSpeciesTabCreateBatch();
- titlePanel = ui.getSpeciesTabCreateBatchReminderLabel();
- title = n_("tutti.createSpeciesBatch.title");
+ switch (card) {
+ case CREATE_BATCH_CARD:
+ tuttiUi = ui.getSpeciesTabCreateBatch();
+ titlePanel = ui.getSpeciesTabCreateBatchReminderLabel();
+ title = n_("tutti.createSpeciesBatch.title");
- } else if (SPLIT_BATCH_CARD.equals(card)) {
- tuttiUi = ui.getSpeciesTabSplitBatch();
- titlePanel = ui.getSpeciesTabSplitBatchReminderLabel();
- title = n_("tutti.splitSpeciesBatch.title");
+ break;
+ case SPLIT_BATCH_CARD:
+ tuttiUi = ui.getSpeciesTabSplitBatch();
+ titlePanel = ui.getSpeciesTabSplitBatchReminderLabel();
+ title = n_("tutti.splitSpeciesBatch.title");
- } else if (EDIT_FREQUENCY_CARD.equals(card)) {
- tuttiUi = ui.getSpeciesTabFrequencyEditor();
- titlePanel = ui.getSpeciesTabFrequencyEditorReminderLabel();
- title = n_("tutti.editSpeciesFrequencies.title");
+ break;
+ case EDIT_FREQUENCY_CARD:
+ tuttiUi = ui.getSpeciesTabFrequencyEditor();
+ titlePanel = ui.getSpeciesTabFrequencyEditorReminderLabel();
+ title = n_("tutti.editSpeciesFrequencies.title");
+ break;
}
if (tuttiUi != null) {
@@ -334,20 +344,24 @@
TuttiUI tuttiUi = null;
JXTitledPanel titlePanel = null;
String title = "";
- if (CREATE_BATCH_CARD.equals(card)) {
- tuttiUi = ui.getBenthosTabCreateBatch();
- titlePanel = ui.getBenthosTabCreateBatchReminderLabel();
- title = n_("tutti.createBenthosBatch.title");
+ switch (card) {
+ case CREATE_BATCH_CARD:
+ tuttiUi = ui.getBenthosTabCreateBatch();
+ titlePanel = ui.getBenthosTabCreateBatchReminderLabel();
+ title = n_("tutti.createBenthosBatch.title");
- } else if (SPLIT_BATCH_CARD.equals(card)) {
- tuttiUi = ui.getBenthosTabSplitBatch();
- titlePanel = ui.getBenthosTabSplitBatchReminderLabel();
- title = n_("tutti.splitBenthosBatch.title");
+ break;
+ case SPLIT_BATCH_CARD:
+ tuttiUi = ui.getBenthosTabSplitBatch();
+ titlePanel = ui.getBenthosTabSplitBatchReminderLabel();
+ title = n_("tutti.splitBenthosBatch.title");
- } else if (EDIT_FREQUENCY_CARD.equals(card)) {
- tuttiUi = ui.getBenthosTabFrequencyEditor();
- titlePanel = ui.getBenthosTabFrequencyEditorReminderLabel();
- title = n_("tutti.editBenthosFrequencies.title");
+ break;
+ case EDIT_FREQUENCY_CARD:
+ tuttiUi = ui.getBenthosTabFrequencyEditor();
+ titlePanel = ui.getBenthosTabFrequencyEditorReminderLabel();
+ title = n_("tutti.editBenthosFrequencies.title");
+ break;
}
if (tuttiUi != 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-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchRowModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -49,32 +49,15 @@
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_SPECIES = "species";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
/**
- * Species observed.
+ * Delegate edit object.
*
- * @since 0.2
+ * @since 1.3
*/
- protected Species species;
+ protected final AccidentalBatch editObject =
+ TuttiBeanFactory.newAccidentalBatch();
/**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Comment.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
* Attachments.
*
* @since 0.2
@@ -98,48 +81,58 @@
fromBean(aBatch);
}
+ @Override
+ protected AccidentalBatch newEntity() {
+ return TuttiBeanFactory.newAccidentalBatch();
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AccidentalBatch --//
+ //------------------------------------------------------------------------//
+
+ @Override
public Species getSpecies() {
- return species;
+ return editObject.getSpecies();
}
+ @Override
public void setSpecies(Species species) {
Object oldValue = getSpecies();
- this.species = species;
+ editObject.setSpecies(species);
firePropertyChange(PROPERTY_SPECIES, oldValue, species);
}
@Override
public FishingOperation getFishingOperation() {
- return null;
+ return editObject.getFishingOperation();
}
@Override
public void setFishingOperation(FishingOperation fishingOperation) {
+ editObject.setFishingOperation(fishingOperation);
}
+ @Override
public Float getWeight() {
- return weight;
+ return editObject.getWeight();
}
+ @Override
public void setWeight(Float weight) {
Object oldValue = getWeight();
- this.weight = weight;
+ editObject.setWeight(weight);
firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
}
- //------------------------------------------------------------------------//
- //-- CommentModelAware --//
- //------------------------------------------------------------------------//
-
@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);
}
@@ -185,9 +178,4 @@
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/accidental/AccidentalBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/AccidentalBatchTableModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -42,27 +42,27 @@
public static final ColumnIdentifier<AccidentalBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SPECIES,
n_("tutti.editAccidentalBatch.table.header.speciesByCode"),
- n_("tutti.editAccidentalBatch.table.header.speciesByCode"));
+ n_("tutti.editAccidentalBatch.table.header.speciesByCode.tip"));
public static final ColumnIdentifier<AccidentalBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SPECIES,
n_("tutti.editAccidentalBatch.table.header.speciesByGenusCode"),
- n_("tutti.editAccidentalBatch.table.header.speciesByGenusCode"));
+ n_("tutti.editAccidentalBatch.table.header.speciesByGenusCode.tip"));
public static final ColumnIdentifier<AccidentalBatchRowModel> WEIGHT = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_WEIGHT,
n_("tutti.editAccidentalBatch.table.header.weight"),
- n_("tutti.editAccidentalBatch.table.header.weight"));
+ n_("tutti.editAccidentalBatch.table.header.weight.tip"));
public static final ColumnIdentifier<AccidentalBatchRowModel> COMMENT = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_COMMENT,
n_("tutti.editAccidentalBatch.table.header.comment"),
- n_("tutti.editAccidentalBatch.table.header.comment"));
+ n_("tutti.editAccidentalBatch.table.header.comment.tip"));
- public static final ColumnIdentifier<AccidentalBatchRowModel> ATTACHMENT = ColumnIdentifier.newId(
+ public static final ColumnIdentifier<AccidentalBatchRowModel> ATTACHMENT = ColumnIdentifier.newReadOnlyId(
AccidentalBatchRowModel.PROPERTY_ATTACHMENT,
n_("tutti.editAccidentalBatch.table.header.file"),
- n_("tutti.editAccidentalBatch.table.header.file"));
+ n_("tutti.editAccidentalBatch.table.header.file.tip"));
public AccidentalBatchTableModel(TableColumnModelExt columnModel) {
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-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchRowModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -28,6 +28,7 @@
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;
@@ -38,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;
@@ -53,7 +54,7 @@
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, BenthosBatchRowModel> implements AttachmentModelAware, CommentModelAware {
+public class BenthosBatchRowModel extends AbstractTuttiBeanUIModel<SpeciesBatch, BenthosBatchRowModel> implements SpeciesBatch, AttachmentModelAware {
private static final long serialVersionUID = 1L;
@@ -259,6 +260,11 @@
Collections.sort(frequency);
}
+ @Override
+ protected SpeciesBatch newEntity() {
+ return TuttiBeanFactory.newSpeciesBatch();
+ }
+
//------------------------------------------------------------------------//
//-- Sample category --//
//------------------------------------------------------------------------//
@@ -319,10 +325,12 @@
//-- Species category --//
//------------------------------------------------------------------------//
+ @Override
public Species getSpecies() {
return species;
}
+ @Override
public void setSpecies(Species species) {
Object oldCategory = getSpecies();
this.species = species;
@@ -494,6 +502,7 @@
//-- Navigation properties --//
//------------------------------------------------------------------------//
+ @Override
public BenthosBatchRowModel getParentBatch() {
return parentBatch;
}
@@ -525,7 +534,7 @@
}
//------------------------------------------------------------------------//
- //-- CommentModelAware --//
+ //-- CommentAware --//
//------------------------------------------------------------------------//
@Override
@@ -587,28 +596,34 @@
//-- Other properties --//
//------------------------------------------------------------------------//
- public Boolean getSpeciesToConfirm() {
+ @Override
+ public boolean isSpeciesToConfirm() {
return speciesToConfirm;
}
- public void setSpeciesToConfirm(Boolean speciesToConfirm) {
- Object oldValue = getSpeciesToConfirm();
+ @Override
+ public void setSpeciesToConfirm(boolean speciesToConfirm) {
+ Object oldValue = isSpeciesToConfirm();
this.speciesToConfirm = speciesToConfirm;
firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
}
+ @Override
public Float getWeight() {
return computedOrNotWeight.getData();
}
+ @Override
public void setWeight(Float weight) {
this.computedOrNotWeight.setData(weight);
}
+ @Override
public Integer getNumber() {
return computedOrNotNumber.getData();
}
+ @Override
public void setNumber(Integer number) {
computedOrNotNumber.setData(number);
}
@@ -623,18 +638,22 @@
firePropertyChange(PROPERTY_FREQUENCY, null, frequency);
}
+ @Override
public Integer getComputedNumber() {
return computedOrNotNumber.getComputedData();
}
+ @Override
public void setComputedNumber(Integer computedNumber) {
computedOrNotNumber.setComputedData(computedNumber);
}
+ @Override
public Float getComputedWeight() {
return computedOrNotWeight.getComputedData();
}
+ @Override
public void setComputedWeight(Float computedWeight) {
computedOrNotWeight.setComputedData(computedWeight);
}
@@ -656,7 +675,103 @@
}
@Override
- protected SpeciesBatch newEntity() {
- return TuttiBeanFactory.newSpeciesBatch();
+ 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) {
+ }
+
+ @Override
+ public Float getSampleCategoryComputedWeight() {
+ return null;
+ }
+
+ @Override
+ public void setSampleCategoryComputedWeight(Float sampleCategoryComputedWeight) {
+ }
+
+ @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) {
+ }
+
+ @Override
+ public void setParentBatch(SpeciesBatch parentBatch) {
+ }
+
+ @Override
+ public FishingOperation getFishingOperation() {
+ return null;
+ }
+
+ @Override
+ public void setFishingOperation(FishingOperation fishingOperation) {
+ }
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchTableModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -48,67 +48,67 @@
public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SPECIES,
n_("tutti.editBenthosBatch.table.header.species"),
- n_("tutti.editBenthosBatch.table.header.species"));
+ n_("tutti.editBenthosBatch.table.header.species.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> SORTED_UNSORTED_CATEGORY = SampleCategoryColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY,
BenthosBatchRowModel.PROPERTY_SORTED_UNSORTED_CATEGORY_WEIGHT,
SampleCategoryEnum.sortedUnsorted,
n_("tutti.editBenthosBatch.table.header.sortedUnsortedCategory"),
- n_("tutti.editBenthosBatch.table.header.sortedUnsortedCategory"));
+ n_("tutti.editBenthosBatch.table.header.sortedUnsortedCategory.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> SIZE_CATEGORY = SampleCategoryColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SIZE_CATEGORY,
BenthosBatchRowModel.PROPERTY_SIZE_CATEGORY_WEIGHT,
SampleCategoryEnum.size,
n_("tutti.editBenthosBatch.table.header.sizeCategory"),
- n_("tutti.editBenthosBatch.table.header.sizeCategory"));
+ n_("tutti.editBenthosBatch.table.header.sizeCategory.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> SEX_CATEGORY = SampleCategoryColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SEX_CATEGORY,
BenthosBatchRowModel.PROPERTY_SEX_CATEGORY_WEIGHT,
SampleCategoryEnum.sex,
n_("tutti.editBenthosBatch.table.header.sexCategory"),
- n_("tutti.editBenthosBatch.table.header.sexCategory"));
+ n_("tutti.editBenthosBatch.table.header.sexCategory.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> MATURITY_CATEGORY = SampleCategoryColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_MATURITY_CATEGORY,
BenthosBatchRowModel.PROPERTY_MATURITY_CATEGORY_WEIGHT,
SampleCategoryEnum.maturity,
n_("tutti.editBenthosBatch.table.header.maturityCategory"),
- n_("tutti.editBenthosBatch.table.header.maturityCategory"));
+ n_("tutti.editBenthosBatch.table.header.maturityCategory.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> AGE_CATEGORY = SampleCategoryColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_AGE_CATEGORY,
BenthosBatchRowModel.PROPERTY_AGE_CATEGORY_WEIGHT,
SampleCategoryEnum.age,
n_("tutti.editBenthosBatch.table.header.ageCategory"),
- n_("tutti.editBenthosBatch.table.header.ageCategory"));
+ n_("tutti.editBenthosBatch.table.header.ageCategory.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> WEIGHT = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_COMPUTED_WEIGHT,
n_("tutti.editBenthosBatch.table.header.weight"),
- n_("tutti.editBenthosBatch.table.header.weight"));
+ n_("tutti.editBenthosBatch.table.header.weight.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> COMPUTED_NUMBER = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_COMPUTED_NUMBER,
n_("tutti.editBenthosBatch.table.header.computedNumber"),
- n_("tutti.editBenthosBatch.table.header.computedNumber"));
+ n_("tutti.editBenthosBatch.table.header.computedNumber.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> COMMENT = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_COMMENT,
n_("tutti.editBenthosBatch.table.header.comment"),
- n_("tutti.editBenthosBatch.table.header.comment"));
+ n_("tutti.editBenthosBatch.table.header.comment.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> ATTACHMENT = ColumnIdentifier.newReadOnlyId(
BenthosBatchRowModel.PROPERTY_ATTACHMENT,
n_("tutti.editBenthosBatch.table.header.file"),
- n_("tutti.editBenthosBatch.table.header.file"));
+ n_("tutti.editBenthosBatch.table.header.file.tip"));
public static final ColumnIdentifier<BenthosBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
BenthosBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
n_("tutti.editBenthosBatch.table.header.toConfirm"),
- n_("tutti.editBenthosBatch.table.header.toConfirm"));
+ n_("tutti.editBenthosBatch.table.header.toConfirm.tip"));
/**
* Columns for the frequency edition.
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIHandler.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -572,7 +572,7 @@
public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
BenthosBatchRowModel row = getTableModel().getEntry(adapter.row);
- return row.getSpeciesToConfirm();
+ return row.isSpeciesToConfirm();
}
}, toConfirmColor);
@@ -593,7 +593,7 @@
public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
BenthosBatchRowModel row = getTableModel().getEntry(adapter.row);
- return row.getSpeciesToConfirm() && !adapter.isEditable();
+ return row.isSpeciesToConfirm() && !adapter.isEditable();
}
}, toConfirmColor.darker());
@@ -1028,7 +1028,7 @@
// copy back parent data (mainly other sample categories)
newRow.setSpecies(parentRow.getSpecies());
- newRow.setSpeciesToConfirm(parentRow.getSpeciesToConfirm());
+ newRow.setSpeciesToConfirm(parentRow.isSpeciesToConfirm());
newRow.setParentBatch(parentRow);
newRow.setSpecies(parentRow.getSpecies());
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUIModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -143,6 +143,25 @@
EditCatchesUIModel.PROPERTY_BENTHOS_TOTAL_LIVING_NOT_ITEMIZED_WEIGHT);
}
+ @Override
+ public boolean isEmpty() {
+ return CollectionUtils.isEmpty(getRows())
+ && getBenthosTotalSortedWeight() == null
+ && getBenthosTotalInertWeight() == null
+ && getBenthosTotalLivingNotItemizedWeight() == null
+ && CollectionUtils.isEmpty(getAttachment());
+ }
+
+ @Override
+ public String getTitle() {
+ return "tutti.label.tab.benthos";
+ }
+
+ @Override
+ public String getIcon() {
+ return null;
+ }
+
public Float getBenthosTotalComputedWeight() {
return catchesUIModel.getBenthosTotalComputedWeight();
}
@@ -346,6 +365,10 @@
return rootBatchId;
}
+ //------------------------------------------------------------------------//
+ //-- AttachmentModelAware --//
+ //------------------------------------------------------------------------//
+
@Override
public AttachementObjectTypeEnum getObjectType() {
return AttachementObjectTypeEnum.CATCH_BATCH;
@@ -385,22 +408,4 @@
firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
}
- @Override
- public boolean isEmpty() {
- return CollectionUtils.isEmpty(getRows())
- && getBenthosTotalSortedWeight() == null
- && getBenthosTotalInertWeight() == null
- && getBenthosTotalLivingNotItemizedWeight() == null
- && CollectionUtils.isEmpty(getAttachment());
- }
-
- @Override
- public String getTitle() {
- return "tutti.label.tab.benthos";
- }
-
- @Override
- public String getIcon() {
- return null;
- }
}
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-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchRowModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -49,50 +49,15 @@
private static final long serialVersionUID = 1L;
- public static final String PROPERTY_MARINE_LITTER_CATEGORY = "marineLitterCategory";
-
- public static final String PROPERTY_MARINE_LITTER_SIZE_CATEGORY = "marineLitterSizeCategory";
-
- public static final String PROPERTY_WEIGHT = "weight";
-
- public static final String PROPERTY_NUMBER = "number";
-
/**
- * MarineLitter category.
+ * Delegate edit object.
*
- * @since 0.2
+ * @since 1.3
*/
- protected CaracteristicQualitativeValue marineLitterCategory;
+ protected final MarineLitterBatch editObject =
+ TuttiBeanFactory.newMarineLitterBatch();
/**
- * MarineLitter size category.
- *
- * @since 0.3
- */
- protected CaracteristicQualitativeValue marineLitterSizeCategory;
-
- /**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Observed number.
- *
- * @since 0.3
- */
- protected Integer number;
-
- /**
- * Comment on this batch.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
* Attachments (should never be null).
*
* @since 0.2
@@ -116,68 +81,82 @@
fromBean(aBatch);
}
+ @Override
+ protected MarineLitterBatch newEntity() {
+ return TuttiBeanFactory.newMarineLitterBatch();
+ }
+
+ //------------------------------------------------------------------------//
+ //-- MarineLitterBatch --//
+ //------------------------------------------------------------------------//
+
+ @Override
public CaracteristicQualitativeValue getMarineLitterCategory() {
- return marineLitterCategory;
+ return editObject.getMarineLitterCategory();
}
+ @Override
public void setMarineLitterCategory(CaracteristicQualitativeValue marineLitterCategory) {
Object oldValue = getMarineLitterCategory();
- this.marineLitterCategory = marineLitterCategory;
+ editObject.setMarineLitterCategory(marineLitterCategory);
firePropertyChange(PROPERTY_MARINE_LITTER_CATEGORY, oldValue, marineLitterCategory);
}
+ @Override
public CaracteristicQualitativeValue getMarineLitterSizeCategory() {
- return marineLitterSizeCategory;
+ return editObject.getMarineLitterSizeCategory();
}
+ @Override
public void setMarineLitterSizeCategory(CaracteristicQualitativeValue marineLitterSizeCategory) {
Object oldValue = getMarineLitterSizeCategory();
- this.marineLitterSizeCategory = marineLitterSizeCategory;
+ editObject.setMarineLitterSizeCategory(marineLitterSizeCategory);
firePropertyChange(PROPERTY_MARINE_LITTER_SIZE_CATEGORY, oldValue, marineLitterSizeCategory);
}
@Override
public FishingOperation getFishingOperation() {
- return null;
+ return editObject.getFishingOperation();
}
@Override
public void setFishingOperation(FishingOperation fishingOperation) {
+ editObject.setFishingOperation(fishingOperation);
}
+ @Override
public Float getWeight() {
- return weight;
+ return editObject.getWeight();
}
+ @Override
public void setWeight(Float weight) {
Object oldValue = getWeight();
- this.weight = weight;
+ editObject.setWeight(weight);
firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
}
+ @Override
public Integer getNumber() {
- return number;
+ return editObject.getNumber();
}
+ @Override
public void setNumber(Integer number) {
Object oldValue = getNumber();
- this.number = number;
+ editObject.setNumber(number);
firePropertyChange(PROPERTY_NUMBER, oldValue, number);
}
- //------------------------------------------------------------------------//
- //-- CommentModelAware --//
- //------------------------------------------------------------------------//
-
@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);
}
@@ -223,9 +202,4 @@
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/MarineLitterBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchTableModel.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchTableModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -41,32 +41,32 @@
public static final ColumnIdentifier<MarineLitterBatchRowModel> MACRO_WASTE_CATEGORY = ColumnIdentifier.newId(
MarineLitterBatchRowModel.PROPERTY_MARINE_LITTER_CATEGORY,
n_("tutti.editMarineLitterBatch.table.header.marineLitterCategory"),
- n_("tutti.editMarineLitterBatch.table.header.marineLitterCategory"));
+ n_("tutti.editMarineLitterBatch.table.header.marineLitterCategory.tip"));
public static final ColumnIdentifier<MarineLitterBatchRowModel> MACRO_WASTE_SIZE_CATEGORY = ColumnIdentifier.newId(
MarineLitterBatchRowModel.PROPERTY_MARINE_LITTER_SIZE_CATEGORY,
n_("tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory"),
- n_("tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory"));
+ n_("tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory.tip"));
+ public static final ColumnIdentifier<MarineLitterBatchRowModel> NUMBER = ColumnIdentifier.newId(
+ MarineLitterBatchRowModel.PROPERTY_NUMBER,
+ n_("tutti.editMarineLitterBatch.table.header.number"),
+ n_("tutti.editMarineLitterBatch.table.header.number.tip"));
+
public static final ColumnIdentifier<MarineLitterBatchRowModel> WEIGHT = ColumnIdentifier.newId(
MarineLitterBatchRowModel.PROPERTY_WEIGHT,
n_("tutti.editMarineLitterBatch.table.header.weight"),
- n_("tutti.editMarineLitterBatch.table.header.weight"));
+ n_("tutti.editMarineLitterBatch.table.header.weight.tip"));
- public static final ColumnIdentifier<MarineLitterBatchRowModel> NUMBER = ColumnIdentifier.newId(
- MarineLitterBatchRowModel.PROPERTY_NUMBER,
- n_("tutti.editMarineLitterBatch.table.header.number"),
- n_("tutti.editMarineLitterBatch.table.header.number"));
-
public static final ColumnIdentifier<MarineLitterBatchRowModel> COMMENT = ColumnIdentifier.newId(
MarineLitterBatchRowModel.PROPERTY_COMMENT,
n_("tutti.editMarineLitterBatch.table.header.comment"),
- n_("tutti.editMarineLitterBatch.table.header.comment"));
+ n_("tutti.editMarineLitterBatch.table.header.comment.tip"));
- public static final ColumnIdentifier<MarineLitterBatchRowModel> ATTACHMENT = ColumnIdentifier.newId(
+ public static final ColumnIdentifier<MarineLitterBatchRowModel> ATTACHMENT = ColumnIdentifier.newReadOnlyId(
MarineLitterBatchRowModel.PROPERTY_ATTACHMENT,
n_("tutti.editMarineLitterBatch.table.header.file"),
- n_("tutti.editMarineLitterBatch.table.header.file"));
+ n_("tutti.editMarineLitterBatch.table.header.file.tip"));
public MarineLitterBatchTableModel(TableColumnModelExt columnModel) {
super(columnModel, true, true);
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.css 2013-04-03 18:25:40 UTC (rev 723)
@@ -27,15 +27,28 @@
showPopupButton: {handler.getConfig().isShowNumberEditorButton()};
bean: {model};
showReset: true;
+ _selectOnFocus: {true};
}
#editMarineLitterBatchTopPanel {
_help: {"tuttihelp.editMarineLitterBatch.help"};
}
+#marineLitterBatchTabToolBar {
+ floatable: false;
+ opaque: false;
+ borderPainted: false;
+}
+
+#marineLitterBatchAttachmentsButton {
+ enabled: {model.getObjectId() != null};
+}
+
#marineLitterTotalWeightLabel {
- text: "tutti.editCatchBatch.field.marineLitterTotalWeight";
+ text: "tutti.editMarineLitterBatch.field.marineLitterTotalWeight";
+ toolTipText: "tutti.editMarineLitterBatch.field.marineLitterTotalWeight.tip";
labelFor: {marineLitterTotalWeightField};
+ _help: {"tutti.editMarineLitterBatch.field.marineLitterTotalWeight.help"};
}
#marineLitterTotalWeightField {
@@ -45,9 +58,23 @@
numberPattern: {INT_6_DIGITS_PATTERN};
}
+#tablePopup {
+ label: "tutti.editMarineLitterBatch.title.batchActions";
+}
+
#table {
selectionMode: {ListSelectionModel.SINGLE_SELECTION};
selectionBackground: {null};
selectionForeground: {Color.BLACK};
sortable: false;
}
+
+#removeSpeciesBatchMenu {
+ actionIcon: batch-delete;
+ text: "tutti.editMarineLitterBatch.action.removeBatch";
+ toolTipText: "tutti.editMarineLitterBatch.action.removeBatch.tip";
+ i18nMnemonic: "tutti.editMarineLitterBatch.action.removeBatch.mnemonic";
+ _tuttiAction: {RemoveMarineLitterBatchAction.class};
+ enabled: {model.isRemoveBatchEnabled()};
+ _help: {"tutti.editMarineLitterBatch.action.removeBatch.help"};
+}
\ No newline at end of file
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-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUI.jaxx 2013-04-03 18:25:40 UTC (rev 723)
@@ -29,6 +29,7 @@
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.TuttiUIContext
fr.ifremer.tutti.ui.swing.util.TuttiUI
+ fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment
jaxx.runtime.swing.editor.NumberEditor
@@ -68,6 +69,15 @@
<TuttiHelpBroker id='broker'
constructorParams='"tuttihelp.editMarineLitterBatch.help"'/>
+ <JToolBar id='marineLitterBatchTabToolBar'>
+ <ButtonAttachment id='marineLitterBatchAttachmentsButton'
+ constructorParams='getHandler().getContext(), getModel()'/>
+ </JToolBar>
+
+ <JPopupMenu id='tablePopup'>
+ <JMenuItem id='removeMarineLitterBatchMenu'/>
+ </JPopupMenu>
+
<Table id='form' fill='both' constraints='BorderLayout.NORTH'>
<!-- Poids total -->
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIHandler.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -25,6 +25,7 @@
*/
import com.google.common.collect.Lists;
+import fr.ifremer.tutti.PropagatePropertyChangeListener;
import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.persistence.entities.data.BatchContainer;
@@ -91,9 +92,21 @@
rows = Lists.newArrayList();
if (!TuttiEntities.isNew(bean)) {
+
+ // get all marine litter root
BatchContainer<MarineLitterBatch> batchContainer =
persistenceService.getRootMarineLitterBatch(bean.getId());
+ model.setRootBatchId(batchContainer.getId());
+
+ List<Attachment> attachments =
+ persistenceService.getAllAttachments(Integer.valueOf(model.getObjectId()));
+ model.addAllAttachment(attachments);
+
+ if (log.isInfoEnabled()) {
+ log.info("marineLitter root batch id: " + model.getRootBatchId());
+ }
+
for (MarineLitterBatch aBatch : batchContainer.getChildren()) {
MarineLitterBatchRowModel entry =
new MarineLitterBatchRowModel(aBatch);
@@ -102,6 +115,7 @@
}
}
model.setRows(rows);
+ recomputeBatchActionEnable();
}
//------------------------------------------------------------------------//
@@ -122,7 +136,7 @@
protected boolean isRowValid(MarineLitterBatchRowModel row) {
boolean result = row.getMarineLitterCategory() != null &&
row.getMarineLitterSizeCategory() != null &&
- row.getWeight() != null;
+ row.getNumber() != null;
return result;
}
@@ -133,6 +147,9 @@
Object oldValue,
Object newValue) {
recomputeRowValidState(row);
+
+ // when row valid state has changed, recompute action enabled states
+ recomputeBatchActionEnable();
}
@Override
@@ -160,17 +177,39 @@
// row is not valid can not save it
- MarineLitterBatch catchBean = row.toBean();
+ MarineLitterBatch batch = row.toBean();
- if (!TuttiEntities.isNew(catchBean)) {
+ if (!TuttiEntities.isNew(batch)) {
// remove this
- persistenceService.deleteMarineLitterBatch(catchBean.getId());
+ persistenceService.deleteMarineLitterBatch(batch.getId());
}
}
}
}
+ @Override
+ protected void onRowValidStateChanged(int rowIndex,
+ MarineLitterBatchRowModel row,
+ Boolean oldValue,
+ Boolean newValue) {
+ super.onRowValidStateChanged(rowIndex, row, oldValue, newValue);
+
+ // when row valid state has changed, recompute action enabled states
+ recomputeBatchActionEnable();
+ }
+
+ @Override
+ protected void onAfterSelectedRowChanged(int oldRowIndex,
+ MarineLitterBatchRowModel oldRow,
+ int newRowIndex,
+ MarineLitterBatchRowModel newRow) {
+ super.onAfterSelectedRowChanged(oldRowIndex, oldRow, newRowIndex, newRow);
+
+ // when selected row has changed, recompute action enabled states
+ recomputeBatchActionEnable();
+ }
+
//------------------------------------------------------------------------//
//-- AbstractTuttiUIHandler methods --//
//------------------------------------------------------------------------//
@@ -192,13 +231,20 @@
MarineLitterBatchUIModel model = new MarineLitterBatchUIModel(catchesUIModel);
ui.setContextValue(model);
+
+ // propagate when value is changing
+ PropagatePropertyChangeListener.listenAndPropagate(
+ catchesUIModel,
+ model,
+ EditCatchesUIModel.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT,
+ EditCatchesUIModel.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT);
}
@Override
public void afterInitUI() {
- if (log.isInfoEnabled()) {
- log.info("afterInit: " + ui);
+ if (log.isDebugEnabled()) {
+ log.debug("afterInit: " + ui);
}
initUI(ui);
@@ -231,6 +277,13 @@
decorator, persistenceService.getMarineLitterSizeCategoryCaracteristic().getQualitativeValue());
}
+ { // Number column
+
+ addIntegerColumnToModel(columnModel,
+ MarineLitterBatchTableModel.NUMBER,
+ TuttiUI.INT_3_DIGITS_PATTERN);
+ }
+
{ // Weight column
addFloatColumnToModel(columnModel,
@@ -238,13 +291,6 @@
TuttiUI.DECIMAL3_PATTERN);
}
- { // Number column
-
- addIntegerColumnToModel(columnModel,
- MarineLitterBatchTableModel.NUMBER,
- TuttiUI.INT_3_DIGITS_PATTERN);
- }
-
{ // Comment column
addColumnToModel(columnModel,
@@ -269,6 +315,7 @@
table.setColumnModel(columnModel);
initBatchTable(table, columnModel, tableModel);
+ recomputeBatchActionEnable();
}
@Override
@@ -276,6 +323,7 @@
if (log.isDebugEnabled()) {
log.debug("closing: " + ui);
}
+ ui.getMarineLitterBatchAttachmentsButton().onCloseUI();
}
//------------------------------------------------------------------------//
@@ -286,6 +334,23 @@
//-- Internal methods --//
//------------------------------------------------------------------------//
+ protected void recomputeBatchActionEnable() {
+
+ int rowIndex = getTable().getSelectedRow();
+
+ boolean enableRemove = false;
+
+ if (rowIndex != -1) {
+
+ // there is a selected row
+
+ enableRemove = true;
+
+ }
+ MarineLitterBatchUIModel model = getModel();
+ model.setRemoveBatchEnabled(enableRemove);
+ }
+
protected void saveRow(MarineLitterBatchRowModel row) {
MarineLitterBatch catchBean = row.toBean();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/MarineLitterBatchUIModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -24,17 +24,40 @@
* #L%
*/
+import com.google.common.collect.Lists;
+import fr.ifremer.tutti.persistence.entities.data.AttachementObjectTypeEnum;
+import fr.ifremer.tutti.persistence.entities.data.Attachment;
import fr.ifremer.tutti.ui.swing.content.operation.AbstractTuttiBatchUIModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel;
+import fr.ifremer.tutti.ui.swing.util.TabContentModel;
+import fr.ifremer.tutti.ui.swing.util.attachment.AttachmentModelAware;
+import org.apache.commons.collections.CollectionUtils;
+import java.util.Collection;
+import java.util.List;
+
/**
* @author tchemit <chemit(a)codelutin.com>
* @since 0.2
*/
-public class MarineLitterBatchUIModel extends AbstractTuttiBatchUIModel<MarineLitterBatchRowModel, MarineLitterBatchUIModel> {
+public class MarineLitterBatchUIModel extends AbstractTuttiBatchUIModel<MarineLitterBatchRowModel, MarineLitterBatchUIModel>
+ implements AttachmentModelAware, TabContentModel {
private static final long serialVersionUID = 1L;
+ public static final String PROPERTY_REMOVE_BATCH_ENABLED = "removeBatchEnabled";
+
+ protected final List<Attachment> attachment = Lists.newArrayList();
+
+ /**
+ * Can user remove a selected marineLitter batch?
+ *
+ * @since 1.3
+ */
+ protected boolean removeBatchEnabled;
+
+ private String rootBatchId;
+
public MarineLitterBatchUIModel(EditCatchesUIModel catchesUIModel) {
super(catchesUIModel,
EditCatchesUIModel.PROPERTY_MARINE_LITTER_TOTAL_WEIGHT);
@@ -47,4 +70,100 @@
public void setMarineLitterTotalWeight(Float marineLitterTotalWeight) {
catchesUIModel.setMarineLitterTotalWeight(marineLitterTotalWeight);
}
+
+ public boolean isRemoveBatchEnabled() {
+ return removeBatchEnabled;
+ }
+
+ public void setRemoveBatchEnabled(boolean removeBatchEnabled) {
+ Object oldValue = isRemoveBatchEnabled();
+ this.removeBatchEnabled = removeBatchEnabled;
+ firePropertyChange(PROPERTY_REMOVE_BATCH_ENABLED, oldValue, removeBatchEnabled);
+ }
+
+ public void setRootBatchId(String rootBatchId) {
+ String oldValue = getObjectId();
+ this.rootBatchId = rootBatchId;
+ firePropertyChange(PROPERTY_OBJECT_ID, oldValue, getObjectId());
+ }
+
+ public String getRootBatchId() {
+ return rootBatchId;
+ }
+
+ //------------------------------------------------------------------------//
+ //-- AttachmentModelAware --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public AttachementObjectTypeEnum getObjectType() {
+ return AttachementObjectTypeEnum.CATCH_BATCH;
+ }
+
+ @Override
+ public String getObjectId() {
+ return rootBatchId;
+ }
+
+ @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());
+ }
+
+ //------------------------------------------------------------------------//
+ //-- TabContentModel --//
+ //------------------------------------------------------------------------//
+
+ @Override
+ public boolean isEmpty() {
+ boolean result = getMarineLitterTotalWeight() == null
+ && CollectionUtils.isEmpty(getAttachment());
+ if (result && CollectionUtils.isNotEmpty(getRows())) {
+
+ // check if every line is not valid
+ for (MarineLitterBatchRowModel row : rows) {
+ if (row.isValid()) {
+
+ // found a valid row so not empty
+ result = false;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ @Override
+ public String getTitle() {
+ return "tutti.label.tab.marineLitter";
+ }
+
+ @Override
+ public String getIcon() {
+ return null;
+ }
}
\ No newline at end of file
Added: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java (rev 0)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -0,0 +1,87 @@
+package fr.ifremer.tutti.ui.swing.content.operation.catches.marinelitter;
+
+import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.persistence.TuttiPersistence;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
+import fr.ifremer.tutti.ui.swing.content.operation.catches.species.RemoveSpeciesSubBatchAction;
+import fr.ifremer.tutti.ui.swing.util.action.AbstractTuttiAction;
+import fr.ifremer.tutti.ui.swing.util.table.AbstractSelectTableAction;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jdesktop.swingx.JXTable;
+
+/**
+ * To remove a selected marine litter batch in the table.
+ *
+ * @author tchemit <chemit(a)codelutin.com>
+ * @since 1.3
+ */
+public class RemoveMarineLitterBatchAction extends AbstractTuttiAction<MarineLitterBatchUIModel, MarineLitterBatchUI, MarineLitterBatchUIHandler> {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(RemoveMarineLitterBatchAction.class);
+
+ protected RemoveSpeciesSubBatchAction removeSpeciesSubBatchAction;
+
+ public RemoveMarineLitterBatchAction(MarineLitterBatchUIHandler handler) {
+ super(handler, false);
+ }
+
+ int rowIndex;
+
+ @Override
+ protected void doAction() throws Exception {
+
+ JXTable table = handler.getTable();
+
+ rowIndex = table.getSelectedRow();
+
+ Preconditions.checkState(rowIndex != -1,
+ "Cant remove batch if none is selected");
+
+ MarineLitterBatchTableModel tableModel = handler.getTableModel();
+ MarineLitterBatchRowModel selectedBatch = tableModel.getEntry(rowIndex);
+
+ boolean persisted = !TuttiEntities.isNew(selectedBatch);
+
+ if (persisted) {
+
+ // remove it from db
+
+ String id = selectedBatch.getId();
+
+ if (log.isInfoEnabled()) {
+ log.info("Remove marineLitter with id: " + id);
+ }
+
+ TuttiPersistence persistenceService =
+ getContext().getPersistenceService();
+
+ persistenceService.deleteMarineLitterBatch(id);
+ }
+ }
+
+ @Override
+ public void postSuccessAction() {
+ super.postSuccessAction();
+
+ JXTable table = handler.getTable();
+
+ MarineLitterBatchTableModel tableModel = handler.getTableModel();
+
+ tableModel.removeRow(rowIndex);
+
+ if (!tableModel.getRows().isEmpty()) {
+
+ // select first row
+ AbstractSelectTableAction.doSelectCell(table, 0, 0);
+ }
+
+ if (table.isEditing()) {
+
+ // but no edit it
+ table.getCellEditor().stopCellEditing();
+ }
+ }
+}
\ No newline at end of file
Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/marinelitter/RemoveMarineLitterBatchAction.java
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: svn:eol-style
+ native
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-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchRowModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -58,11 +58,12 @@
public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight";
/**
- * Species observed.
+ * Delegate edit object.
*
- * @since 0.2
+ * @since 1.3
*/
- protected Species species;
+ protected final PlanktonBatch editObject =
+ TuttiBeanFactory.newPlanktonBatch();
/**
* Is the species need to be confirmed?.
@@ -72,27 +73,6 @@
protected boolean speciesToConfirm;
/**
- * Observed weight.
- *
- * @since 0.2
- */
- protected Float weight;
-
- /**
- * Sample weight.
- *
- * @since 0.2
- */
- protected Float sampleWeight;
-
- /**
- * Comment.
- *
- * @since 0.2
- */
- protected String comment;
-
- /**
* Attachments (should never be null).
*
* @since 0.2
@@ -116,68 +96,80 @@
fromBean(aBatch);
}
- public Species getSpecies() {
- return species;
+ @Override
+ protected PlanktonBatch newEntity() {
+ return TuttiBeanFactory.newPlanktonBatch();
}
- public void setSpecies(Species species) {
- Object oldValue = getSpecies();
- this.species = species;
- firePropertyChange(PROPERTY_SPECIES, oldValue, species);
- }
-
- public Boolean getSpeciesToConfirm() {
+ public boolean isSpeciesToConfirm() {
return speciesToConfirm;
}
- public void setSpeciesToConfirm(Boolean speciesToConfirm) {
- Object oldValue = getSpeciesToConfirm();
+ public void setSpeciesToConfirm(boolean speciesToConfirm) {
+ Object oldValue = isSpeciesToConfirm();
this.speciesToConfirm = speciesToConfirm;
firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
}
+ //------------------------------------------------------------------------//
+ //-- PlanktonBatch --//
+ //------------------------------------------------------------------------//
+
@Override
+ public Species getSpecies() {
+ return editObject.getSpecies();
+ }
+
+ @Override
+ public void setSpecies(Species species) {
+ Object oldValue = getSpecies();
+ editObject.setSpecies(species);
+ firePropertyChange(PROPERTY_SPECIES, oldValue, species);
+ }
+
+ @Override
public FishingOperation getFishingOperation() {
- return null;
+ return editObject.getFishingOperation();
}
@Override
public void setFishingOperation(FishingOperation fishingOperation) {
+ editObject.setFishingOperation(fishingOperation);
}
+ @Override
public Float getWeight() {
- return weight;
+ return editObject.getWeight();
}
+ @Override
public void setWeight(Float weight) {
Object oldValue = getWeight();
- this.weight = weight;
+ editObject.setWeight(weight);
firePropertyChange(PROPERTY_WEIGHT, oldValue, weight);
}
+ @Override
public Float getSampleWeight() {
- return sampleWeight;
+ return editObject.getSampleWeight();
}
+ @Override
public void setSampleWeight(Float sampleWeight) {
Object oldValue = getSampleWeight();
- this.sampleWeight = sampleWeight;
+ editObject.setSampleWeight(sampleWeight);
firePropertyChange(PROPERTY_SAMPLE_WEIGHT, oldValue, sampleWeight);
}
- //------------------------------------------------------------------------//
- //-- CommentModelAware --//
- //------------------------------------------------------------------------//
-
@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);
}
@@ -223,9 +215,4 @@
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/plankton/PlanktonBatchTableModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchTableModel.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/plankton/PlanktonBatchTableModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -41,37 +41,37 @@
public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_TO_CONFIRM = ColumnIdentifier.newId(
PlanktonBatchRowModel.PROPERTY_SPECIES_TO_CONFIRM,
n_("tutti.editPlanktonBatch.table.header.toConfirm"),
- n_("tutti.editPlanktonBatch.table.header.toConfirm"));
+ n_("tutti.editPlanktonBatch.table.header.toConfirm.tip"));
public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_BY_CODE = ColumnIdentifier.newId(
PlanktonBatchRowModel.PROPERTY_SPECIES,
n_("tutti.editPlanktonBatch.table.header.speciesByCode"),
- n_("tutti.editPlanktonBatch.table.header.speciesByCode"));
+ n_("tutti.editPlanktonBatch.table.header.speciesByCode.tip"));
public static final ColumnIdentifier<PlanktonBatchRowModel> SPECIES_BY_GENUS_CODE = ColumnIdentifier.newId(
PlanktonBatchRowModel.PROPERTY_SPECIES,
n_("tutti.editPlanktonBatch.table.header.speciesByGenusCode"),
- n_("tutti.editPlanktonBatch.table.header.speciesByGenusCode"));
+ n_("tutti.editPlanktonBatch.table.header.speciesByGenusCode.tip"));
public static final ColumnIdentifier<PlanktonBatchRowModel> WEIGHT = ColumnIdentifier.newId(
PlanktonBatchRowModel.PROPERTY_WEIGHT,
n_("tutti.editPlanktonBatch.table.header.weight"),
- n_("tutti.editPlanktonBatch.table.header.weight"));
+ n_("tutti.editPlanktonBatch.table.header.weight.tip"));
public static final ColumnIdentifier<PlanktonBatchRowModel> SAMPLE_WEIGHT = ColumnIdentifier.newId(
PlanktonBatchRowModel.PROPERTY_SAMPLE_WEIGHT,
n_("tutti.editPlanktonBatch.table.header.sampleWeight"),
- n_("tutti.editPlanktonBatch.table.header.sampleWeight"));
+ n_("tutti.editPlanktonBatch.table.header.sampleWeight.tip"));
public static final ColumnIdentifier<PlanktonBatchRowModel> COMMENT = ColumnIdentifier.newId(
PlanktonBatchRowModel.PROPERTY_COMMENT,
n_("tutti.editPlanktonBatch.table.header.comment"),
- n_("tutti.editPlanktonBatch.table.header.comment"));
+ n_("tutti.editPlanktonBatch.table.header.comment.tip"));
- public static final ColumnIdentifier<PlanktonBatchRowModel> ATTACHMENT = ColumnIdentifier.newId(
+ public static final ColumnIdentifier<PlanktonBatchRowModel> ATTACHMENT = ColumnIdentifier.newReadOnlyId(
PlanktonBatchRowModel.PROPERTY_ATTACHMENT,
n_("tutti.editPlanktonBatch.table.header.file"),
- n_("tutti.editPlanktonBatch.table.header.file"));
+ n_("tutti.editPlanktonBatch.table.header.file.tip"));
public PlanktonBatchTableModel(TableColumnModelExt columnModel) {
super(columnModel, true, true);
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 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchRowModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -268,6 +268,11 @@
Collections.sort(frequency);
}
+ @Override
+ protected SpeciesBatch newEntity() {
+ return TuttiBeanFactory.newSpeciesBatch();
+ }
+
//------------------------------------------------------------------------//
//-- Sample category --//
//------------------------------------------------------------------------//
@@ -562,6 +567,7 @@
//-- Navigation properties --//
//------------------------------------------------------------------------//
+ @Override
public SpeciesBatchRowModel getParentBatch() {
return parentBatch;
}
@@ -597,7 +603,7 @@
}
//------------------------------------------------------------------------//
- //-- CommentModelAware --//
+ //-- CommentAware --//
//------------------------------------------------------------------------//
@Override
@@ -659,12 +665,13 @@
//-- Other properties --//
//------------------------------------------------------------------------//
- public Boolean getSpeciesToConfirm() {
+ @Override
+ public boolean isSpeciesToConfirm() {
return speciesToConfirm;
}
- public void setSpeciesToConfirm(Boolean speciesToConfirm) {
- Object oldValue = getSpeciesToConfirm();
+ public void setSpeciesToConfirm(boolean speciesToConfirm) {
+ Object oldValue = isSpeciesToConfirm();
this.speciesToConfirm = speciesToConfirm;
firePropertyChange(PROPERTY_SPECIES_TO_CONFIRM, oldValue, speciesToConfirm);
}
@@ -678,10 +685,12 @@
public void setFishingOperation(FishingOperation fishingOperation) {
}
+ @Override
public Float getWeight() {
return computedOrNotWeight.getData();
}
+ @Override
public void setWeight(Float weight) {
this.computedOrNotWeight.setData(weight);
}
@@ -713,24 +722,17 @@
public void setSampleCategoryWeight(Float sampleCategoryWeight) {
}
+ @Override
public Integer getNumber() {
return computedOrNotNumber.getData();
}
+ @Override
public void setNumber(Integer number) {
computedOrNotNumber.setData(number);
}
@Override
- public boolean isSpeciesToConfirm() {
- return false;
- }
-
- @Override
- public void setSpeciesToConfirm(boolean speciesToConfirm) {
- }
-
- @Override
public Float getSampleCategoryComputedWeight() {
return null;
}
@@ -801,18 +803,22 @@
firePropertyChange(PROPERTY_FREQUENCY, null, frequency);
}
+ @Override
public Integer getComputedNumber() {
return computedOrNotNumber.getComputedData();
}
+ @Override
public void setComputedNumber(Integer computedNumber) {
computedOrNotNumber.setComputedData(computedNumber);
}
+ @Override
public Float getComputedWeight() {
return computedOrNotWeight.getComputedData();
}
+ @Override
public void setComputedWeight(Float computedWeight) {
computedOrNotWeight.setComputedData(computedWeight);
}
@@ -833,8 +839,4 @@
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/SpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2013-04-03 18:25:40 UTC (rev 723)
@@ -28,7 +28,6 @@
<import>
fr.ifremer.tutti.ui.swing.TuttiHelpBroker
fr.ifremer.tutti.ui.swing.content.operation.catches.TableViewMode
-
fr.ifremer.tutti.ui.swing.util.TuttiUI
fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment
fr.ifremer.tutti.ui.swing.util.editor.TuttiComputedOrNotDataEditor
@@ -83,6 +82,7 @@
<JMenuItem id='renameSpeciesBatchMenu'/>
<JMenuItem id='createSpeciesMelagMenu'/>
</JPopupMenu>
+
<Table id='form' fill='both' constraints='BorderLayout.NORTH'>
<!-- Poids total / Poids total vrac -->
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-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIHandler.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -591,7 +591,7 @@
public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
SpeciesBatchRowModel row = getTableModel().getEntry(adapter.row);
- return row.getSpeciesToConfirm();
+ return row.isSpeciesToConfirm();
}
}, toConfirmColor);
@@ -612,7 +612,7 @@
public boolean isHighlighted(Component renderer, ComponentAdapter adapter) {
SpeciesBatchRowModel row = getTableModel().getEntry(adapter.row);
- return row.getSpeciesToConfirm() && !adapter.isEditable();
+ return row.isSpeciesToConfirm() && !adapter.isEditable();
}
}, toConfirmColor.darker());
@@ -1036,7 +1036,7 @@
// copy back parent data (mainly other sample categories)
newRow.setSpecies(parentRow.getSpecies());
- newRow.setSpeciesToConfirm(parentRow.getSpeciesToConfirm());
+ newRow.setSpeciesToConfirm(parentRow.isSpeciesToConfirm());
newRow.setParentBatch(parentRow);
newRow.setSpecies(parentRow.getSpecies());
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUIModel.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -346,6 +346,10 @@
return rootBatchId;
}
+ //------------------------------------------------------------------------//
+ //-- AttachmentModelAware --//
+ //------------------------------------------------------------------------//
+
@Override
public AttachementObjectTypeEnum getObjectType() {
return AttachementObjectTypeEnum.CATCH_BATCH;
@@ -385,6 +389,10 @@
firePropertyChange(PROPERTY_ATTACHMENT, null, getAttachment());
}
+ //------------------------------------------------------------------------//
+ //-- TabContentModel --//
+ //------------------------------------------------------------------------//
+
@Override
public boolean isEmpty() {
return CollectionUtils.isEmpty(getRows())
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/ButtonComment.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/ButtonComment.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/ButtonComment.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.CommentAware;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import jaxx.runtime.SwingUtil;
@@ -55,7 +56,7 @@
protected boolean popupMoving;
public ButtonComment(TuttiUIContext context,
- CommentModelAware model) {
+ CommentAware model) {
setIcon(SwingUtil.createActionIcon("edit-comment"));
setToolTipText(_("tutti.commentEditor.action.tip"));
@@ -116,7 +117,7 @@
popup.getHandler().init();
}
- public void init(CommentModelAware model) {
+ public void init(CommentAware model) {
setBean(model);
init();
}
@@ -125,11 +126,11 @@
setSelected(false);
}
- public CommentModelAware getBean() {
+ public CommentAware getBean() {
return popup.getBean();
}
- protected void setBean(CommentModelAware model) {
+ protected void setBean(CommentAware model) {
popup.setBean(model);
init();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentCellEditor.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentCellEditor.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentCellEditor.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -25,6 +25,7 @@
*/
import com.google.common.base.Preconditions;
+import fr.ifremer.tutti.persistence.entities.CommentAware;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.util.AbstractTuttiBeanUIModel;
import fr.ifremer.tutti.ui.swing.util.TuttiUI;
@@ -99,7 +100,7 @@
rowIndex = row;
columnIndex = column;
- CommentModelAware model = (CommentModelAware) tableModel.getEntry(row);
+ CommentAware model = (CommentAware) tableModel.getEntry(row);
editorButton.init(model);
@@ -114,7 +115,7 @@
@Override
public Object getCellEditorValue() {
- CommentModelAware model = editorButton.getBean();
+ CommentAware model = editorButton.getBean();
Preconditions.checkNotNull(model, "No model found in editor.");
Object result = model.getComment();
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentEditorUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentEditorUI.jaxx 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentEditorUI.jaxx 2013-04-03 18:25:40 UTC (rev 723)
@@ -24,6 +24,7 @@
<JDialog id='commentDialog' layout='{new BorderLayout()}'>
<import>
+ fr.ifremer.tutti.persistence.entities.CommentAware
fr.ifremer.tutti.ui.swing.TuttiUIContext
org.jdesktop.swingx.JXTitledPanel
@@ -54,7 +55,7 @@
]]></script>
<!-- bean property -->
- <CommentModelAware id='bean' javaBean='null'/>
+ <CommentAware id='bean' javaBean='null'/>
<CommentEditorUIHandler id='handler'
initializer='getContextValue(CommentEditorUIHandler.class)'/>
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentEditorUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentEditorUIHandler.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentEditorUIHandler.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -24,6 +24,7 @@
* #L%
*/
+import fr.ifremer.tutti.persistence.entities.CommentAware;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import jaxx.runtime.SwingUtil;
import jaxx.runtime.swing.ComponentMover;
@@ -154,7 +155,7 @@
public void init() {
- CommentModelAware bean = ui.getBean();
+ CommentAware bean = ui.getBean();
String content = bean == null ? null : bean.getComment();
ui.getTextContent().setText(content);
}
@@ -181,7 +182,7 @@
/** pushes the typed text in the property of the bean */
public void setText(String value) {
- CommentModelAware bean = ui.getBean();
+ CommentAware bean = ui.getBean();
bean.setComment(value);
}
Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentModelAware.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentModelAware.java 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/comment/CommentModelAware.java 2013-04-03 18:25:40 UTC (rev 723)
@@ -1,40 +0,0 @@
-package fr.ifremer.tutti.ui.swing.util.comment;
-
-/*
- * #%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%
- */
-
-/**
- * To place on model wich supports comment.
- *
- * @author tchemit <chemit(a)codelutin.com>
- * @since 1.1
- */
-public interface CommentModelAware {
-
- String PROPERTY_COMMENT = "comment";
-
- String getComment();
-
- void setComment(String comment);
-}
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-04-03 18:25:40 UTC (rev 723)
@@ -172,10 +172,15 @@
tutti.dbManager.title.choose.dbExportFile=
tutti.dbManager.title.choose.dbImportFile=
tutti.editAccidentalBatch.table.header.comment=
+tutti.editAccidentalBatch.table.header.comment.tip=
tutti.editAccidentalBatch.table.header.file=
+tutti.editAccidentalBatch.table.header.file.tip=
tutti.editAccidentalBatch.table.header.speciesByCode=
+tutti.editAccidentalBatch.table.header.speciesByCode.tip=
tutti.editAccidentalBatch.table.header.speciesByGenusCode=
+tutti.editAccidentalBatch.table.header.speciesByGenusCode.tip=
tutti.editAccidentalBatch.table.header.weight=
+tutti.editAccidentalBatch.table.header.weight.tip=
tutti.editBenthosBatch.action.createBatch=
tutti.editBenthosBatch.action.createBatch.mnemonic=
tutti.editBenthosBatch.action.createBatch.tip=
@@ -212,20 +217,31 @@
tutti.editBenthosBatch.split.weightNotNull.message=
tutti.editBenthosBatch.split.weightNotNull.title=
tutti.editBenthosBatch.table.header.ageCategory=
+tutti.editBenthosBatch.table.header.ageCategory.tip=
tutti.editBenthosBatch.table.header.comment=
+tutti.editBenthosBatch.table.header.comment.tip=
tutti.editBenthosBatch.table.header.computedNumber=
+tutti.editBenthosBatch.table.header.computedNumber.tip=
tutti.editBenthosBatch.table.header.file=
+tutti.editBenthosBatch.table.header.file.tip=
tutti.editBenthosBatch.table.header.maturityCategory=
+tutti.editBenthosBatch.table.header.maturityCategory.tip=
tutti.editBenthosBatch.table.header.number=
tutti.editBenthosBatch.table.header.sampleWeight=
tutti.editBenthosBatch.table.header.sexCategory=
+tutti.editBenthosBatch.table.header.sexCategory.tip=
tutti.editBenthosBatch.table.header.sizeCategory=
+tutti.editBenthosBatch.table.header.sizeCategory.tip=
tutti.editBenthosBatch.table.header.sortedUnsortedCategory=
+tutti.editBenthosBatch.table.header.sortedUnsortedCategory.tip=
tutti.editBenthosBatch.table.header.species=
+tutti.editBenthosBatch.table.header.species.tip=
tutti.editBenthosBatch.table.header.speciesByCode=
tutti.editBenthosBatch.table.header.speciesByGenusCode=
tutti.editBenthosBatch.table.header.toConfirm=
+tutti.editBenthosBatch.table.header.toConfirm.tip=
tutti.editBenthosBatch.table.header.weight=
+tutti.editBenthosBatch.table.header.weight.tip=
tutti.editBenthosFrequencies.action.cancel=
tutti.editBenthosFrequencies.action.cancel.mnemonic=
tutti.editBenthosFrequencies.action.cancel.tip=
@@ -461,19 +477,34 @@
tutti.editFishingOperation.label.traitReminder.inCreation=
tutti.editFishingOperation.pane.other=
tutti.editFishingOperation.tab.general=
+tutti.editMarineLitterBatch.field.marineLitterTotalWeight=
+tutti.editMarineLitterBatch.field.marineLitterTotalWeight.tip=
tutti.editMarineLitterBatch.table.header.comment=
+tutti.editMarineLitterBatch.table.header.comment.tip=
tutti.editMarineLitterBatch.table.header.file=
+tutti.editMarineLitterBatch.table.header.file.tip=
tutti.editMarineLitterBatch.table.header.marineLitterCategory=
+tutti.editMarineLitterBatch.table.header.marineLitterCategory.tip=
tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory=
+tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory.tip=
tutti.editMarineLitterBatch.table.header.number=
+tutti.editMarineLitterBatch.table.header.number.tip=
tutti.editMarineLitterBatch.table.header.weight=
+tutti.editMarineLitterBatch.table.header.weight.tip=
tutti.editPlanktonBatch.table.header.comment=
+tutti.editPlanktonBatch.table.header.comment.tip=
tutti.editPlanktonBatch.table.header.file=
+tutti.editPlanktonBatch.table.header.file.tip=
tutti.editPlanktonBatch.table.header.sampleWeight=
+tutti.editPlanktonBatch.table.header.sampleWeight.tip=
tutti.editPlanktonBatch.table.header.speciesByCode=
+tutti.editPlanktonBatch.table.header.speciesByCode.tip=
tutti.editPlanktonBatch.table.header.speciesByGenusCode=
+tutti.editPlanktonBatch.table.header.speciesByGenusCode.tip=
tutti.editPlanktonBatch.table.header.toConfirm=
+tutti.editPlanktonBatch.table.header.toConfirm.tip=
tutti.editPlanktonBatch.table.header.weight=
+tutti.editPlanktonBatch.table.header.weight.tip=
tutti.editProgram.action.closeEditProgram=
tutti.editProgram.action.closeEditProgram.mnemonic=
tutti.editProgram.action.closeEditProgram.tip=
Modified: trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-04-03 17:29:52 UTC (rev 722)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2013-04-03 18:25:40 UTC (rev 723)
@@ -175,10 +175,15 @@
tutti.dbManager.title.choose.dbExportFile=Exporter la base de données
tutti.dbManager.title.choose.dbImportFile=Importer la base de données
tutti.editAccidentalBatch.table.header.comment=Commentaire
+tutti.editAccidentalBatch.table.header.comment.tip=
tutti.editAccidentalBatch.table.header.file=Pièces-jointes
+tutti.editAccidentalBatch.table.header.file.tip=
tutti.editAccidentalBatch.table.header.speciesByCode=Espèce
+tutti.editAccidentalBatch.table.header.speciesByCode.tip=
tutti.editAccidentalBatch.table.header.speciesByGenusCode=Espèce
+tutti.editAccidentalBatch.table.header.speciesByGenusCode.tip=
tutti.editAccidentalBatch.table.header.weight=Poids observé
+tutti.editAccidentalBatch.table.header.weight.tip=
tutti.editBenthosBatch.action.createBatch=Créer un lot pour une espèce
tutti.editBenthosBatch.action.createBatch.mnemonic=C
tutti.editBenthosBatch.action.createBatch.tip=Créer un nouveau lot pour une espèce
@@ -221,16 +226,27 @@
tutti.editBenthosBatch.split.weightNotNull.message=Pour catégoriser un lot, il ne doit pas avoir de poids sous-échantillonné.
tutti.editBenthosBatch.split.weightNotNull.title=Poids sous-échantillonné non nul
tutti.editBenthosBatch.table.header.ageCategory=Age
+tutti.editBenthosBatch.table.header.ageCategory.tip=
tutti.editBenthosBatch.table.header.comment=Commentaire
+tutti.editBenthosBatch.table.header.comment.tip=
tutti.editBenthosBatch.table.header.computedNumber=Nombre
+tutti.editBenthosBatch.table.header.computedNumber.tip=
tutti.editBenthosBatch.table.header.file=Pièces jointes
+tutti.editBenthosBatch.table.header.file.tip=
tutti.editBenthosBatch.table.header.maturityCategory=Maturité
+tutti.editBenthosBatch.table.header.maturityCategory.tip=
tutti.editBenthosBatch.table.header.sexCategory=Sexe
+tutti.editBenthosBatch.table.header.sexCategory.tip=
tutti.editBenthosBatch.table.header.sizeCategory=Class. Tri
+tutti.editBenthosBatch.table.header.sizeCategory.tip=
tutti.editBenthosBatch.table.header.sortedUnsortedCategory=V/HV (kg)
+tutti.editBenthosBatch.table.header.sortedUnsortedCategory.tip=
tutti.editBenthosBatch.table.header.species=Espèce
+tutti.editBenthosBatch.table.header.species.tip=
tutti.editBenthosBatch.table.header.toConfirm=A Confirmer
+tutti.editBenthosBatch.table.header.toConfirm.tip=
tutti.editBenthosBatch.table.header.weight=Poids sous-échantillonné (kg)
+tutti.editBenthosBatch.table.header.weight.tip=
tutti.editBenthosBatch.title.batchActions=Actions
tutti.editBenthosFrequencies.action.cancel=Annuler
tutti.editBenthosFrequencies.action.cancel.mnemonic=A
@@ -468,19 +484,34 @@
tutti.editFishingOperation.label.traitReminder.inCreation=en cours de création
tutti.editFishingOperation.pane.other=Autres caractéristiques
tutti.editFishingOperation.tab.general=Trait
+tutti.editMarineLitterBatch.field.marineLitterTotalWeight=Poids total (Kg)
+tutti.editMarineLitterBatch.field.marineLitterTotalWeight.tip=Poids total (Kg)
tutti.editMarineLitterBatch.table.header.comment=Commentaire
+tutti.editMarineLitterBatch.table.header.comment.tip=Commentaire
tutti.editMarineLitterBatch.table.header.file=Pièces jointes
+tutti.editMarineLitterBatch.table.header.file.tip=Pièces jointes
tutti.editMarineLitterBatch.table.header.marineLitterCategory=Catégorie
+tutti.editMarineLitterBatch.table.header.marineLitterCategory.tip=Catégorie de déchets
tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory=Catégorie de taille
+tutti.editMarineLitterBatch.table.header.marineLitterSizeCategory.tip=Catégorie de taille
tutti.editMarineLitterBatch.table.header.number=Nombre
+tutti.editMarineLitterBatch.table.header.number.tip=Nombre d'objets
tutti.editMarineLitterBatch.table.header.weight=Poids
+tutti.editMarineLitterBatch.table.header.weight.tip=Poids (Kg)
tutti.editPlanktonBatch.table.header.comment=Commentaire
+tutti.editPlanktonBatch.table.header.comment.tip=
tutti.editPlanktonBatch.table.header.file=Pièces jointes
+tutti.editPlanktonBatch.table.header.file.tip=Pièces jointes
tutti.editPlanktonBatch.table.header.sampleWeight=Poids échantillonné
+tutti.editPlanktonBatch.table.header.sampleWeight.tip=
tutti.editPlanktonBatch.table.header.speciesByCode=Espèce
+tutti.editPlanktonBatch.table.header.speciesByCode.tip=
tutti.editPlanktonBatch.table.header.speciesByGenusCode=Espèce
+tutti.editPlanktonBatch.table.header.speciesByGenusCode.tip=
tutti.editPlanktonBatch.table.header.toConfirm=A Confirmer
+tutti.editPlanktonBatch.table.header.toConfirm.tip=
tutti.editPlanktonBatch.table.header.weight=Poids
+tutti.editPlanktonBatch.table.header.weight.tip=
tutti.editProgram.action.closeEditProgram=Fermer
tutti.editProgram.action.closeEditProgram.mnemonic=r
tutti.editProgram.action.closeEditProgram.tip=Annuler l'édition (ou la création) de la série de campagne
1
0
r722 - in trunk/tutti-service/src/main: java/fr/ifremer/tutti/service java/fr/ifremer/tutti/service/catches resources/i18n
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 19:29:52 +0200 (Wed, 03 Apr 2013)
New Revision: 722
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/722
Log:
create service to compute the weights
Added:
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/
trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java
Modified:
trunk/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java
===================================================================
--- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java (rev 0)
+++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/TuttiWeightComputingService.java 2013-04-03 17:29:52 UTC (rev 722)
@@ -0,0 +1,330 @@
+package fr.ifremer.tutti.service.catches;
+
+import fr.ifremer.tutti.TuttiBusinessException;
+import fr.ifremer.tutti.persistence.entities.data.*;
+import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
+import fr.ifremer.tutti.service.AbstractTuttiService;
+import fr.ifremer.tutti.service.PersistenceService;
+import fr.ifremer.tutti.service.TuttiServiceContext;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import javax.swing.*;
+import java.util.List;
+
+import static org.nuiton.i18n.I18n._;
+
+/**
+ * @author kmorin <kmorin(a)codelutin.com>
+ * @since 1.3
+ */
+public class TuttiWeightComputingService extends AbstractTuttiService {
+
+ private static final Log log =
+ LogFactory.getLog(TuttiWeightComputingService.class);
+
+ protected PersistenceService persistenceService;
+
+ @Override
+ public void setServiceContext(TuttiServiceContext context) {
+ super.setServiceContext(context);
+ persistenceService = getService(PersistenceService.class);
+ }
+
+ public void computeCatchBatchWeights(CatchBatch catchBatch,
+ BatchContainer<SpeciesBatch> rootSpeciesBatch,
+ BatchContainer<SpeciesBatch> rootBenthosBatch) {
+
+ // Species
+ Float speciesTotalComputedSortedWeight = 0f;
+ Float speciesTotalComputedUnsortedWeight = 0f;
+
+ for (int i = 0; i < rootSpeciesBatch.getChildren().size(); i++) {
+ SpeciesBatch row = rootSpeciesBatch.getChildren().get(i);
+ Float weight = row.getSampleCategoryWeight();
+ if (weight == null) {
+ weight = row.getSampleCategoryComputedWeight();
+ }
+ if (weight == null) {
+ return;
+ }
+
+ CaracteristicQualitativeValue value = (CaracteristicQualitativeValue) row.getSampleCategoryValue();
+ if (SortedUnsortedEnum.SORTED.matchValue(value)) {
+ speciesTotalComputedSortedWeight += weight;
+ } else {
+ speciesTotalComputedUnsortedWeight += weight;
+ }
+ }
+
+ Number inertWeight = catchBatch.getSpeciesTotalInertWeight();
+ if (inertWeight != null) {
+ speciesTotalComputedSortedWeight += inertWeight.floatValue();
+ } else {
+ catchBatch.setSpeciesTotalInertComputedWeight(0f);
+ }
+
+ Number livingNotItemizedWeight = catchBatch.getSpeciesTotalLivingNotItemizedWeight();
+ if (livingNotItemizedWeight != null) {
+ speciesTotalComputedSortedWeight += livingNotItemizedWeight.floatValue();
+ } else {
+ catchBatch.setSpeciesTotalLivingNotItemizedComputedWeight(0f);
+ }
+
+ catchBatch.setSpeciesTotalSampleSortedComputedWeight(speciesTotalComputedSortedWeight);
+
+ Float speciesTotalSortedWeight = catchBatch.getSpeciesTotalSortedWeight();
+ if (speciesTotalSortedWeight == null) {
+ speciesTotalSortedWeight = speciesTotalComputedSortedWeight;
+ catchBatch.setSpeciesTotalSortedComputedWeight(speciesTotalSortedWeight);
+
+ } else if (speciesTotalSortedWeight < speciesTotalComputedSortedWeight) {
+ throw new TuttiBusinessException(_("tutti.service.catches.computeWeights.error.incoherentSpeciesTotalSorted"));
+ }
+ catchBatch.setSpeciesTotalUnsortedComputedWeight(speciesTotalComputedUnsortedWeight);
+
+ if (speciesTotalSortedWeight == null) {
+ speciesTotalSortedWeight = catchBatch.getSpeciesTotalSortedComputedWeight();
+ }
+ Float speciesTotalWeight = speciesTotalComputedUnsortedWeight + speciesTotalSortedWeight;
+ catchBatch.setSpeciesTotalComputedWeight(speciesTotalWeight);
+
+ // Benthos
+ Float benthosTotalComputedSortedWeight = 0f;
+ Float benthosTotalComputedUnsortedWeight = 0f;
+
+ for (int i = 0; i < rootBenthosBatch.getChildren().size(); i++) {
+ SpeciesBatch row = rootBenthosBatch.getChildren().get(i);
+ Float weight = row.getSampleCategoryWeight();
+ if (weight == null) {
+ weight = row.getSampleCategoryComputedWeight();
+ }
+ if (weight == null) {
+ return;
+ }
+
+ CaracteristicQualitativeValue value = (CaracteristicQualitativeValue) row.getSampleCategoryValue();
+ if (SortedUnsortedEnum.SORTED.matchValue(value)) {
+ benthosTotalComputedSortedWeight += weight;
+ } else {
+ benthosTotalComputedUnsortedWeight += weight;
+ }
+ }
+
+ inertWeight = catchBatch.getBenthosTotalInertWeight();
+ if (inertWeight != null) {
+ benthosTotalComputedSortedWeight += inertWeight.floatValue();
+ } else {
+ catchBatch.setBenthosTotalInertComputedWeight(0f);
+ }
+
+ livingNotItemizedWeight = catchBatch.getBenthosTotalLivingNotItemizedWeight();
+ if (livingNotItemizedWeight != null) {
+ benthosTotalComputedSortedWeight += livingNotItemizedWeight.floatValue();
+ } else {
+ catchBatch.setBenthosTotalLivingNotItemizedComputedWeight(0f);
+ }
+
+ catchBatch.setBenthosTotalSampleSortedComputedWeight(benthosTotalComputedSortedWeight);
+
+ Float benthosTotalSortedWeight = catchBatch.getBenthosTotalSortedWeight();
+ if (benthosTotalSortedWeight == null) {
+ benthosTotalSortedWeight = benthosTotalComputedSortedWeight;
+ catchBatch.setBenthosTotalSortedComputedWeight(benthosTotalSortedWeight);
+
+ } else if (benthosTotalSortedWeight < benthosTotalComputedSortedWeight) {
+ throw new TuttiBusinessException(_("tutti.service.catches.computeWeights.error.incoherentBenthosTotalSorted"));
+ }
+ catchBatch.setBenthosTotalUnsortedComputedWeight(benthosTotalComputedUnsortedWeight);
+
+ if (benthosTotalSortedWeight == null) {
+ benthosTotalSortedWeight = catchBatch.getBenthosTotalSortedComputedWeight();
+ }
+ Float benthosTotalWeight = benthosTotalComputedUnsortedWeight + benthosTotalSortedWeight;
+ catchBatch.setBenthosTotalComputedWeight(benthosTotalWeight);
+
+ // Catch
+ Float carrouselWeight = catchBatch.getCatchTotalSortedCarousselWeight();
+ Float totalUnsortedWeight = catchBatch.getSpeciesTotalUnsortedComputedWeight() +
+ catchBatch.getBenthosTotalUnsortedComputedWeight();
+ Float totalSortedWeight;
+ if (carrouselWeight != null) {
+ totalSortedWeight = carrouselWeight;
+ } else {
+ totalSortedWeight = speciesTotalSortedWeight + benthosTotalSortedWeight;
+ }
+ catchBatch.setCatchTotalSortedComputedWeight(totalSortedWeight);
+ catchBatch.setCatchTotalUnsortedComputedWeight(totalUnsortedWeight);
+
+ Float totalWeight = catchBatch.getCatchTotalWeight();
+ Float rejectedWeight = catchBatch.getCatchTotalRejectedWeight();
+
+ if (rejectedWeight == null && totalWeight != null) {
+ if (!totalWeight.equals(totalUnsortedWeight
+ + totalSortedWeight)) {
+ throw new TuttiBusinessException(_("tutti.service.catches.computeWeights.error.incoherentTotal"));
+
+ } else {
+ catchBatch.setCatchTotalRejectedComputedWeight(totalWeight
+ - totalUnsortedWeight
+ - totalSortedWeight);
+ }
+
+ } else if (totalWeight == null) {
+ if (rejectedWeight == null) {
+ rejectedWeight = 0f;
+ catchBatch.setCatchTotalRejectedComputedWeight(0f);
+ }
+ catchBatch.setCatchTotalComputedWeight(totalUnsortedWeight
+ + totalSortedWeight
+ + rejectedWeight);
+
+ } else if (!totalWeight.equals(totalUnsortedWeight + totalSortedWeight + rejectedWeight)) {
+ throw new TuttiBusinessException(_("tutti.service.catches.computeWeights.error.incoherentTotal"));
+ }
+ }
+
+ public BatchContainer<SpeciesBatch> getComputedSpeciesBatches(FishingOperation operation) {
+
+ BatchContainer<SpeciesBatch> rootSpeciesBatch =
+ persistenceService.getRootSpeciesBatch(operation.getId());
+
+ if (rootSpeciesBatch != null) {
+ List<SpeciesBatch> roots = rootSpeciesBatch.getChildren();
+
+ for (int i = 0; i < roots.size(); i++) {
+ SpeciesBatch batch = roots.get(i);
+ computeSpeciesBatch(batch);
+ }
+ }
+
+ return rootSpeciesBatch;
+ }
+
+ public BatchContainer<SpeciesBatch> getComputedBenthosBatches(FishingOperation operation) {
+
+ BatchContainer<SpeciesBatch> rootBenthosBatch =
+ persistenceService.getRootBenthosBatch(operation.getId());
+
+ List<SpeciesBatch> roots = rootBenthosBatch.getChildren();
+
+ for (int i = 0; i < roots.size(); i++) {
+ SpeciesBatch batch = roots.get(i);
+ computeSpeciesBatch(batch);
+ }
+
+ return rootBenthosBatch;
+ }
+
+ protected Float computeSpeciesBatch(SpeciesBatch batch) {
+ Float result = null;
+ Float categoryWeight = batch.getSampleCategoryWeight();
+ Float rowWeight = batch.getWeight();
+
+ List<SpeciesBatch> children = batch.getChildBatchs();
+ // if the row is not a leaf
+ if (batch.sizeChildBatchs() > 0) {
+ Float sum = 0f;
+ // make the sum of the children weights
+ for (SpeciesBatch child : children) {
+ Float weight = computeSpeciesBatch(child);
+ if (weight == null) {
+ sum = null;
+ break;
+ }
+ sum += weight;
+ }
+
+ if (sum != null) {
+// if (categoryWeight == null) {
+// finestCategory.setComputedWeight(sum);
+// for (SpeciesBatchRowModel child : children) {
+// child.getFinestCategory().setSubSample(false);
+// }
+//
+// } else if (categoryWeight < sum) {
+// throw new TuttiBusinessException(_("tutti.editCatchBatch.action.computeWeights.error.incoherentParentCategoryWeight"));
+//
+// } else {
+// boolean subSample = categoryWeight > sum;
+// for (SpeciesBatchRowModel child : children) {
+// child.getFinestCategory().setSubSample(subSample);
+// }
+// sum = categoryWeight;
+// }
+// result = sum;
+ if (categoryWeight == null) {
+ batch.setSampleCategoryComputedWeight(sum);
+
+ } else if (categoryWeight < sum) {
+ throw new TuttiBusinessException(_("tutti.service.catches.computeWeights.error.incoherentParentCategoryWeight"));
+
+ } else {
+ sum = categoryWeight;
+ }
+ result = sum;
+ }
+
+ } else {// the row is a leaf
+
+ batch.setComputedWeight(null);
+
+ List<SpeciesBatchFrequency> frequencies = persistenceService.getAllSpeciesBatchFrequency(batch.getId());
+
+ if (CollectionUtils.isNotEmpty(frequencies)) {
+ // if there are frequencies, then compute their weight
+ Float frequencyWeight = 0f;
+ for (SpeciesBatchFrequency frequency : frequencies) {
+ Float w = frequency.getWeight();
+ if (w == null) {
+
+ // can't sum when a null value appears
+ frequencyWeight = null;
+ break;
+
+ } else if (frequencyWeight != null) {
+
+ // still can sum weights
+ frequencyWeight += w;
+ }
+ }
+
+ if (categoryWeight == null && rowWeight != null) {
+ throw new TuttiBusinessException(_("tutti.service.catches.computeWeights.error.incoherentRowWeightCategory"));
+
+ } else if (categoryWeight == null && frequencyWeight != null) {
+ // if the category weight is null and the frequencies have a weight,
+ // then this weight is the result
+ batch.setSampleCategoryComputedWeight(frequencyWeight);
+ result = frequencyWeight;
+
+ } else if (frequencyWeight != null
+ && !frequencyWeight.equals(categoryWeight)) {
+
+ // if the weight of the frequencies is different from the category
+ // weight, then set the weight of the sample
+ if (frequencyWeight > categoryWeight) {
+ throw new TuttiBusinessException(_("tutti.service.catches.computeWeights.error.incoherentCategoryWeight"));
+
+ } else if (rowWeight == null) {
+ batch.setComputedWeight(frequencyWeight);
+
+ } else if (!rowWeight.equals(frequencyWeight)) {
+ throw new TuttiBusinessException(_("tutti.service.catches.computeWeights.error.incoherentRowWeightFrequency"));
+ }
+ result = categoryWeight;
+
+ } else {
+ result = categoryWeight;
+ }
+
+ } else {
+ result = categoryWeight;
+ }
+ }
+
+ return result;
+ }
+
+}
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-04-03 15:15:57 UTC (rev 721)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2013-04-03 17:29:52 UTC (rev 722)
@@ -7,6 +7,10 @@
tutti.config.option.tmp.directory.description=
tutti.config.option.version.description=
tutti.config.service=
+tutti.editCatchBatch.action.computeWeights.error.incoherentCategoryWeight=
+tutti.editCatchBatch.action.computeWeights.error.incoherentParentCategoryWeight=
+tutti.editCatchBatch.action.computeWeights.error.incoherentRowWeightCategory=
+tutti.editCatchBatch.action.computeWeights.error.incoherentRowWeightFrequency=
tutti.property.attachment=
tutti.property.caracteristic=
tutti.property.country=
@@ -43,6 +47,12 @@
tutti.propety.no.vessel.name=
tutti.propety.no.zone=
tutti.propety.vessel.nation.registrationCode=
+tutti.service.catches.computeWeights.error.incoherentCategoryWeight=
+tutti.service.catches.computeWeights.error.incoherentParentCategoryWeight=
+tutti.service.catches.computeWeights.error.incoherentRowWeightCategory=
+tutti.service.catches.computeWeights.error.incoherentRowWeightFrequency=
+tutti.service.catches.computeWeights.error.incoherentSpeciesTotalSorted=
+tutti.service.catches.computeWeights.error.incoherentTotal=
tutti.validator.error.comment.too.long=
tutti.validator.error.cruise.beginDate.required=
tutti.validator.error.cruise.dates.endBeforeStart=
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-04-03 15:15:57 UTC (rev 721)
+++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2013-04-03 17:29:52 UTC (rev 722)
@@ -7,6 +7,7 @@
tutti.config.option.tmp.directory.description=Répertoire temporaire utilisée par l'application (est nettoyé à chaque démarrage de l'application).
tutti.config.option.version.description=Version courante de l'application
tutti.config.service=Configuration des services de Tutti
+tutti.editCatchBatch.action.computeWeights.error.incoherentParentCategoryWeight=
tutti.property.attachment=Pièce jointe
tutti.property.caracteristic=Caractéristique
tutti.property.country=Pays
@@ -43,6 +44,12 @@
tutti.propety.no.vessel.name=Nom inconnu
tutti.propety.no.zone=Pas de zone
tutti.propety.vessel.nation.registrationCode=%s (nat.)
+tutti.service.catches.computeWeights.error.incoherentCategoryWeight=Le poids total des mensurations est supérieur au poids de la catégorie
+tutti.service.catches.computeWeights.error.incoherentParentCategoryWeight=Le poids de la catégorie est différent de la somme des poids de ses sous-catégories
+tutti.service.catches.computeWeights.error.incoherentRowWeightCategory=Le poids de la catégorie ne peut pas être nul si le poids de sous-échantillonage est renseigné
+tutti.service.catches.computeWeights.error.incoherentRowWeightFrequency=Le poids total des mensurations est différent du poids du sous-échantillon
+tutti.service.catches.computeWeights.error.incoherentSpeciesTotalSorted=Le poids total Vrac des espèces est inférieur à la somme des poids Vrac triés, inerte trié et vivant non détaillé trié
+tutti.service.catches.computeWeights.error.incoherentTotal=Le poids total de la capture ne correspond pas à la somme des poids totaux Vrac, Hors Vrac et non triés
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
1
0
Author: tchemit
Date: 2013-04-03 17:15:57 +0200 (Wed, 03 Apr 2013)
New Revision: 721
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/721
Log:
add more ignore test resources
Modified:
trunk/tutti-persistence/src/test/
Property changes on: trunk/tutti-persistence/src/test
___________________________________________________________________
Modified: svn:ignore
- db
+ db
dbEmpty
1
0
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
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
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
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