Revision ac9742df
Added by Patrick Plitzner over 6 years ago
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenImportNames.java | ||
---|---|---|
29 | 29 |
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; |
30 | 30 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
31 | 31 |
import eu.etaxonomy.cdm.model.name.BotanicalName; |
32 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus; |
|
33 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
|
32 | 34 |
import eu.etaxonomy.cdm.model.name.Rank; |
33 | 35 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
34 | 36 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
... | ... | |
111 | 113 |
String authorKombString = rs.getString(RedListUtil.AUTOR_KOMB); |
112 | 114 |
String authorBasiString = rs.getString(RedListUtil.AUTOR_BASI); |
113 | 115 |
|
116 |
//---NAME--- |
|
114 | 117 |
if(CdmUtils.isBlank(taxNameString) && CdmUtils.isBlank(ep1String)){ |
115 | 118 |
RedListUtil.logMessage(id, "No name found!", logger); |
116 | 119 |
} |
117 | 120 |
|
118 |
Rank rank = makeRank(state, rangString); |
|
121 |
Rank rank = makeRank(id, state, rangString);
|
|
119 | 122 |
if(rank==null){ |
120 | 123 |
RedListUtil.logMessage(id, "Rank could not be resolved.", logger); |
121 | 124 |
} |
... | ... | |
135 | 138 |
name.setInfraSpecificEpithet(ep3String); |
136 | 139 |
} |
137 | 140 |
} |
141 |
//nomenclatural status |
|
142 |
NomenclaturalStatusType status = makeNomenclaturalStatus(id, state, nomZusatzString); |
|
143 |
if(status!=null){ |
|
144 |
name.addStatus(NomenclaturalStatus.NewInstance(status)); |
|
145 |
} |
|
146 |
|
|
138 | 147 |
|
139 | 148 |
//--- AUTHORS --- |
140 | 149 |
//combination author |
... | ... | |
247 | 256 |
state.getTaxonMap().put(id, taxonBase.getUuid()); |
248 | 257 |
} |
249 | 258 |
|
250 |
private Rank makeRank(RedListGefaesspflanzenImportState state, String rankStr) { |
|
259 |
private Rank makeRank(long id, RedListGefaesspflanzenImportState state, String rankStr) {
|
|
251 | 260 |
Rank rank = null; |
252 | 261 |
try { |
253 | 262 |
rank = state.getTransformer().getRankByKey(rankStr); |
... | ... | |
255 | 264 |
e.printStackTrace(); |
256 | 265 |
} |
257 | 266 |
if(rank==null){ |
258 |
logger.error(rankStr+" could not be associated to a known rank.");
|
|
267 |
RedListUtil.logMessage(id, rankStr+" could not be associated to a known rank.", logger);
|
|
259 | 268 |
} |
260 | 269 |
return rank; |
261 | 270 |
} |
262 | 271 |
|
272 |
private NomenclaturalStatusType makeNomenclaturalStatus(long id, RedListGefaesspflanzenImportState state, String nomZusatzString) { |
|
273 |
NomenclaturalStatusType status = null; |
|
274 |
try { |
|
275 |
status = state.getTransformer().getNomenclaturalStatusByKey(nomZusatzString); |
|
276 |
} catch (UndefinedTransformerMethodException e) { |
|
277 |
e.printStackTrace(); |
|
278 |
} |
|
279 |
if(status==null){ |
|
280 |
RedListUtil.logMessage(id, nomZusatzString+" could not be associated to a known nomenclatural status.", logger); |
|
281 |
} |
|
282 |
return status; |
|
283 |
} |
|
284 |
|
|
263 | 285 |
|
264 | 286 |
|
265 | 287 |
@Override |
app-import/src/main/java/eu/etaxonomy/cdm/io/redlist/gefaesspflanzen/RedListGefaesspflanzenTransformer.java | ||
---|---|---|
14 | 14 |
|
15 | 15 |
import eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase; |
16 | 16 |
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException; |
17 |
import eu.etaxonomy.cdm.model.name.NomenclaturalStatusType; |
|
17 | 18 |
import eu.etaxonomy.cdm.model.name.Rank; |
18 | 19 |
|
19 | 20 |
/** |
... | ... | |
52 | 53 |
return null; |
53 | 54 |
} |
54 | 55 |
|
55 |
|
|
56 |
@Override |
|
57 |
public NomenclaturalStatusType getNomenclaturalStatusByKey(String key) throws UndefinedTransformerMethodException { |
|
58 |
if (key == null){return null;} |
|
59 |
if (key.equals("nom. cons.")){return NomenclaturalStatusType.CONSERVED();} |
|
60 |
else if (key.equals("nom. illeg.")){return NomenclaturalStatusType.ILLEGITIMATE();} |
|
61 |
else if (key.equals("nom. inval.")){return NomenclaturalStatusType.INVALID();} |
|
62 |
else if (key.equals("nom. ambig.")){return NomenclaturalStatusType.AMBIGUOUS();} |
|
63 |
else if (key.equals("nom. nud.")){return NomenclaturalStatusType.NUDUM();} |
|
64 |
else if (key.equals("nom. rejic.")){return NomenclaturalStatusType.REJECTED();} |
|
65 |
else if (key.equals("nom. utique rejic.")){return NomenclaturalStatusType.UTIQUE_REJECTED();} |
|
66 |
else if (key.equals("nom. utique rejic. pro.")){return NomenclaturalStatusType.UTIQUE_REJECTED_PROP();} |
|
67 |
else if (key.equals("comb. nov.")){return NomenclaturalStatusType.COMB_NOV();} |
|
68 |
return null; |
|
69 |
} |
|
56 | 70 |
|
57 | 71 |
} |
Also available in: Unified diff
Import nomenclatural status