Tutti-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
May 2014
- 5 participants
- 105 discussions
r1799 - in branches/tutti-3.4.x: tutti-persistence/src/main/java/fr/ifremer/tutti/persistence tutti-service/src/main/java/fr/ifremer/tutti/service tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic
by tchemit@users.forge.codelutin.com 21 May '14
by tchemit@users.forge.codelutin.com 21 May '14
21 May '14
Author: tchemit
Date: 2014-05-21 09:39:03 +0200 (Wed, 21 May 2014)
New Revision: 1799
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1799
Log:
fixes #5110 [EXPORT GENERIQUE] calcul du coef ?\195?\169l?\195?\169vation finale ?\195?\160 corriger
Modified:
branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportModel.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportRow.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/ExportSampleCategory.java
branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java
branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java
Modified: branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java
===================================================================
--- branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistence.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -277,6 +277,8 @@
boolean isVracBatch(SpeciesAbleBatch speciesBatch);
+ boolean isHorsVracBatch(SpeciesAbleBatch speciesBatch);
+
boolean isTemporary(TuttiReferentialEntity entity);
List<Gear> getAllScientificGear();
Modified: branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java
===================================================================
--- branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -437,6 +437,11 @@
}
@Override
+ public boolean isHorsVracBatch(SpeciesAbleBatch speciesBatch) {
+ return !batchVracPredicate.apply(speciesBatch);
+ }
+
+ @Override
public Predicate<SpeciesAbleBatch> getVracBatchPredicate() {
return batchVracPredicate;
}
Modified: branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java
===================================================================
--- branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceNoDbImpl.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -260,6 +260,11 @@
}
@Override
+ public boolean isHorsVracBatch(SpeciesAbleBatch speciesBatch) {
+ throw notImplemented();
+ }
+
+ @Override
public Predicate<SpeciesAbleBatch> getVracBatchPredicate() {
throw notImplemented();
}
Modified: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -895,6 +895,11 @@
}
@Override
+ public boolean isHorsVracBatch(SpeciesAbleBatch speciesBatch) {
+ return driver.isHorsVracBatch(speciesBatch);
+ }
+
+ @Override
public Predicate<SpeciesAbleBatch> getVracBatchPredicate() {
return driver.getVracBatchPredicate();
}
Modified: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportModel.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportModel.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportModel.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -118,24 +118,29 @@
String batchWeightUnit = weightMeasuredCaracteristic.getUnit();
for (SpeciesBatch speciesBatch : rootSpeciesBatch.getChildren()) {
- CatchExportRow row = new CatchExportRow();
+
+ boolean vracBatch = persistenceService.isVracBatch(speciesBatch);
+
+ CatchExportRow row = new CatchExportRow(vracBatch, false);
row.setCruise(cruise);
row.setFishingOperation(operation);
row.setSpecies(speciesBatch.getSpecies());
row.setBatchWeightUnit(batchWeightUnit);
- if (!persistenceService.isVracBatch(speciesBatch)) {
+ float raisingFactor = speciesCatchRaisingFactor;
+
+ if (!vracBatch) {
+
// for HV, always use a 1.0 raising factor
- speciesCatchRaisingFactor = 1.f;
+ raisingFactor = 1.f;
}
Float batchWeight = TuttiEntities.getValueOrComputedValue(
speciesBatch.getSampleCategoryWeight(),
speciesBatch.getSampleCategoryComputedWeight());
- float totalBatchWeight = batchWeight == null ? 0 : speciesCatchRaisingFactor *
- batchWeight;
+ float totalBatchWeight = batchWeight == null ? 0 : raisingFactor * batchWeight;
addSpeciesBatch(persistenceService,
row,
@@ -145,24 +150,28 @@
}
for (BenthosBatch benthosBatch : rootBenthosBatch.getChildren()) {
- CatchExportRow row = new CatchExportRow();
+
+ boolean vracBatch = persistenceService.isVracBatch(benthosBatch);
+
+ CatchExportRow row = new CatchExportRow(vracBatch, true);
row.setCruise(cruise);
row.setFishingOperation(operation);
row.setSpecies(benthosBatch.getSpecies());
row.setBatchWeightUnit(batchWeightUnit);
- if (!persistenceService.isVracBatch(benthosBatch)) {
+ float raisingFactor = benthosCatchRaisingFactor;
+ if (!vracBatch) {
+
// for HV, always use a 1.0 raising factor
- benthosCatchRaisingFactor = 1.f;
+ raisingFactor = 1.f;
}
Float batchWeight = TuttiEntities.getValueOrComputedValue(
benthosBatch.getSampleCategoryWeight(),
benthosBatch.getSampleCategoryComputedWeight());
- float totalBatchWeight = batchWeight == null ? 0 : benthosCatchRaisingFactor *
- batchWeight;
+ float totalBatchWeight = batchWeight == null ? 0 : raisingFactor * batchWeight;
addBenthosBatch(persistenceService,
row,
@@ -173,21 +182,38 @@
// compute final raising factor
// see http://forge.codelutin.com/issues/4135
+ // see http://forge.codelutin.com/issues/5110
for (CatchExportRow row : rows) {
- float finalRaisingFactor = 1f;
+ float finalRaisingFactor;
+ if (row.isVrac()) {
+
+ finalRaisingFactor = row.isBenthosRow() ? benthosCatchRaisingFactor : speciesCatchRaisingFactor;
+
+ } else {
+
+ finalRaisingFactor = 1f;
+
+ }
+
for (ExportSampleCategory exportSampleCategory : row.getSampleCategory()) {
if (exportSampleCategory != null) {
Float totalWeight = exportSampleCategory.getCategoryWeight();
- Float sampleWeight = exportSampleCategory.getSampleWeight();
+ Float sampleWeight = TuttiEntities.getValueOrComputedValue(
+ exportSampleCategory.getSampleWeight(),
+ exportSampleCategory.getSampleComputedWeight());
if (totalWeight != null && sampleWeight != null) {
- // the only case which can change the final rate
+
float currentRate = totalWeight / sampleWeight;
- finalRaisingFactor *= currentRate;
+ if (TuttiEntities.isNotEqualWeight(1.0f, currentRate)) {
+
+ // the only case which can change the final rate
+ finalRaisingFactor *= currentRate;
+ }
}
}
}
@@ -282,6 +308,10 @@
} else {
+ int categoryIndex = currentRow.getSampleCategory().size();
+
+ float sampleComputedWeight = 0f;
+
for (SpeciesBatch childBatch : speciesBatch.getChildBatchs()) {
// always use a copy, otherwise sample categories can be shared by brothers
CatchExportRow childRow = currentRow.copy();
@@ -291,7 +321,15 @@
childBatch,
totalBatchWeight
);
+ ExportSampleCategory exportSampleCategory = childRow.getSampleCategory().get(categoryIndex);
+ if (exportSampleCategory != null) {
+ float categoryWeight = TuttiEntities.getValueOrComputedValue(
+ exportSampleCategory.getCategoryWeight(),
+ exportSampleCategory.getComputedWeight());
+ sampleComputedWeight += categoryWeight;
+ }
}
+ currentRow.getSampleCategory().get(categoryIndex - 1).setSampleComputedWeight(sampleComputedWeight);
}
}
@@ -393,6 +431,10 @@
} else {
+ int categoryIndex = currentRow.getSampleCategory().size();
+
+ float sampleComputedWeight = 0f;
+
for (BenthosBatch childBatch : benthosBatch.getChildBatchs()) {
// always use a copy, otherwise sample categories can be shared by brothers
CatchExportRow childRow = currentRow.copy();
@@ -401,7 +443,13 @@
rows,
childBatch,
totalBatchWeight);
+ ExportSampleCategory exportSampleCategory = childRow.getSampleCategory().get(categoryIndex);
+ float categoryWeight = TuttiEntities.getValueOrComputedValue(
+ exportSampleCategory.getCategoryWeight(),
+ exportSampleCategory.getComputedWeight());
+ sampleComputedWeight += categoryWeight;
}
+ currentRow.getSampleCategory().get(categoryIndex - 1).setSampleComputedWeight(sampleComputedWeight);
}
}
Modified: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportRow.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportRow.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/CatchExportRow.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -78,6 +78,8 @@
public static final String FINAL_RAISING_FACTOR = "finalRaisingFactor";
+ public static final String BENTHOS_ROW = "benthosRow";
+
protected Cruise cruise;
protected FishingOperation fishingOperation;
@@ -100,8 +102,17 @@
protected String batchWeightUnit;
+ protected final boolean benthosRow;
+
+ protected final boolean vrac;
+
protected final List<String> comment = new ArrayList<>();
+ public CatchExportRow(boolean vrac, boolean benthosRow) {
+ this.vrac = vrac;
+ this.benthosRow = benthosRow;
+ }
+
public void setCruise(Cruise cruise) {
this.cruise = cruise;
}
@@ -218,11 +229,22 @@
this.batchWeightUnit = batchWeightUnit;
}
+ public boolean isVrac() {
+ return vrac;
+ }
+
+ public boolean isHorsVrac() {
+ return !isVrac();
+ }
+
+ public boolean isBenthosRow() {
+ return benthosRow;
+ }
+
public CatchExportRow copy() {
- CatchExportRow result = new CatchExportRow();
+ CatchExportRow result = new CatchExportRow(vrac, benthosRow);
result.setCruise(cruise);
result.setFishingOperation(fishingOperation);
-// result.setSpeciesCategory(speciesCategory);
result.sampleCategory.addAll(sampleCategory);
if (benthosFrequency != null) {
result.setBenthosFrequency(benthosFrequency);
Modified: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/ExportSampleCategory.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/ExportSampleCategory.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/generic/ExportSampleCategory.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -42,10 +42,6 @@
public static final String PROPERTY_CATEGORY_CARACTERISTIC = "categoryCaracteristic";
- public static final String PROPERTY_CATEGORY_VALUE = "categoryValue";
-
- public static final String PROPERTY_CATEGORY_WEIGHT = "categoryWeight";
-
public static final String PROPERTY_NUMBER = "number";
public static final String PROPERTY_COMPUTED_WEIGHT = "computedWeight";
@@ -64,6 +60,8 @@
private Float sampleWeight;
+ private Float sampleComputedWeight;
+
public String getWeightOrVolType() {
return weightOrVolType;
}
@@ -88,6 +86,14 @@
this.sampleWeight = sampleWeight;
}
+ public Float getSampleComputedWeight() {
+ return sampleComputedWeight;
+ }
+
+ public void setSampleComputedWeight(Float sampleComputedWeight) {
+ this.sampleComputedWeight = sampleComputedWeight;
+ }
+
public Caracteristic getCategoryCaracteristic() {
return categoryDef.getCaracteristic();
}
Modified: branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportService2Test.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -132,7 +132,7 @@
URL url = new URL(urlPrefix + "species.csv");
ServiceDbResource.assertFileContent("species export:\n",
url,
- "Id;Code_Rubin;Nom Scientifique;Code campagne\n" +
+ "Id;Code_Rubin;Nom_scientifique;Code_campagne\n" +
"380;ACANECH;Acanthocardia echinata;\n" +
"1358;ALOSALO;Alosa alosa;\n" +
"1938;AGONCAT;Agonus cataphractus;\n" +
@@ -192,16 +192,16 @@
ServiceDbResource.assertFileContent("Catch export:\n",
url,
"Annee;Serie;Serie_Partielle;Engin;Code_station;Id_Operation;Poche;Code_Taxon;Code_Espece_Campagne;Nom_scientifique;Commentaire;V_HV;Num_Ordre_V_HV_H2;Tot_V_HV;Ech_V_HV;Type_Volume_Poids_V_HV;Unite_Volume_Poids_V_HV;Class_Tri;Num_Ordre_Class_Tri_H2;Tot_Class_Tri;Ech_Class_Tri;Type_Volume_Poids_Class_Tri;Unite_Volume_Poids_Class_Tri;Sexe;Num_Ordre_Sexe_H2;Tot_Sexe;Ech_Sexe;Type_Volume_Poids_Sexe;Unite_Volume_Poids_Sexe;Maturite;Num_Ordre_Maturite_H2;Tot_Maturite;Ech_Maturite;Type_Volume_Poids_Maturite;Unite_Volume_Poids_Maturite;Age;Num_Ordre_Age_H2;Tot_Age;Ech_Age;Type_Volume_Poids_Age;Unite_Volume_Poids_Age;Code_Longueur;Libelle_Longueur;Taille;NumOrdre_Taille_H2;Poids_Classe_Taille;Unite_Taille;Precision_Mesure;Nbr;Poids_Reference;Coef_Elev_Espece_Capture;Coef_Final_Elevation\n" +
- "2013;test elevation;1;OTB 20/28.10;B;2;1;1938;;Agonus cataphractus;Trait B-2-1 AGONCAT-vrac 80;Vrac;1;80.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;80.0;3.5;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;B;2;1;1358;;Alosa alosa;Trait B-2-1 ALOSALO Vrac|Trait B-2-1 ALOSALO Vrac - Male 60;Vrac;2;;;Poids;kg;NA;;;;;kg;Mâle;1;60.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;60.0;5.8333335;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;B;2;1;1358;;Alosa alosa;Trait B-2-1 ALOSALO Vrac|Trait B-2-1 ALOSALO Vrac - Femelle 40.0;Vrac;2;;;Poids;kg;NA;;;;;kg;Femelle;2;40.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;40.0;8.75;1.0\n" +
+ "2013;test elevation;1;OTB 20/28.10;B;2;1;1938;;Agonus cataphractus;Trait B-2-1 AGONCAT-vrac 80;Vrac;1;80.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;80.0;3.5;3.5\n" +
+ "2013;test elevation;1;OTB 20/28.10;B;2;1;1358;;Alosa alosa;Trait B-2-1 ALOSALO Vrac|Trait B-2-1 ALOSALO Vrac - Male 60;Vrac;2;;;Poids;kg;NA;;;;;kg;Mâle;1;60.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;60.0;5.8333335;3.5\n" +
+ "2013;test elevation;1;OTB 20/28.10;B;2;1;1358;;Alosa alosa;Trait B-2-1 ALOSALO Vrac|Trait B-2-1 ALOSALO Vrac - Femelle 40.0;Vrac;2;;;Poids;kg;NA;;;;;kg;Femelle;2;40.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;40.0;8.75;3.5\n" +
"2013;test elevation;1;OTB 20/28.10;B;2;1;1938;;Agonus cataphractus;Trait B-2-1 AGONCAT-horsvrac 20;Hors Vrac;1;20.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;20.0;1.0;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;B;2;1;4622;;Abietinaria abietina;Trait B-2-1 Benthos ABIEABI Vrac 30@@@@avec @@@@commentaire...;Vrac;101;30.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;30.0;7.0;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;B;2;1;380;;Acanthocardia echinata;Trait B-2-1 Benthos ACANECH Vrac 18@@@@avec @@@@commentaire...;Vrac;102;18.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;18.0;7.0;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;A;1;1;1938;;Agonus cataphractus;AGONCAT-vrac-80;Vrac;1;80.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;80.0;5.4444447;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;A;1;1;1358;;Alosa alosa;ALOSALO-vrac|ALOSALO-vrac-male 60;Vrac;2;;;Poids;kg;NA;;;;;kg;Mâle;1;60.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;60.0;9.074075;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;A;1;1;1358;;Alosa alosa;ALOSALO-vrac|ALOSALO-vrac-femelle 40;Vrac;2;;;Poids;kg;NA;;;;;kg;Femelle;2;40.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;5.0;1;0.6;cm;1.0;4;0.6;907.4074;1.0\n" +
- "2013;test elevation;1;OTB 20/28.10;A;1;1;1358;;Alosa alosa;ALOSALO-vrac|ALOSALO-vrac-femelle 40;Vrac;2;;;Poids;kg;NA;;;;;kg;Femelle;2;40.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;6.0;2;0.4;cm;1.0;10;0.4;1361.1111;1.0\n" +
+ "2013;test elevation;1;OTB 20/28.10;B;2;1;4622;;Abietinaria abietina;Trait B-2-1 Benthos ABIEABI Vrac 30@@@@avec @@@@commentaire...;Vrac;101;30.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;30.0;7.0;7.0\n" +
+ "2013;test elevation;1;OTB 20/28.10;B;2;1;380;;Acanthocardia echinata;Trait B-2-1 Benthos ACANECH Vrac 18@@@@avec @@@@commentaire...;Vrac;102;18.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;18.0;7.0;7.0\n" +
+ "2013;test elevation;1;OTB 20/28.10;A;1;1;1938;;Agonus cataphractus;AGONCAT-vrac-80;Vrac;1;80.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;80.0;5.4444447;5.4444447\n" +
+ "2013;test elevation;1;OTB 20/28.10;A;1;1;1358;;Alosa alosa;ALOSALO-vrac|ALOSALO-vrac-male 60;Vrac;2;;;Poids;kg;NA;;;;;kg;Mâle;1;60.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;60.0;9.074075;5.4444447\n" +
+ "2013;test elevation;1;OTB 20/28.10;A;1;1;1358;;Alosa alosa;ALOSALO-vrac|ALOSALO-vrac-femelle 40;Vrac;2;;;Poids;kg;NA;;;;;kg;Femelle;2;40.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;5.0;1;0.6;cm;1.0;4;0.6;907.4074;5.4444447\n" +
+ "2013;test elevation;1;OTB 20/28.10;A;1;1;1358;;Alosa alosa;ALOSALO-vrac|ALOSALO-vrac-femelle 40;Vrac;2;;;Poids;kg;NA;;;;;kg;Femelle;2;40.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;306;Longueur totale (LT) - individu - totale - Mesure au cm par un observateur;6.0;2;0.4;cm;1.0;10;0.4;1361.1111;5.4444447\n" +
"2013;test elevation;1;OTB 20/28.10;A;1;1;1938;;Agonus cataphractus;AGONCAT-horsvrac-20;Hors Vrac;1;20.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;20.0;1.0;1.0\n" +
"2013;test elevation;1;;C;3;1;11183;;Brissopsis atlantica;|;Vrac;1;;;Poids;kg;NA;;;;;kg;UNK - Indéterminé;1;30.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;30.0;0.0;1.0\n" +
"2013;test elevation;1;;C;3;1;11183;;Brissopsis atlantica;|;Vrac;1;;;Poids;kg;NA;;;;;kg;Mâle;2;20.0;;Poids;kg;NA;;;;;kg;NA;;;;;kg;;;;;;;;;20.0;0.0;1.0\n" +
Modified: branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java 2014-05-20 14:47:17 UTC (rev 1798)
+++ branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/generic/TuttiExportServiceTest.java 2014-05-21 07:39:03 UTC (rev 1799)
@@ -100,10 +100,10 @@
public static final String CATCH_CONTENT =
"Annee;Serie;Serie_Partielle;Engin;Code_station;Id_Operation;Poche;Code_Taxon;Code_Espece_Campagne;Nom_scientifique;Commentaire;V_HV;Num_Ordre_V_HV_H2;Tot_V_HV;Ech_V_HV;Type_Volume_Poids_V_HV;Unite_Volume_Poids_V_HV;Class_Tri;Num_Ordre_Class_Tri_H2;Tot_Class_Tri;Ech_Class_Tri;Type_Volume_Poids_Class_Tri;Unite_Volume_Poids_Class_Tri;Sexe;Num_Ordre_Sexe_H2;Tot_Sexe;Ech_Sexe;Type_Volume_Poids_Sexe;Unite_Volume_Poids_Sexe;Maturite;Num_Ordre_Maturite_H2;Tot_Maturite;Ech_Maturite;Type_Volume_Poids_Maturite;Unite_Volume_Poids_Maturite;Age;Num_Ordre_Age_H2;Tot_Age;Ech_Age;Type_Volume_Poids_Age;Unite_Volume_Poids_Age;Code_Longueur;Libelle_Longueur;Taille;NumOrdre_Taille_H2;Poids_Classe_Taille;Unite_Taille;Precision_Mesure;Nbr;Poids_Reference;Coef_Elev_Espece_Capture;Coef_Final_Elevation\n" +
- "2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;|||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Mâle;1;30.0;;Poids;kg;1 - Stade 1;1;10.0;5.0;Poids;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;10.0;1;;cm;0.5;5;5.0;20.0;2.0\n" +
- "2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;|||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Mâle;1;30.0;;Poids;kg;1 - Stade 1;1;10.0;5.0;Poids;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;10.5;2;;cm;0.5;2;5.0;20.0;2.0\n" +
- "2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;|||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Mâle;1;30.0;;Poids;kg;1 - Stade 1;1;10.0;5.0;Poids;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;11.0;3;;cm;0.5;1;5.0;20.0;2.0\n" +
- "2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;|||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Mâle;1;30.0;;Poids;kg;3 - Stade 3;3;10.0;;Poids;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;11.0;1;;cm;0.5;5;10.0;10.0;1.0\n" +
+ "2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;|||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Mâle;1;30.0;;Poids;kg;1 - Stade 1;1;10.0;5.0;Poids;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;10.0;1;;cm;0.5;5;5.0;20.0;3.0\n" +
+ "2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;|||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Mâle;1;30.0;;Poids;kg;1 - Stade 1;1;10.0;5.0;Poids;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;10.5;2;;cm;0.5;2;5.0;20.0;3.0\n" +
+ "2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;|||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Mâle;1;30.0;;Poids;kg;1 - Stade 1;1;10.0;5.0;Poids;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;11.0;3;;cm;0.5;1;5.0;20.0;3.0\n" +
+ "2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;|||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Mâle;1;30.0;;Poids;kg;3 - Stade 3;3;10.0;;Poids;kg;NA;;;;;kg;307;Longueur totale (LT) - individu - totale - Mesure au 1/2 cm par un observateur;11.0;1;;cm;0.5;5;10.0;10.0;1.5\n" +
"2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Femelle;2;50.0;30.0;Poids;kg;NA;;;;;kg;NA;;;;;kg;1425;Longueur totale (LT) - individu - queue - Mesure au cm par un observateur;10.0;1;;cm;;5;30.0;3.3333333;1.6666666\n" +
"2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Femelle;2;50.0;30.0;Poids;kg;NA;;;;;kg;NA;;;;;kg;1425;Longueur totale (LT) - individu - queue - Mesure au cm par un observateur;11.0;2;;cm;;6;30.0;3.3333333;1.6666666\n" +
"2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;11242;;Aaptos;||;Vrac;1;100.0;;Poids;kg;G - Gros;1;80.0;;Poids;kg;Femelle;2;50.0;30.0;Poids;kg;NA;;;;;kg;NA;;;;;kg;1425;Longueur totale (LT) - individu - queue - Mesure au cm par un observateur;12.0;3;;cm;;7;30.0;3.3333333;1.6666666\n" +
@@ -167,13 +167,13 @@
"2013;Campagne CGFS;;GOV 19.7/25.9;A;1;1;100001;3835;Abalistes;;1425;4.0";
public static final String SPECIES_CONTENT =
- "Id;Code_Rubin;Nom Scientifique;Code campagne\n" +
+ "Id;Code_Rubin;Nom_scientifique;Code_campagne\n" +
"3835;ABAL;Abalistes;\n" +
"11242;AAPT;Aaptos;\n" +
"11243;AAPTAAP;Aaptos aaptos;";
public static final String SPECIES_CONTENT_2 =
- "Id;Code_Rubin;Nom Scientifique;Code campagne\n" +
+ "Id;Code_Rubin;Nom_scientifique;Code_campagne\n" +
"300;BUCCUND;Buccinum undatum;\n" +
"365;AEQUOPE;Aequipecten opercularis;\n" +
"489;LOLIVUL;Loligo vulgaris;LOLIVUL\n" +
1
0
r1798 - in trunk/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/action resources/i18n
by tchemit@users.forge.codelutin.com 20 May '14
by tchemit@users.forge.codelutin.com 20 May '14
20 May '14
Author: tchemit
Date: 2014-05-20 16:47:17 +0200 (Tue, 20 May 2014)
New Revision: 1798
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1798
Log:
refs #5115 (report from version 3.4.4)
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/ExportFishingOperationForSumatraAction.java
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: trunk/tutti-ui-swing/src/main/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 14:46:49 UTC (rev 1797)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 14:47:17 UTC (rev 1798)
@@ -68,10 +68,9 @@
if (!getDataContext().isProtocolFilled()) {
displayWarningMessage(
- t("tutti.exportCruiseForSumatra.title.required.protocol"),
- t("tutti.exportCruiseForSumatra.message.required.protocol")
+ t("tutti.exportCruiseForSumatra.title.missing.protocol"),
+ t("tutti.exportCruiseForSumatra.message.missing.protocol")
);
- doAction = false;
}
}
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 14:46:49 UTC (rev 1797)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-20 14:47:17 UTC (rev 1798)
@@ -80,10 +80,9 @@
if (!getDataContext().isProtocolFilled()) {
displayWarningMessage(
- t("tutti.exportFishingOperationForSumatra.title.required.protocol"),
- t("tutti.exportFishingOperationForSumatra.message.required.protocol")
+ t("tutti.exportFishingOperationForSumatra.title.missing.protocol"),
+ t("tutti.exportFishingOperationForSumatra.message.missing.protocol")
);
- doAction = false;
}
}
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 14:46:49 UTC (rev 1797)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2014-05-20 14:47:17 UTC (rev 1798)
@@ -1132,7 +1132,11 @@
tutti.exportCruise.action.success=
tutti.exportCruiseForSumatra.action.chooseFile=
tutti.exportCruiseForSumatra.action.success=
+tutti.exportCruiseForSumatra.message.missing.protocol=
+tutti.exportCruiseForSumatra.message.required.protocol=
tutti.exportCruiseForSumatra.title.choose.exportFile=
+tutti.exportCruiseForSumatra.title.missing.protocol=
+tutti.exportCruiseForSumatra.title.required.protocol=
tutti.exportCruiseForSumatraV2.action.chooseFile=
tutti.exportCruiseForSumatraV2.action.success=
tutti.exportCruiseForSumatraV2.message.required.protocol=
@@ -1146,11 +1150,13 @@
tutti.exportFishingOperationForSumatra.action.success=
tutti.exportFishingOperationForSumatra.message.badBenthos=
tutti.exportFishingOperationForSumatra.message.badSpecies=
+tutti.exportFishingOperationForSumatra.message.missing.protocol=
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.missing.protocol=
tutti.exportFishingOperationForSumatra.title.model.modified=Can't export, catch is modified
tutti.exportFishingOperationForSumatra.title.required.protocol=
tutti.exportFishingOperationForSumatraV2.action.chooseFile=
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 14:46:49 UTC (rev 1797)
+++ trunk/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2014-05-20 14:47:17 UTC (rev 1798)
@@ -1116,9 +1116,9 @@
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.message.missing.protocol=<html><body>Pas de protocole renseigné, La colonne <strong>espcecamapgne</strong> ne sera pas renseigné.</body></html>
tutti.exportCruiseForSumatra.title.choose.exportFile=Exporter la campagne
-tutti.exportCruiseForSumatra.title.required.protocol=Protocole requis pour export csv
+tutti.exportCruiseForSumatra.title.missing.protocol=Pas de protocole renseigné
tutti.exportCruiseForSumatraV2.message.required.protocol=
tutti.exportCruiseForSumatraV2.title.required.protocol=
tutti.exportDb.step.closeDb=Fermeture de la base courante
@@ -1129,11 +1129,13 @@
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.missing.protocol=
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.missing.protocol=
tutti.exportFishingOperationForSumatra.title.model.modified=Impossible d'exporter, capture modifiée
tutti.exportFishingOperationForSumatra.title.required.protocol=Protocole requis pour export csv
tutti.exportFishingOperationReport.action.chooseFile=Choisir le fichier de rapport
1
0
r1797 - in branches/tutti-3.4.x/tutti-ui-swing/src/main: java/fr/ifremer/tutti/ui/swing/action resources/i18n
by tchemit@users.forge.codelutin.com 20 May '14
by tchemit@users.forge.codelutin.com 20 May '14
20 May '14
Author: tchemit
Date: 2014-05-20 16:46:49 +0200 (Tue, 20 May 2014)
New Revision: 1797
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1797
Log:
fixes #5115 [EXPORT] Evolution format export SUMATRA pelgas
Modified:
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 14:38:18 UTC (rev 1796)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 14:46:49 UTC (rev 1797)
@@ -68,10 +68,9 @@
if (!getDataContext().isProtocolFilled()) {
displayWarningMessage(
- t("tutti.exportCruiseForSumatra.title.required.protocol"),
- t("tutti.exportCruiseForSumatra.message.required.protocol")
+ t("tutti.exportCruiseForSumatra.title.missing.protocol"),
+ t("tutti.exportCruiseForSumatra.message.missing.protocol")
);
- doAction = false;
}
}
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-20 14:38:18 UTC (rev 1796)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-20 14:46:49 UTC (rev 1797)
@@ -80,10 +80,9 @@
if (!getDataContext().isProtocolFilled()) {
displayWarningMessage(
- t("tutti.exportFishingOperationForSumatra.title.required.protocol"),
- t("tutti.exportFishingOperationForSumatra.message.required.protocol")
+ t("tutti.exportFishingOperationForSumatra.title.missing.protocol"),
+ t("tutti.exportFishingOperationForSumatra.message.missing.protocol")
);
- doAction = false;
}
}
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2014-05-20 14:38:18 UTC (rev 1796)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2014-05-20 14:46:49 UTC (rev 1797)
@@ -1130,7 +1130,11 @@
tutti.exportCruise.action.success=
tutti.exportCruiseForSumatra.action.chooseFile=
tutti.exportCruiseForSumatra.action.success=
+tutti.exportCruiseForSumatra.message.missing.protocol=
+tutti.exportCruiseForSumatra.message.required.protocol=
tutti.exportCruiseForSumatra.title.choose.exportFile=
+tutti.exportCruiseForSumatra.title.missing.protocol=
+tutti.exportCruiseForSumatra.title.required.protocol=
tutti.exportCruiseForSumatraV2.action.chooseFile=
tutti.exportCruiseForSumatraV2.action.success=
tutti.exportCruiseForSumatraV2.message.required.protocol=
@@ -1144,11 +1148,13 @@
tutti.exportFishingOperationForSumatra.action.success=
tutti.exportFishingOperationForSumatra.message.badBenthos=
tutti.exportFishingOperationForSumatra.message.badSpecies=
+tutti.exportFishingOperationForSumatra.message.missing.protocol=
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.missing.protocol=
tutti.exportFishingOperationForSumatra.title.model.modified=Can't export, catch is modified
tutti.exportFishingOperationForSumatra.title.required.protocol=
tutti.exportFishingOperationForSumatraV2.action.chooseFile=
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2014-05-20 14:38:18 UTC (rev 1796)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2014-05-20 14:46:49 UTC (rev 1797)
@@ -1114,9 +1114,9 @@
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.message.missing.protocol=<html><body>Pas de protocole renseigné, La colonne <strong>espcecamapgne</strong> ne sera pas renseigné.</body></html>
tutti.exportCruiseForSumatra.title.choose.exportFile=Exporter la campagne
-tutti.exportCruiseForSumatra.title.required.protocol=Protocole requis pour export csv
+tutti.exportCruiseForSumatra.title.missing.protocol=Pas de protocole renseigné
tutti.exportCruiseForSumatraV2.message.required.protocol=
tutti.exportCruiseForSumatraV2.title.required.protocol=
tutti.exportDb.step.closeDb=Fermeture de la base courante
@@ -1127,11 +1127,13 @@
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.missing.protocol=
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.missing.protocol=
tutti.exportFishingOperationForSumatra.title.model.modified=Impossible d'exporter, capture modifiée
tutti.exportFishingOperationForSumatra.title.required.protocol=Protocole requis pour export csv
tutti.exportFishingOperationReport.action.chooseFile=Choisir le fichier de rapport
1
0
r1796 - trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action
by tchemit@users.forge.codelutin.com 20 May '14
by tchemit@users.forge.codelutin.com 20 May '14
20 May '14
Author: tchemit
Date: 2014-05-20 16:38:18 +0200 (Tue, 20 May 2014)
New Revision: 1796
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1796
Log:
refs #5115 (report from version 3.4.4)
Modified:
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
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 14:37:25 UTC (rev 1795)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 14:38:18 UTC (rev 1796)
@@ -68,8 +68,8 @@
if (!getDataContext().isProtocolFilled()) {
displayWarningMessage(
- t("tutti.exportCruiseForSumatraV2.title.required.protocol"),
- t("tutti.exportCruiseForSumatraV2.message.required.protocol")
+ t("tutti.exportCruiseForSumatra.title.required.protocol"),
+ t("tutti.exportCruiseForSumatra.message.required.protocol")
);
doAction = false;
}
1
0
r1795 - branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action
by tchemit@users.forge.codelutin.com 20 May '14
by tchemit@users.forge.codelutin.com 20 May '14
20 May '14
Author: tchemit
Date: 2014-05-20 16:37:25 +0200 (Tue, 20 May 2014)
New Revision: 1795
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1795
Log:
fixes #5115 [EXPORT] Evolution format export SUMATRA pelgas
Modified:
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 14:35:51 UTC (rev 1794)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 14:37:25 UTC (rev 1795)
@@ -68,8 +68,8 @@
if (!getDataContext().isProtocolFilled()) {
displayWarningMessage(
- t("tutti.exportCruiseForSumatraV2.title.required.protocol"),
- t("tutti.exportCruiseForSumatraV2.message.required.protocol")
+ t("tutti.exportCruiseForSumatra.title.required.protocol"),
+ t("tutti.exportCruiseForSumatra.message.required.protocol")
);
doAction = false;
}
1
0
r1794 - in trunk: src/conception/specifications src/site/rst tutti-ui-swing/src/main/help/fr
by lkaufmann@users.forge.codelutin.com 20 May '14
by lkaufmann@users.forge.codelutin.com 20 May '14
20 May '14
Author: lkaufmann
Date: 2014-05-20 16:35:51 +0200 (Tue, 20 May 2014)
New Revision: 1794
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1794
Log:
Fixes #5089 Specifications : add last evolutions & referential queries
Modified:
trunk/src/conception/specifications/AllegroCampagne-Specifications.odt
trunk/src/conception/specifications/AllegroCampagne-Specifications.pdf
trunk/src/site/rst/referential.rst
trunk/tutti-ui-swing/src/main/help/fr/dbMapping.html
Modified: trunk/src/conception/specifications/AllegroCampagne-Specifications.odt
===================================================================
(Binary files differ)
Modified: trunk/src/conception/specifications/AllegroCampagne-Specifications.pdf
===================================================================
(Binary files differ)
Modified: trunk/src/site/rst/referential.rst
===================================================================
--- trunk/src/site/rst/referential.rst 2014-05-20 14:35:16 UTC (rev 1793)
+++ trunk/src/site/rst/referential.rst 2014-05-20 14:35:51 UTC (rev 1794)
@@ -31,7 +31,7 @@
Ce document décrit comment sont récupérées les données du référentiel.
-Chaque requète a un nom du style **[REF-XXX]**.
+Chaque requête a un nom du style **[REF-XXX]**.
Les requètes métier
~~~~~~~~~~~~~~~~~~~
@@ -161,6 +161,7 @@
-------------------------------
::
+
SELECT DISTINCT
p.id,
p.lastname,
@@ -173,9 +174,9 @@
WHERE
p.status.code IN (:statusValidCode, :statusTemporaryCode)
AND pp.id IN (
- :observerProfilId,
- :projectMemberProfilId,
- :userProfilId
+ :observerProfilId,
+ :projectMemberProfilId,
+ :userProfilId
)
AND p.department.code LIKE concat(:departementPrefixCode , '%')
@@ -190,42 +191,42 @@
*État:* Valide.
-[REF-05] Catégorie de macro-déchets
+[REF-06] Catégorie de macro-déchets
-----------------------------------
[REF-T01] + [REF-T02] avec :pmfmId = *PmfmId.MARINE_LITTER_TYPE*
*État:* Valide.
-[REF-06] Catégorie de taille macro-déchets
+[REF-07] Catégorie de taille macro-déchets
-------------------------------------------
[REF-T01] + [REF-T02] avec :pmfmId = *PmfmId.MARINE_LITTER_SIZE_CATEGORY*
*État:* Valide.
-[REF-07] Catégorie H/VC
+[REF-08] Catégorie H/VC
-----------------------
[REF-T01] + [REF-T02] avec :pmfmId = *PmfmId.SORTED_UNSORTED*
*État:* Valide.
-[REF-08] Catégorie Classe. Tri
+[REF-09] Catégorie Classe. Tri
------------------------------
[REF-T01] + [REF-T02] avec :pmfmId = *PmfmId.SIZE_CATEGORY*
*État:* Valide.
-[REF-09] Catégorie Sexe
+[REF-10] Catégorie Sexe
-----------------------
[REF-T01] + [REF-T02] avec :pmfmId = *PmfmId.SEX*
*État:* Valide.
-[REF-10] Catégorie Maturité
+[REF-11] Catégorie Maturité
---------------------------
[REF-T01] + [REF-T02] avec :pmfmId = *PmfmId.MATURITY*
@@ -273,7 +274,7 @@
*État:* Valide.
-Les requètes techniques
+Les requêtes techniques
~~~~~~~~~~~~~~~~~~~~~~~
+-----------------------------------------------------+-------+-----------------------------------------------------+
Modified: trunk/tutti-ui-swing/src/main/help/fr/dbMapping.html
===================================================================
--- trunk/tutti-ui-swing/src/main/help/fr/dbMapping.html 2014-05-20 14:35:16 UTC (rev 1793)
+++ trunk/tutti-ui-swing/src/main/help/fr/dbMapping.html 2014-05-20 14:35:51 UTC (rev 1794)
@@ -220,12 +220,21 @@
<td>
<p>Date (JJ/MM/AAAA)</p>
</td>
- <td colspan="2">
+ <td colspan="2" rowspan="2">
<p>ScientificCruise.departureDateTime (SCIENTIFIC_CRUISE.DEPARTURE_DATE_TIME)</p>
</td>
</tr>
<tr>
+ <td>Heure de début</td>
<td>
+ <p class="checked">X</p>
+ </td>
+ <td>
+ Heure (HH:MM)
+ </td>
+ </tr>
+ <tr>
+ <td>
<p>Date de fin</p>
</td>
<td>
@@ -234,12 +243,21 @@
<td>
<p>Date (JJ/MM/AAAA)</p>
</td>
- <td colspan="2">
+ <td colspan="2" rowspan="2">
<p>ScientificCruise.returnDateTime (SCIENTIFIC_CRUISE.RETURN_DATE_TIME)</p>
</td>
</tr>
<tr>
+ <td>Heure de fin</td>
<td>
+ <p class="checked">X</p>
+ </td>
+ <td>
+ Heure (HH:MM)
+ </td>
+ </tr>
+ <tr>
+ <td>
<p>Navire</p>
</td>
<td>
1
0
20 May '14
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(a)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(a)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(a)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(a)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
1
0
r1792 - in branches/tutti-3.4.x: tutti-service/src/main/java/fr/ifremer/tutti/service tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra tutti-service/src/main/resources/i18n tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action tutti-ui-swing/src/main/resources/i18n
by tchemit@users.forge.codelutin.com 20 May '14
by tchemit@users.forge.codelutin.com 20 May '14
20 May '14
Author: tchemit
Date: 2014-05-20 15:40:25 +0200 (Tue, 20 May 2014)
New Revision: 1792
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1792
Log:
fixes #5115 [EXPORT] Evolution format export SUMATRA pelgas
Added:
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java
Modified:
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java
branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/PersistenceService.java 2014-05-20 13:40:25 UTC (rev 1792)
@@ -76,7 +76,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;
@@ -86,9 +85,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;
@@ -608,10 +609,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()) {
@@ -622,19 +625,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()) {
@@ -644,12 +654,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: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java 2014-05-20 13:40:25 UTC (rev 1792)
@@ -157,7 +157,8 @@
@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: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java 2014-05-20 13:40:25 UTC (rev 1792)
@@ -42,7 +42,8 @@
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.species"), CatchRow.PROPERTY_SPECIES, TuttiCsvUtil.SPECIES_SURVEY_CODE_FORMATTER);
+ 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);
@@ -50,10 +51,10 @@
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);
- newColumnForExport(t("tutti.service.exportSumatra.header.startLongitude"), CatchRow.PROPERTY_GEAR_SHOOTING_START_LONGITUDE);
- newColumnForExport(t("tutti.service.exportSumatra.header.endLatitude"), CatchRow.PROPERTY_GEAR_SHOOTING_END_LATITUDE);
- newColumnForExport(t("tutti.service.exportSumatra.header.endLongitude"), CatchRow.PROPERTY_GEAR_SHOOTING_END_LONGITUDE);
+ 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
Modified: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java 2014-05-20 13:40:25 UTC (rev 1792)
@@ -77,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");
@@ -106,7 +107,11 @@
progressionModel.adaptTotal(operations.size() + 3);
- prepareOperationsAndExport(file, operations, progressionModel);
+ SumatraExportResult result = new SumatraExportResult();
+
+ prepareOperationsAndExport(file, operations, progressionModel, result);
+
+ return result;
}
/**
@@ -115,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");
@@ -138,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();
@@ -162,7 +173,7 @@
break;
}
- prepareFishingOperation(csvModel, rows, operationId);
+ prepareFishingOperation(csvModel, rows, operationId, result);
}
}
@@ -184,7 +195,8 @@
protected void prepareFishingOperation(CatchRowModel csvModel,
List<CatchRow> rows,
- String operationId) {
+ String operationId,
+ SumatraExportResult result) {
ExportCatchContext exportContext = ExportCatchContext.newExportContext(
persistenceService,
@@ -214,7 +226,9 @@
}
// fill survey code in species
- persistenceService.fillSpeciesSurveyCode(allspecies);
+ Set<String> badSpecies = persistenceService.fillSpeciesSurveyCode(allspecies);
+ result.setBadSpecies(badSpecies);
+
}
// Benthos
@@ -233,7 +247,8 @@
}
// fill survey code in benthos
- persistenceService.fillBenthosSurveyCode(allspecies);
+ Set<String> badBenthos = persistenceService.fillBenthosSurveyCode(allspecies);
+ result.setBadBenthos(badBenthos);
}
}
}
Added: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java (rev 0)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/SumatraExportResult.java 2014-05-20 13:40:25 UTC (rev 1792)
@@ -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(a)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: branches/tutti-3.4.x/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: branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2014-05-20 13:40:25 UTC (rev 1792)
@@ -82,6 +82,7 @@
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=
@@ -91,6 +92,7 @@
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=
Modified: branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2014-05-20 13:40:25 UTC (rev 1792)
@@ -1,5 +1,5 @@
-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.error.benthos.not.in.protocol=Les espèces suivantes (onglet Benthos) ne sont déclarées dans le protocole \: %s.
+tutti.error.species.not.in.protocol=Les espèces suivantes (onglet Espèce) ne sont pas déclarées dans le protocole \: %s.
tutti.io.mkDir.error=Erreur à la création du dossier %s
tutti.property.attachment=Pièce jointe
tutti.property.caracteristic=Caractéristique
@@ -81,15 +81,16 @@
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.species=espece
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
Modified: branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java 2014-05-20 13:40:25 UTC (rev 1792)
@@ -61,10 +61,10 @@
public static final String OPERATION_BAD_3_ID = "100115";
public static final String EXPORT_CONTENT =
- "annee;station;poche;espece;signe;tri;total;poidsmoy;longueurmoy;nbindividus;moule;latitudedebut;longitudedebut;latitudefin;longitudefin\n" +
- "2013;A;1;CHAMMAG;;100.0;100.0;2.5;;40;0.4;;;;\n" +
- "2013;A;1;ECHIGAM;;100.0;100.0;0.23980816;;417;4.17;;;;\n" +
- "2013;A;1;BRISATLAN;;100.0;100.0;1.0638298;10.571428;94;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;
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-20 13:40:25 UTC (rev 1792)
@@ -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);
}
@@ -91,6 +94,7 @@
@Override
public void releaseAction() {
file = null;
+ sumatraExportResult = null;
super.releaseAction();
}
@@ -111,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));
}
}
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-20 13:40:25 UTC (rev 1792)
@@ -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);
}
@@ -105,6 +108,7 @@
@Override
public void releaseAction() {
file = null;
+ sumatraExportResult = null;
super.releaseAction();
}
@@ -128,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));
}
}
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2014-05-20 13:40:25 UTC (rev 1792)
@@ -1142,8 +1142,12 @@
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=
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2014-05-19 19:10:43 UTC (rev 1791)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2014-05-20 13:40:25 UTC (rev 1792)
@@ -1125,8 +1125,12 @@
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.exportFishingOperationForSumatra.title.required.protocol=Protocole requis pour export csv
1
0
19 May '14
Author: tchemit
Date: 2014-05-19 21:10:43 +0200 (Mon, 19 May 2014)
New Revision: 1791
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1791
Log:
refs-80 #5108 [EXPORT SUMATRA] ?\195?\169volutions
Removed:
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModelV2.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowV2.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2.java
branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraV2Action.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraV2Action.java
Modified:
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRow.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java
branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java
branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
Modified: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/TuttiCsvUtil.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -153,13 +153,6 @@
}
};
- 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) {
Modified: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRow.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRow.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRow.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -28,6 +28,7 @@
import fr.ifremer.tutti.persistence.entities.referential.Species;
import java.io.Serializable;
+import java.util.Date;
/**
* @author kmorin <kmorin(a)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: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModel.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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,21 @@
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.species"), 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);
+ newColumnForExport(t("tutti.service.exportSumatra.header.startLongitude"), CatchRow.PROPERTY_GEAR_SHOOTING_START_LONGITUDE);
+ newColumnForExport(t("tutti.service.exportSumatra.header.endLatitude"), CatchRow.PROPERTY_GEAR_SHOOTING_END_LATITUDE);
+ newColumnForExport(t("tutti.service.exportSumatra.header.endLongitude"), CatchRow.PROPERTY_GEAR_SHOOTING_END_LONGITUDE);
}
@Override
@@ -72,8 +65,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: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModelV2.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModelV2.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowModelV2.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowV2.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowV2.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchRowV2.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportService.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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;
@@ -187,34 +190,50 @@
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
+ persistenceService.fillSpeciesSurveyCode(allspecies);
}
// 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
+ persistenceService.fillBenthosSurveyCode(allspecies);
}
}
}
Deleted: branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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);
- }
- }
-}
Modified: branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_en_GB.properties 2014-05-19 19:10:43 UTC (rev 1791)
@@ -78,10 +78,22 @@
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.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.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: branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/main/resources/i18n/tutti-service_fr_FR.properties 2014-05-19 19:10:43 UTC (rev 1791)
@@ -77,21 +77,22 @@
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.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.species=espece
+tutti.service.exportSumatra.header.startLatitude=latitudedebut
+tutti.service.exportSumatra.header.startLongitude=longitudedebut
+tutti.service.exportSumatra.header.station=station
+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: branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceTest.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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;espece;signe;tri;total;poidsmoy;longueurmoy;nbindividus;moule;latitudedebut;longitudedebut;latitudefin;longitudefin\n" +
+ "2013;A;1;CHAMMAG;;100.0;100.0;2.5;;40;0.4;;;;\n" +
+ "2013;A;1;ECHIGAM;;100.0;100.0;0.23980816;;417;4.17;;;;\n" +
+ "2013;A;1;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: branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java
===================================================================
--- branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-service/src/test/java/fr/ifremer/tutti/service/export/sumatra/CatchesSumatraExportServiceV2Test.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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(a)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: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/TuttiUIContext.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -44,7 +44,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;
@@ -469,8 +468,9 @@
i18nLocale, i18nDirectory));
}
I18n.init(new UserI18nInitializer(
- i18nDirectory, new DefaultI18nInitializer("tutti-i18n")),
- i18nLocale);
+ i18nDirectory, new DefaultI18nInitializer("tutti-i18n")),
+ i18nLocale
+ );
//--------------------------------------------------------------------//
@@ -706,10 +706,6 @@
return serviceContext.getService(CatchesSumatraExportService.class);
}
- public CatchesSumatraExportServiceV2 getCatchesSumatraExportServiceV2() {
- return serviceContext.getService(CatchesSumatraExportServiceV2.class);
- }
-
public MultiPostImportService getMultiPostImportService() {
return serviceContext.getService(MultiPostImportService.class);
}
Modified: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraAction.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -63,6 +63,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(
Deleted: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraV2Action.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraV2Action.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportCruiseForSumatraV2Action.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraAction.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -75,6 +75,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");
Deleted: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraV2Action.java
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraV2Action.java 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/action/ExportFishingOperationForSumatraV2Action.java 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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(a)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: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.css 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/home/SelectCruiseUI.jaxx 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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: branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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: branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_en_GB.properties 2014-05-19 19:10:43 UTC (rev 1791)
@@ -1143,8 +1143,10 @@
tutti.exportFishingOperationForSumatra.action.chooseFile=
tutti.exportFishingOperationForSumatra.action.success=
tutti.exportFishingOperationForSumatra.message.model.modified=Catch was modified, please save it before launching an export.
+tutti.exportFishingOperationForSumatra.message.required.protocol=
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: branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties
===================================================================
--- branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2014-05-19 17:02:21 UTC (rev 1790)
+++ branches/tutti-3.4.x/tutti-ui-swing/src/main/resources/i18n/tutti-ui-swing_fr_FR.properties 2014-05-19 19:10:43 UTC (rev 1791)
@@ -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
@@ -1117,12 +1114,11 @@
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
@@ -1130,15 +1126,10 @@
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.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.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.
@@ -1447,10 +1438,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
1
0
r1790 - in trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing: content/operation/catches content/operation/catches/benthos content/operation/catches/benthos/frequency content/operation/catches/species content/operation/catches/species/frequency util
by tchemit@users.forge.codelutin.com 19 May '14
by tchemit@users.forge.codelutin.com 19 May '14
19 May '14
Author: tchemit
Date: 2014-05-19 19:02:21 +0200 (Mon, 19 May 2014)
New Revision: 1790
Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1790
Log:
refs #5084 (report from version 3.4.4)
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.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx
trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
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-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.css 2014-05-19 17:02:21 UTC (rev 1790)
@@ -108,7 +108,7 @@
}
#catchTotalSortedWeightField {
- text: {getWeightStringValue(model.getCatchTotalSortedComputedWeight())};
+ text: {handler.getWeightStringValue(catchTotalSortedWeightLabel, model.getCatchTotalSortedComputedWeight())};
_computed: true;
_help: {"tutti.editCatchBatch.field.catchTotalSortedWeight.help"};
}
@@ -127,7 +127,7 @@
#catchTotalSortedTremisWeightField {
enabled: false;
- text: {getWeightStringValue(model.getCatchTotalSortedTremisWeight())};
+ text: {handler.getWeightStringValue(catchTotalSortedTremisWeightLabel, model.getCatchTotalSortedTremisWeight())};
_help: {"tutti.editCatchBatch.field.catchTotalSortedTremisWeight.help"};
}
@@ -141,7 +141,7 @@
#catchTotalSortedCarousselWeightField {
enabled: false;
- text: {getWeightStringValue(model.getCatchTotalSortedCarousselWeight())};
+ text: {handler.getWeightStringValue(catchTotalSortedCarousselWeightLabel, model.getCatchTotalSortedCarousselWeight())};
_help: {"tutti.editCatchBatch.field.catchTotalSortedCarousselWeight.help"};
}
@@ -168,7 +168,7 @@
}
#catchTotalUnsortedWeightField {
- text: {getWeightStringValue(model.getCatchTotalUnsortedComputedWeight())};
+ text: {handler.getWeightStringValue(catchTotalUnsortedWeightLabel, model.getCatchTotalUnsortedComputedWeight())};
_computed: true;
_help: {"tutti.editCatchBatch.field.catchTotalUnsortedWeight.help"};
}
@@ -191,7 +191,7 @@
}
#speciesTotalWeightField {
- text: {handler.getWeightStringValueForTotalWeight(model.getCatchTotalRejectedWeight(), model.getSpeciesTotalComputedWeight())};
+ text: {handler.getWeightStringValueForTotalWeight(speciesTotalWeightLabel, model.getCatchTotalRejectedWeight(), model.getSpeciesTotalComputedWeight())};
disabledTextColor: {handler.getWeightColorForTotalWeight(model.getCatchTotalRejectedWeight(), model.getSpeciesTotalComputedWeight())};
_computed: true;
_help: {"tutti.editCatchBatch.field.speciesTotalWeight.help"};
@@ -220,7 +220,7 @@
}
#speciesTotalSampleSortedWeightField {
- text: {getWeightStringValue(model.getSpeciesTotalSampleSortedComputedWeight())};
+ text: {handler.getWeightStringValue(speciesTotalSampleSortedWeightLabel, model.getSpeciesTotalSampleSortedComputedWeight())};
_computed: true;
_help: {"tutti.editCatchBatch.field.speciesTotalSampleSortedWeight.help"};
}
@@ -234,7 +234,7 @@
}
#speciesTotalUnsortedWeightField {
- text: {getWeightStringValue(model.getSpeciesTotalUnsortedComputedWeight())};
+ text: {handler.getWeightStringValue(speciesTotalUnsortedWeightLabel, model.getSpeciesTotalUnsortedComputedWeight())};
_computed: true;
_help: {"tutti.editCatchBatch.field.speciesTotalUnsortedWeight.help"};
}
@@ -257,7 +257,7 @@
}
#benthosTotalWeightField {
- text: {handler.getWeightStringValueForTotalWeight(model.getCatchTotalRejectedWeight(), model.getBenthosTotalComputedWeight())};
+ text: {handler.getWeightStringValueForTotalWeight(benthosTotalWeightLabel, model.getCatchTotalRejectedWeight(), model.getBenthosTotalComputedWeight())};
disabledTextColor: {handler.getWeightColorForTotalWeight(model.getCatchTotalRejectedWeight(), model.getBenthosTotalComputedWeight())};
_computed: true;
_help: {"tutti.editCatchBatch.field.benthosTotalWeight.help"};
@@ -286,7 +286,7 @@
}
#benthosTotalSampleSortedWeightField {
- text: {getWeightStringValue(model.getBenthosTotalSampleSortedComputedWeight())};
+ text: {handler.getWeightStringValue(benthosTotalSampleSortedWeightLabel, model.getBenthosTotalSampleSortedComputedWeight())};
_computed: true;
_help: {"tutti.editCatchBatch.field.benthosTotalSampleSortedWeight.help"};
}
@@ -300,7 +300,7 @@
}
#benthosTotalUnsortedWeightField {
- text: {getWeightStringValue(model.getBenthosTotalUnsortedComputedWeight())};
+ text: {handler.getWeightStringValue(benthosTotalUnsortedWeightLabel, model.getBenthosTotalUnsortedComputedWeight())};
_computed: true;
_help: {"tutti.editCatchBatch.field.benthosTotalUnsortedWeight.help"};
}
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-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUI.jaxx 2014-05-19 17:02:21 UTC (rev 1790)
@@ -55,7 +55,6 @@
jaxx.runtime.swing.CardLayout2Ext
static org.nuiton.i18n.I18n.t
- static fr.ifremer.tutti.persistence.entities.TuttiEntities.getWeightStringValue
]]></import>
<script><![CDATA[
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/EditCatchesUIHandler.java 2014-05-19 17:02:21 UTC (rev 1790)
@@ -25,8 +25,6 @@
*/
import com.google.common.collect.Sets;
-import org.nuiton.jaxx.application.swing.tab.TabHandler;
-import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.BenthosBatchRowModel;
import fr.ifremer.tutti.ui.swing.content.operation.catches.benthos.frequency.BenthosFrequencyCellComponent;
@@ -44,16 +42,18 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTitledPanel;
+import org.nuiton.jaxx.application.swing.tab.TabHandler;
import javax.swing.JComponent;
+import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import java.awt.Color;
import java.util.Set;
+import static org.nuiton.i18n.I18n.n;
import static org.nuiton.i18n.I18n.t;
-import static org.nuiton.i18n.I18n.n;
/**
* @author tchemit <chemit(a)codelutin.com>
@@ -606,12 +606,12 @@
}
}
- public String getWeightStringValueForTotalWeight(Float rejectWeight, Float totalWeight) {
+ public String getWeightStringValueForTotalWeight(JLabel label, Float rejectWeight, Float totalWeight) {
String result;
if (rejectWeight == null || totalWeight == null) {
// no reject weight, so can let this weight
- result = TuttiEntities.getWeightStringValue(totalWeight);
+ result = getWeightStringValue(label, totalWeight);
} else {
result = t("tutti.editCatchBatch.field.speciesOrBenthosTotalWeight.not.computed");
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.css 2014-05-19 17:02:21 UTC (rev 1790)
@@ -58,7 +58,7 @@
}
#benthosTotalWeightField {
- text: {getWeightStringValue(model.getBenthosTotalComputedWeight())};
+ text: {handler.getWeightStringValue(benthosTotalWeightLabel, model.getBenthosTotalComputedWeight())};
_computed: true;
_help: {"tutti.editBenthosBatch.field.benthosTotalWeight.help"};
}
@@ -86,7 +86,7 @@
}
#benthosTotalSampleSortedWeightField {
- text: {getWeightStringValue(model.getBenthosTotalSampleSortedComputedWeight())};
+ text: {handler.getWeightStringValue(benthosTotalSampleSortedWeightLabel, model.getBenthosTotalSampleSortedComputedWeight())};
_computed: true;
_help: {"tutti.editBenthosBatch.field.benthosTotalSampleSortedWeight.help"};
}
@@ -100,7 +100,7 @@
}
#benthosTotalUnsortedWeightField {
- text: {getWeightStringValue(model.getBenthosTotalUnsortedComputedWeight())};
+ text: {handler.getWeightStringValue(benthosTotalUnsortedWeightLabel, model.getBenthosTotalUnsortedComputedWeight())};
_computed: true;
_help: {"tutti.editBenthosBatch.field.benthosTotalUnsortedWeight.help"};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/BenthosBatchUI.jaxx 2014-05-19 17:02:21 UTC (rev 1790)
@@ -40,7 +40,6 @@
java.awt.Color
static org.nuiton.i18n.I18n.t
- static fr.ifremer.tutti.persistence.entities.TuttiEntities.getWeightStringValue
]]></import>
<script><![CDATA[
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.css 2014-05-19 17:02:21 UTC (rev 1790)
@@ -81,7 +81,7 @@
}
#totalWeightField {
- text: {getWeightStringValue(model.getTotalWeight())};
+ text: {handler.getWeightStringValue(totalWeightLabel, model.getTotalWeight())};
enabled: false;
_computed: true;
_help: {"tutti.editBenthosFrequencies.field.totalWeight.help"};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/benthos/frequency/BenthosFrequencyUI.jaxx 2014-05-19 17:02:21 UTC (rev 1790)
@@ -46,7 +46,6 @@
static org.nuiton.i18n.I18n.t
static jaxx.runtime.SwingUtil.getStringValue
- static fr.ifremer.tutti.persistence.entities.TuttiEntities.getWeightStringValue
</import>
<script><![CDATA[
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.css 2014-05-19 17:02:21 UTC (rev 1790)
@@ -58,7 +58,7 @@
}
#speciesTotalWeightField {
- text: {getWeightStringValue(model.getSpeciesTotalComputedWeight())};
+ text: {handler.getWeightStringValue(speciesTotalWeightLabel, model.getSpeciesTotalComputedWeight())};
_computed: true;
_help: {"tutti.editSpeciesBatch.field.speciesTotalWeight.help"};
}
@@ -86,7 +86,7 @@
}
#speciesTotalSampleSortedWeightField {
- text: {getWeightStringValue(model.getSpeciesTotalSampleSortedComputedWeight())};
+ text: {handler.getWeightStringValue(speciesTotalSampleSortedWeightLabel, model.getSpeciesTotalSampleSortedComputedWeight())};
_computed: true;
_help: {"tutti.editSpeciesBatch.field.speciesTotalSampleSortedWeight.help"};
}
@@ -100,7 +100,7 @@
}
#speciesTotalUnsortedWeightField {
- text: {getWeightStringValue(model.getSpeciesTotalUnsortedComputedWeight())};
+ text: {handler.getWeightStringValue(speciesTotalUnsortedWeightLabel, model.getSpeciesTotalUnsortedComputedWeight())};
_computed: true;
_help: {"tutti.editSpeciesBatch.field.speciesTotalUnsortedWeight.help"};
}
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/SpeciesBatchUI.jaxx 2014-05-19 17:02:21 UTC (rev 1790)
@@ -40,7 +40,6 @@
java.awt.Color
static org.nuiton.i18n.I18n.t
- static fr.ifremer.tutti.persistence.entities.TuttiEntities.getWeightStringValue
]]></import>
<script><![CDATA[
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.css 2014-05-19 17:02:21 UTC (rev 1790)
@@ -81,7 +81,7 @@
}
#totalWeightField {
- text: {getWeightStringValue(model.getTotalWeight())};
+ text: {handler.getWeightStringValue(totalWeightLabel, model.getTotalWeight())};
enabled: false;
_computed: true;
_help: {"tutti.editSpeciesFrequencies.field.totalWeight.help"};
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/content/operation/catches/species/frequency/SpeciesFrequencyUI.jaxx 2014-05-19 17:02:21 UTC (rev 1790)
@@ -46,7 +46,6 @@
static org.nuiton.i18n.I18n.t
static jaxx.runtime.SwingUtil.getStringValue
- static fr.ifremer.tutti.persistence.entities.TuttiEntities.getWeightStringValue
</import>
<script><![CDATA[
Modified: trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java
===================================================================
--- trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2014-05-19 17:01:07 UTC (rev 1789)
+++ trunk/tutti-ui-swing/src/main/java/fr/ifremer/tutti/ui/swing/util/AbstractTuttiUIHandler.java 2014-05-19 17:02:21 UTC (rev 1790)
@@ -26,18 +26,9 @@
import com.google.common.base.Preconditions;
import com.google.common.collect.Sets;
-import fr.ifremer.tutti.type.WeightUnit;
-import fr.ifremer.tutti.ui.swing.util.computable.ComputableDataEditor;
-import jaxx.runtime.swing.JAXXWidgetUtil;
-import jaxx.runtime.swing.editor.NumberEditor;
-import jaxx.runtime.swing.editor.cell.NumberCellEditor;
-import org.jdesktop.swingx.JXTitledPanel;
-import org.jdesktop.swingx.table.TableColumnExt;
-import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler;
-import org.nuiton.jaxx.application.swing.action.ApplicationActionUI;
-import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
import fr.ifremer.tutti.LabelAware;
import fr.ifremer.tutti.TuttiConfiguration;
+import fr.ifremer.tutti.persistence.entities.TuttiEntities;
import fr.ifremer.tutti.persistence.entities.data.SampleCategory;
import fr.ifremer.tutti.persistence.entities.referential.Species;
import fr.ifremer.tutti.service.DecoratorService;
@@ -45,22 +36,33 @@
import fr.ifremer.tutti.service.TuttiDataContext;
import fr.ifremer.tutti.service.ValidationService;
import fr.ifremer.tutti.service.catches.ValidateCruiseOperationsService;
+import fr.ifremer.tutti.type.WeightUnit;
import fr.ifremer.tutti.ui.swing.TuttiUIContext;
import fr.ifremer.tutti.ui.swing.content.MainUI;
import fr.ifremer.tutti.ui.swing.content.MainUIHandler;
import fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment;
+import fr.ifremer.tutti.ui.swing.util.computable.ComputableDataEditor;
+import jaxx.runtime.swing.JAXXWidgetUtil;
+import jaxx.runtime.swing.editor.NumberEditor;
+import jaxx.runtime.swing.editor.cell.NumberCellEditor;
import jaxx.runtime.validator.swing.SwingValidator;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jdesktop.swingx.JXTable;
+import org.jdesktop.swingx.JXTitledPanel;
import org.jdesktop.swingx.decorator.ComponentAdapter;
import org.jdesktop.swingx.decorator.FontHighlighter;
import org.jdesktop.swingx.decorator.HighlightPredicate;
import org.jdesktop.swingx.decorator.Highlighter;
+import org.jdesktop.swingx.table.TableColumnExt;
import org.nuiton.decorator.Decorator;
+import org.nuiton.jaxx.application.swing.AbstractApplicationUIHandler;
+import org.nuiton.jaxx.application.swing.action.ApplicationActionUI;
+import org.nuiton.jaxx.application.swing.table.AbstractApplicationTableModel;
import org.nuiton.jaxx.application.swing.table.ColumnIdentifier;
import org.nuiton.validator.bean.simple.SimpleBeanValidator;
+import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.JTextField;
@@ -75,6 +77,7 @@
import java.awt.Font;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import java.text.DecimalFormat;
import java.util.Set;
import static org.nuiton.i18n.I18n.t;
@@ -145,6 +148,29 @@
handler.clearValidators();
}
+ public String getWeightStringValue(WeightUnit weightUnit, Float weight) {
+ String textValue;
+ if (weight != null) {
+
+ int numberDigits = weightUnit.getNumberDigits();
+
+ DecimalFormat weightDecimalFormat = TuttiEntities.getDecimalFormat(1, numberDigits);
+ textValue = weightDecimalFormat.format(weight);
+
+ } else {
+ textValue = "";
+ }
+ return textValue;
+ }
+
+ public String getWeightStringValue(JComponent component, Float weight) {
+
+
+ WeightUnit weightUnit = (WeightUnit) component.getClientProperty("addWeightUnit");
+ return getWeightStringValue(weightUnit, weight);
+ }
+
+
@Override
public <O> Decorator<O> getDecorator(Class<O> type, String name) {
DecoratorService decoratorService =
1
0