This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository tutti. See http://git.codelutin.com/tutti.git commit daee9201a582a57224d1f128a27e536c4ed9018a Author: Tony CHEMIT <chemit@codelutin.com> Date: Sat Apr 11 16:07:28 2015 +0200 refs #6936 Ajout d'une colonne par catégorie pour contenir son éventuel commentaire --- .../consumer/CsvConsumerForCatch.java | 2 ++ .../service/genericformat/csv/CatchModel.java | 10 +++++----- .../tutti/service/genericformat/csv/CatchRow.java | 22 +--------------------- .../genericformat/csv/ExportSampleCategory.java | 14 +++++++++++++- .../producer/CsvProducerForCatch.java | 8 ++++---- 5 files changed, 25 insertions(+), 31 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/consumer/CsvConsumerForCatch.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/consumer/CsvConsumerForCatch.java index bd95840..4e848c7 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/consumer/CsvConsumerForCatch.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/consumer/CsvConsumerForCatch.java @@ -254,6 +254,7 @@ public class CsvConsumerForCatch extends CsvComsumer<CatchRow, CatchModel> { batch.setSampleCategoryValue(sampleCategory.getCategoryValue()); batch.setSampleCategoryWeight(sampleCategory.getCategoryWeight()); batch.setRankOrder(sampleCategory.getRankOrder()); + batch.setComment(sampleCategory.getComment()); result = batch; operationContext.registerBatchObjectId(batch.getIdAsInt(), sampleCategory.getBatchId()); @@ -289,6 +290,7 @@ public class CsvConsumerForCatch extends CsvComsumer<CatchRow, CatchModel> { result.setSampleCategoryId(sampleCategory.getCategoryId()); result.setSampleCategoryValue(sampleCategory.getCategoryValue()); result.setSampleCategoryWeight(sampleCategory.getCategoryWeight()); + result.setComment(sampleCategory.getComment()); operationContext.registerBatchObjectId(batch.getIdAsInt(), sampleCategory.getBatchId()); if (log.isInfoEnabled()) { log.info("Create child batch for batch: " + batch.getSpecies().getName() + " - " + batch.getSampleCategoryId() + " - " + batch.getSampleCategoryValue()); diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/CatchModel.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/CatchModel.java index 02bf75a..f33af11 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/CatchModel.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/CatchModel.java @@ -89,8 +89,7 @@ public class CatchModel extends AbstractTuttiImportExportModel<CatchRow> { newColumnForExport("Code_Taxon", SpeciesBatch.PROPERTY_SPECIES, TuttiCsvUtil.SPECIES_TECHNICAL_FORMATTER); newColumnForExport("Code_Espece_Campagne", SpeciesBatch.PROPERTY_SPECIES, TuttiCsvUtil.SPECIES_SURVEY_CODE_FORMATTER); newColumnForExport("Nom_Scientifique", SpeciesBatch.PROPERTY_SPECIES, TuttiCsvUtil.SPECIES_FORMATTER); - newColumnForExport("Benthos", CatchRow.PROPOERTY_BENTHOS, TuttiCsvUtil.BOOLEAN); - newColumnForExport("Commentaire", SpeciesBatch.PROPERTY_COMMENT, TuttiCsvUtil.COMMENT_LIST_PARSER_FORMATTER); + newColumnForExport("Benthos", CatchRow.PROPERTY_BENTHOS, TuttiCsvUtil.BOOLEAN); for (SampleCategoryModelEntry entry : sampleCategoryModel.getCategory()) { @@ -103,6 +102,7 @@ public class CatchModel extends AbstractTuttiImportExportModel<CatchRow> { newIndexNullableColumnForExport("Ech_" + headerPrefix, collectionName, categoryOrder, ExportSampleCategory.PROPERTY_SAMPLE_WEIGHT, TuttiCsvUtil.FLOAT); newIndexNullableColumnForExport("Type_Volume_Poids_" + headerPrefix, collectionName, categoryOrder, ExportSampleCategory.PROPERTY_WEIGHT_OR_VOL_TYPE); newNullableColumnForExport("Unite_Volume_Poids_" + headerPrefix, CatchRow.BATCH_WEIGHT_UNIT); + newIndexNullableColumnForExport("Commentaire_" + headerPrefix, collectionName, categoryOrder, ExportSampleCategory.PROPERTY_COMMENT); } @@ -118,7 +118,6 @@ public class CatchModel extends AbstractTuttiImportExportModel<CatchRow> { newColumnForExport("Nbr", CatchRow.BATCH_NUMBER, TuttiCsvUtil.INTEGER); newColumnForExport("Nbr_Calcule", CatchRow.BATCH_NUMBER_COMPUTED, TuttiCsvUtil.BOOLEAN); - newColumnForExport("Poids_Reference", CatchRow.REFERENCE_WEIGHT, TuttiCsvUtil.PRIMITIVE_FLOAT); newColumnForExport("Coef_Elev_Espece_Capture", CatchRow.RAISING_FACTOR, TuttiCsvUtil.PRIMITIVE_FLOAT); newColumnForExport("Coef_Final_Elevation", CatchRow.FINAL_RAISING_FACTOR, TuttiCsvUtil.FLOAT); @@ -150,8 +149,7 @@ public class CatchModel extends AbstractTuttiImportExportModel<CatchRow> { newMandatoryColumn("Code_Taxon", SpeciesBatch.PROPERTY_SPECIES, parserFactory.getSpeciesParser()); newIgnoredColumn("Code_Espece_Campagne"); newIgnoredColumn("Nom_Scientifique"); - newMandatoryColumn("Benthos", CatchRow.PROPOERTY_BENTHOS, TuttiCsvUtil.BOOLEAN); - newMandatoryColumn("Commentaire", SpeciesBatch.PROPERTY_COMMENT, TuttiCsvUtil.COMMENT_LIST_PARSER_FORMATTER); + newMandatoryColumn("Benthos", CatchRow.PROPERTY_BENTHOS, TuttiCsvUtil.BOOLEAN); for (SampleCategoryModelEntry entry : sampleCategoryModel.getCategory()) { @@ -165,6 +163,8 @@ public class CatchModel extends AbstractTuttiImportExportModel<CatchRow> { newIgnoredColumn("Type_Volume_Poids_" + headerPrefix); newIgnoredColumn("Unite_Volume_Poids_" + headerPrefix); + newMandatoryColumn("Commentaire_" + headerPrefix, TuttiCsvUtil.STRING, new SampleCategoryValueSetter<String>(entry, ExportSampleCategory.PROPERTY_COMMENT)); + } // mensuration diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/CatchRow.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/CatchRow.java index cf73b2e..b9d54b1 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/CatchRow.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/CatchRow.java @@ -27,7 +27,6 @@ import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry; import fr.ifremer.tutti.persistence.entities.data.SpeciesAbleBatchFrequency; import fr.ifremer.tutti.persistence.entities.referential.Caracteristic; import fr.ifremer.tutti.persistence.entities.referential.Species; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -47,7 +46,7 @@ public class CatchRow extends RowWithOperationContextSupport { /** Logger. */ private static final Log log = LogFactory.getLog(CatchRow.class); - public static final String PROPOERTY_BENTHOS = "benthos"; + public static final String PROPERTY_BENTHOS = "benthos"; public static final String FREQUENCY_LENGTH_STEP = "frequencyLengthStep"; @@ -105,8 +104,6 @@ public class CatchRow extends RowWithOperationContextSupport { protected Integer frequencyRankOrder; - protected List<String> comment = new ArrayList<>(); - public void setBenthos(boolean benthos) { this.benthos = benthos; } @@ -254,28 +251,11 @@ public class CatchRow extends RowWithOperationContextSupport { result.setReferenceWeight(referenceWeight); result.setBatchNumber(batchNumber); result.setBatchWeightUnit(batchWeightUnit); - result.comment.addAll(comment); result.setFinalRaisingFactor(finalRaisingFactor); return result; } - public void addComment(String comment) { - String safeComment = StringUtils.isEmpty(comment) ? "" : comment; - if (log.isDebugEnabled()) { - log.debug("Add comment: " + safeComment); - } - this.comment.add(safeComment); - } - - public List<String> getComment() { - return comment; - } - - public void setComment(List<String> comment) { - this.comment = comment; - } - public boolean withFrequency() { return frequencyLengthStep != null; } diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/ExportSampleCategory.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/ExportSampleCategory.java index d2040d8..3f3da4f 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/ExportSampleCategory.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/csv/ExportSampleCategory.java @@ -52,7 +52,9 @@ public class ExportSampleCategory<S extends Serializable> extends SampleCategory public static final String PROPERTY_SAMPLE_WEIGHT = "sampleWeight"; - public static final java.lang.String PROPERTY_BATCH_ID = "batchId"; + public static final String PROPERTY_BATCH_ID = "batchId"; + + public static final String PROPERTY_COMMENT = "comment"; private Integer batchId; @@ -64,6 +66,8 @@ public class ExportSampleCategory<S extends Serializable> extends SampleCategory private Float sampleComputedWeight; + private String comment; + public String getWeightOrVolType() { return weightOrVolType; } @@ -104,6 +108,14 @@ public class ExportSampleCategory<S extends Serializable> extends SampleCategory this.sampleComputedWeight = sampleComputedWeight; } + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + public Caracteristic getCategoryCaracteristic() { return categoryDef.getCaracteristic(); } diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/producer/CsvProducerForCatch.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/producer/CsvProducerForCatch.java index 1091dc2..fb899a3 100644 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/producer/CsvProducerForCatch.java +++ b/tutti-service/src/main/java/fr/ifremer/tutti/service/genericformat/producer/CsvProducerForCatch.java @@ -210,8 +210,6 @@ public class CsvProducerForCatch extends CsvProducer<CatchRow, CatchModel> { SpeciesBatch speciesBatch, float totalBatchWeight) { - currentRow.addComment(speciesBatch.getComment()); - Integer number = Numbers.getValueOrComputedValue(speciesBatch.getNumber(), speciesBatch.getComputedNumber()); Boolean numberComputed = Numbers.getValueOrComputedValueComputed(speciesBatch.getNumber(), @@ -227,6 +225,7 @@ public class CsvProducerForCatch extends CsvProducer<CatchRow, CatchModel> { speciesBatch.getSampleCategoryWeight(), speciesBatch.getSampleCategoryComputedWeight(), speciesBatch.getWeight(), + speciesBatch.getComment(), number, numberComputed, rankOrder); @@ -336,8 +335,6 @@ public class CsvProducerForCatch extends CsvProducer<CatchRow, CatchModel> { BenthosBatch benthosBatch, float totalBatchWeight) { - currentRow.addComment(benthosBatch.getComment()); - Integer number = Numbers.getValueOrComputedValue(benthosBatch.getNumber(), benthosBatch.getComputedNumber()); Boolean numberComputed = Numbers.getValueOrComputedValueComputed(benthosBatch.getNumber(), @@ -353,6 +350,7 @@ public class CsvProducerForCatch extends CsvProducer<CatchRow, CatchModel> { benthosBatch.getSampleCategoryWeight(), benthosBatch.getSampleCategoryComputedWeight(), benthosBatch.getWeight(), + benthosBatch.getComment(), number, numberComputed, rankOrder); @@ -504,6 +502,7 @@ public class CsvProducerForCatch extends CsvProducer<CatchRow, CatchModel> { Float sampleCategoryWeight, Float sampleCategoryComputedWeight, Float batchWeight, + String comment, Integer batchNumber, Boolean batchNumberComputed, Integer batchRankOrder) { @@ -517,6 +516,7 @@ public class CsvProducerForCatch extends CsvProducer<CatchRow, CatchModel> { sampleCategory.setCategoryValue(sampleCategoryValue); sampleCategory.setCategoryWeight(sampleCategoryWeight); sampleCategory.setSampleWeight(batchWeight); + sampleCategory.setComment(comment); sampleCategory.setComputedWeight(sampleCategoryComputedWeight); sampleCategory.setWeightOrVolType(CatchModel.WEIGHT_OR_VOL_TYPE); -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.