Revision c1641f79
Added by Patrick Plitzner about 8 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java | ||
---|---|---|
19 | 19 |
import org.apache.log4j.Logger; |
20 | 20 |
import org.springframework.stereotype.Component; |
21 | 21 |
|
22 |
import eu.etaxonomy.cdm.common.CdmUtils; |
|
22 | 23 |
import eu.etaxonomy.cdm.io.common.DbImportBase; |
23 | 24 |
import eu.etaxonomy.cdm.io.common.IPartitionedIO; |
24 | 25 |
import eu.etaxonomy.cdm.io.common.ImportHelper; |
25 | 26 |
import eu.etaxonomy.cdm.io.common.ResultSetPartitioner; |
26 | 27 |
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException; |
28 |
import eu.etaxonomy.cdm.model.agent.AgentBase; |
|
27 | 29 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
28 | 30 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
29 | 31 |
import eu.etaxonomy.cdm.model.name.Rank; |
... | ... | |
46 | 48 |
private static final String pluralString = "names"; |
47 | 49 |
|
48 | 50 |
private static final String TAXON_NAMESPACE = "name"; |
51 |
private static final String AUTHOR_KOMB_NAMESPACE = "author_komb"; |
|
52 |
private static final String AUTHOR_BASI_NAMESPACE = "author_basi"; |
|
49 | 53 |
|
50 | 54 |
public RedListGefaesspflanzenImportNames() { |
51 | 55 |
super(tableName, pluralString); |
... | ... | |
101 | 105 |
String nomZusatzString = rs.getString("NOM_ZUSATZ"); |
102 | 106 |
String zusatzString = rs.getString("ZUSATZ"); |
103 | 107 |
|
108 |
if(CdmUtils.isBlank(taxNameString) && CdmUtils.isBlank(ep1String)){ |
|
109 |
logger.error("NAMNR: "+id+" No name found!"); |
|
110 |
} |
|
111 |
|
|
112 |
|
|
113 |
Rank rank = makeRank(state, rangString); |
|
114 |
BotanicalName name = BotanicalName.NewInstance(rank); |
|
104 | 115 |
|
105 |
BotanicalName name = BotanicalName.NewInstance(makeRank(state, rangString)); |
|
116 |
//ep1 should always be present |
|
117 |
name.setGenusOrUninomial(ep1String); |
|
118 |
if(rank==Rank.SPECIES()){ |
|
119 |
name.setGenusOrUninomial(ep1String); |
|
120 |
} |
|
106 | 121 |
|
122 |
//add author |
|
123 |
AgentBase authorKomb = getAgentService().load(state.getAuthorKombMap().get(id)); |
|
124 |
// name.setCombinationAuthorship(authorKomb); |
|
107 | 125 |
|
108 | 126 |
//id |
109 | 127 |
ImportHelper.setOriginalSource(name, state.getTransactionalSourceReference(), id, TAXON_NAMESPACE); |
... | ... | |
128 | 146 |
public Map<Object, Map<String, ? extends CdmBase>> getRelatedObjectsForPartition(ResultSet rs, |
129 | 147 |
RedListGefaesspflanzenImportState state) { |
130 | 148 |
Map<Object, Map<String, ? extends CdmBase>> result = new HashMap<>(); |
131 |
// Map<String, TeamOrPersonBase<?>> authorMap = new HashMap<>(); |
|
132 |
// Set<String> authorKombSet = new HashSet<>(); |
|
133 |
// Set<String> referenceIdSet = new HashSet<String>(); |
|
149 |
// Map<Long, AgentBase<?>> authorKombMap = new HashMap<>(); |
|
150 |
// Map<Long, AgentBase<?>> authorBasiMap = new HashMap<>(); |
|
134 | 151 |
// |
152 |
// //load authors |
|
153 |
// for(Entry<Long, UUID> entry:state.getAuthorKombMap().entrySet()){ |
|
154 |
// authorKombMap.put(entry.getKey(), getAgentService().load(entry.getValue())); |
|
155 |
// } |
|
156 |
// for(Entry<Long, UUID> entry:state.getAuthorBasiMap().entrySet()){ |
|
157 |
// authorBasiMap.put(entry.getKey(), getAgentService().load(entry.getValue())); |
|
158 |
// } |
|
135 | 159 |
// try { |
136 | 160 |
// while (rs.next()){ |
137 |
// String authorStr = rs.getString("tax_author_name"); |
|
138 |
// authorKombSet.add(authorStr); |
|
139 |
// handleForeignKey(rs, referenceIdSet, "tax_document"); |
|
161 |
// long id = rs.getLong("NAMNR"); |
|
140 | 162 |
// } |
141 | 163 |
// } catch (SQLException e) { |
142 | 164 |
// e.printStackTrace(); |
Also available in: Unified diff
Improved author and name import (unstable)