This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository wao. See http://git.codelutin.com/wao.git commit 0b25043013d86ce857c08cbb11c2d230fb411b1a Author: Brendan Le Ny <bleny@codelutin.com> Date: Tue Oct 21 15:13:01 2014 +0200 On ajoute les données en jours de mer dans l'export CSV du réalisé ObsMer (fixes #5651) --- .../ifremer/wao/services/service/SamplingPlan.java | 4 -- .../service/csv/ObsMerSamplingPlanExportModel.java | 63 ++++++++++++++++++---- 2 files changed, 54 insertions(+), 13 deletions(-) diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlan.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlan.java index 68195b0..ba16478 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlan.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/SamplingPlan.java @@ -515,10 +515,6 @@ public abstract class SamplingPlan implements Iterable<SamplingPlan.SamplingPlan return professionDescriptionWithoutDCF5; } - public Effort getEffortInObservationsForMonth(Date month) { - return effortInObservationsPerMonths.get(month); - } - public String getFishingZones() { return fishingZones; } diff --git a/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ObsMerSamplingPlanExportModel.java b/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ObsMerSamplingPlanExportModel.java index 6694e0a..39b7f6c 100644 --- a/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ObsMerSamplingPlanExportModel.java +++ b/wao-services/src/main/java/fr/ifremer/wao/services/service/csv/ObsMerSamplingPlanExportModel.java @@ -64,18 +64,21 @@ public class ObsMerSamplingPlanExportModel extends AbstractExportModel<ObsMerSam for (Date month : months) { String headerName = monthYearFormatter.format(month); - modelBuilder.newColumnForExport(headerName + "_EFFORT", new ExpectedTidesValueGetter(month), Common.INTEGER); - modelBuilder.newColumnForExport(headerName + "_ESTIME", new EstimatedTidesValueGetter(month), Common.INTEGER); - modelBuilder.newColumnForExport(headerName + "_REALISE", new RealTidesValueGetter(month), Common.INTEGER); + modelBuilder.newColumnForExport(headerName + "_EFFORT_OBSERVATIONS", new ExpectedTidesValueGetter(month), Common.INTEGER); + modelBuilder.newColumnForExport(headerName + "_EFFORT_JOURS", new ExpectedDaysValueGetter(month), Common.INTEGER); + modelBuilder.newColumnForExport(headerName + "_ESTIME_OBSERVATIONS", new EstimatedTidesValueGetter(month), Common.INTEGER); + modelBuilder.newColumnForExport(headerName + "_ESTIME_JOURS", new EstimatedDaysValueGetter(month), Common.INTEGER); + modelBuilder.newColumnForExport(headerName + "_REALISE_OBSERVATIONS", new RealTidesValueGetter(month), Common.INTEGER); + modelBuilder.newColumnForExport(headerName + "_REALISE_JOURS", new RealDaysValueGetter(month), Common.INTEGER); } modelBuilder.newColumnForExport("TOTAL_EFFORT", "totalObservations.expected", Common.INTEGER); modelBuilder.newColumnForExport("TOTAL_ESTIME", "totalObservations.estimated", Common.INTEGER); modelBuilder.newColumnForExport("TOTAL_REALISE", "totalObservations.real", Common.INTEGER); - modelBuilder.newColumnForExport("TOTAL_EFFORT_JOURS", "observationTimesInDaysExpected", Common.INTEGER); - modelBuilder.newColumnForExport("TOTAL_ESTIME_JOURS", "observationTimesInDaysEstimated", Common.LONG); - modelBuilder.newColumnForExport("TOTAL_REALISE_JOURS", "observationTimesInDaysReal", Common.LONG); + modelBuilder.newColumnForExport("TOTAL_EFFORT_JOURS", "totalDays.expected", Common.INTEGER); + modelBuilder.newColumnForExport("TOTAL_ESTIME_JOURS", "totalDays.estimated", Common.INTEGER); + modelBuilder.newColumnForExport("TOTAL_REALISE_JOURS", "totalDays.real", Common.INTEGER); } @@ -89,7 +92,7 @@ public class ObsMerSamplingPlanExportModel extends AbstractExportModel<ObsMerSam @Override public Integer get(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart) { - return sampleRowPart.getEffortInObservationsForMonth(month).getExpected(); + return sampleRowPart.getEffortInObservationsPerMonths().get(month).getExpected(); } } @@ -103,7 +106,7 @@ public class ObsMerSamplingPlanExportModel extends AbstractExportModel<ObsMerSam @Override public Integer get(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart) { - return sampleRowPart.getEffortInObservationsForMonth(month).getExpected(); + return sampleRowPart.getEffortInObservationsPerMonths().get(month).getEstimated(); } } @@ -117,7 +120,49 @@ public class ObsMerSamplingPlanExportModel extends AbstractExportModel<ObsMerSam @Override public Integer get(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart) { - return sampleRowPart.getEffortInObservationsForMonth(month).getReal(); + return sampleRowPart.getEffortInObservationsPerMonths().get(month).getReal(); + } + } + + protected static class ExpectedDaysValueGetter implements ValueGetter<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart, Integer> { + + protected Date month; + + public ExpectedDaysValueGetter(Date month) { + this.month = month; + } + + @Override + public Integer get(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart) { + return sampleRowPart.getEffortInDaysPerMonths().get(month).getExpected(); + } + } + + protected static class EstimatedDaysValueGetter implements ValueGetter<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart, Integer> { + + protected Date month; + + public EstimatedDaysValueGetter(Date month) { + this.month = month; + } + + @Override + public Integer get(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart) { + return sampleRowPart.getEffortInDaysPerMonths().get(month).getEstimated(); + } + } + + protected static class RealDaysValueGetter implements ValueGetter<ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart, Integer> { + + protected Date month; + + public RealDaysValueGetter(Date month) { + this.month = month; + } + + @Override + public Integer get(ObsMerSamplingPlan.ObsMerSamplingPlanSampleRowPart sampleRowPart) { + return sampleRowPart.getEffortInDaysPerMonths().get(month).getReal(); } } } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.