r1665 - trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence
Author: tchemit Date: 2014-03-28 17:26:34 +0100 (Fri, 28 Mar 2014) New Revision: 1665 Url: http://forge.codelutin.com/projects/tutti/repository/revisions/1665 Log: fixes #4855: [EXPORT] sumatra V2 : probl?\195?\168me calcul longueurs moyennes Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java Modified: trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java =================================================================== --- trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2014-03-28 16:26:18 UTC (rev 1664) +++ trunk/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/TuttiPersistenceImpl.java 2014-03-28 16:26:34 UTC (rev 1665) @@ -33,7 +33,6 @@ import fr.ifremer.adagio.core.dao.technical.VersionNotFoundException; import fr.ifremer.adagio.core.service.technical.CacheService; import fr.ifremer.adagio.core.service.technical.sanity.DatabaseSanityService; -import org.nuiton.jaxx.application.ApplicationTechnicalException; import fr.ifremer.tutti.persistence.entities.CaracteristicMap; import fr.ifremer.tutti.persistence.entities.TuttiEntities; import fr.ifremer.tutti.persistence.entities.data.AccidentalBatch; @@ -79,6 +78,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.nuiton.jaxx.application.ApplicationTechnicalException; import org.nuiton.util.Version; import org.nuiton.util.VersionUtil; import org.springframework.beans.factory.annotation.Autowired; @@ -789,12 +789,24 @@ Multimap<Species, SpeciesBatchFrequency> result = ArrayListMultimap.create(); for (SpeciesBatch speciesBatch : batchContainer.getChildren()) { - List<SpeciesBatchFrequency> speciesBatchFrequency = getAllSpeciesBatchFrequency(speciesBatch.getId()); - result.putAll(speciesBatch.getSpecies(), speciesBatchFrequency); + getAllSpeciesBatchFrequencyForBatch(speciesBatch, result); } return result; } + protected void getAllSpeciesBatchFrequencyForBatch(SpeciesBatch batch, + Multimap<Species, SpeciesBatchFrequency> result) { + + List<SpeciesBatchFrequency> speciesBatchFrequency = getAllSpeciesBatchFrequency(batch.getId()); + result.putAll(batch.getSpecies(), speciesBatchFrequency); + + if (!batch.isChildBatchsEmpty()) { + for (SpeciesBatch child : batch.getChildBatchs()) { + getAllSpeciesBatchFrequencyForBatch(child, result); + } + } + } + @Override public List<SpeciesBatchFrequency> saveSpeciesBatchFrequency(String speciesBatchId, List<SpeciesBatchFrequency> frequencies) { return speciesBatchService.saveSpeciesBatchFrequency(speciesBatchId, frequencies); @@ -843,13 +855,26 @@ public Multimap<Species, BenthosBatchFrequency> getAllBenthosBatchFrequencyForBatch(BatchContainer<BenthosBatch> batchContainer) { Multimap<Species, BenthosBatchFrequency> result = ArrayListMultimap.create(); + for (BenthosBatch speciesBatch : batchContainer.getChildren()) { - List<BenthosBatchFrequency> speciesBatchFrequency = getAllBenthosBatchFrequency(speciesBatch.getId()); - result.putAll(speciesBatch.getSpecies(), speciesBatchFrequency); + getAllBenthosBatchFrequencyForBatch(speciesBatch, result); } return result; } + protected void getAllBenthosBatchFrequencyForBatch(BenthosBatch batch, + Multimap<Species, BenthosBatchFrequency> result) { + + List<BenthosBatchFrequency> speciesBatchFrequency = getAllBenthosBatchFrequency(batch.getId()); + result.putAll(batch.getSpecies(), speciesBatchFrequency); + + if (!batch.isChildBatchsEmpty()) { + for (BenthosBatch child : batch.getChildBatchs()) { + getAllBenthosBatchFrequencyForBatch(child, result); + } + } + } + @Override public List<BenthosBatchFrequency> saveBenthosBatchFrequency(String benthosBatchId, List<BenthosBatchFrequency> frequencies) {
participants (1)
-
tchemit@users.forge.codelutin.com