branch feature/6575 updated (3cf2fbc -> 47f83be)
This is an automated email from the git hooks/post-receive script. New change to branch feature/6575 in repository tutti. See http://git.codelutin.com/tutti.git from 3cf2fbc start of #6575 adds 50855f2 refs #6575 ajout des poids tremie et carrousel + ratio vrac trié / vrac total adds 44525ee amélioration du démarrage de l'application adds c4ec765 chargement en lazy du modèle de catégorisation adds 8a187b4 do not remove sample category model reference, just dirty it adds 865dbb3 add delete on exit hook adds 98f931c always work on a copy of db to avoid windows locks on files adds f2665e3 fixes #6541 adds 84422d2 add new shutdown methods adds 892651f add new method to close persistence service adds 3f51fe4 add new shutdown methods adds 5c1d9d4 delete db files adds dfe6838 rename exit code adds e44d941 fixes #6601 adds c75959c amélioration des propriétés du launcher adds a9f657f transmission des paramètres aux scripts de lancement adds a186a74 fix launcher properties adds fc265ad use last launcher version adds 1cdf969 fix bash script adds 68f7958 fix launcher archive configuration adds 28d9da7 fix NPE (refs #6538) adds 43e6198 fixes #6594: [REFERENTIEL] Pb de mise à jour (utilisation adagio 3.8.3.1) adds e33b29e use codelutinpom wagon-m-p version adds 740d00d introduction de classes différentes pour les différentes types de signes adds d321712 deplacement du code csv dabs un paquetage dédié + nettoyage code adds 412db54 ajout d'une méthode pour retrouver tous les lots d'un lot racine adds f9c70c9 deplacement du code csv dabs un paquetage dédié + nettoyage code adds 11bae16 introduction d'un objet context de l'import adds f11ac3a suppression des vieux signes adds 8e2435c réusinage du code d'import et prise en compte du nouveau mode d'import (en indiquant le lot plutot que l'espèce carégorisée) adds 714ca74 fixes #6471 adds 3d46837 fixes #6588: [VALIDATION] ordre des traits : proposer d'ordonner les trait par date/heure ou n° station ou n° trait (les traits sont ordonnés par date / heure) adds 4f3c7cf refs 6544: [TECH] Permettre que les mises à jour fonctionnent depuis la version 3.7 adds 2a27fc2 update db versions adds 61db5d8 i18n adds 856e849 fixes #6610: [TECH] Mauvaise fermeture des bases adds 45fd868 refs #6538 chargement du svg à chaque fois qu'on revient sur l'onglet adds b6c955c refs #6538 better handle erors new 249cea2 Merge branches 'develop' and 'feature/6575' of https://git.codelutin.com/tutti into feature/6575 new 47f83be add species code, name and vernacular name + catch comment The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 47f83beb685fddd9dfcd82fa5dc09cecb5ea82e1 Author: Kevin Morin <morin@codelutin.com> Date: Thu Feb 5 18:38:39 2015 +0100 add species code, name and vernacular name + catch comment commit 249cea2ed9bb3f8339abfef1feb3c2300486131c Merge: 3cf2fbc b6c955c Author: Kevin Morin <morin@codelutin.com> Date: Thu Feb 5 15:40:30 2015 +0100 Merge branches 'develop' and 'feature/6575' of https://git.codelutin.com/tutti into feature/6575 Summary of changes: README.txt | 33 +- pom.xml | 12 +- src/site/rst/dbversions.rst | 4 + src/update/tutti-application.properties | 2 +- .../tutti/persistence/TuttiPersistenceImpl.java | 31 +- .../persistence/entities/data/SpeciesBatchs.java | 20 + .../src/main/java/fr/ifremer/tutti/util/Jdbcs.java | 31 + .../ifremer/tutti/service/PdfGeneratorService.java | 1 + .../fr/ifremer/tutti/service/TuttiDataContext.java | 41 +- .../tutti/service/bigfin/BigfinDataRowModel.java | 138 ---- .../tutti/service/bigfin/BigfinImportContext.java | 357 ++++++++ .../tutti/service/bigfin/BigfinImportService.java | 366 ++++----- .../fr/ifremer/tutti/service/bigfin/Signs.java | 216 ----- .../service/bigfin/{ => csv}/BigfinDataRow.java | 75 +- .../service/bigfin/csv/BigfinDataRowModel.java | 231 ++++++ .../service/bigfin/csv/SpeciesOrSpeciesBatch.java | 42 + .../fr/ifremer/tutti/service/bigfin/signs/Sex.java | 109 +++ .../ifremer/tutti/service/bigfin/signs/Sign.java | 27 + .../ifremer/tutti/service/bigfin/signs/Size.java | 111 +++ .../tutti/service/bigfin/signs/VracHorsVrac.java | 92 +++ .../catches/ValidateCruiseOperationsService.java | 38 +- .../tutti/service/export/ExportCatchContext.java | 145 +++- .../ToConfirmReportBatchEntry.java} | 23 +- .../toconfirmreport/ToConfirmReportOperation.java | 2 +- .../toconfirmreport/ToConfirmReportService.java | 321 ++++++++ .../toconfirmreport/ToConfirmReportService.java | 125 --- .../resources/ftl/toConfirmSpeciesReport_fr.ftl | 87 +- .../resources/i18n/tutti-service_en_GB.properties | 5 + .../resources/i18n/tutti-service_fr_FR.properties | 9 +- .../tutti/ui/swing/updater/DeleteHelper.java | 27 + .../src/main/resources/update_runtime.bat | 5 +- .../src/main/resources/update_runtime.sh | 7 +- tutti-ui-swing/pom.xml | 67 ++ .../src/main/assembly/full-linux-component.xml | 2 +- .../src/main/assembly/full-shared-component.xml | 45 +- .../src/main/assembly/full-windows-component.xml | 3 +- .../{full-windows-component.xml => launcher.xml} | 61 +- .../main/assembly/{full => launcher}/README.txt | 0 .../{full => launcher}/linux/tutti-sanity.sh | 2 +- .../assembly/{full => launcher}/linux/tutti.sh | 2 +- .../{full => launcher}/windows/tutti-sanity.bat | 0 .../assembly/{full => launcher}/windows/tutti.bat | 0 .../src/main/assembly/report/version.appup | 1 - tutti-ui-swing/src/main/assembly/standalone.xml | 39 +- .../main/assembly/standalone/launcher.properties | 9 +- .../src/main/assembly/standalone/linux/launch.sh | 8 +- .../main/assembly/standalone/windows/launch.bat | 7 +- .../java/fr/ifremer/tutti/ui/swing/RunTutti.java | 7 +- .../fr/ifremer/tutti/ui/swing/TuttiUIContext.java | 45 +- .../ui/swing/action/CloseApplicationAction.java | 4 +- .../tutti/ui/swing/action/CloseDbAction.java | 5 +- .../ui/swing/action/ExportAndCleanDbAction.java | 21 +- .../tutti/ui/swing/action/ExportDbAction.java | 6 +- .../tutti/ui/swing/action/ImportDbAction.java | 6 +- .../tutti/ui/swing/action/OpenDbAction.java | 6 +- .../tutti/ui/swing/action/ReimportDbAction.java | 9 +- .../tutti/ui/swing/action/ReinstallDbAction.java | 9 +- .../tutti/ui/swing/action/ReloadTuttiAction.java | 2 +- .../action/SaveSampleCategoryModelAction.java | 2 +- .../SpeciesToConfirmReportForCruiseAction.java | 2 +- .../ui/swing/action/UpdateApplicationAction.java | 2 +- .../tutti/ui/swing/action/UpdateReportAction.java | 2 +- .../operation/catches/EditCatchesUIHandler.java | 905 ++++++++++++--------- .../validation/ValidateCruiseUIHandler.java | 13 +- .../content/validation/ValidateCruiseUIModel.java | 3 +- .../ui/swing/update/module/DbModuleUpdater.java | 79 +- .../util/AbstractTuttiTabContainerUIHandler.java | 55 +- tutti-ui-swing/src/main/resources/EcranResume.svg | 112 ++- 68 files changed, 2804 insertions(+), 1470 deletions(-) delete mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/BigfinDataRowModel.java create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/BigfinImportContext.java delete mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/Signs.java rename tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/{ => csv}/BigfinDataRow.java (60%) create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/csv/BigfinDataRowModel.java create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/csv/SpeciesOrSpeciesBatch.java create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/signs/Sex.java create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/signs/Sign.java create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/signs/Size.java create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/bigfin/signs/VracHorsVrac.java copy tutti-service/src/main/java/fr/ifremer/tutti/service/export/{pdf/PdfExportBatchEntry.java => toconfirmreport/ToConfirmReportBatchEntry.java} (74%) rename tutti-service/src/main/java/fr/ifremer/tutti/service/{ => export}/toconfirmreport/ToConfirmReportOperation.java (95%) create mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportService.java delete mode 100644 tutti-service/src/main/java/fr/ifremer/tutti/service/toconfirmreport/ToConfirmReportService.java copy tutti-ui-swing/src/main/assembly/{full-windows-component.xml => launcher.xml} (52%) rename tutti-ui-swing/src/main/assembly/{full => launcher}/README.txt (100%) rename tutti-ui-swing/src/main/assembly/{full => launcher}/linux/tutti-sanity.sh (77%) rename tutti-ui-swing/src/main/assembly/{full => launcher}/linux/tutti.sh (83%) rename tutti-ui-swing/src/main/assembly/{full => launcher}/windows/tutti-sanity.bat (100%) rename tutti-ui-swing/src/main/assembly/{full => launcher}/windows/tutti.bat (100%) delete mode 100644 tutti-ui-swing/src/main/assembly/report/version.appup -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6575 in repository tutti. See http://git.codelutin.com/tutti.git commit 249cea2ed9bb3f8339abfef1feb3c2300486131c Merge: 3cf2fbc b6c955c Author: Kevin Morin <morin@codelutin.com> Date: Thu Feb 5 15:40:30 2015 +0100 Merge branches 'develop' and 'feature/6575' of https://git.codelutin.com/tutti into feature/6575 README.txt | 33 +- pom.xml | 12 +- src/site/rst/dbversions.rst | 4 + src/update/tutti-application.properties | 2 +- .../tutti/persistence/TuttiPersistenceImpl.java | 31 +- .../persistence/entities/data/SpeciesBatchs.java | 20 + .../src/main/java/fr/ifremer/tutti/util/Jdbcs.java | 31 + .../fr/ifremer/tutti/service/TuttiDataContext.java | 41 +- .../tutti/service/bigfin/BigfinDataRowModel.java | 138 ---- .../tutti/service/bigfin/BigfinImportContext.java | 357 ++++++++ .../tutti/service/bigfin/BigfinImportService.java | 366 ++++----- .../fr/ifremer/tutti/service/bigfin/Signs.java | 216 ----- .../service/bigfin/{ => csv}/BigfinDataRow.java | 75 +- .../service/bigfin/csv/BigfinDataRowModel.java | 231 ++++++ .../service/bigfin/csv/SpeciesOrSpeciesBatch.java | 42 + .../fr/ifremer/tutti/service/bigfin/signs/Sex.java | 109 +++ .../ifremer/tutti/service/bigfin/signs/Sign.java | 27 + .../ifremer/tutti/service/bigfin/signs/Size.java | 111 +++ .../tutti/service/bigfin/signs/VracHorsVrac.java | 92 +++ .../catches/ValidateCruiseOperationsService.java | 38 +- .../resources/i18n/tutti-service_en_GB.properties | 5 + .../resources/i18n/tutti-service_fr_FR.properties | 9 +- .../tutti/ui/swing/updater/DeleteHelper.java | 27 + .../src/main/resources/update_runtime.bat | 5 +- .../src/main/resources/update_runtime.sh | 7 +- tutti-ui-swing/pom.xml | 67 ++ .../src/main/assembly/full-linux-component.xml | 2 +- .../src/main/assembly/full-shared-component.xml | 45 +- .../src/main/assembly/full-windows-component.xml | 3 +- .../{full-windows-component.xml => launcher.xml} | 61 +- .../main/assembly/{full => launcher}/README.txt | 0 .../{full => launcher}/linux/tutti-sanity.sh | 2 +- .../assembly/{full => launcher}/linux/tutti.sh | 2 +- .../{full => launcher}/windows/tutti-sanity.bat | 0 .../assembly/{full => launcher}/windows/tutti.bat | 0 .../src/main/assembly/report/version.appup | 1 - tutti-ui-swing/src/main/assembly/standalone.xml | 39 +- .../main/assembly/standalone/launcher.properties | 9 +- .../src/main/assembly/standalone/linux/launch.sh | 8 +- .../main/assembly/standalone/windows/launch.bat | 7 +- .../java/fr/ifremer/tutti/ui/swing/RunTutti.java | 7 +- .../fr/ifremer/tutti/ui/swing/TuttiUIContext.java | 43 +- .../ui/swing/action/CloseApplicationAction.java | 4 +- .../tutti/ui/swing/action/CloseDbAction.java | 5 +- .../ui/swing/action/ExportAndCleanDbAction.java | 21 +- .../tutti/ui/swing/action/ExportDbAction.java | 6 +- .../tutti/ui/swing/action/ImportDbAction.java | 6 +- .../tutti/ui/swing/action/OpenDbAction.java | 6 +- .../tutti/ui/swing/action/ReimportDbAction.java | 9 +- .../tutti/ui/swing/action/ReinstallDbAction.java | 9 +- .../tutti/ui/swing/action/ReloadTuttiAction.java | 2 +- .../action/SaveSampleCategoryModelAction.java | 2 +- .../ui/swing/action/UpdateApplicationAction.java | 2 +- .../tutti/ui/swing/action/UpdateReportAction.java | 2 +- .../operation/catches/EditCatchesUIHandler.java | 903 ++++++++++++--------- .../validation/ValidateCruiseUIHandler.java | 13 +- .../content/validation/ValidateCruiseUIModel.java | 3 +- .../ui/swing/update/module/DbModuleUpdater.java | 79 +- .../util/AbstractTuttiTabContainerUIHandler.java | 55 +- tutti-ui-swing/src/main/resources/EcranResume.svg | 112 ++- 60 files changed, 2299 insertions(+), 1265 deletions(-) diff --cc tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java index 6e4284f,1b6db2c..10dcf6d --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java @@@ -53,8 -53,8 +53,9 @@@ import fr.ifremer.tutti.service.referen import fr.ifremer.tutti.service.referential.ReferentialTemporaryVesselService; import fr.ifremer.tutti.service.referential.TuttiReferentialSynchronizeService; import fr.ifremer.tutti.service.report.ReportService; +import fr.ifremer.tutti.service.toconfirmreport.ToConfirmReportService; import fr.ifremer.tutti.ui.swing.content.MainUI; + import fr.ifremer.tutti.ui.swing.updater.DeleteHelper; import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; import fr.ifremer.tutti.ui.swing.util.UIMessageNotifier; import fr.ifremer.tutti.ui.swing.util.auth.AuthenticationInfo; -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/6575 in repository tutti. See http://git.codelutin.com/tutti.git commit 47f83beb685fddd9dfcd82fa5dc09cecb5ea82e1 Author: Kevin Morin <morin@codelutin.com> Date: Thu Feb 5 18:38:39 2015 +0100 add species code, name and vernacular name + catch comment --- .../ifremer/tutti/service/PdfGeneratorService.java | 1 + .../tutti/service/export/ExportCatchContext.java | 145 ++++++++-- .../toconfirmreport/ToConfirmReportBatchEntry.java | 72 +++++ .../toconfirmreport/ToConfirmReportOperation.java | 2 +- .../toconfirmreport/ToConfirmReportService.java | 321 +++++++++++++++++++++ .../toconfirmreport/ToConfirmReportService.java | 125 -------- .../resources/ftl/toConfirmSpeciesReport_fr.ftl | 87 +++--- .../fr/ifremer/tutti/ui/swing/TuttiUIContext.java | 2 +- .../SpeciesToConfirmReportForCruiseAction.java | 2 +- .../operation/catches/EditCatchesUIHandler.java | 6 +- 10 files changed, 569 insertions(+), 194 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/PdfGeneratorService.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/PdfGeneratorService.java index 9881944..a76a7f1 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/PdfGeneratorService.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/PdfGeneratorService.java @@ -86,6 +86,7 @@ public class PdfGeneratorService extends AbstractTuttiService { Writer out = new StringWriter(); mapTemplate.process(model, out); + out.flush(); // render template output as pdf diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportCatchContext.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportCatchContext.java index e37da42..1966dce 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportCatchContext.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportCatchContext.java @@ -41,6 +41,9 @@ import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.catches.WeightComputingService; import fr.ifremer.tutti.util.Numbers; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.application.ApplicationBusinessException; import java.util.Collection; import java.util.List; @@ -56,6 +59,8 @@ import java.util.Map; */ public class ExportCatchContext { + private static final Log log = LogFactory.getLog(ExportCatchContext.class); + final FishingOperation fishingOperation; final CatchBatch catchBatch; @@ -72,10 +77,20 @@ public class ExportCatchContext { final Predicate<SpeciesAbleBatch> vracPredicate; + final boolean weightComputationSucceeded; + public static ExportCatchContext newExportContext(PersistenceService persistenceService, WeightComputingService weightComputingService, String fishingOperationId, boolean loadFrequencies) { + return newExportContext(persistenceService, weightComputingService, fishingOperationId, loadFrequencies, true); + } + + public static ExportCatchContext newExportContext(PersistenceService persistenceService, + WeightComputingService weightComputingService, + String fishingOperationId, + boolean loadFrequencies, + boolean failOnWeightComputingError) { FishingOperation fishingOperation = persistenceService.getFishingOperation(fishingOperationId); @@ -83,20 +98,74 @@ public class ExportCatchContext { CatchBatch catchBatch = persistenceService.getCatchBatchFromFishingOperation(fishingOperationId); - BatchContainer<SpeciesBatch> rootSpeciesBatch = - weightComputingService.getComputedSpeciesBatches(fishingOperationId); + boolean weightComputationSucceeded = true; - BatchContainer<BenthosBatch> rootBenthosBatch = - weightComputingService.getComputedBenthosBatches(fishingOperationId); + BatchContainer<SpeciesBatch> rootSpeciesBatch = null; + try { + rootSpeciesBatch = weightComputingService.getComputedSpeciesBatches(fishingOperationId); - BatchContainer<MarineLitterBatch> marineLitterBatches = - weightComputingService.getComputedMarineLitterBatches( - fishingOperationId, - catchBatch.getMarineLitterTotalWeight()); - weightComputingService.computeCatchBatchWeights(catchBatch, - rootSpeciesBatch, - rootBenthosBatch, - marineLitterBatches); + } catch (ApplicationBusinessException ex) { + if (failOnWeightComputingError) { + throw ex; + } + if (log.isWarnEnabled()) { + log.warn("Error on weight computing", ex); + } + weightComputationSucceeded = false; + if (persistenceService.isFishingOperationWithCatchBatch(fishingOperationId)) { + rootSpeciesBatch = persistenceService.getRootSpeciesBatch(fishingOperationId, false); + } + } + + BatchContainer<BenthosBatch> rootBenthosBatch = null; + try { + rootBenthosBatch = weightComputingService.getComputedBenthosBatches(fishingOperationId); + + } catch (ApplicationBusinessException ex) { + if (failOnWeightComputingError) { + throw ex; + } + if (log.isWarnEnabled()) { + log.warn("Error on weight computing", ex); + } + weightComputationSucceeded = false; + if (persistenceService.isFishingOperationWithCatchBatch(fishingOperationId)) { + rootBenthosBatch = persistenceService.getRootBenthosBatch(fishingOperationId, false); + } + } + + BatchContainer<MarineLitterBatch> marineLitterBatches; + try { + marineLitterBatches = + weightComputingService.getComputedMarineLitterBatches(fishingOperationId, + catchBatch.getMarineLitterTotalWeight()); + + } catch (ApplicationBusinessException ex) { + if (failOnWeightComputingError) { + throw ex; + } + if (log.isWarnEnabled()) { + log.warn("Error on weight computing", ex); + } + weightComputationSucceeded = false; + marineLitterBatches = persistenceService.getRootMarineLitterBatch(fishingOperationId);; + } + + try { + weightComputingService.computeCatchBatchWeights(catchBatch, + rootSpeciesBatch, + rootBenthosBatch, + marineLitterBatches); + + } catch (ApplicationBusinessException ex) { + if (failOnWeightComputingError) { + throw ex; + } + if (log.isWarnEnabled()) { + log.warn("Error on weight computing", ex); + } + weightComputationSucceeded = false; + } Multimap<Species, SpeciesBatchFrequency> speciesFrequencies; Multimap<Species, BenthosBatchFrequency> benthosFrequencies; @@ -119,7 +188,8 @@ public class ExportCatchContext { speciesFrequencies, rootBenthosBatch, benthosFrequencies, - marineLitterBatches); + marineLitterBatches, + weightComputationSucceeded); return result; } @@ -131,7 +201,8 @@ public class ExportCatchContext { Multimap<Species, SpeciesBatchFrequency> speciesFrequencies, BatchContainer<BenthosBatch> rootBenthosBatch, Multimap<Species, BenthosBatchFrequency> benthosFrequencies, - BatchContainer<MarineLitterBatch> marineLitterBatches) { + BatchContainer<MarineLitterBatch> marineLitterBatches, + boolean weightComputationSucceeded) { this.vracPredicate = vracPredicate; this.fishingOperation = fishingOperation; this.catchBatch = catchBatch; @@ -140,6 +211,7 @@ public class ExportCatchContext { this.benthosFrequencies = benthosFrequencies; this.rootBenthosBatch = rootBenthosBatch; this.marineLitterBatches = marineLitterBatches; + this.weightComputationSucceeded = weightComputationSucceeded; } public FishingOperation getFishingOperation() { @@ -177,6 +249,7 @@ public class ExportCatchContext { } public List<ExportBatchEntry> getSpeciesBatchEntry(boolean computeNumber) { + List<ExportBatchEntry> catchList = Lists.newArrayList(); if (withSpeciesBatches()) { @@ -288,33 +361,45 @@ public class ExportCatchContext { } protected float getSpeciesElevationRate() { + float result; + if (weightComputationSucceeded) { - float globalRatio = (getCatchTotalWeight() - catchBatch.getCatchTotalUnsortedComputedWeight()) / catchBatch.getCatchTotalSortedComputedWeight(); + float globalRatio = (getCatchTotalWeight() - catchBatch.getCatchTotalUnsortedComputedWeight()) / catchBatch.getCatchTotalSortedComputedWeight(); - float speciesTotalSortedWeight = Numbers.getValueOrComputedValue( - catchBatch.getSpeciesTotalSortedWeight(), - catchBatch.getSpeciesTotalSortedComputedWeight()); + float speciesTotalSortedWeight = Numbers.getValueOrComputedValue( + catchBatch.getSpeciesTotalSortedWeight(), + catchBatch.getSpeciesTotalSortedComputedWeight()); - // ratio total species weight / total sorted sampled species weight - float result = globalRatio * speciesTotalSortedWeight; - if (catchBatch.getSpeciesTotalSampleSortedComputedWeight() > 0) { - result /= catchBatch.getSpeciesTotalSampleSortedComputedWeight(); + // ratio total species weight / total sorted sampled species weight + result = globalRatio * speciesTotalSortedWeight; + if (catchBatch.getSpeciesTotalSampleSortedComputedWeight() > 0) { + result /= catchBatch.getSpeciesTotalSampleSortedComputedWeight(); + } + + } else { + result = 0; } return result; } protected float getBenthosElevationRate() { + float result; + if (weightComputationSucceeded) { + + float globalRatio = (getCatchTotalWeight() - catchBatch.getCatchTotalUnsortedComputedWeight()) / catchBatch.getCatchTotalSortedComputedWeight(); - float globalRatio = (getCatchTotalWeight() - catchBatch.getCatchTotalUnsortedComputedWeight()) / catchBatch.getCatchTotalSortedComputedWeight(); + float benthosTotalSortedWeight = Numbers.getValueOrComputedValue( + catchBatch.getBenthosTotalSortedWeight(), + catchBatch.getBenthosTotalSortedComputedWeight()); - float benthosTotalSortedWeight = Numbers.getValueOrComputedValue( - catchBatch.getBenthosTotalSortedWeight(), - catchBatch.getBenthosTotalSortedComputedWeight()); + // ratio total benthos weight / total sorted sampled benthos weight + result = globalRatio * benthosTotalSortedWeight; + if (catchBatch.getBenthosTotalSampleSortedComputedWeight() > 0) { + result /= catchBatch.getBenthosTotalSampleSortedComputedWeight(); + } - // ratio total benthos weight / total sorted sampled benthos weight - float result = globalRatio * benthosTotalSortedWeight; - if (catchBatch.getBenthosTotalSampleSortedComputedWeight() > 0) { - result /= catchBatch.getBenthosTotalSampleSortedComputedWeight(); + } else { + result = 0; } return result; } diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportBatchEntry.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportBatchEntry.java new file mode 100644 index 0000000..1954119 --- /dev/null +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportBatchEntry.java @@ -0,0 +1,72 @@ +package fr.ifremer.tutti.service.export.toconfirmreport; + +/* + * #%L + * Tutti :: Service + * %% + * Copyright (C) 2012 - 2014 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.service.export.ExportBatchEntry; + +/** + * To store a species or batch entry within his speices informations, + * his sorted weight, total weight and percentage amoong the total catch + * weight. + * + * @author Kevin Morin (Code Lutin) + * @since 3.13 + */ +public class ToConfirmReportBatchEntry extends ExportBatchEntry { + + protected final String code; + + protected final String scientificName; + + protected final String vernacularCode; + + protected final String comment; + + public ToConfirmReportBatchEntry(String code, + String scientificName, + String vernacularCode, + String comment) { + super(null); + + this.code = code; + this.scientificName = scientificName; + this.vernacularCode = vernacularCode; + this.comment = comment; + } + + public String getCode() { + return code; + } + + public String getScientificName() { + return scientificName; + } + + public String getVernacularCode() { + return vernacularCode; + } + + public String getComment() { + return comment; + } +} diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/toconfirmreport/ToConfirmReportOperation.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportOperation.java similarity index 95% rename from tutti-service/src/main/java/fr/ifremer/tutti/service/toconfirmreport/ToConfirmReportOperation.java rename to tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportOperation.java index abaa627..0ca07f5 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/toconfirmreport/ToConfirmReportOperation.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportOperation.java @@ -1,4 +1,4 @@ -package fr.ifremer.tutti.service.toconfirmreport; +package fr.ifremer.tutti.service.export.toconfirmreport; import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportService.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportService.java new file mode 100644 index 0000000..1356913 --- /dev/null +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/export/toconfirmreport/ToConfirmReportService.java @@ -0,0 +1,321 @@ +package fr.ifremer.tutti.service.export.toconfirmreport; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import fr.ifremer.tutti.persistence.entities.data.Cruise; +import fr.ifremer.tutti.persistence.entities.data.FishingOperation; +import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatch; +import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol; +import fr.ifremer.tutti.persistence.entities.referential.Species; +import fr.ifremer.tutti.service.AbstractTuttiService; +import fr.ifremer.tutti.service.DecoratorService; +import fr.ifremer.tutti.service.PdfGeneratorService; +import fr.ifremer.tutti.service.PersistenceService; +import fr.ifremer.tutti.service.TuttiServiceContext; +import fr.ifremer.tutti.service.catches.WeightComputingService; +import fr.ifremer.tutti.service.export.ExportBatchEntry; +import fr.ifremer.tutti.service.export.ExportCatchContext; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +import java.io.File; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** + * @author Kevin Morin (Code Lutin) + * @since 3.13 + */ +public class ToConfirmReportService extends AbstractTuttiService { + + private static final Log log = LogFactory.getLog(ToConfirmReportService.class); + + protected PersistenceService persistenceService; + protected DecoratorService decoratorService; + protected PdfGeneratorService pdfGeneratorService; + protected WeightComputingService weightComputingService; + + @Override + public void setServiceContext(TuttiServiceContext context) { + super.setServiceContext(context); + persistenceService = getService(PersistenceService.class); + decoratorService = getService(DecoratorService.class); + pdfGeneratorService = getService(PdfGeneratorService.class); + weightComputingService = getService(WeightComputingService.class); + } + + public void createToConfirmReport(String cruiseId, Locale locale) { + + Cruise cruise = persistenceService.getCruise(cruiseId); + if (log.isDebugEnabled()) { + log.debug("Cruise " + decoratorService.getDecorator(cruise).toString(cruise)); + } + + List<String> allFishingOperation = + persistenceService.getAllFishingOperationIds(cruiseId); + + List<Map<String, Object>> operations = Lists.newArrayList(); + for (String operationId : allFishingOperation) { + prepareOperation(operationId, operations); + } + +// List<ToConfirmReportOperation> toConfirmReportOperations = new ArrayList<>(); +// +// List<FishingOperation> allFishingOperation = persistenceService.getAllFishingOperation(cruiseId); +// for (FishingOperation fishingOperation : allFishingOperation) { +// +// if (log.isDebugEnabled()) { +// log.debug("|- Operation " + decoratorService.getDecorator(fishingOperation).toString(fishingOperation)); +// } +// +// String operationId = fishingOperation.getId(); +// +// boolean withCatchBath = persistenceService.isFishingOperationWithCatchBatch(operationId); +// +// List<PdfExportBatchEntry> speciesBatchesToConfirm = null; +// List<PdfExportBatchEntry> benthosBatchesToConfirm = null; +// +// if (withCatchBath) { +// +// boolean protocolFilled = context.getDataContext().isProtocolFilled(); +// +// Map<Integer, SpeciesProtocol> speciesProtocolMap = null; +// +// if (protocolFilled) { +// speciesProtocolMap = persistenceService.toSpeciesProtocolMap(); +// } +// +// for (ExportBatchEntry entry : speciesBatchEntries) { +// +// SpeciesAbleBatch batch = entry.getBatch(); +// Species species = batch.getSpecies(); +// +// Species speciesWithVerncularCode = +// persistenceService.getSpeciesByReferenceTaxonIdWithVernacularCode(species.getReferenceTaxonId()); +// +// String code; +// +// +// // if the protocol is set and the species is in the protocol +// if (protocolFilled && speciesProtocolMap.containsKey(species.getReferenceTaxonId())) { +// +// // use surveyCode from protocol +// SpeciesProtocol speciesProtocol = speciesProtocolMap.get(species.getReferenceTaxonId()); +// +// code = speciesProtocol.getSpeciesSurveyCode(); +// +// } else { +// +// // use refTaxCode +// code = species.getRefTaxCode(); +// +// } +// +// if (StringUtils.isEmpty(code)) { +// +// +// throw new ApplicationBusinessException(t("tutti.pdf.export.missing.species.code", species.getReferenceTaxonId(), species.getName())); +// } +// +// PdfExportBatchEntry pdfEntry = new PdfExportBatchEntry(code, +// species.getName(), +// speciesWithVerncularCode.getVernacularCode(), +// entry.getSortedWeight(), +// entry.getTotalWeight(), +// totalWeight); +// catchList.add(pdfEntry); +// } +// +// // load it +// try { +// speciesBatchesToConfirm = persistenceService.getAllSpeciesBatchToConfirm(operationId); +// for (SpeciesBatch speciesBatch : speciesBatchesToConfirm) { +// if (log.isDebugEnabled()) { +// Species species = speciesBatch.getSpecies(); +// Serializable sampleCategoryValue = speciesBatch.getSampleCategoryValue(); +// log.debug(" |- " + decoratorService.getDecorator(species).toString(species) + +// " / " + decoratorService.getDecorator(sampleCategoryValue).toString(sampleCategoryValue)); +// } +// } +// +// benthosBatchesToConfirm = persistenceService.getAllBenthosBatchToConfirm(operationId); +// for (BenthosBatch benthosBatch : benthosBatchesToConfirm) { +// if (log.isDebugEnabled()) { +// Species species = benthosBatch.getSpecies(); +// Serializable sampleCategoryValue = benthosBatch.getSampleCategoryValue(); +// log.debug(" |- " + decoratorService.getDecorator(species).toString(species) + +// " / " + decoratorService.getDecorator(sampleCategoryValue).toString(sampleCategoryValue)); +// } +// } +// +// } catch (InvalidBatchModelException e) { +// +// // batch is not compatible with Tutti +// if (log.isDebugEnabled()) { +// log.debug("Invalid batch model", e); +// } +// } +// +// } else { +// if (log.isDebugEnabled()) { +// log.debug(" |- No catchBatch "); +// } +// } +// +// String operation = decoratorService.getDecorator(fishingOperation).toString(fishingOperation); +// ToConfirmReportOperation toConfirmReportOperation = new ToConfirmReportOperation(operation, speciesBatchesToConfirm, benthosBatchesToConfirm); +// toConfirmReportOperations.add(toConfirmReportOperation); +// } + + + generatePdf(new File("/tmp/test.pdf"), locale, decoratorService.getDecorator(cruise).toString(cruise), operations); + + } + + protected void prepareOperation(String fishingOperationId, + List<Map<String, Object>> operations) { + + // get operation and catch data + boolean withCatchBatch = + persistenceService.isFishingOperationWithCatchBatch( + fishingOperationId); + + if (!withCatchBatch) { + if (log.isWarnEnabled()) { + log.warn("Skip fishing operation " + fishingOperationId + + " since no catchBatch associated."); + } + return; + } + + ExportCatchContext exportCatchContext = ExportCatchContext.newExportContext( + persistenceService, + weightComputingService, + fishingOperationId, + false, + false); + + // create operation data model + Map<String, Object> op = createOperation(exportCatchContext.getFishingOperation()); + + boolean protocolFilled = context.getDataContext().isProtocolFilled(); + + // Species + List<ToConfirmReportBatchEntry> speciesCatchList = Lists.newArrayList(); + + if (exportCatchContext.withSpeciesBatches()) { + + List<ExportBatchEntry> speciesBatchEntries = + exportCatchContext.getSpeciesBatchEntry(false); + + Map<Integer, SpeciesProtocol> speciesProtocolMap = null; + + if (protocolFilled) { + speciesProtocolMap = persistenceService.toSpeciesProtocolMap(); + } + + findSpeciesToConfirm(protocolFilled, speciesBatchEntries, speciesCatchList, speciesProtocolMap); + } + + if (!speciesCatchList.isEmpty()) { + op.put("speciesCatches", speciesCatchList); + } + + // Benthos + List<ToConfirmReportBatchEntry> benthosCatchList = Lists.newArrayList(); + + if (exportCatchContext.withBenthosBatches()) { + + List<ExportBatchEntry> benthosBatchEntries = + exportCatchContext.getBenthosBatchEntry(false); + + Map<Integer, SpeciesProtocol> speciesProtocolMap = null; + + if (protocolFilled) { + speciesProtocolMap = persistenceService.toBenthosProtocolMap(); + } + + findSpeciesToConfirm(protocolFilled, benthosBatchEntries, benthosCatchList, speciesProtocolMap); + } + + if (!benthosCatchList.isEmpty()) { + op.put("benthosCatches", benthosCatchList); + } + + if (!speciesCatchList.isEmpty() || !benthosCatchList.isEmpty()) { + operations.add(op); + } + } + + protected void findSpeciesToConfirm(boolean protocolFilled, + List<ExportBatchEntry> batchEntries, + List<ToConfirmReportBatchEntry> catchList, + Map<Integer, SpeciesProtocol> speciesProtocolMap) { + + for (ExportBatchEntry entry : batchEntries) { + SpeciesAbleBatch batch = entry.getBatch(); + + Species species = batch.getSpecies(); + Species speciesWithVerncularCode = + persistenceService.getSpeciesByReferenceTaxonIdWithVernacularCode(species.getReferenceTaxonId()); + + String code; + + // if the protocol is set and the species is in the protocol + if (protocolFilled && speciesProtocolMap.containsKey(species.getReferenceTaxonId())) { + + // use surveyCode from protocol + SpeciesProtocol speciesProtocol = speciesProtocolMap.get(species.getReferenceTaxonId()); + + code = speciesProtocol.getSpeciesSurveyCode(); + + } else { + // use refTaxCode + code = species.getRefTaxCode(); + } + + String name = species.getName(); + String vernacularCode = speciesWithVerncularCode.getVernacularCode(); + + findSpeciesToConfirm(catchList, batch, code, name, vernacularCode); + } + } + + protected void findSpeciesToConfirm(List<ToConfirmReportBatchEntry> catchList, SpeciesAbleBatch batch, String code, String name, String vernacularCode) { + if (batch.isSpeciesToConfirm()) { + String comment = batch.getComment(); + ToConfirmReportBatchEntry reportEntry = new ToConfirmReportBatchEntry(code, + name, + vernacularCode, + comment); + catchList.add(reportEntry); + + } else if (!batch.isChildBatchsEmpty()) { + + for (SpeciesAbleBatch speciesAbleBatch : batch.getChildBatchs()) { + findSpeciesToConfirm(catchList, speciesAbleBatch, code, name, vernacularCode); + } + } + } + + protected Map<String, Object> createOperation(FishingOperation fishingOperation) { + Map<String, Object> op = Maps.newHashMap(); + op.put("number", fishingOperation.getFishingOperationNumber()); + op.put("station", fishingOperation.getStationNumber()); + op.put("rigNumber", fishingOperation.getMultirigAggregation()); + op.put("startDate", fishingOperation.getGearShootingStartDate()); + op.put("endDate", fishingOperation.getGearShootingEndDate()); + + return op; + } + + protected void generatePdf(File targetFile, Locale locale, String cruiseName, List<Map<String, Object>> operations) { + + Map<String, Object> data = Maps.newHashMap(); + data.put("operations", operations); + + pdfGeneratorService.generatePdf(targetFile, locale, "toConfirmSpeciesReport.ftl", data); + + } +} diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/toconfirmreport/ToConfirmReportService.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/toconfirmreport/ToConfirmReportService.java deleted file mode 100644 index 15ed549..0000000 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/toconfirmreport/ToConfirmReportService.java +++ /dev/null @@ -1,125 +0,0 @@ -package fr.ifremer.tutti.service.toconfirmreport; - -import fr.ifremer.tutti.persistence.InvalidBatchModelException; -import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; -import fr.ifremer.tutti.persistence.entities.data.Cruise; -import fr.ifremer.tutti.persistence.entities.data.FishingOperation; -import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; -import fr.ifremer.tutti.persistence.entities.referential.Species; -import fr.ifremer.tutti.service.AbstractTuttiService; -import fr.ifremer.tutti.service.DecoratorService; -import fr.ifremer.tutti.service.PdfGeneratorService; -import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.service.TuttiServiceContext; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import java.io.File; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; - -/** - * @author Kevin Morin (Code Lutin) - * @since 3.13 - */ -public class ToConfirmReportService extends AbstractTuttiService { - - private static final Log log = LogFactory.getLog(ToConfirmReportService.class); - - protected PersistenceService persistenceService; - protected DecoratorService decoratorService; - protected PdfGeneratorService pdfGeneratorService; - - @Override - public void setServiceContext(TuttiServiceContext context) { - super.setServiceContext(context); - persistenceService = getService(PersistenceService.class); - decoratorService = getService(DecoratorService.class); - pdfGeneratorService = getService(PdfGeneratorService.class); - } - - public void createToConfirmReport(String cruiseId, Locale locale) { - - Cruise cruise = persistenceService.getCruise(cruiseId); - if (log.isDebugEnabled()) { - log.debug("Cruise " + decoratorService.getDecorator(cruise).toString(cruise)); - } - - List<ToConfirmReportOperation> toConfirmReportOperations = new ArrayList<>(); - - List<FishingOperation> allFishingOperation = persistenceService.getAllFishingOperation(cruiseId); - for (FishingOperation fishingOperation : allFishingOperation) { - - if (log.isDebugEnabled()) { - log.debug("|- Operation " + decoratorService.getDecorator(fishingOperation).toString(fishingOperation)); - } - - String operationId = fishingOperation.getId(); - - boolean withCatchBath = persistenceService.isFishingOperationWithCatchBatch(operationId); - - List<SpeciesBatch> speciesBatchesToConfirm = null; - List<BenthosBatch> benthosBatchesToConfirm = null; - - if (withCatchBath) { - - // load it - try { - speciesBatchesToConfirm = persistenceService.getAllSpeciesBatchToConfirm(operationId); - for (SpeciesBatch speciesBatch : speciesBatchesToConfirm) { - if (log.isDebugEnabled()) { - Species species = speciesBatch.getSpecies(); - Serializable sampleCategoryValue = speciesBatch.getSampleCategoryValue(); - log.debug(" |- " + decoratorService.getDecorator(species).toString(species) + - " / " + decoratorService.getDecorator(sampleCategoryValue).toString(sampleCategoryValue)); - } - } - - benthosBatchesToConfirm = persistenceService.getAllBenthosBatchToConfirm(operationId); - for (BenthosBatch benthosBatch : benthosBatchesToConfirm) { - if (log.isDebugEnabled()) { - Species species = benthosBatch.getSpecies(); - Serializable sampleCategoryValue = benthosBatch.getSampleCategoryValue(); - log.debug(" |- " + decoratorService.getDecorator(species).toString(species) + - " / " + decoratorService.getDecorator(sampleCategoryValue).toString(sampleCategoryValue)); - } - } - - } catch (InvalidBatchModelException e) { - - // batch is not compatible with Tutti - if (log.isDebugEnabled()) { - log.debug("Invalid batch model", e); - } - } - - } else { - if (log.isDebugEnabled()) { - log.debug(" |- No catchBatch "); - } - } - - String operation = decoratorService.getDecorator(fishingOperation).toString(fishingOperation); - ToConfirmReportOperation toConfirmReportOperation = new ToConfirmReportOperation(operation, speciesBatchesToConfirm, benthosBatchesToConfirm); - toConfirmReportOperations.add(toConfirmReportOperation); - } - - - generatePdf(new File("/tmp/test.pdf"), locale, decoratorService.getDecorator(cruise).toString(cruise), toConfirmReportOperations); - - } - - protected void generatePdf(File targetFile, Locale locale, String cruiseName, List<ToConfirmReportOperation> toConfirmReportOperations) { - - Map<String, Object> data = new HashMap<>(); - data.put("cruise", cruiseName); - data.put("operations", toConfirmReportOperations); - - pdfGeneratorService.generatePdf(targetFile, locale, "toConfirmSpeciesReport.ftl", data); - - } -} diff --git a/tutti-service/src/main/resources/ftl/toConfirmSpeciesReport_fr.ftl b/tutti-service/src/main/resources/ftl/toConfirmSpeciesReport_fr.ftl index 7d84b28..40068fa 100644 --- a/tutti-service/src/main/resources/ftl/toConfirmSpeciesReport_fr.ftl +++ b/tutti-service/src/main/resources/ftl/toConfirmSpeciesReport_fr.ftl @@ -27,6 +27,8 @@ <#assign blueColor="#000080"> + @page { size: A4 landscape;} + h1, h4 { color: ${blueColor}; font-weight: bold; @@ -64,55 +66,72 @@ <h1>Rapport des espèces à confirmer</h1> - <h2>${cruise}</h2> - - <#list operations as operation> + <#assign orderedOperations = operations?sort_by("startDate")?reverse> + <#list orderedOperations as operation> <p class='operationInfo'> - <span class="label">Opération :</span> <span class="value">${operation.operation}</span> + <span class="label">Station :</span> <span class="value">${operation.station} - ${operation.number}</span> + <span class="label">Poche :</span> <span class="value">${operation.rigNumber}</span> + <span class="label"> + du ${operation.startDate?date?string.full} ${operation.startDate?time?string.short} + <#if operation.endDate??>au ${operation.endDate?date?string.full} ${operation.endDate?time?string.short}</#if> + </span> </p> - <#if operation.speciesBatches??> - <h4>Espèces :</h4> - + <#if operation.speciesCatches??> <table> - <tr> - <th>Espèce</th> - <th>Catégorie</th> - <th>Poids</th> - <th>Commentaire</th> - </tr> - - <#list operation.speciesBatches as batch> + <caption>Espèces</caption> + <thead> <tr> - <td>${batch.species}</td> - <td></td><td></td> - <td>${batch.comment!""}</td> + <th>Espèce</th> + <th>Nom scientifique</th> + <th>Nom commun</th> + <th>Trié (kg)</th> + <th>Commentaire</th> </tr> - </#list> + </thead> + <tbody> + <#list operation.speciesCatches?sort_by("sortedWeight")?reverse as catch> + <tr> + <td><#if catch.code??>${catch.code}</#if></td> + <td><em>${catch.scientificName}</em></td> + <td><#if catch.vernacularCode??>${catch.vernacularCode}</#if></td> + <td class="number"><#if catch.sortedWeight??>${catch.sortedWeight?string("0.00")}</#if></td> + <td><#if catch.comment??>${catch.comment?html}</#if></td> + </tr> + </#list> + </tbody> </table> - </#if> - <#if operation.benthosBatches??> - <h4>Benthos :</h4> + <#if operation.benthosCatches??> <table> - <tr> - <th>Espèce</th> - <th>Catégorie</th> - <th>Poids</th> - <th>Commentaire</th> - </tr> - - <#list operation.benthosBatches as batch> + <caption>Benthos</caption> + <thead> <tr> - <td>${batch.species}</td> - <td></td><td></td> - <td>${batch.comment!""}</td> + <th>Espèce</th> + <th>Nom scientifique</th> + <th>Nom commun</th> + <th>Trié (kg)</th> + <th>Commentaire</th> </tr> - </#list> + </thead> + <tbody> + <#list operation.benthosCatches?sort_by("sortedWeight")?reverse as catch> + <tr> + <td><#if catch.code??>${catch.code}</#if></td> + <td><em>${catch.scientificName}</em></td> + <td><#if catch.vernacularCode??>${catch.vernacularCode}</#if></td> + <td class="number"><#if catch.sortedWeight??>${catch.sortedWeight?string("0.00")}</#if></td> + <td><#if catch.comment??>${catch.comment?html}</#if></td> + </tr> + </#list> + </tbody> </table> + </#if> + <#if operation != orderedOperations?last> + <h2 style="page-break-after:always"/> </#if> </#list> diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java index 10dcf6d..8b086b2 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java @@ -53,7 +53,7 @@ import fr.ifremer.tutti.service.referential.ReferentialTemporarySpeciesService; import fr.ifremer.tutti.service.referential.ReferentialTemporaryVesselService; import fr.ifremer.tutti.service.referential.TuttiReferentialSynchronizeService; import fr.ifremer.tutti.service.report.ReportService; -import fr.ifremer.tutti.service.toconfirmreport.ToConfirmReportService; +import fr.ifremer.tutti.service.export.toconfirmreport.ToConfirmReportService; import fr.ifremer.tutti.ui.swing.content.MainUI; import fr.ifremer.tutti.ui.swing.updater.DeleteHelper; import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil; diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SpeciesToConfirmReportForCruiseAction.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SpeciesToConfirmReportForCruiseAction.java index 8828a97..0f64476 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SpeciesToConfirmReportForCruiseAction.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/SpeciesToConfirmReportForCruiseAction.java @@ -24,7 +24,7 @@ package fr.ifremer.tutti.ui.swing.action; import com.google.common.base.Preconditions; import fr.ifremer.tutti.persistence.entities.data.Cruise; -import fr.ifremer.tutti.service.toconfirmreport.ToConfirmReportService; +import fr.ifremer.tutti.service.export.toconfirmreport.ToConfirmReportService; import fr.ifremer.tutti.ui.swing.content.MainUIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java index e27cc5f..dfafc77 100644 --- a/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java +++ b/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java @@ -1139,8 +1139,10 @@ public class EditCatchesUIHandler extends AbstractTuttiTabContainerUIHandler<Edi } svgRelatedPropertyChangeListeners.clear(); - canvas.dispose(); - getUI().getSvgCanvasPanel().remove(canvas); + if (canvas != null) { + canvas.dispose(); + getUI().getSvgCanvasPanel().remove(canvas); + } } protected void addSvgRelatedPropertyChangeListener(String property, PropertyChangeListener listener) { -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.
participants (1)
-
codelutin.com scm