Revision b4b7ae12
Added by Patrick Plitzner about 8 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java | ||
---|---|---|
42 | 42 |
@Component |
43 | 43 |
@SuppressWarnings("serial") |
44 | 44 |
public class RedListGefaesspflanzenImportNames extends DbImportBase<RedListGefaesspflanzenImportState, RedListGefaesspflanzenImportConfigurator> { |
45 |
/** |
|
46 |
* |
|
47 |
*/ |
|
48 |
private static final String EX = " ex "; |
|
49 |
|
|
45 | 50 |
private static final Logger logger = Logger.getLogger(RedListGefaesspflanzenImportNames.class); |
46 | 51 |
|
47 | 52 |
private static final String tableName = "Rote Liste Gefäßpflanzen"; |
... | ... | |
120 | 125 |
name.setGenusOrUninomial(ep1String); |
121 | 126 |
} |
122 | 127 |
|
123 |
//add author |
|
124 |
TeamOrPersonBase authorKomb = HibernateProxyHelper.deproxy(getAgentService().load(state.getAuthorMap().get(authorKombString)), TeamOrPersonBase.class); |
|
125 |
name.setCombinationAuthorship(authorKomb); |
|
126 |
TeamOrPersonBase authorBasi = HibernateProxyHelper.deproxy(getAgentService().load(state.getAuthorMap().get(authorBasiString)), TeamOrPersonBase.class); |
|
127 |
name.setBasionymAuthorship(authorBasi); |
|
128 |
//--- AUTHORS --- |
|
129 |
//combination author |
|
130 |
if(authorKombString.contains(EX)){ |
|
131 |
//TODO: what happens with multiple ex authors?? |
|
132 |
String[] kombSplit = authorKombString.split(EX); |
|
133 |
for (int i = 0; i < kombSplit.length; i++) { |
|
134 |
if(i==0){ |
|
135 |
//first author is ex author |
|
136 |
TeamOrPersonBase authorKomb = HibernateProxyHelper.deproxy(getAgentService().load(state.getAuthorMap().get(kombSplit[i])), TeamOrPersonBase.class); |
|
137 |
name.setExCombinationAuthorship(authorKomb); |
|
138 |
} |
|
139 |
else{ |
|
140 |
TeamOrPersonBase authorKomb = HibernateProxyHelper.deproxy(getAgentService().load(state.getAuthorMap().get(kombSplit[i])), TeamOrPersonBase.class); |
|
141 |
name.setCombinationAuthorship(authorKomb); |
|
142 |
} |
|
143 |
} |
|
144 |
} |
|
145 |
else if(!CdmUtils.isBlank(authorKombString)){ |
|
146 |
TeamOrPersonBase authorKomb = HibernateProxyHelper.deproxy(getAgentService().load(state.getAuthorMap().get(authorKombString)), TeamOrPersonBase.class); |
|
147 |
name.setCombinationAuthorship(authorKomb); |
|
148 |
} |
|
149 |
//basionym author |
|
150 |
if(authorBasiString.contains(EX)){ |
|
151 |
String[] basiSplit = authorBasiString.split(EX); |
|
152 |
for (int i = 0; i < basiSplit.length; i++) { |
|
153 |
if(i==0){ |
|
154 |
TeamOrPersonBase authorBasi = HibernateProxyHelper.deproxy(getAgentService().load(state.getAuthorMap().get(basiSplit[i])), TeamOrPersonBase.class); |
|
155 |
name.setExBasionymAuthorship(authorBasi); |
|
156 |
} |
|
157 |
else{ |
|
158 |
TeamOrPersonBase authorBasi = HibernateProxyHelper.deproxy(getAgentService().load(state.getAuthorMap().get(basiSplit[i])), TeamOrPersonBase.class); |
|
159 |
name.setBasionymAuthorship(authorBasi); |
|
160 |
} |
|
161 |
} |
|
162 |
} |
|
163 |
else if(!CdmUtils.isBlank(authorBasiString)){ |
|
164 |
TeamOrPersonBase authorBasi = HibernateProxyHelper.deproxy(getAgentService().load(state.getAuthorMap().get(authorBasiString)), TeamOrPersonBase.class); |
|
165 |
name.setBasionymAuthorship(authorBasi); |
|
166 |
} |
|
128 | 167 |
|
129 | 168 |
//check authorship consistency |
130 | 169 |
String authorString = rs.getString("AUTOR"); |
131 |
if(!authorString.equals(name.getAuthorshipCache())){ |
|
132 |
logger.warn("Authorship inconsisten! Name-AuthorhshipCache: +"+name.getAuthorshipCache()+" Column AUTOR: "+authorString); |
|
170 |
String authorshipCache = name.getAuthorshipCache(); |
|
171 |
|
|
172 |
if(!CdmUtils.isBlank(zusatzString)){ |
|
173 |
authorString = authorString.replace(", "+zusatzString, ""); |
|
174 |
} |
|
175 |
if(CdmUtils.isBlank(authorKombString) && !CdmUtils.isBlank(authorBasiString)){ |
|
176 |
authorString = "("+authorString+")"; |
|
177 |
} |
|
178 |
if(!authorString.equals(authorshipCache)){ |
|
179 |
logger.warn("NAMNR: "+id+" Authorship inconsistent! name.authorhshipCache <-> Column AUTOR: "+authorshipCache+" <-> "+authorString); |
|
133 | 180 |
} |
134 | 181 |
|
135 | 182 |
//id |
Also available in: Unified diff
Import ex authors