Project

General

Profile

« Previous | Next » 

Revision 592ccd9f

Added by Patrick Plitzner about 7 years ago

Speed up assembly of related names

View differences:

app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java
193 193

  
194 194
        //id
195 195
        ImportHelper.setOriginalSource(name, state.getTransactionalSourceReference(), id, NAME_NAMESPACE);
196
        state.getNameMap().put(id, name.getUuid());
196 197

  
197 198
        namesToSave.add(name);
198 199
    }
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportState.java
29 29
	private static final Logger logger = Logger.getLogger(RedListGefaesspflanzenImportState.class);
30 30

  
31 31
	private final Map<String, UUID> authorMap = new HashMap<String, UUID>();
32
	private final Map<Long, UUID> nameMap = new HashMap<Long, UUID>();
32 33

  
33 34
    protected RedListGefaesspflanzenImportState(RedListGefaesspflanzenImportConfigurator config) {
34 35
        super(config);
......
38 39
        return authorMap;
39 40
    }
40 41

  
42
    public Map<Long, UUID> getNameMap() {
43
        return nameMap;
44
    }
45

  
41 46
}
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportTaxa.java
92 92
    private void makeSingleTaxon(RedListGefaesspflanzenImportState state, ResultSet rs, Set<TaxonBase> taxaToSave)
93 93
            throws SQLException {
94 94
        long id = rs.getLong("NAMNR");
95
        String gueltString = rs.getString("GUELT");
95 96

  
96
        BotanicalName name = state.getRelatedObject("name", String.valueOf(id), BotanicalName.class);
97
        BotanicalName name = state.getRelatedObject("name",String.valueOf(id), BotanicalName.class);
97 98
        TaxonBase taxon = Taxon.NewInstance(name, null);
98 99

  
99 100
        taxaToSave.add(taxon);
......
107 108
            RedListGefaesspflanzenImportState state) {
108 109
        Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>();
109 110
        Map<String, BotanicalName> nameMap = new HashMap<String, BotanicalName>();
110

  
111

  
112 111
        try {
113 112
            while (rs.next()){
114 113
                long id = rs.getLong("NAMNR");
115
                BotanicalName name = (BotanicalName) getCommonService().getSourcedObjectByIdInSource(BotanicalName.class, String.valueOf(id), "name");
116
                nameMap.put(String.valueOf(id), name);
117

  
114
                nameMap.put(String.valueOf(id), (BotanicalName) getNameService().load(state.getNameMap().get(id)));
118 115
            }
119 116
        } catch (SQLException e) {
120 117
            e.printStackTrace();

Also available in: Unified diff