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 412db5483e727fc6a109450da37c82c747d5dbf7 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Feb 3 19:12:42 2015 +0100 ajout d'une méthode pour retrouver tous les lots d'un lot racine --- .../persistence/entities/data/SpeciesBatchs.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchs.java b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchs.java index 3076167..bf7b3d6 100644 --- a/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchs.java +++ b/tutti-persistence/src/main/java/fr/ifremer/tutti/persistence/entities/data/SpeciesBatchs.java @@ -27,6 +27,8 @@ package fr.ifremer.tutti.persistence.entities.data; import com.google.common.base.Function; import java.io.Serializable; +import java.util.Map; +import java.util.TreeMap; /** * @author Kevin Morin (Code Lutin) @@ -41,4 +43,22 @@ public class SpeciesBatchs extends AbstractSpeciesBatchs { } }; + public static Map<Integer, SpeciesBatch> getAllSpeciesBatchesById(BatchContainer<SpeciesBatch> rootSpeciesBatch) { + Map<Integer, SpeciesBatch> result = new TreeMap<>(); + + for (SpeciesBatch speciesBatch : rootSpeciesBatch.getChildren()) { + getAllspeciesBatchesById(speciesBatch, result); + } + return result; + } + + private static void getAllspeciesBatchesById(SpeciesBatch speciesBatch, Map<Integer, SpeciesBatch> result) { + result.put(speciesBatch.getIdAsInt(), speciesBatch); + if (!speciesBatch.isChildBatchsEmpty()) { + for (SpeciesBatch batch : speciesBatch.getChildBatchs()) { + getAllspeciesBatchesById(batch, result); + } + } + } + } -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.