Project

General

Profile

« Previous | Next » 

Revision 379eb203

Added by Andreas Müller over 3 years ago

cleanup

View differences:

cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/specimen/excel/in/SpecimenSythesysExcelImport.java
6 6
 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
 * See LICENSE.TXT at the top of this package for the full license terms.
8 8
 */
9

  
10 9
package eu.etaxonomy.cdm.io.specimen.excel.in;
11 10

  
12 11
import java.io.FileNotFoundException;
......
71 70
 * @author p.kelbert
72 71
 * @since 29.10.2008
73 72
 * @since 13 mars 2013
74
 *
75 73
 */
76 74
@Component
77 75
public class SpecimenSythesysExcelImport  extends CdmImportBase<SpecimenSynthesysExcelImportConfigurator, SpecimenSynthesysExcelImportState>
78 76
        implements ICdmIO<SpecimenSynthesysExcelImportState> {
79 77

  
78
    private static final long serialVersionUID = -1145031415387024364L;
79

  
80 80
    private static final Logger logger = Logger.getLogger(SpecimenSythesysExcelImport.class);
81 81

  
82 82
    protected String fullScientificNameString;
......
126 126
     * return empty string instead of null
127 127
     * */
128 128
    public class MyHashMap<K,V> extends HashMap<K,V> {
129
        /**
130
         *
131
         */
129

  
132 130
        private static final long serialVersionUID = -6230407405666753405L;
133 131

  
134 132
        @SuppressWarnings("unchecked")
......
212 210
                }
213 211
                getClassificationService().saveOrUpdate(classification);
214 212
            }
215

  
216 213
        }
217 214
    }
218 215

  
......
317 314
        identifier = unit.get("identifier");
318 315
    }
319 316

  
320

  
321 317
    private Institution getInstitution(SpecimenSynthesysExcelImportConfigurator config){
322 318
        Institution institution;
323 319
        List<Institution> institutions;
......
385 381
        return collection;
386 382
    }
387 383

  
388
    /*
389
     *
390
     * @param app
391
     * @param derivedThing
392
     * @param sec
393
     */
394 384
    private void setTaxonName(SpecimenSynthesysExcelImportConfigurator config){
395 385
        TaxonName taxonName = null;
396 386
        Taxon taxon = null;
......
462 452
                taxon = addTaxonNode(taxon, config);
463 453
            }
464 454

  
465

  
466

  
467 455
            DeterminationEvent determinationEvent = DeterminationEvent.NewInstance();
468 456
            determinationEvent.setTaxon(getTaxonService().find(taxon.getUuid()));
469 457
            determinationEvent.setPreferredFlag(preferredFlag);
......
480 468

  
481 469
            getOccurrenceService().saveOrUpdate(derivedUnitBase);
482 470
        }
483

  
484 471
    }
485 472

  
486
    /**
487
     * @param taxon
488
     * @param taxonName
489
     * @param config
490
     * @return
491
     */
492 473
    private Taxon addTaxonNode(Taxon taxon, SpecimenSynthesysExcelImportConfigurator config) {
493 474
        if (DEBUG) {
494 475
            logger.info("link taxon to a taxonNode");
......
969 950
                            }
970 951
                        }
971 952
                        if (collteam.size()>0) {
972
                            collectorinteams.add(new ArrayList<String>(new HashSet<String>(collteam)));
953
                            collectorinteams.add(new ArrayList<String>(new HashSet<>(collteam)));
973 954
                        }
974 955
                    }
975 956
                    else
......
980 961
            }
981 962
        }
982 963

  
983
        List<String> collectorsU = new ArrayList<String>(new HashSet<String>(collectors));
984
        List<String> teamsU = new ArrayList<String>(new HashSet<String>(teams));
964
        List<String> collectorsU = new ArrayList<String>(new HashSet<>(collectors));
965
        List<String> teamsU = new ArrayList<String>(new HashSet<>(teams));
985 966

  
986 967

  
987 968
        //existing teams in DB
988 969
        Map<String,Team> titleCacheTeam = new HashMap<String, Team>();
989 970
        List<UuidAndTitleCache<Team>> hiberTeam = getAgentService().getTeamUuidAndTitleCache();
990 971

  
991
        Set<UUID> uuids = new HashSet<UUID>();
972
        Set<UUID> uuids = new HashSet<>();
992 973
        for (UuidAndTitleCache<Team> hibernateT:hiberTeam){
993 974
            uuids.add(hibernateT.getUuid());
994 975
        }
......
1000 981
        }
1001 982

  
1002 983

  
1003
        Map<String,UUID> teamMap = new HashMap<String, UUID>();
984
        Map<String,UUID> teamMap = new HashMap<>();
1004 985
        for (UuidAndTitleCache<Team> uuidt:hiberTeam){
1005 986
            teamMap.put(uuidt.getTitleCache(), uuidt.getUuid());
1006 987
        }
1007 988

  
1008 989
        //existing persons in DB
1009 990
        List<UuidAndTitleCache<Person>> hiberPersons = getAgentService().getPersonUuidAndTitleCache();
1010
        Map<String,Person> titleCachePerson = new HashMap<String, Person>();
991
        Map<String,Person> titleCachePerson = new HashMap<>();
1011 992
        uuids = new HashSet<UUID>();
1012 993
        for (UuidAndTitleCache<Person> hibernateP:hiberPersons){
1013 994
            uuids.add(hibernateP.getUuid());
......
1025 1006
            personMap.put(person.getTitleCache(), person.getUuid());
1026 1007
        }
1027 1008

  
1028
        java.util.Collection<AgentBase> personsToAdd = new ArrayList<AgentBase>();
1029
        java.util.Collection<AgentBase> teamsToAdd = new ArrayList<AgentBase>();
1009
        java.util.Collection<AgentBase> personsToAdd = new ArrayList<>();
1010
        java.util.Collection<AgentBase> teamsToAdd = new ArrayList<>();
1030 1011

  
1031 1012
        for (String collector:collectorsU){
1032 1013
            Person p = Person.NewInstance();
......
1047 1028
            titleCachePerson.put(uuuidPerson.get(u).getTitleCache(),CdmBase.deproxy(uuuidPerson.get(u), Person.class) );
1048 1029
        }
1049 1030

  
1050

  
1051 1031
        Person ptmp ;
1052 1032
        Map <String,Integer>teamdone = new HashMap<String, Integer>();
1053 1033
        for (List<String> collteam: collectorinteams){

Also available in: Unified diff