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 1f32a0cfc0eafbdc57fdc2051882cbf7fd543809 Author: Tony CHEMIT <chemit@codelutin.com> Date: Tue Feb 17 16:48:25 2015 +0100 suppression SpeciesMap (remplacé par TaxonCache) --- .../java/fr/ifremer/tutti/service/SpeciesMap.java | 147 --------------------- 1 file changed, 147 deletions(-) diff --git a/tutti-service/src/main/java/fr/ifremer/tutti/service/SpeciesMap.java b/tutti-service/src/main/java/fr/ifremer/tutti/service/SpeciesMap.java deleted file mode 100644 index 3018753..0000000 --- a/tutti-service/src/main/java/fr/ifremer/tutti/service/SpeciesMap.java +++ /dev/null @@ -1,147 +0,0 @@ -package fr.ifremer.tutti.service; - -/* - * #%L - * Tutti :: Service - * $Id:$ - * $HeadURL:$ - * %% - * Copyright (C) 2012 - 2015 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.SpeciesAbleBatch; -import fr.ifremer.tutti.persistence.entities.protocol.SpeciesProtocol; -import fr.ifremer.tutti.persistence.entities.referential.Species; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -/** - * Created on 2/9/15. - * - * @author Tony Chemit - chemit@codelutin.com - * @since 3.13 - */ -public class SpeciesMap { - - public static SpeciesMap create(TuttiDataContext dataContext, PersistenceService persistenceService) { - - boolean protocolFilled = dataContext.isProtocolFilled(); - - Map<Integer, SpeciesProtocol> speciesProtocolMap; - Map<Integer, SpeciesProtocol> benthosProtocolMap; - - if (protocolFilled) { - - speciesProtocolMap = persistenceService.toSpeciesProtocolMap(); - benthosProtocolMap = persistenceService.toBenthosProtocolMap(); - - } else { - - speciesProtocolMap = new HashMap<>(); - benthosProtocolMap = new HashMap<>(); - } - - SpeciesMap speciesMap = new SpeciesMap(persistenceService, speciesProtocolMap, benthosProtocolMap); - return speciesMap; - - } - - protected final Map<Integer, SpeciesProtocol> speciesProtocolMap; - - protected final Map<Integer, SpeciesProtocol> benthosProtocolMap; - - protected final Map<Integer, Species> speciesByReferenceTaxonId = new TreeMap<>(); - - protected final PersistenceService persistenceService; - - public <A extends SpeciesAbleBatch> void loadSpecies(List<A> speciesAbleBatches) { - - for (A speciesAbleBatch : speciesAbleBatches) { - loadSpecies(speciesAbleBatch.getSpecies()); - } - - } - - public <A extends SpeciesAbleBatch> void loadBenthos(List<A> speciesAbleBatches) { - - for (A speciesAbleBatch : speciesAbleBatches) { - loadBenthos(speciesAbleBatch.getSpecies()); - } - - } - - public void loadSpecies(Species species) { - - load(species, speciesProtocolMap); - - } - - public void loadBenthos(Species species) { - - load(species, benthosProtocolMap); - - } - - protected SpeciesMap(PersistenceService persistenceService, - Map<Integer, SpeciesProtocol> speciesProtocolMap, - Map<Integer, SpeciesProtocol> benthosProtocolMap) { - - this.speciesProtocolMap = speciesProtocolMap; - this.benthosProtocolMap = benthosProtocolMap; - this.persistenceService = persistenceService; - - } - - protected void load(Species species, Map<Integer, SpeciesProtocol> protocolMap) { - - Integer referenceTaxonId = species.getReferenceTaxonId(); - - Species speciesLoaded = speciesByReferenceTaxonId.get(referenceTaxonId); - - if (speciesLoaded == null) { - - Species speciesWithVerncularCode = - persistenceService.getSpeciesByReferenceTaxonIdWithVernacularCode(referenceTaxonId); - - species.setVernacularCode(speciesWithVerncularCode.getVernacularCode()); - - if (protocolMap.containsKey(species.getReferenceTaxonId())) { - - SpeciesProtocol speciesProtocol = protocolMap.get(species.getReferenceTaxonId()); - String surveyCode = speciesProtocol.getSpeciesSurveyCode(); - species.setSurveyCode(surveyCode); - - } - - speciesByReferenceTaxonId.put(species.getReferenceTaxonId(), species); - - } else { - - species.setVernacularCode(speciesLoaded.getVernacularCode()); - species.setSurveyCode(speciesLoaded.getSurveyCode()); - - } - - - } - - -} -- To stop receiving notification emails like this one, please contact codelutin.com SCM administrator <admin+scm@codelutin.com>.