Author: tchemit Date: 2013-04-21 13:29:20 +0200 (Sun, 21 Apr 2013) New Revision: 839 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/839 Log: refs #1875: [IMP/EXP] - Export des donn?\195?\169es de campagne : format g?\195?\169n?\195?\169rique + add missing stuff Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportSampleCategory.java Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ExportCatchesReportService.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/CatchExportModel.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/CatchExportRow.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/TuttiExportService.java trunk/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl 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/cruise/ValidateCruiseUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel-error-validation.xml trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties trunk/tutti-ui-swing/src/main/resources/icons/action-email.png 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-20 14:33:56 UTC (rev 838) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/service/SpeciesBatchPersistenceServiceImpl.java 2013-04-21 11:29:20 UTC (rev 839) @@ -272,7 +272,9 @@ Preconditions.checkNotNull(species); Preconditions.checkNotNull(species.getReferenceTaxonId()); - catchBatchDao.setSortingBatchReferenceTaxon(batchId, species.getReferenceTaxonId()); + catchBatchDao.setSortingBatchReferenceTaxon( + batchId, + species.getReferenceTaxonId()); } //------------------------------------------------------------------------// @@ -284,24 +286,11 @@ String speciesBatchId) { Preconditions.checkNotNull(speciesBatchId); -// List<SpeciesBatchFrequency> results = Lists.newArrayList(); -// -// Integer sortingBatchId = Integer.valueOf(speciesBatchId); -// Integer catchBatchId = catchBatchDao.getIdBySortingBatchId(sortingBatchId); -// Preconditions.checkNotNull( -// catchBatchId, -// "Could not find catchBatch for speciesBatch: " + speciesBatchId); -// -// CatchBatch catchBatch = catchBatchDao.loadFullTree(catchBatchId); -// -// SortingBatch sortingBatch = catchBatchDao.getSortingBatchById( -// catchBatch, sortingBatchId); -// -// List<SortingBatch> frequencyChilds = batchHelper.getFrequencyChilds(sortingBatch); List<SortingBatch> frequencyChilds = batchHelper.getFrequencies(speciesBatchId); List<SpeciesBatchFrequency> results = Lists.newArrayList(); for (SortingBatch child : frequencyChilds) { - SpeciesBatchFrequency target = TuttiBeanFactory.newSpeciesBatchFrequency(); + SpeciesBatchFrequency target = + TuttiBeanFactory.newSpeciesBatchFrequency(); entityToSpeciesBatchFrequency(child, target); results.add(target); @@ -352,10 +341,6 @@ for (SortingBatch child : frequencyChilds) { notUpdatedChildIds.add(child.getId()); } -// for (Batch batch : parentBatch.getChildBatchs()) { -// SortingBatch sortingBatch = (SortingBatch) batch; -// notUpdatedChildIds.add(sortingBatch.getId()); -// } short rankOrder = 0; List<SortingBatch> batchsToUpdate = Lists.newArrayList(); @@ -489,13 +474,7 @@ SpeciesBatch targetChild = TuttiBeanFactory.newSpeciesBatch(); entityToSpeciesBatch(sourceChild, targetChild); if (log.isInfoEnabled()) { - String species; - if (target.getSpecies() != null) { - species = String.valueOf(target.getSpecies().getReferenceTaxonId()); - } else { - species = "no species"; - } - log.info("Loaded CatchBatch Hors Vrac > (Species|Benthos) > " + species + " : " + target.getId()); + log.info("Loaded CatchBatch Hors Vrac > (Species|Benthos) > " + target.getSpecies().getReferenceTaxonId() + " : " + target.getId()); } if (targetChild.getSampleCategoryValue() != null) { targetChilds.add(targetChild); Modified: trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties =================================================================== --- trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-persistence/src/main/resources/tutti-db-enumerations.properties 2013-04-21 11:29:20 UTC (rev 839) @@ -385,14 +385,11 @@ #PSFM "Remis à l'eau mort ou vivant" PmfmId.DEAD_OR_ALIVE=1393 -#TODO A creer (type alphanumeric) # PSFM "Pour référencer un autre id de pmfm" PmfmId.ID_PSFM=1433 -#TODO A creer (type alphanumeric) PmfmId.SAMPLE_ID=1435 -#TODO A creer (type alphanumeric) PmfmId.OTOLITHE_ID=1436 # (20=observateur volant, 95=Administrateur SIH) -> L'avantage du 20 est qu'il est inactif (=20), donc plus facilement detectable @@ -413,7 +410,7 @@ VesselPersonRoleId.SORT_ROOM_MANAGER=3 VesselPersonRoleId.RECORDER_PERSON=4 -TranscribingTypeId.TAXINOMIE_REFTAX_MNEMONIQUE=101 -TranscribingTypeId.TAXINOMIE_COMMUN_NOM_VERNACULAIRE=102 +TranscribingTypeId.TAXINOMIE_REFTAX_MNEMONIQUE=55 +TranscribingTypeId.TAXINOMIE_COMMUN_NOM_VERNACULAIRE=56 MatrixId.PRODUCT_BATCH=1 \ No newline at end of file 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-20 14:33:56 UTC (rev 838) +++ trunk/tutti-persistence/src/test/java/fr/ifremer/tutti/persistence/service/ReferentialPersistenceServiceReadTest.java 2013-04-21 11:29:20 UTC (rev 839) @@ -288,7 +288,7 @@ @Test public void getMacroWasteCategoryCaracteristic() { Caracteristic result = service.getMarineLitterCategoryCaracteristic(); - assertCaracteristicQualitative(result, 21); + assertCaracteristicQualitative(result, 34); } @Test Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ExportCatchesReportService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ExportCatchesReportService.java 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ExportCatchesReportService.java 2013-04-21 11:29:20 UTC (rev 839) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.service.catches; +/* + * #%L + * Tutti :: Service + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.itextpdf.text.DocumentException; Property changes on: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/catches/ExportCatchesReportService.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/CatchExportModel.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/CatchExportModel.java 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/CatchExportModel.java 2013-04-21 11:29:20 UTC (rev 839) @@ -30,9 +30,15 @@ import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.Program; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.referential.Gear; +import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.persistence.entities.referential.Vessel; +import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.TuttiCsvUtil; +import org.apache.commons.collections.CollectionUtils; +import java.io.Serializable; import java.util.List; /** @@ -49,32 +55,150 @@ newColumnForExport("Annee", Cruise.PROPERTY_BEGIN_DATE, TuttiCsvUtil.YEAR); newColumnForExport("Serie", Cruise.PROPERTY_PROGRAM, Program.PROPERTY_NAME); newColumnForExport("Serie_Partielle", Cruise.PROPERTY_SURVEY_PART); + newColumnForExport("Engin", FishingOperation.PROPERTY_GEAR, Gear.PROPERTY_NAME); + newColumnForExport("Poche", FishingOperation.PROPERTY_MULTIRIG_AGGREGATION); newColumnForExport("Id_Operation", FishingOperation.PROPERTY_STATION_NUMBER); newColumnForExport("NumOrdre_Station", FishingOperation.PROPERTY_FISHING_OPERATION_NUMBER, TuttiCsvUtil.INTEGER); newColumnForExport("Navire", Cruise.PROPERTY_VESSEL, Vessel.PROPERTY_NAME); - newColumnForExport("Zone_Etude", "programeZoneName"); - newColumnForExport("Id_Sismer", Cruise.PROPERTY_NAME); - newColumnForExport("Date_Deb_Campagne", Cruise.PROPERTY_BEGIN_DATE, TuttiCsvUtil.DAY_TIME_SECOND); - newColumnForExport("Port_Deb_Campagne", Cruise.PROPERTY_DEPARTURE_LOCATION); - newColumnForExport("Date_Fin_Campagne", Cruise.PROPERTY_END_DATE, TuttiCsvUtil.DAY_TIME_SECOND); - newColumnForExport("Port_Fin_Campagne", Cruise.PROPERTY_RETURN_LOCATION); - newColumnForExport("Chef_Mission", Cruise.PROPERTY_HEAD_OF_MISSION); - newColumnForExport("Resp_Salle_Tri", Cruise.PROPERTY_HEAD_OF_SORT_ROOM); - newColumnForExport("Commentaire", Cruise.PROPERTY_COMMENT); + newColumnForExport("Taxon", CatchExportRow.SPECIES_SAMPLE_CATEGORY); + newColumnForExport("NumOrdre_Taxon_H2", CatchExportRow.SPECIES_SAMPLE_CATEGORY); + newColumnForExport("Tot_Taxon", CatchExportRow.SPECIES_SAMPLE_CATEGORY); + newColumnForExport("Ech_Taxon", CatchExportRow.SPECIES_SAMPLE_CATEGORY); + newColumnForExport("Type_Volume_Poids_Taxon", CatchExportRow.SPECIES_SAMPLE_CATEGORY); + newColumnForExport("Unite_Volume_Poids_Taxon", CatchExportRow.SPECIES_SAMPLE_CATEGORY); + + newColumnForExport("Vrac/Hors_Vrac", CatchExportRow.SORTED_UNSORTED_SAMPLE_CATEGORY); + newColumnForExport("NumOrdre_Vrac_H2", CatchExportRow.SORTED_UNSORTED_SAMPLE_CATEGORY); + newColumnForExport("Tot_Vrac", CatchExportRow.SORTED_UNSORTED_SAMPLE_CATEGORY); + newColumnForExport("Ech_Vrac", CatchExportRow.SORTED_UNSORTED_SAMPLE_CATEGORY); + newColumnForExport("Type_Volume_Poids_Vrac", CatchExportRow.SORTED_UNSORTED_SAMPLE_CATEGORY); + newColumnForExport("Unite_Volume_Poids_Vrac", CatchExportRow.SORTED_UNSORTED_SAMPLE_CATEGORY); + + newColumnForExport("Categorie", CatchExportRow.SIZE_SAMPLE_CATEGORY); + newColumnForExport("NumOrdre_Cat_H2", CatchExportRow.SIZE_SAMPLE_CATEGORY); + newColumnForExport("Tot_Cat", CatchExportRow.SIZE_SAMPLE_CATEGORY); + newColumnForExport("Ech_Cat", CatchExportRow.SIZE_SAMPLE_CATEGORY); + newColumnForExport("Type_Volume_Poids_Cat", CatchExportRow.SIZE_SAMPLE_CATEGORY); + newColumnForExport("Unite_Volume_Poids_Cat", CatchExportRow.SIZE_SAMPLE_CATEGORY); + + newColumnForExport("Sexe", CatchExportRow.SEX_SAMPLE_CATEGORY); + newColumnForExport("NumOrdre_Sexe_H2", CatchExportRow.SEX_SAMPLE_CATEGORY); + newColumnForExport("Tot_Sexe", CatchExportRow.SEX_SAMPLE_CATEGORY); + newColumnForExport("Ech_Sexe", CatchExportRow.SEX_SAMPLE_CATEGORY); + newColumnForExport("Type_Volume_Poids_Sexe", CatchExportRow.SEX_SAMPLE_CATEGORY); + newColumnForExport("Unite_Volume_Poids_Sexe", CatchExportRow.SEX_SAMPLE_CATEGORY); + + newColumnForExport("Maturite", CatchExportRow.MATURITY_SAMPLE_CATEGORY); + newColumnForExport("NumOrdre_Maturite_H2", CatchExportRow.MATURITY_SAMPLE_CATEGORY); + newColumnForExport("Tot_Maturite", CatchExportRow.MATURITY_SAMPLE_CATEGORY); + newColumnForExport("Ech_Maturite", CatchExportRow.MATURITY_SAMPLE_CATEGORY); + newColumnForExport("Type_Volume_Poids_Maturite", CatchExportRow.MATURITY_SAMPLE_CATEGORY); + newColumnForExport("Unite_Volume_Poids_Maturite", CatchExportRow.MATURITY_SAMPLE_CATEGORY); + + newColumnForExport("Age", CatchExportRow.AGE_SAMPLE_CATEGORY); + newColumnForExport("Num_Ordre_Age_H2", CatchExportRow.AGE_SAMPLE_CATEGORY); + + newColumnForExport("Code_Longueur", CatchExportRow.FREQUENCY_LENGTH_STEP_CARACTERISTIC); + newColumnForExport("Taille", CatchExportRow.FREQUENCY_LENGTH_STEP); + newColumnForExport("NumOrdre_Taille_H2", Cruise.PROPERTY_HEAD_OF_MISSION); + newColumnForExport("Poids_Classe_Taille", CatchExportRow.FREQUENCY_WEIGHT); + newColumnForExport("Unite_Taille", CatchExportRow.FREQUENCY_LENGTH_STEP_CARACTERISTIC); + newColumnForExport("Precision_Mesure", CatchExportRow.FREQUENCY_LENGTH_STEP_CARACTERISTIC); + newColumnForExport("Nbr", CatchExportRow.FREQUENCY_NUMBER); + + newColumnForExport("Poids_Reference", Cruise.PROPERTY_HEAD_OF_SORT_ROOM); + newColumnForExport("Coef_Final_Elevation", Cruise.PROPERTY_COMMENT); } - public void prepareRows(List<CatchExportRow> rows, + public void prepareRows(PersistenceService persistenceService, + List<CatchExportRow> rows, Cruise cruise, FishingOperation operation, BatchContainer<SpeciesBatch> rootSpeciesBatch, BatchContainer<BenthosBatch> rootBenthosBatch) { - CatchExportRow row = new CatchExportRow(); - row.setCruise(cruise); - row.setFishingOperation(operation); -// row.setRootSpeciesBatch(rootSpeciesBatch); -// row.setRootBenthosBatch(rootBenthosBatch); - rows.add(row); + + + for (SpeciesBatch speciesBatch : rootSpeciesBatch.getChildren()) { + CatchExportRow row = new CatchExportRow(); + row.setCruise(cruise); + row.setFishingOperation(operation); + ExportSampleCategory<Species> speciesCategory = new ExportSampleCategory<Species>(); + speciesCategory.setCategoryValue(speciesBatch.getSpecies()); + speciesCategory.setCategoryWeight(speciesBatch.getWeight()); + speciesCategory.setComputedWeight(speciesBatch.getComputedWeight()); + speciesCategory.setNumber(speciesBatch.getNumber()); + speciesCategory.setComputedNumber(speciesBatch.getComputedNumber()); + + row.setSpeciesCategory(speciesCategory); + prepareRows(persistenceService, row, rows, speciesBatch); + } + for (BenthosBatch benthosBatch : rootBenthosBatch.getChildren()) { + CatchExportRow row = new CatchExportRow(); + row.setCruise(cruise); + row.setFishingOperation(operation); + ExportSampleCategory<Species> speciesCategory = new ExportSampleCategory<Species>(); + speciesCategory.setCategoryValue(benthosBatch.getSpecies()); + speciesCategory.setCategoryWeight(benthosBatch.getWeight()); + speciesCategory.setComputedWeight(benthosBatch.getComputedWeight()); + speciesCategory.setNumber(benthosBatch.getNumber()); + speciesCategory.setComputedNumber(benthosBatch.getComputedNumber()); + + row.setSpeciesCategory(speciesCategory); + prepareRows(persistenceService, row, rows, benthosBatch); + } } + public void prepareRows(PersistenceService persistenceService, + CatchExportRow currentRow, + List<CatchExportRow> rows, + SpeciesBatch speciesBatch) { + + ExportSampleCategory<Serializable> sampleCategory = + new ExportSampleCategory<Serializable>(); + sampleCategory.setCategoryType(speciesBatch.getSampleCategoryType()); + sampleCategory.setCategoryValue(speciesBatch.getSampleCategoryValue()); + sampleCategory.setCategoryWeight(speciesBatch.getSampleCategoryWeight()); + sampleCategory.setComputedWeight(speciesBatch.getSampleCategoryComputedWeight()); + sampleCategory.setNumber(speciesBatch.getNumber()); + sampleCategory.setComputedNumber(speciesBatch.getComputedNumber()); + + currentRow.addCategory(sampleCategory); + + if (speciesBatch.isChildBatchsEmpty()) { + + // on a leaf, get frequencies + + List<SpeciesBatchFrequency> speciesBatchFrequency = + persistenceService.getAllSpeciesBatchFrequency(speciesBatch.getId()); + + if (CollectionUtils.isEmpty(speciesBatchFrequency)) { + + // no frequency + // simple denombrement + rows.add(currentRow.copy()); + } else { + for (SpeciesBatchFrequency batchFrequency : speciesBatchFrequency) { + CatchExportRow row = currentRow.copy(); + row.setSpeciesFrequency(batchFrequency); + rows.add(row); + } + } + + } else { + + for (SpeciesBatch childBatch : speciesBatch.getChildBatchs()) { + prepareRows(persistenceService, currentRow, rows, childBatch); + } + } + + } + + public void prepareRows(PersistenceService persistenceService, + CatchExportRow currentRow, + List<CatchExportRow> rows, + BenthosBatch benthosBatch) { + + + } } \ No newline at end of file Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/CatchExportRow.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/CatchExportRow.java 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/CatchExportRow.java 2013-04-21 11:29:20 UTC (rev 839) @@ -24,13 +24,20 @@ * #L% */ +import com.google.common.collect.Maps; +import fr.ifremer.tutti.persistence.entities.data.BenthosBatchFrequency; import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.persistence.entities.data.Program; +import fr.ifremer.tutti.persistence.entities.data.SampleCategoryEnum; +import fr.ifremer.tutti.persistence.entities.data.SpeciesBatchFrequency; +import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; +import fr.ifremer.tutti.persistence.entities.referential.Gear; import fr.ifremer.tutti.persistence.entities.referential.Vessel; import java.io.Serializable; import java.util.Date; +import java.util.Map; /** * A row in a catch export. @@ -42,10 +49,38 @@ private static final long serialVersionUID = 1L; + public static final String FREQUENCY_LENGTH_STEP_CARACTERISTIC = "frequencyLengthStepCaracteristic"; + + public static final String FREQUENCY_LENGTH_STEP = "frequencyLengthStep"; + + public static final String FREQUENCY_WEIGHT = "frequencyWeight"; + + public static final String FREQUENCY_NUMBER = "frequencyNumber"; + + public static final String SPECIES_SAMPLE_CATEGORY = "speciesSampleCategory"; + + public static final String SORTED_UNSORTED_SAMPLE_CATEGORY = "sortedUnsortedSampleCategory"; + + public static final String SIZE_SAMPLE_CATEGORY = "sizeSampleCategory"; + + public static final String SEX_SAMPLE_CATEGORY = "SexSampleCategory"; + + public static final String MATURITY_SAMPLE_CATEGORY = "maturitySampleCategory"; + + public static final String AGE_SAMPLE_CATEGORY = "ageSampleCategory"; + protected Cruise cruise; protected FishingOperation fishingOperation; + protected ExportSampleCategory speciesCategory; + + protected final Map<SampleCategoryEnum, ExportSampleCategory> categories = Maps.newEnumMap(SampleCategoryEnum.class); + + protected SpeciesBatchFrequency speciesFrequency; + + protected BenthosBatchFrequency benthosFrequency; + public void setCruise(Cruise cruise) { this.cruise = cruise; } @@ -54,6 +89,22 @@ this.fishingOperation = fishingOperation; } + public void setSpeciesCategory(ExportSampleCategory sampleCategory) { + this.speciesCategory = sampleCategory; + } + + public void addCategory(ExportSampleCategory sampleCategory) { + categories.put(sampleCategory.getCategoryType(), sampleCategory); + } + + public void setSpeciesFrequency(SpeciesBatchFrequency speciesFrequency) { + this.speciesFrequency = speciesFrequency; + } + + public void setBenthosFrequency(BenthosBatchFrequency benthosFrequency) { + this.benthosFrequency = benthosFrequency; + } + public Date getBeginDate() { return cruise.getBeginDate(); } @@ -66,6 +117,10 @@ return cruise.getSurveyPart(); } + public Vessel getVessel() { + return cruise.getVessel(); + } + public String getStationNumber() { return fishingOperation.getStationNumber(); } @@ -74,7 +129,87 @@ return fishingOperation.getFishingOperationNumber(); } - public Vessel getVessel() { - return cruise.getVessel(); + public Gear getGear() { + return fishingOperation.getGear(); } + + public String getMultirigAggregation() { + return fishingOperation.getMultirigAggregation(); + } + + public Caracteristic getFrequencyLengthStepCaracteristic() { + Caracteristic result; + if (speciesFrequency == null) { + result = benthosFrequency.getLengthStepCaracteristic(); + } else { + result = speciesFrequency.getLengthStepCaracteristic(); + } + return result; + } + + public Float getFrequencyLengthStep() { + Float result; + if (speciesFrequency == null) { + result = benthosFrequency.getLengthStep(); + } else { + result = speciesFrequency.getLengthStep(); + } + return result; + } + + public Float getFrequencyWeight() { + Float result; + if (speciesFrequency == null) { + result = benthosFrequency.getWeight(); + } else { + result = speciesFrequency.getWeight(); + } + return result; + } + + public Integer getFrequencyNumber() { + Integer result; + if (speciesFrequency == null) { + result = benthosFrequency.getNumber(); + } else { + result = speciesFrequency.getNumber(); + } + return result; + } + + public ExportSampleCategory getSpeciesSampleCategory() { + return speciesCategory; + } + + public ExportSampleCategory getSortedUnsortedSampleCategory() { + return categories.get(SampleCategoryEnum.sortedUnsorted); + } + + public ExportSampleCategory getSizeSampleCategory() { + return categories.get(SampleCategoryEnum.size); + } + + public ExportSampleCategory getSexSampleCategory() { + return categories.get(SampleCategoryEnum.sex); + } + + public ExportSampleCategory getMaturitySampleCategory() { + return categories.get(SampleCategoryEnum.maturity); + } + + public ExportSampleCategory getAgeSampleCategory() { + return categories.get(SampleCategoryEnum.age); + } + + public CatchExportRow copy() { + CatchExportRow result = new CatchExportRow(); + result.setCruise(cruise); + result.setFishingOperation(fishingOperation); + result.setSpeciesCategory(speciesCategory); + result.categories.putAll(categories); + result.setSpeciesFrequency(speciesFrequency); + result.setBenthosFrequency(benthosFrequency); + + return result; + } } \ No newline at end of file Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportSampleCategory.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportSampleCategory.java (rev 0) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportSampleCategory.java 2013-04-21 11:29:20 UTC (rev 839) @@ -0,0 +1,61 @@ +package fr.ifremer.tutti.service.export; + +/* + * #%L + * Tutti :: Service + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + +import fr.ifremer.tutti.persistence.entities.data.SampleCategory; + +import java.io.Serializable; + +/** + * Export sample category (extends {@link SampleCategory} to some computed + * stuff. + * + * @author tchemit <chemit@codelutin.com> + * @since 2.0 + */ +public class ExportSampleCategory<S extends Serializable> extends SampleCategory<S> { + + private static final long serialVersionUID = 1L; + + private Integer number; + + private Integer computedNumber; + + public Integer getNumber() { + return number; + } + + public void setNumber(Integer number) { + this.number = number; + } + + public Integer getComputedNumber() { + return computedNumber; + } + + public void setComputedNumber(Integer computedNumber) { + this.computedNumber = computedNumber; + } +} Property changes on: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/ExportSampleCategory.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/TuttiExportService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/TuttiExportService.java 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/TuttiExportService.java 2013-04-21 11:29:20 UTC (rev 839) @@ -34,8 +34,10 @@ import fr.ifremer.tutti.persistence.entities.TuttiEntities; import fr.ifremer.tutti.persistence.entities.data.BatchContainer; import fr.ifremer.tutti.persistence.entities.data.BenthosBatch; +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.data.MarineLitterBatch; import fr.ifremer.tutti.persistence.entities.data.Program; import fr.ifremer.tutti.persistence.entities.data.SpeciesBatch; import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; @@ -219,7 +221,7 @@ exportParameters(exportContext, cruise, operations); - exportCatches(exportContext, cruise, operations); +// exportCatches(exportContext, cruise, operations); } protected void exportSurvey(ExportContext exportContext, @@ -271,24 +273,40 @@ protected void exportCatches(ExportContext exportContext, Cruise cruise, List<FishingOperation> operations) { - try { for (FishingOperation operation : operations) { + String operationId = operation.getId(); + + CatchBatch catchBatch = + persistenceService.getCatchBatchFromFishingOperation( + operationId); + BatchContainer<SpeciesBatch> rootSpeciesBatch = - persistenceService.getRootSpeciesBatch(operation.getId()); + persistenceService.getRootSpeciesBatch(operationId); BatchContainer<BenthosBatch> rootBenthosBatch = - persistenceService.getRootBenthosBatch(operation.getId()); + persistenceService.getRootBenthosBatch(operationId); + BatchContainer<MarineLitterBatch> rootMarineLitterBatch = + persistenceService.getRootMarineLitterBatch(operationId); + + tuttiWeightComputingService.computeCatchBatchWeights( + catchBatch, + rootSpeciesBatch, + rootBenthosBatch, + rootMarineLitterBatch); + List<CatchExportRow> rows = Lists.newArrayList(); - exportContext.catchModel.prepareRows(rows, + exportContext.catchModel.prepareRows(persistenceService, + rows, cruise, operation, rootSpeciesBatch, rootBenthosBatch); -// exportContext.catchExport.write(rows, exportContext.catchWriter); + + exportContext.catchExport.write(rows, exportContext.catchWriter); } } catch (Exception e) { Modified: trunk/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl =================================================================== --- trunk/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl 2013-04-21 11:29:20 UTC (rev 839) @@ -1,3 +1,26 @@ +<#-- + #%L + Tutti :: Service + $Id$ + $HeadURL$ + %% + Copyright (C) 2012 - 2013 Ifremer + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% +--> <html> <head> <style type="text/css"> Property changes on: trunk/tutti-service/src/main/resources/ftl/catchesReport_fr.ftl ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native 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-20 14:33:56 UTC (rev 838) +++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-en.properties 2013-04-21 11:29:20 UTC (rev 839) @@ -1,5 +1,28 @@ +### +# #%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 -#Thu Apr 18 16:32:55 CEST 2013 +#Sun Apr 21 13:23:05 CEST 2013 tutti.createAccidentalBatch.action.cancel.help= tutti.createAccidentalBatch.action.save.help= tutti.createAccidentalBatch.field.accidentalDeadOrAlive.help= @@ -48,6 +71,7 @@ tutti.editAccidentalBatch.action.removeBatch.help= tutti.editBenthosBatch.action.createBatch.help=editBenthosBatch.html\#fields tutti.editBenthosBatch.action.removeBatch.help=editBenthosBatch.html\#fields +tutti.editBenthosBatch.action.removeSubBatch.help= tutti.editBenthosBatch.action.renameBatch.help=editBenthosBatch.html\#fields tutti.editBenthosBatch.action.splitBatch.help=editBenthosBatch.html\#fields tutti.editBenthosBatch.field.benthosTotalInertWeight.help=editBenthosBatch.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-20 14:33:56 UTC (rev 838) +++ trunk/tutti-ui-swing/src/main/filtered-resources/tutti-help-fr.properties 2013-04-21 11:29:20 UTC (rev 839) @@ -1,3 +1,26 @@ +### +# #%L +# Tutti :: UI +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2012 - 2013 Ifremer +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public +# License along with this program. If not, see +# <http://www.gnu.org/licenses/gpl-3.0.html>. +# #L% +### #Generated by org.nuiton.jaxx.plugin.GenerateHelpIdsMojo #Thu Apr 18 16:32:55 CEST 2013 tutti.createAccidentalBatch.action.cancel.help= Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css 2013-04-21 11:29:20 UTC (rev 839) @@ -1,3 +1,26 @@ +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ #navigation { rootVisible: false; } \ No newline at end of file Property changes on: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/cruise/ValidateCruiseUI.css ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SendCruiseReportAction.java 2013-04-21 11:29:20 UTC (rev 839) @@ -1,5 +1,29 @@ package fr.ifremer.tutti.ui.swing.content.home; +/* + * #%L + * Tutti :: UI + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2012 - 2013 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/gpl-3.0.html>. + * #L% + */ + import com.google.common.base.Preconditions; import fr.ifremer.tutti.TuttiIOUtil; import fr.ifremer.tutti.persistence.entities.data.Cruise; Modified: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel-error-validation.xml =================================================================== --- trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel-error-validation.xml 2013-04-20 14:33:56 UTC (rev 838) +++ trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel-error-validation.xml 2013-04-21 11:29:20 UTC (rev 839) @@ -1,4 +1,28 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Tutti :: UI + $Id$ + $HeadURL$ + %% + Copyright (C) 2012 - 2013 Ifremer + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/gpl-3.0.html>. + #L% + --> + <!DOCTYPE validators PUBLIC "-//Apache Struts//XWork Validator 1.0.3//EN" "http://struts.apache.org/dtds/xwork-validator-1.0.3.dtd"> Property changes on: trunk/tutti-ui-swing/src/main/resources/fr/ifremer/tutti/ui/swing/content/operation/catches/accidental/create/CreateAccidentalBatchUIModel-error-validation.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: svn:eol-style + native 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-20 14:33:56 UTC (rev 838) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2013-04-21 11:29:20 UTC (rev 839) @@ -266,6 +266,9 @@ tutti.editBenthosBatch.action.removeBatch= tutti.editBenthosBatch.action.removeBatch.mnemonic= tutti.editBenthosBatch.action.removeBatch.tip= +tutti.editBenthosBatch.action.removeSubBatch= +tutti.editBenthosBatch.action.removeSubBatch.mnemonic= +tutti.editBenthosBatch.action.removeSubBatch.tip= tutti.editBenthosBatch.action.renameBatch= tutti.editBenthosBatch.action.renameBatch.mnemonic= tutti.editBenthosBatch.action.renameBatch.tip= Property changes on: trunk/tutti-ui-swing/src/main/resources/icons/action-email.png ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL