Author: tchemit Date: 2014-05-20 16:35:16 +0200 (Tue, 20 May 2014) New Revision: 1793 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1793 Log: refs #5115 (report from version 3.4.4) Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java Removed: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModelV2.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowV2.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2.java trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraV2Action.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraV2Action.java Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRow.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java trunk/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 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/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-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -74,7 +74,6 @@ import org.apache.commons.vfs2.FileType; import org.nuiton.jaxx.application.ApplicationBusinessException; import org.nuiton.jaxx.application.ApplicationIOUtil; -import org.nuiton.jaxx.application.ApplicationTechnicalException; import org.nuiton.util.TimeLog; import org.nuiton.util.Version; @@ -84,9 +83,11 @@ import java.text.SimpleDateFormat; import java.util.Collection; import java.util.Collections; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Set; import java.util.concurrent.Callable; import static org.nuiton.i18n.I18n.t; @@ -601,10 +602,12 @@ return null; } - public void fillSpeciesSurveyCode(Collection<Species> speciesList) { + public Set<String> fillSpeciesSurveyCode(Collection<Species> speciesList) { TuttiProtocol protocol = getProtocol(); + Set<String> badSpecies = new LinkedHashSet<>(); + if (protocol != null) { // fill available species from protocol if (!protocol.isSpeciesEmpty()) { @@ -615,19 +618,26 @@ SpeciesProtocol speciesProtocol = protocolMap.get(species.getReferenceTaxonId()); if (speciesProtocol == null || StringUtils.isEmpty(speciesProtocol.getSpeciesSurveyCode())) { - throw new ApplicationTechnicalException(t("tutti.error.species.not.in.protocol", species.getName())); + badSpecies.add(species.getName()); + continue; } species.setSurveyCode(speciesProtocol.getSpeciesSurveyCode()); } } } + + return badSpecies; } - public void fillBenthosSurveyCode(Collection<Species> benthosList) { + public Set<String> fillBenthosSurveyCode(Collection<Species> benthosList) { TuttiProtocol protocol = getProtocol(); + Set<String> badSpecies = new LinkedHashSet<>(); + if (protocol != null) { + + // fill available benthos from protocol if (!protocol.isBenthosEmpty()) { @@ -637,12 +647,15 @@ SpeciesProtocol speciesProtocol = protocolMap.get(species.getReferenceTaxonId()); if (speciesProtocol == null || StringUtils.isEmpty(speciesProtocol.getSpeciesSurveyCode())) { - throw new ApplicationTechnicalException(t("tutti.error.benthos.not.in.protocol", species.getName())); + badSpecies.add(species.getName()); + continue; } species.setSurveyCode(speciesProtocol.getSpeciesSurveyCode()); } } } + + return badSpecies; } public static final TimeLog TIME_LOG = new TimeLog(PersistenceService.class); Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -153,18 +153,12 @@ } }; - public static final ValueFormatter<Number> NUMBER_OR_NA = new ValueFormatter<Number>() { - @Override - public String format(Number s) { - return s == null ? "NA" : s.toString(); - } - }; - public static final ValueFormatter<Species> SPECIES_SURVEY_CODE_FORMATTER = new ValueFormatter<Species>() { @Override public String format(Species s) { Preconditions.checkNotNull(s, t("tutti.service.error.species.null")); - return s.getSurveyCode(); + String surveyCode = s.getSurveyCode(); + return surveyCode == null ? "" : surveyCode; } }; Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRow.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRow.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRow.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -28,6 +28,7 @@ import fr.ifremer.tutti.persistence.entities.referential.Species; import java.io.Serializable; +import java.util.Date; /** * @author kmorin <kmorin@codelutin.com> @@ -37,26 +38,82 @@ private static final long serialVersionUID = 1L; - public static final String PROPERTY_FISHING_OPERATION = "fishingOperation"; + public static final String PROPERTY_STATION_NUMBER = FishingOperation.PROPERTY_STATION_NUMBER; + public static final String PROPERTY_GEAR_SHOOTING_START_DATE = FishingOperation.PROPERTY_GEAR_SHOOTING_START_DATE; + + public static final String PROPERTY_MULTIRIG_AGGREGATION = FishingOperation.PROPERTY_MULTIRIG_AGGREGATION; + + public static final String PROPERTY_GEAR_SHOOTING_START_LATITUDE = FishingOperation.PROPERTY_GEAR_SHOOTING_START_LATITUDE; + + public static final String PROPERTY_GEAR_SHOOTING_END_LATITUDE = FishingOperation.PROPERTY_GEAR_SHOOTING_END_LATITUDE; + + public static final String PROPERTY_GEAR_SHOOTING_START_LONGITUDE = FishingOperation.PROPERTY_GEAR_SHOOTING_START_LONGITUDE; + + public static final String PROPERTY_GEAR_SHOOTING_END_LONGITUDE = FishingOperation.PROPERTY_GEAR_SHOOTING_END_LONGITUDE; + public static final String PROPERTY_SPECIES = "species"; - public static final String PROPERTY_WEIGHT = "weight"; + public static final String PROPERTY_SIGN = "sign"; + public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight"; + + public static final String PROPERTY_SORTED_WEIGHT = "sortedWeight"; + + public static final String PROPERTY_AVERAGE_WEIGHT = "averageWeight"; + + public static final String PROPERTY_AVERAGE_SIZE = "averageSize"; + public static final String PROPERTY_NUMBER = "number"; + public static final String PROPERTY_MOULE = "moule"; + protected FishingOperation fishingOperation; protected Species species; - protected Float weight; + protected String sign; + protected Float totalWeight; + + protected Float sortedWeight; + + protected Float averageWeight; + + protected Float averageSize; + protected Integer number; - public FishingOperation getFishingOperation() { - return fishingOperation; + protected Float moule; + + public String getStationNumber() { + return fishingOperation.getStationNumber(); } + public Date getGearShootingStartDate() { + return fishingOperation.getGearShootingStartDate(); + } + + public String getMultirigAggregation() { + return fishingOperation.getMultirigAggregation(); + } + + public Float getGearShootingStartLatitude() { + return fishingOperation.getGearShootingStartLatitude(); + } + + public Float getGearShootingStartLongitude() { + return fishingOperation.getGearShootingStartLongitude(); + } + + public Float getGearShootingEndLatitude() { + return fishingOperation.getGearShootingEndLatitude(); + } + + public Float getGearShootingEndLongitude() { + return fishingOperation.getGearShootingEndLongitude(); + } + public void setFishingOperation(FishingOperation fishingOperation) { this.fishingOperation = fishingOperation; } @@ -69,14 +126,46 @@ this.species = species; } - public Float getWeight() { - return weight; + public String getSign() { + return sign; } - public void setWeight(Float weight) { - this.weight = weight; + public void setSign(String sign) { + this.sign = sign; } + public Float getTotalWeight() { + return totalWeight; + } + + public void setTotalWeight(Float totalWeight) { + this.totalWeight = totalWeight; + } + + public Float getSortedWeight() { + return sortedWeight; + } + + public void setSortedWeight(Float sortedWeight) { + this.sortedWeight = sortedWeight; + } + + public Float getAverageWeight() { + return averageWeight; + } + + public void setAverageWeight(Float averageWeight) { + this.averageWeight = averageWeight; + } + + public Float getAverageSize() { + return averageSize; + } + + public void setAverageSize(Float averageSize) { + this.averageSize = averageSize; + } + public Integer getNumber() { return number; } @@ -84,4 +173,12 @@ public void setNumber(Integer number) { this.number = number; } + + public Float getMoule() { + return moule; + } + + public void setMoule(Float moule) { + this.moule = moule; + } } Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -24,13 +24,9 @@ * #L% */ -import com.google.common.base.Preconditions; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; -import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.TuttiCsvUtil; import fr.ifremer.tutti.service.export.ExportBatchEntry; -import org.nuiton.csv.Common; -import org.nuiton.csv.ValueFormatter; import static org.nuiton.i18n.I18n.t; @@ -43,24 +39,22 @@ public CatchRowModel(char separator) { super(separator); - // export definition - - newColumnForExport(t("tutti.service.exportSumatra.header.station"), CatchRow.PROPERTY_FISHING_OPERATION, new ValueFormatter<FishingOperation>() { - @Override - public String format(FishingOperation o) { - Preconditions.checkNotNull(o, t("tutti.service.exportSumatra.error.station.null")); - return o.getStationNumber(); - } - }); - newColumnForExport(t("tutti.service.exportSumatra.header.species"), CatchRow.PROPERTY_SPECIES, new ValueFormatter<Species>() { - @Override - public String format(Species s) { - Preconditions.checkNotNull(s, t("tutti.service.exportSumatra.error.species.null")); - return s.getName(); - } - }); - newColumnForExport(t("tutti.service.exportSumatra.header.weight"), CatchRow.PROPERTY_WEIGHT, Common.PRIMITIVE_FLOAT); - newColumnForExport(t("tutti.service.exportSumatra.header.number"), CatchRow.PROPERTY_NUMBER, Common.PRIMITIVE_INTEGER); + newColumnForExport(t("tutti.service.exportSumatra.header.year"), CatchRow.PROPERTY_GEAR_SHOOTING_START_DATE, TuttiCsvUtil.YEAR); + newColumnForExport(t("tutti.service.exportSumatra.header.station"), CatchRow.PROPERTY_STATION_NUMBER); + newColumnForExport(t("tutti.service.exportSumatra.header.multirigAggregation"), CatchRow.PROPERTY_MULTIRIG_AGGREGATION); + newColumnForExport(t("tutti.service.exportSumatra.header.genuisSpecies"), CatchRow.PROPERTY_SPECIES, TuttiCsvUtil.SPECIES_NAME_FORMATTER); + newColumnForExport(t("tutti.service.exportSumatra.header.surveySpecies"), CatchRow.PROPERTY_SPECIES, TuttiCsvUtil.SPECIES_SURVEY_CODE_FORMATTER); + newColumnForExport(t("tutti.service.exportSumatra.header.sign"), CatchRow.PROPERTY_SIGN); + newColumnForExport(t("tutti.service.exportSumatra.header.sortedWeight"), CatchRow.PROPERTY_SORTED_WEIGHT, TuttiCsvUtil.PRIMITIVE_FLOAT); + newColumnForExport(t("tutti.service.exportSumatra.header.totalWeight"), CatchRow.PROPERTY_TOTAL_WEIGHT, TuttiCsvUtil.PRIMITIVE_FLOAT); + newColumnForExport(t("tutti.service.exportSumatra.header.averageWeight"), CatchRow.PROPERTY_AVERAGE_WEIGHT, TuttiCsvUtil.FLOAT); + newColumnForExport(t("tutti.service.exportSumatra.header.averageSize"), CatchRow.PROPERTY_AVERAGE_SIZE, TuttiCsvUtil.FLOAT); + newColumnForExport(t("tutti.service.exportSumatra.header.number"), CatchRow.PROPERTY_NUMBER, TuttiCsvUtil.PRIMITIVE_INTEGER); + newColumnForExport(t("tutti.service.exportSumatra.header.moule"), CatchRow.PROPERTY_MOULE, TuttiCsvUtil.FLOAT); + newColumnForExport(t("tutti.service.exportSumatra.header.startLatitude"), CatchRow.PROPERTY_GEAR_SHOOTING_START_LATITUDE, TuttiCsvUtil.FLOAT); + newColumnForExport(t("tutti.service.exportSumatra.header.startLongitude"), CatchRow.PROPERTY_GEAR_SHOOTING_START_LONGITUDE, TuttiCsvUtil.FLOAT); + newColumnForExport(t("tutti.service.exportSumatra.header.endLatitude"), CatchRow.PROPERTY_GEAR_SHOOTING_END_LATITUDE, TuttiCsvUtil.FLOAT); + newColumnForExport(t("tutti.service.exportSumatra.header.endLongitude"), CatchRow.PROPERTY_GEAR_SHOOTING_END_LONGITUDE, TuttiCsvUtil.FLOAT); } @Override @@ -72,8 +66,20 @@ CatchRow row = newEmptyInstance(); row.setFishingOperation(operation); row.setSpecies(entry.getBatch().getSpecies()); - row.setWeight(entry.getTotalWeight()); - row.setNumber(entry.getTotalNumber()); + row.setSortedWeight(entry.getSortedWeight()); + float totalWeight = entry.getTotalWeight(); + int number = entry.getTotalNumber(); + + row.setNumber(number); + row.setTotalWeight(totalWeight); + + // average size + row.setAverageSize(entry.getAverageFrequency()); + + // avarage weight + row.setAverageWeight(number == 0 ? null : totalWeight / (float) number); + // moule + row.setMoule(totalWeight == 0 ? null : (float) number / totalWeight); return row; } Deleted: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModelV2.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModelV2.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModelV2.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -1,83 +0,0 @@ -package fr.ifremer.tutti.service.export.sumatra; - -/* - * #%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.FishingOperation; -import fr.ifremer.tutti.service.TuttiCsvUtil; -import fr.ifremer.tutti.service.export.ExportBatchEntry; - -import static org.nuiton.i18n.I18n.t; - -/** - * @author tchemit - * @since 3.3 - */ -public class CatchRowModelV2 extends TuttiCsvUtil.AbstractTuttiImportExportModel<CatchRowV2> { - - public CatchRowModelV2(char separator) { - super(separator); - - newColumnForExport(t("tutti.service.exportSumatraV2.header.year"), CatchRowV2.PROPERTY_GEAR_SHOOTING_START_DATE, TuttiCsvUtil.YEAR); - newColumnForExport(t("tutti.service.exportSumatraV2.header.station"), CatchRowV2.PROPERTY_STATION_NUMBER); - newColumnForExport(t("tutti.service.exportSumatraV2.header.multirigAggregation"), CatchRowV2.PROPERTY_MULTIRIG_AGGREGATION); - - newColumnForExport(t("tutti.service.exportSumatraV2.header.species"), CatchRowV2.PROPERTY_SPECIES, TuttiCsvUtil.SPECIES_SURVEY_CODE_FORMATTER); - newColumnForExport(t("tutti.service.exportSumatraV2.header.sign"), CatchRowV2.PROPERTY_SIGN); - - newColumnForExport(t("tutti.service.exportSumatraV2.header.sortedWeight"), CatchRowV2.PROPERTY_SORTED_WEIGHT, TuttiCsvUtil.PRIMITIVE_FLOAT); - newColumnForExport(t("tutti.service.exportSumatraV2.header.totalWeight"), CatchRowV2.PROPERTY_TOTAL_WEIGHT, TuttiCsvUtil.PRIMITIVE_FLOAT); - newColumnForExport(t("tutti.service.exportSumatraV2.header.averageWeight"), CatchRowV2.PROPERTY_AVERAGE_WEIGHT, TuttiCsvUtil.NUMBER_OR_NA); - newColumnForExport(t("tutti.service.exportSumatraV2.header.averageSize"), CatchRowV2.PROPERTY_AVERAGE_SIZE, TuttiCsvUtil.NUMBER_OR_NA); - newColumnForExport(t("tutti.service.exportSumatraV2.header.number"), CatchRowV2.PROPERTY_NUMBER, TuttiCsvUtil.PRIMITIVE_INTEGER); - newColumnForExport(t("tutti.service.exportSumatraV2.header.moule"), CatchRowV2.PROPERTY_MOULE, TuttiCsvUtil.NUMBER_OR_NA); - } - - @Override - public CatchRowV2 newEmptyInstance() { - return new CatchRowV2(); - } - - public CatchRowV2 newRow(FishingOperation operation, ExportBatchEntry entry) { - CatchRowV2 row = newEmptyInstance(); - row.setFishingOperation(operation); - row.setSpecies(entry.getBatch().getSpecies()); - row.setSortedWeight(entry.getSortedWeight()); - float totalWeight = entry.getTotalWeight(); - int number = entry.getTotalNumber(); - - row.setNumber(number); - row.setTotalWeight(totalWeight); - - // average size - row.setAverageSize(entry.getAverageFrequency()); - - // avarage weight - row.setAverageWeight(number == 0 ? null : totalWeight / (float) number); - // moule - row.setMoule(totalWeight == 0 ? null : (float) number / totalWeight); - return row; - } - -} Deleted: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowV2.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowV2.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowV2.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -1,160 +0,0 @@ -package fr.ifremer.tutti.service.export.sumatra; - -/* - * #%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.FishingOperation; -import fr.ifremer.tutti.persistence.entities.referential.Species; - -import java.io.Serializable; -import java.util.Date; - -/** - * @author tchemit - * @since 3.3 - */ -public class CatchRowV2 implements Serializable { - - private static final long serialVersionUID = 1L; - - public static final String PROPERTY_STATION_NUMBER = FishingOperation.PROPERTY_STATION_NUMBER; - - public static final String PROPERTY_GEAR_SHOOTING_START_DATE = FishingOperation.PROPERTY_GEAR_SHOOTING_START_DATE; - - public static final String PROPERTY_MULTIRIG_AGGREGATION = FishingOperation.PROPERTY_MULTIRIG_AGGREGATION; - - public static final String PROPERTY_SPECIES = "species"; - - public static final String PROPERTY_SIGN = "sign"; - - public static final String PROPERTY_TOTAL_WEIGHT = "totalWeight"; - - public static final String PROPERTY_SORTED_WEIGHT = "sortedWeight"; - - public static final String PROPERTY_AVERAGE_WEIGHT = "averageWeight"; - - public static final String PROPERTY_AVERAGE_SIZE = "averageSize"; - - public static final String PROPERTY_NUMBER = "number"; - - public static final String PROPERTY_MOULE = "moule"; - - protected FishingOperation fishingOperation; - - protected Species species; - - protected String sign; - - protected Float totalWeight; - - protected Float sortedWeight; - - protected Float averageWeight; - - protected Float averageSize; - - protected Integer number; - - protected Float moule; - - public String getStationNumber() { - return fishingOperation.getStationNumber(); - } - - public Date getGearShootingStartDate() { - return fishingOperation.getGearShootingStartDate(); - } - - public String getMultirigAggregation() { - return fishingOperation.getMultirigAggregation(); - } - - public void setFishingOperation(FishingOperation fishingOperation) { - this.fishingOperation = fishingOperation; - } - - public Species getSpecies() { - return species; - } - - public void setSpecies(Species species) { - this.species = species; - } - - public String getSign() { - return sign; - } - - public void setSign(String sign) { - this.sign = sign; - } - - public Float getTotalWeight() { - return totalWeight; - } - - public void setTotalWeight(Float totalWeight) { - this.totalWeight = totalWeight; - } - - public Float getSortedWeight() { - return sortedWeight; - } - - public void setSortedWeight(Float sortedWeight) { - this.sortedWeight = sortedWeight; - } - - public Float getAverageWeight() { - return averageWeight; - } - - public void setAverageWeight(Float averageWeight) { - this.averageWeight = averageWeight; - } - - public Float getAverageSize() { - return averageSize; - } - - public void setAverageSize(Float averageSize) { - this.averageSize = averageSize; - } - - public Integer getNumber() { - return number; - } - - public void setNumber(Integer number) { - this.number = number; - } - - public Float getMoule() { - return moule; - } - - public void setMoule(Float moule) { - this.moule = moule; - } -} Modified: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -31,6 +31,7 @@ import fr.ifremer.tutti.persistence.ProgressionModel; import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; +import fr.ifremer.tutti.persistence.entities.referential.Species; import fr.ifremer.tutti.service.AbstractTuttiService; import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.TuttiServiceContext; @@ -45,7 +46,9 @@ import java.io.BufferedWriter; import java.io.File; +import java.util.HashSet; import java.util.List; +import java.util.Set; import static org.nuiton.i18n.I18n.t; @@ -74,11 +77,12 @@ * * @param file where to generate report * @param cruiseId id of the cruise to export + * @return export result * @since 2.0 */ - public void exportCruiseForSumatra(File file, - String cruiseId, - ProgressionModel progressionModel) { + public SumatraExportResult exportCruiseForSumatra(File file, + String cruiseId, + ProgressionModel progressionModel) { Preconditions.checkNotNull(cruiseId, "Cannot export a null cruise"); Preconditions.checkNotNull(file, "Cannot export to a null file"); @@ -103,7 +107,11 @@ progressionModel.adaptTotal(operations.size() + 3); - prepareOperationsAndExport(file, operations, progressionModel); + SumatraExportResult result = new SumatraExportResult(); + + prepareOperationsAndExport(file, operations, progressionModel, result); + + return result; } /** @@ -112,12 +120,13 @@ * @param file where to generate report * @param cruiseId id of the cruise to export * @param fishingOperationId id of the fishing operation to export + * @return export result * @since 2.7 */ - public void exportFishingOperationForSumatra(File file, - String cruiseId, - String fishingOperationId, - ProgressionModel progressionModel) { + public SumatraExportResult exportFishingOperationForSumatra(File file, + String cruiseId, + String fishingOperationId, + ProgressionModel progressionModel) { Preconditions.checkNotNull(file, "Cannot export to a null file"); Preconditions.checkNotNull(cruiseId, "Cannot export a null cruise"); @@ -135,12 +144,17 @@ List<String> operations = Lists.newArrayList(fishingOperationId); - prepareOperationsAndExport(file, operations, progressionModel); + SumatraExportResult result = new SumatraExportResult(); + + prepareOperationsAndExport(file, operations, progressionModel, result); + + return result; } protected void prepareOperationsAndExport(File file, List<String> operations, - ProgressionModel progressionModel) { + ProgressionModel progressionModel, + SumatraExportResult result) { List<CatchRow> rows = Lists.newArrayList(); @@ -159,7 +173,7 @@ break; } - prepareFishingOperation(csvModel, rows, operationId); + prepareFishingOperation(csvModel, rows, operationId, result); } } @@ -181,40 +195,60 @@ protected void prepareFishingOperation(CatchRowModel csvModel, List<CatchRow> rows, - String operationId) { + String operationId, + SumatraExportResult result) { ExportCatchContext exportContext = ExportCatchContext.newExportContext( persistenceService, weightComputingService, operationId, - false); + true); FishingOperation operation = exportContext.getFishingOperation(); // Species if (exportContext.withSpeciesBatches()) { + Set<Species> allspecies = new HashSet<>(); + List<ExportBatchEntry> entries = exportContext.getSpeciesBatchEntry(true); for (ExportBatchEntry entry : entries) { + // get species campaign code from protocol + + allspecies.add(entry.getBatch().getSpecies()); + CatchRow row = csvModel.newRow(operation, entry); + row.getSpecies(); rows.add(row); } + + // fill survey code in species + Set<String> badSpecies = persistenceService.fillSpeciesSurveyCode(allspecies); + result.setBadSpecies(badSpecies); + } // Benthos if (exportContext.withBenthosBatches()) { + Set<Species> allspecies = new HashSet<>(); + List<ExportBatchEntry> entries = exportContext.getBenthosBatchEntry(true); for (ExportBatchEntry entry : entries) { CatchRow row = csvModel.newRow(operation, entry); + allspecies.add(entry.getBatch().getSpecies()); rows.add(row); } + + // fill survey code in benthos + Set<String> badBenthos = persistenceService.fillBenthosSurveyCode(allspecies); + result.setBadBenthos(badBenthos); } } } Deleted: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -1,242 +0,0 @@ -package fr.ifremer.tutti.service.export.sumatra; - -/* - * #%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.base.Charsets; -import com.google.common.base.Preconditions; -import com.google.common.collect.Lists; -import com.google.common.io.Files; -import fr.ifremer.tutti.persistence.ProgressionModel; -import fr.ifremer.tutti.persistence.entities.data.Cruise; -import fr.ifremer.tutti.persistence.entities.data.FishingOperation; -import fr.ifremer.tutti.persistence.entities.referential.Species; -import fr.ifremer.tutti.service.AbstractTuttiService; -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.io.IOUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.csv.Export; -import org.nuiton.jaxx.application.ApplicationTechnicalException; - -import java.io.BufferedWriter; -import java.io.File; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import static org.nuiton.i18n.I18n.t; - -/** - * To export as sumatra format (v2). - * - * @author tchemit - * @since 3.3 - */ -public class CatchesSumatraExportServiceV2 extends AbstractTuttiService { - - private static final Log log = - LogFactory.getLog(CatchesSumatraExportServiceV2.class); - - protected PersistenceService persistenceService; - - protected WeightComputingService weightComputingService; - - @Override - public void setServiceContext(TuttiServiceContext context) { - super.setServiceContext(context); - persistenceService = getService(PersistenceService.class); - weightComputingService = getService(WeightComputingService.class); - } - - /** - * Export selected cruise with the csv sumatra (v2) format. - * - * @param file where to generate report - * @param cruiseId id of the cruise to export - * @since 3.3 - */ - public void exportCruiseForSumatra(File file, - String cruiseId, - ProgressionModel progressionModel) { - - Preconditions.checkNotNull(cruiseId, "Cannot export a null cruise"); - Preconditions.checkNotNull(file, "Cannot export to a null file"); - - if (log.isInfoEnabled()) { - log.info("Will export cruise " + cruiseId + " to file: " + file); - } - - progressionModel.increments(t("tutti.service.sumatra.export.step.load.cruise", cruiseId)); - - Cruise cruise = persistenceService.getCruise(cruiseId); - Preconditions.checkNotNull(cruise, "Cruise [" + cruiseId + "] not found"); - - progressionModel.increments(t("tutti.service.sumatra.export.step.load.fishingOperationIds")); - - List<String> operations = - persistenceService.getAllFishingOperationIds(cruiseId); - - if (log.isInfoEnabled()) { - log.info(operations.size() + " operations found for cruise: " + cruiseId); - } - - progressionModel.adaptTotal(operations.size() + 3); - - prepareOperationsAndExport(file, operations, progressionModel); - } - - /** - * Export selected fishing operation with the csv sumatra (v2) format. - * - * @param file where to generate report - * @param cruiseId id of the cruise to export - * @param fishingOperationId id of the fishing operation to export - * @since 3.3 - */ - public void exportFishingOperationForSumatra(File file, - String cruiseId, - String fishingOperationId, - ProgressionModel progressionModel) { - - Preconditions.checkNotNull(file, "Cannot export to a null file"); - Preconditions.checkNotNull(cruiseId, "Cannot export a null cruise"); - Preconditions.checkNotNull(fishingOperationId, "Cannot export a null fishing operation"); - - if (log.isInfoEnabled()) { - log.info("Will export fishing operation " + - fishingOperationId + " to file: " + file); - } - - progressionModel.increments(t("tutti.service.sumatra.export.step.load.cruise", cruiseId)); - - Cruise cruise = persistenceService.getCruise(cruiseId); - Preconditions.checkNotNull(cruise, "Cruise [" + cruiseId + "] not found"); - - List<String> operations = Lists.newArrayList(fishingOperationId); - - prepareOperationsAndExport(file, operations, progressionModel); - } - - protected void prepareOperationsAndExport(File file, - List<String> operations, - ProgressionModel progressionModel) { - - List<CatchRowV2> rows = Lists.newArrayList(); - - CatchRowModelV2 csvModel = - new CatchRowModelV2(context.getConfig().getCsvSeparator()); - - if (operations != null) { - for (String operationId : operations) { - - progressionModel.increments(t("tutti.service.sumatra.export.step.load.fishingOperation", operationId)); - if (!persistenceService.isFishingOperationWithCatchBatch(operationId)) { - - if (log.isWarnEnabled()) { - log.warn("No catch for operation with id: " + operationId); - } - break; - } - - prepareFishingOperation(csvModel, rows, operationId); - } - } - - progressionModel.increments(t("tutti.service.sumatra.export.step.export", file)); - - - BufferedWriter writer = null; - try { - writer = Files.newWriter(file, Charsets.UTF_8); - Export export = Export.newExport(csvModel, rows); - export.write(writer); - writer.close(); - - } catch (Exception e) { - throw new ApplicationTechnicalException(t("tutti.service.sumatra.export.error", file), e); - } finally { - IOUtils.closeQuietly(writer); - } - } - - protected void prepareFishingOperation(CatchRowModelV2 csvModel, - List<CatchRowV2> rows, - String operationId) { - - ExportCatchContext exportContext = ExportCatchContext.newExportContext( - persistenceService, - weightComputingService, - operationId, - true); - - FishingOperation operation = exportContext.getFishingOperation(); - - // Species - if (exportContext.withSpeciesBatches()) { - - Set<Species> allspecies = new HashSet<>(); - - List<ExportBatchEntry> entries = - exportContext.getSpeciesBatchEntry(true); - - for (ExportBatchEntry entry : entries) { - - // get species campaign code from protocol - - allspecies.add(entry.getBatch().getSpecies()); - - CatchRowV2 row = csvModel.newRow(operation, entry); - row.getSpecies(); - rows.add(row); - } - - // fill survey code in species - persistenceService.fillSpeciesSurveyCode(allspecies); - } - - // Benthos - if (exportContext.withBenthosBatches()) { - - Set<Species> allspecies = new HashSet<>(); - - List<ExportBatchEntry> entries = - exportContext.getBenthosBatchEntry(true); - - for (ExportBatchEntry entry : entries) { - - CatchRowV2 row = csvModel.newRow(operation, entry); - allspecies.add(entry.getBatch().getSpecies()); - rows.add(row); - } - - // fill survey code in benthos - persistenceService.fillBenthosSurveyCode(allspecies); - } - } -} Added: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java =================================================================== --- trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java (rev 0) +++ trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -0,0 +1,72 @@ +package fr.ifremer.tutti.service.export.sumatra; + +/* + * #%L + * Tutti :: Service + * $Id$ + * $HeadURL:$ + * %% + * 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 org.apache.commons.collections4.CollectionUtils; + +import java.util.Set; + +/** + * Created on 5/20/14. + * + * @author Tony Chemit <chemit@codelutin.com> + * @since 3.4.4 + */ +public class SumatraExportResult { + + /** + * Name of species that are not well filled in protocol. + */ + protected Set<String> badSpecies; + + /** + * Name of benthos that are not well filled in protocol. + */ + protected Set<String> badBenthos; + + public Set<String> getBadSpecies() { + return badSpecies; + } + + public Set<String> getBadBenthos() { + return badBenthos; + } + + public void setBadSpecies(Set<String> badSpecies) { + this.badSpecies = badSpecies; + } + + public void setBadBenthos(Set<String> badSBenthos) { + this.badBenthos = badSBenthos; + } + + public boolean withBadSpecies() { + return CollectionUtils.isNotEmpty(badSpecies); + } + + public boolean withBadBenthos() { + return CollectionUtils.isNotEmpty(badBenthos); + } +} Property changes on: trunk/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision Added: svn:eol-style + native 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 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2014-05-20 14:35:16 UTC (rev 1793) @@ -78,10 +78,24 @@ tutti.service.exportCruise.exportSurvey= tutti.service.exportSumatra.error.species.null= tutti.service.exportSumatra.error.station.null= +tutti.service.exportSumatra.header.averageSize= +tutti.service.exportSumatra.header.averageWeight= +tutti.service.exportSumatra.header.endLatitude= +tutti.service.exportSumatra.header.endLongitude= +tutti.service.exportSumatra.header.genuisSpecies= +tutti.service.exportSumatra.header.moule= +tutti.service.exportSumatra.header.multirigAggregation= tutti.service.exportSumatra.header.number= +tutti.service.exportSumatra.header.sign= +tutti.service.exportSumatra.header.sortedWeight= tutti.service.exportSumatra.header.species= +tutti.service.exportSumatra.header.startLatitude= +tutti.service.exportSumatra.header.startLongitude= tutti.service.exportSumatra.header.station= +tutti.service.exportSumatra.header.surveySpecies= +tutti.service.exportSumatra.header.totalWeight= tutti.service.exportSumatra.header.weight= +tutti.service.exportSumatra.header.year= tutti.service.exportSumatraV2.header.averageSize=Averagesize tutti.service.exportSumatraV2.header.averageWeight=AverageWeight tutti.service.exportSumatraV2.header.moule=Moule 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 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2014-05-20 14:35:16 UTC (rev 1793) @@ -1,5 +1,3 @@ -tutti.error.benthos.not.in.protocol=L'espèce (onglet Benthos) %s n'est pas déclarée dans le protocole. -tutti.error.species.not.in.protocol=L'espèce %s (onglet Espèce) n'est pas déclarée dans le protocole. tutti.io.mkDir.error=Erreur à la création du dossier %s tutti.property.attachment=Pièce jointe tutti.property.caracteristic=Caractéristique @@ -77,21 +75,23 @@ tutti.service.exportCruise.exportSurvey=<html>Export du fichier <strong>survey.csv</strong> pour la campagne %s</html> tutti.service.exportSumatra.error.species.null=L'espèce est nulle tutti.service.exportSumatra.error.station.null=Le trait est nul -tutti.service.exportSumatra.header.number=NbIndividus -tutti.service.exportSumatra.header.species=Espèce -tutti.service.exportSumatra.header.station=Station -tutti.service.exportSumatra.header.weight=Total -tutti.service.exportSumatraV2.header.averageSize=LongueurMoy -tutti.service.exportSumatraV2.header.averageWeight=PoidsMoy -tutti.service.exportSumatraV2.header.moule=Moule -tutti.service.exportSumatraV2.header.multirigAggregation=Poche -tutti.service.exportSumatraV2.header.number=NbIndividus -tutti.service.exportSumatraV2.header.sign=Signe -tutti.service.exportSumatraV2.header.sortedWeight=Tri -tutti.service.exportSumatraV2.header.species=Espèce -tutti.service.exportSumatraV2.header.station=Station -tutti.service.exportSumatraV2.header.totalWeight=Total -tutti.service.exportSumatraV2.header.year=Année +tutti.service.exportSumatra.header.averageSize=longueurmoy +tutti.service.exportSumatra.header.averageWeight=poidsmoy +tutti.service.exportSumatra.header.endLatitude=latitudefin +tutti.service.exportSumatra.header.endLongitude=longitudefin +tutti.service.exportSumatra.header.genuisSpecies=especescientifique +tutti.service.exportSumatra.header.moule=moule +tutti.service.exportSumatra.header.multirigAggregation=poche +tutti.service.exportSumatra.header.number=nbindividus +tutti.service.exportSumatra.header.sign=signe +tutti.service.exportSumatra.header.sortedWeight=tri +tutti.service.exportSumatra.header.startLatitude=latitudedebut +tutti.service.exportSumatra.header.startLongitude=longitudedebut +tutti.service.exportSumatra.header.station=station +tutti.service.exportSumatra.header.surveySpecies=espececampagne +tutti.service.exportSumatra.header.totalWeight=total +tutti.service.exportSumatra.header.weight=total +tutti.service.exportSumatra.header.year=annee tutti.service.multipost.attachment.copy.error=Erreur lors de l'export de la pièce-jointe %s tutti.service.multipost.attachment.mkdir.error=Impossible de créer le répertoire %s tutti.service.multipost.export.attachments.error=Erreur lors de l'export des pièces-jointes Modified: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java =================================================================== --- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -25,6 +25,8 @@ */ import fr.ifremer.tutti.persistence.ProgressionModel; +import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; +import fr.ifremer.tutti.service.PersistenceService; import fr.ifremer.tutti.service.ServiceDbResource; import fr.ifremer.tutti.service.TuttiServiceContext; import fr.ifremer.tutti.service.catches.TuttiWeightComputingException; @@ -59,10 +61,10 @@ public static final String OPERATION_BAD_3_ID = "100115"; public static final String EXPORT_CONTENT = - "Station;Espèce;Total;NbIndividus\n" + - "A;Chama magna;100.0;40\n" + - "A;Echinogammarus;100.0;417\n" + - "A;Brissopsis atlantica;100.0;94"; + "annee;station;poche;especescientifique;espececampagne;signe;tri;total;poidsmoy;longueurmoy;nbindividus;moule;latitudedebut;longitudedebut;latitudefin;longitudefin\n" + + "2013;A;1;Chama magna;CHAMMAG;;100.0;100.0;2.5;;40;0.4;;;;\n" + + "2013;A;1;Echinogammarus;ECHIGAM;;100.0;100.0;0.23980816;;417;4.17;;;;\n" + + "2013;A;1;Brissopsis atlantica;BRISATLAN;;100.0;100.0;1.0638298;10.571428;94;0.94;;;;"; protected CatchesSumatraExportService service; @@ -79,6 +81,12 @@ dbResource.openDataContext(); + File protocolFile = new File("src/test/resources/tuttiProtocol.tuttiProtocol"); + + TuttiProtocol protocol = dbResource.loadProtocol(protocolFile); + + serviceContext.getService(PersistenceService.class).setProtocol(protocol); + service = serviceContext.getService(CatchesSumatraExportService.class); } @@ -100,8 +108,7 @@ @Test public void testExportCruiseForSumatra() throws Exception { - dataContext = dbResource.loadContext(PROGRAM_ID, CRUISE_ID, 1, - OPERATION_1_ID); + dataContext = dbResource.loadContext(PROGRAM_ID, CRUISE_ID, 1, OPERATION_1_ID); File exportFile = new File(dataDirectory, "exportSumatra.csv"); Deleted: trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java =================================================================== --- trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -1,123 +0,0 @@ -package fr.ifremer.tutti.service.export.sumatra; - -/* - * #%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.ProgressionModel; -import fr.ifremer.tutti.persistence.entities.protocol.TuttiProtocol; -import fr.ifremer.tutti.service.PersistenceService; -import fr.ifremer.tutti.service.ServiceDbResource; -import fr.ifremer.tutti.service.TuttiServiceContext; -import fr.ifremer.tutti.service.catches.TuttiWeightComputingException; -import org.junit.Before; -import org.junit.ClassRule; -import org.junit.Test; - -import java.io.File; - -/** - * @author tchemit <chemit@codelutin.com> - * @since 3.3 - */ -public class CatchesSumatraExportServiceV2Test { - - @ClassRule - public static final ServiceDbResource dbResource = - ServiceDbResource.readDb("dbExport"); - - public static final String PROGRAM_ID = "CAM-TEST_ELEVATION"; - - public static final String CRUISE_BAD_ID = "100003"; - - public static final String CRUISE_ID = "100004"; - - public static final String OPERATION_1_ID = "100116"; - - public static final String OPERATION_BAD_1_ID = "100112"; - - public static final String OPERATION_BAD_2_ID = "100113"; - - public static final String OPERATION_BAD_3_ID = "100115"; - - public static final String EXPORT_CONTENT = - "Année;Station;Poche;Espèce;Signe;Tri;Total;PoidsMoy;LongueurMoy;NbIndividus;Moule\n" + - "2013;A;1;CHAMMAG;;100.0;100.0;2.5;NA;40;0.4\n" + - "2013;A;1;ECHIGAM;;100.0;100.0;0.23980816;NA;417;4.17\n" + - "2013;A;1;BRISATLAN;;100.0;100.0;1.0638298;10.571428;94;0.94"; - - protected CatchesSumatraExportServiceV2 service; - - protected ServiceDbResource.DataContext dataContext; - - protected File dataDirectory; - - @Before - public void setUp() throws Exception { - - dataDirectory = dbResource.getConfig().getDataDirectory(); - - TuttiServiceContext serviceContext = dbResource.getServiceContext(); - - dbResource.openDataContext(); - - File protocolFile = new File("src/test/resources/tuttiProtocol.tuttiProtocol"); - - TuttiProtocol protocol = dbResource.loadProtocol(protocolFile); - - serviceContext.getService(PersistenceService.class).setProtocol(protocol); - - service = serviceContext.getService(CatchesSumatraExportServiceV2.class); - } - - @Test(expected = TuttiWeightComputingException.class) - public void testExportCruiseForSumatraBadCruise() throws Exception { - - dataContext = dbResource.loadContext(PROGRAM_ID, CRUISE_BAD_ID, 3, - OPERATION_BAD_2_ID, - OPERATION_BAD_1_ID, - OPERATION_BAD_3_ID); - - File exportFile = new File(dataDirectory, "exportSumatra.csv"); - - ProgressionModel progressionModel = new ProgressionModel(); - progressionModel.setTotal(3); - service.exportCruiseForSumatra(exportFile, CRUISE_BAD_ID, progressionModel); - } - - @Test - public void testExportCruiseForSumatra() throws Exception { - - dataContext = dbResource.loadContext(PROGRAM_ID, CRUISE_ID, 1, OPERATION_1_ID); - - File exportFile = new File(dataDirectory, "exportSumatra.csv"); - - ProgressionModel progressionModel = new ProgressionModel(); - progressionModel.setTotal(3); - service.exportCruiseForSumatra(exportFile, CRUISE_ID, progressionModel); - - ServiceDbResource.assertFileContent("Sumatra export file:\n", - exportFile, - EXPORT_CONTENT); - } -} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -43,7 +43,6 @@ import fr.ifremer.tutti.service.export.generic.TuttiExportService; import fr.ifremer.tutti.service.export.pdf.CatchesPdfExportService; import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService; -import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportServiceV2; import fr.ifremer.tutti.service.protocol.ProtocolImportExportService; import fr.ifremer.tutti.service.psionimport.PsionImportService; import fr.ifremer.tutti.service.pupitri.PupitriImportExportService; @@ -694,10 +693,6 @@ return serviceContext.getService(CatchesSumatraExportService.class); } - public CatchesSumatraExportServiceV2 getCatchesSumatraExportServiceV2() { - return serviceContext.getService(CatchesSumatraExportServiceV2.class); - } - public MultiPostImportService getMultiPostImportService() { return serviceContext.getService(MultiPostImportService.class); } Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -28,6 +28,7 @@ import fr.ifremer.tutti.persistence.ProgressionModel; import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService; +import fr.ifremer.tutti.service.export.sumatra.SumatraExportResult; import fr.ifremer.tutti.ui.swing.content.MainUIHandler; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -52,6 +53,8 @@ protected File file; + protected SumatraExportResult sumatraExportResult; + public ExportCruiseForSumatraAction(MainUIHandler handler) { super(handler, false); } @@ -63,6 +66,17 @@ if (doAction) { + if (!getDataContext().isProtocolFilled()) { + displayWarningMessage( + t("tutti.exportCruiseForSumatraV2.title.required.protocol"), + t("tutti.exportCruiseForSumatraV2.message.required.protocol") + ); + doAction = false; + } + } + + if (doAction) { + String date = DateUtil.formatDate(new Date(), "dd-MM-yyyy"); // choose file to export file = saveFile( @@ -80,6 +94,7 @@ @Override public void releaseAction() { file = null; + sumatraExportResult = null; super.releaseAction(); } @@ -100,13 +115,38 @@ // export catches CatchesSumatraExportService service = getContext().getCatchesSumatraExportService(); - service.exportCruiseForSumatra(file, cruise.getId(), pm); + sumatraExportResult = service.exportCruiseForSumatra(file, cruise.getId(), pm); } @Override public void postSuccessAction() { super.postSuccessAction(); + + if (sumatraExportResult.withBadSpecies()) { + + StringBuilder badSpeciesList = new StringBuilder(); + for (String s : sumatraExportResult.getBadSpecies()) { + badSpeciesList.append("<li>").append(s); + } + + displayWarningMessage( + t("tutti.exportFishingOperationForSumatra.title.badSpecies"), + t("tutti.exportFishingOperationForSumatra.message.badSpecies", badSpeciesList.toString())); + } + + if (sumatraExportResult.withBadBenthos()) { + + StringBuilder badBenthosList = new StringBuilder(); + for (String s : sumatraExportResult.getBadBenthos()) { + badBenthosList.append("<li>").append(s); + } + + displayWarningMessage( + t("tutti.exportFishingOperationForSumatra.title.badBenthos"), + t("tutti.exportFishingOperationForSumatra.message.badBenthos", badBenthosList.toString())); + } + sendMessage(t("tutti.exportCruiseForSumatra.action.success", file)); } } Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraV2Action.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraV2Action.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraV2Action.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -1,123 +0,0 @@ -package fr.ifremer.tutti.ui.swing.action; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 - 2013 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.base.Preconditions; -import fr.ifremer.tutti.persistence.ProgressionModel; -import fr.ifremer.tutti.persistence.entities.data.Cruise; -import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportServiceV2; -import fr.ifremer.tutti.ui.swing.content.MainUIHandler; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.DateUtil; - -import java.io.File; -import java.util.Date; - -import static org.nuiton.i18n.I18n.t; - -/** - * Export the hole cruise using the sumatra format (V2). - * - * @author tchemit - * @since 3.3 - */ -public class ExportCruiseForSumatraV2Action extends AbstractMainUITuttiAction { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(ExportCruiseForSumatraV2Action.class); - - protected File file; - - public ExportCruiseForSumatraV2Action(MainUIHandler handler) { - super(handler, false); - } - - @Override - public boolean prepareAction() throws Exception { - - boolean doAction = super.prepareAction(); - - if (doAction) { - - if (!getDataContext().isProtocolFilled()) { - displayWarningMessage( - t("tutti.exportCruiseForSumatraV2.title.required.protocol"), - t("tutti.exportCruiseForSumatraV2.message.required.protocol") - ); - doAction = false; - } - } - - if (doAction) { - - String date = DateUtil.formatDate(new Date(), "dd-MM-yyyy"); - // choose file to export - file = saveFile( - String.format("sumatra_v2_%s_%s", getDataContext().getCruise().getName(), date), - "csv", - t("tutti.exportCruiseForSumatraV2.title.choose.exportFile"), - t("tutti.exportCruiseForSumatraV2.action.chooseFile"), - "^.+\\.csv$", t("tutti.common.file.csv") - ); - doAction = file != null; - } - return doAction; - } - - @Override - public void releaseAction() { - file = null; - super.releaseAction(); - } - - @Override - public void doAction() throws Exception { - Cruise cruise = getDataContext().getCruise(); - Preconditions.checkNotNull(cruise); - Preconditions.checkNotNull(file); - - if (log.isInfoEnabled()) { - log.info("Will export cruise " + cruise.getId() + - " to file: " + file); - } - ProgressionModel pm = new ProgressionModel(); - pm.setTotal(3); // loading cruise + loading fishing operationIds + export - setProgressionModel(pm); - - // export catches - CatchesSumatraExportServiceV2 service = - getContext().getCatchesSumatraExportServiceV2(); - service.exportCruiseForSumatra(file, cruise.getId(), pm); - - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - sendMessage(t("tutti.exportCruiseForSumatraV2.action.success", file)); - } -} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -29,6 +29,7 @@ import fr.ifremer.tutti.persistence.entities.data.Cruise; import fr.ifremer.tutti.persistence.entities.data.FishingOperation; import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportService; +import fr.ifremer.tutti.service.export.sumatra.SumatraExportResult; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel; @@ -55,6 +56,8 @@ protected File file; + protected SumatraExportResult sumatraExportResult; + public ExportFishingOperationForSumatraAction(EditCatchesUIHandler handler) { super(handler, true); } @@ -75,6 +78,17 @@ if (doAction) { + if (!getDataContext().isProtocolFilled()) { + displayWarningMessage( + t("tutti.exportFishingOperationForSumatra.title.required.protocol"), + t("tutti.exportFishingOperationForSumatra.message.required.protocol") + ); + doAction = false; + } + } + + if (doAction) { + FishingOperation fishingOperation = getModel().getFishingOperation(); String date = DateUtil.formatDate(new Date(), "dd-MM-yyyy"); @@ -94,6 +108,7 @@ @Override public void releaseAction() { file = null; + sumatraExportResult = null; super.releaseAction(); } @@ -117,16 +132,42 @@ // export catches CatchesSumatraExportService service = getContext().getCatchesSumatraExportService(); - service.exportFishingOperationForSumatra(file, - cruise.getId(), - fishingOperation.getId(), - pm); + sumatraExportResult = service.exportFishingOperationForSumatra(file, + cruise.getId(), + fishingOperation.getId(), + pm); + } @Override public void postSuccessAction() { super.postSuccessAction(); + + if (sumatraExportResult.withBadSpecies()) { + + StringBuilder badSpeciesList = new StringBuilder(); + for (String s : sumatraExportResult.getBadSpecies()) { + badSpeciesList.append("<li>").append(s); + } + + displayWarningMessage( + t("tutti.exportFishingOperationForSumatra.title.badSpecies"), + t("tutti.exportFishingOperationForSumatra.message.badSpecies", badSpeciesList.toString())); + } + + if (sumatraExportResult.withBadBenthos()) { + + StringBuilder badBenthosList = new StringBuilder(); + for (String s : sumatraExportResult.getBadBenthos()) { + badBenthosList.append("<li>").append(s); + } + + displayWarningMessage( + t("tutti.exportFishingOperationForSumatra.title.badBenthos"), + t("tutti.exportFishingOperationForSumatra.message.badBenthos", badBenthosList.toString())); + } + sendMessage(t("tutti.exportFishingOperationForSumatra.action.success", file)); } } Deleted: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraV2Action.java =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraV2Action.java 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraV2Action.java 2014-05-20 14:35:16 UTC (rev 1793) @@ -1,143 +0,0 @@ -package fr.ifremer.tutti.ui.swing.action; - -/* - * #%L - * Tutti :: UI - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2012 - 2013 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program. If not, see - * <http://www.gnu.org/licenses/gpl-3.0.html>. - * #L% - */ - -import com.google.common.base.Preconditions; -import fr.ifremer.tutti.persistence.ProgressionModel; -import fr.ifremer.tutti.persistence.entities.data.Cruise; -import fr.ifremer.tutti.persistence.entities.data.FishingOperation; -import fr.ifremer.tutti.service.export.sumatra.CatchesSumatraExportServiceV2; -import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI; -import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIHandler; -import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUIModel; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.nuiton.util.DateUtil; - -import java.io.File; -import java.util.Date; - -import static org.nuiton.i18n.I18n.t; - -/** - * Created on 10/1/13. - * - * @author Tony Chemit <chemit@codelutin.com> - * @since 3.3 - */ -public class ExportFishingOperationForSumatraV2Action extends AbstractTuttiAction<EditCatchesUIModel, EditCatchesUI, EditCatchesUIHandler> { - - /** Logger. */ - private static final Log log = - LogFactory.getLog(ExportFishingOperationForSumatraV2Action.class); - - protected File file; - - public ExportFishingOperationForSumatraV2Action(EditCatchesUIHandler handler) { - super(handler, true); - } - - @Override - public boolean prepareAction() throws Exception { - - boolean doAction = super.prepareAction(); - - if (getModel().isModify()) { - - displayWarningMessage( - t("tutti.exportFishingOperationForSumatraV2.title.model.modified"), - t("tutti.exportFishingOperationForSumatraV2.message.model.modified") - ); - doAction = false; - } - - if (doAction) { - - if (!getDataContext().isProtocolFilled()) { - displayWarningMessage( - t("tutti.exportFishingOperationForSumatraV2.title.required.protocol"), - t("tutti.exportFishingOperationForSumatraV2.message.required.protocol") - ); - doAction = false; - } - } - - if (doAction) { - - FishingOperation fishingOperation = getModel().getFishingOperation(); - - String date = DateUtil.formatDate(new Date(), "dd-MM-yyyy"); - // choose file to export - file = saveFile( - String.format("sumatra_v2_%s_%s_%s", getDataContext().getCruise().getName(), fishingOperation.getId(), date), - "csv", - t("tutti.exportFishingOperationForSumatraV2.title.choose.exportFile"), - t("tutti.exportFishingOperationForSumatraV2.action.chooseFile"), - "^.+\\.csv$", t("tutti.common.file.csv") - ); - doAction = file != null; - } - return doAction; - } - - @Override - public void releaseAction() { - file = null; - super.releaseAction(); - } - - @Override - public void doAction() throws Exception { - Cruise cruise = getDataContext().getCruise(); - FishingOperation fishingOperation = getModel().getFishingOperation(); - Preconditions.checkNotNull(cruise); - Preconditions.checkNotNull(fishingOperation); - Preconditions.checkNotNull(file); - - if (log.isInfoEnabled()) { - log.info("Will export fishingOperation " + cruise.getId() + "-" + fishingOperation.getStationNumber() + - " to file: " + file); - } - - ProgressionModel pm = new ProgressionModel(); - pm.setTotal(3); // loading cruise + loading fishing operationIds + export - setProgressionModel(pm); - - // export catches - CatchesSumatraExportServiceV2 service = - getContext().getCatchesSumatraExportServiceV2(); - service.exportFishingOperationForSumatra(file, - cruise.getId(), - fishingOperation.getId(), - pm); - - } - - @Override - public void postSuccessAction() { - super.postSuccessAction(); - sendMessage(t("tutti.exportFishingOperationForSumatraV2.action.success", file)); - } -} Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2014-05-20 14:35:16 UTC (rev 1793) @@ -105,7 +105,7 @@ } #editCruiseComboBox { - model: {handler.newComboModel(editCruiseButton, exportCruiseButton, sendCruiseReportButton, exportCruiseForSumatraButton, exportCruiseForSumatraV2Button)}; + model: {handler.newComboModel(editCruiseButton, exportCruiseButton, sendCruiseReportButton, exportCruiseForSumatraButton)}; enabled: {model.isProgramFound() && model.isCruiseFound()}; renderer: {new ActionListCellRenderer()}; } @@ -143,14 +143,6 @@ _help: {"tutti.selectCruise.action.exportCruiseForSumatra.help"}; } -#exportCruiseForSumatraV2Button { - actionIcon: export; - text: "tutti.selectCruise.action.exportCruiseForSumatraV2"; - toolTipText: "tutti.selectCruise.action.exportCruiseForSumatraV2.tip"; - _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportCruiseForSumatraV2Action.class}; - _help: {"tutti.selectCruise.action.exportCruiseForSumatraV2.help"}; -} - #newCruiseButton { actionIcon: add; text: "tutti.selectCruise.action.newCruise"; Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx =================================================================== --- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2014-05-20 14:35:16 UTC (rev 1793) @@ -69,7 +69,6 @@ <JButton id='exportCruiseButton'/> <JButton id='sendCruiseReportButton'/> <JButton id='exportCruiseForSumatraButton'/> - <JButton id='exportCruiseForSumatraV2Button'/> <JButton id='newProtocolButton'/> <JButton id='importProtocolButton'/> <JButton id='editProtocolButton'/> 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 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2014-05-20 14:35:16 UTC (rev 1793) @@ -362,15 +362,6 @@ _help: {"tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.help"}; } -#exportFishingOperationReportForSumatraV2Button { - actionIcon: export; - text: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatraV2"; - toolTipText: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatraV2.tip"; - i18nMnemonic: "tutti.editCatchBatch.action.exportFishingOperationReportForSumatraV2.mnemonic"; - _applicationAction: {fr.ifremer.tutti.ui.swing.action.ExportFishingOperationForSumatraV2Action.class}; - _help: {"tutti.editCatchBatch.action.exportFishingOperationReportForSumatraV2.help"}; -} - #saveButton { actionIcon: save; text: "tutti.editCatchBatch.action.saveCatchBatch"; 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 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2014-05-20 14:35:16 UTC (rev 1793) @@ -104,7 +104,6 @@ <JToolBar id='catchesCaracteristicsTabToolBar'> <JButton id='exportFishingOperationReportButton'/> <JButton id='exportFishingOperationReportForSumatraButton'/> - <JButton id='exportFishingOperationReportForSumatraV2Button'/> <ButtonAttachment id='catchesCaracteristicsAttachmentsButton' constructorParams='getHandler().getContext(), getModel()'/> </JToolBar> 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 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2014-05-20 14:35:16 UTC (rev 1793) @@ -1144,9 +1144,15 @@ tutti.exportDb.step.reloadApplication= tutti.exportFishingOperationForSumatra.action.chooseFile= tutti.exportFishingOperationForSumatra.action.success= +tutti.exportFishingOperationForSumatra.message.badBenthos= +tutti.exportFishingOperationForSumatra.message.badSpecies= tutti.exportFishingOperationForSumatra.message.model.modified=Catch was modified, please save it before launching an export. +tutti.exportFishingOperationForSumatra.message.required.protocol= +tutti.exportFishingOperationForSumatra.title.badBenthos= +tutti.exportFishingOperationForSumatra.title.badSpecies= tutti.exportFishingOperationForSumatra.title.choose.exportFile= tutti.exportFishingOperationForSumatra.title.model.modified=Can't export, catch is modified +tutti.exportFishingOperationForSumatra.title.required.protocol= tutti.exportFishingOperationForSumatraV2.action.chooseFile= tutti.exportFishingOperationForSumatraV2.action.success= tutti.exportFishingOperationForSumatraV2.message.model.modified= 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 2014-05-20 13:40:25 UTC (rev 1792) +++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2014-05-20 14:35:16 UTC (rev 1793) @@ -537,12 +537,9 @@ tutti.editCatchBatch.action.exportFishingOperationReport=Résumé PDF tutti.editCatchBatch.action.exportFishingOperationReport.mnemonic=P tutti.editCatchBatch.action.exportFishingOperationReport.tip=Envoyer le résumé au format pdf du trait sélectionné -tutti.editCatchBatch.action.exportFishingOperationReportForSumatra=Résumé Sumatra +tutti.editCatchBatch.action.exportFishingOperationReportForSumatra=Résumé Csv tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.mnemonic=u -tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.tip=Exporter le trait sélectionnée pour Sumatra (au format csv) -tutti.editCatchBatch.action.exportFishingOperationReportForSumatraV2=Résumé Sumatra V2 -tutti.editCatchBatch.action.exportFishingOperationReportForSumatraV2.mnemonic=m -tutti.editCatchBatch.action.exportFishingOperationReportForSumatraV2.tip=Exporter le trait sélectionnée pour Sumatra V2 (au format csv) +tutti.editCatchBatch.action.exportFishingOperationReportForSumatra.tip=Exporter le résumé au format csv du trait sélectionnée tutti.editCatchBatch.action.saveCatchBatch=Enregistrer tutti.editCatchBatch.action.saveCatchBatch.mnemonic=S tutti.editCatchBatch.action.saveCatchBatch.tip=Enregistrer la capture @@ -1119,28 +1116,26 @@ tutti.exportCruise.action.success=La campagne <strong>%s</strong> a été exportée dans le fichier <strong>%s</strong>. tutti.exportCruiseForSumatra.action.chooseFile=Choisir le fichier d'export tutti.exportCruiseForSumatra.action.success=La campagne sélectionnée a été exportée dans le fichier <strong>%s</strong> +tutti.exportCruiseForSumatra.message.required.protocol=Pour faire un export csv, un protocol est requis.<br/>De plus toutes les espèces de la captures doivent être renseignées dans le protocole. tutti.exportCruiseForSumatra.title.choose.exportFile=Exporter la campagne -tutti.exportCruiseForSumatraV2.action.chooseFile=Choisir le fichier d'export -tutti.exportCruiseForSumatraV2.action.success=La campagne sélectionnée a été exportée dans le fichier <strong>%s</strong> -tutti.exportCruiseForSumatraV2.message.required.protocol=Pour faire un export sumatra v2, un protocol est requis.<br/>De plus toutes les espèces de la captures doivent être renseignées dans le protocole. -tutti.exportCruiseForSumatraV2.title.choose.exportFile=Exporter la campagne -tutti.exportCruiseForSumatraV2.title.required.protocol=Protocole requis pour export sumatra v2 +tutti.exportCruiseForSumatra.title.required.protocol=Protocole requis pour export csv +tutti.exportCruiseForSumatraV2.message.required.protocol= +tutti.exportCruiseForSumatraV2.title.required.protocol= tutti.exportDb.step.closeDb=Fermeture de la base courante tutti.exportDb.step.createArchive=Création de l'archive %s tutti.exportDb.step.openDb=Réouverture de la base courante tutti.exportDb.step.reloadApplication=Redémarrage de l'application tutti.exportFishingOperationForSumatra.action.chooseFile=Choisir le fichier d'export tutti.exportFishingOperationForSumatra.action.success=Le trait a été exporté dans le fichier <strong>%s</strong> +tutti.exportFishingOperationForSumatra.message.badBenthos=<html><body>Des espèces non présentes (ou avec un code campagne non renseigné) dans le protocole (onglet Benthos) ont été détectées \: <ul>%s</ul></body></html> +tutti.exportFishingOperationForSumatra.message.badSpecies=<html><body>Des espèces non présentes (ou avec un code campagne non renseigné) dans le protocole (onglet Espèce) ont été détectées \: <ul>%s</ul></body></html> tutti.exportFishingOperationForSumatra.message.model.modified=La capture a été modifiée, veuillez l'enregistrer avant de lancer un export. +tutti.exportFishingOperationForSumatra.message.required.protocol=<html><body>Pour faire un export csv, un protocol est requis.<br/>De plus toutes les espèces de la captures doivent être renseignées dans le protocole.</body></html> +tutti.exportFishingOperationForSumatra.title.badBenthos=Espèces non présentes dans le protocole (onglet Benthos) +tutti.exportFishingOperationForSumatra.title.badSpecies=Espèces non présentes dans le protocole (onglet Espèce) tutti.exportFishingOperationForSumatra.title.choose.exportFile=Exporter le trait de la campagne tutti.exportFishingOperationForSumatra.title.model.modified=Impossible d'exporter, capture modifiée -tutti.exportFishingOperationForSumatraV2.action.chooseFile=Choisir le fichier d'export -tutti.exportFishingOperationForSumatraV2.action.success=Le trait a été exporté dans le fichier <strong>%s</strong> -tutti.exportFishingOperationForSumatraV2.message.model.modified=La capture a été modifiée, veuillez l'enregistrer avant de lancer un export. -tutti.exportFishingOperationForSumatraV2.message.required.protocol=<html><body>Pour faire un export sumatra v2, un protocol est requis.<br/>De plus toutes les espèces de la captures doivent être renseignées dans le protocole.</body></html> -tutti.exportFishingOperationForSumatraV2.title.choose.exportFile=Exporter le trait de la campagne -tutti.exportFishingOperationForSumatraV2.title.model.modified=Impossible d'exporter, capture modifiée -tutti.exportFishingOperationForSumatraV2.title.required.protocol=Protocole requis pour export sumatra v2 +tutti.exportFishingOperationForSumatra.title.required.protocol=Protocole requis pour export csv tutti.exportFishingOperationReport.action.chooseFile=Choisir le fichier de rapport tutti.exportFishingOperationReport.action.success=Le trait a été exporté dans le fichier <strong>%s</strong> tutti.exportFishingOperationReport.message.model.modified=La capture a été modifiée, veuillez l'enregistrer avant de lancer un export. @@ -1449,10 +1444,8 @@ tutti.selectCruise.action.editProtocol.tip=Éditer le protocole sélectionné tutti.selectCruise.action.exportCruise=Export Générique tutti.selectCruise.action.exportCruise.tip=Exporter la campagne sélectionnée au format générique -tutti.selectCruise.action.exportCruiseForSumatra=Eport Sumatra (v1) -tutti.selectCruise.action.exportCruiseForSumatra.tip=Exporter la campagne sélectionnée au format csv pour Sumatra (v1) -tutti.selectCruise.action.exportCruiseForSumatraV2=Export Sumatra (V2) -tutti.selectCruise.action.exportCruiseForSumatraV2.tip=Exporter la campagne sélectionnée au format csv pour Sumatra (V2) +tutti.selectCruise.action.exportCruiseForSumatra=Eport csv +tutti.selectCruise.action.exportCruiseForSumatra.tip=Exporter la campagne sélectionnée au format csv tutti.selectCruise.action.exportProgram=Exporter tutti.selectCruise.action.exportProgram.tip=Exporter la série sélectionnée tutti.selectCruise.action.exportProtocol=Exporter