Revision ab4cc1fb
Added by Andreas Müller about 14 years ago
cdmlib-io/src/main/java/eu/etaxonomy/cdm/io/erms/ErmsTransformer.java | ||
---|---|---|
18 | 18 |
|
19 | 19 |
import eu.etaxonomy.cdm.common.CdmUtils; |
20 | 20 |
import eu.etaxonomy.cdm.io.common.mapping.IDbImportTransformer; |
21 |
import eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase; |
|
22 |
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException; |
|
21 | 23 |
import eu.etaxonomy.cdm.model.common.Language; |
22 | 24 |
import eu.etaxonomy.cdm.model.description.Feature; |
23 | 25 |
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus; |
... | ... | |
28 | 30 |
* @created 01.03.2010 |
29 | 31 |
* @version 1.0 |
30 | 32 |
*/ |
31 |
public final class ErmsTransformer implements IDbImportTransformer{ |
|
33 |
public final class ErmsTransformer extends InputTransformerBase implements IDbImportTransformer{
|
|
32 | 34 |
private static final Logger logger = Logger.getLogger(ErmsTransformer.class); |
33 | 35 |
|
34 | 36 |
public static final int SOURCE_USE_ORIGINAL_DESCRIPTION = 1; |
... | ... | |
40 | 42 |
public static final int SOURCE_USE_STATUS_SOURCE = 7; |
41 | 43 |
public static final int SOURCE_USE_EMENDATION = 8; |
42 | 44 |
|
43 |
|
|
45 |
//language uuids |
|
44 | 46 |
public static final UUID uuidEuropeanMarineWaters = UUID.fromString("47389e42-3b3c-4873-bded-ac030db86462"); |
45 | 47 |
public static final UUID uuidMediterraneanSea = UUID.fromString("bde8a624-23c4-4ac3-b381-11287f5d656a"); |
46 | 48 |
public static final UUID uuidWhiteSea = UUID.fromString("bf14bfb6-8925-4696-911c-56d3e90d4491"); |
... | ... | |
93 | 95 |
public static final UUID uuidTurkishExclusiveEconomicZone = UUID.fromString("3d552e73-2bf5-4f36-8a91-94fbead970e5"); |
94 | 96 |
public static final UUID uuidDanishExclusiveEconomicZone = UUID.fromString("53d5a8bd-804b-4cbb-b5ad-f47ff6433db0"); |
95 | 97 |
|
96 |
|
|
98 |
|
|
99 |
//feature uuids |
|
100 |
public static final UUID uuidRemark = UUID.fromString("648eab77-8469-4139-bbf4-3fb26ec15864"); |
|
101 |
public static final UUID uuidAdditionalinformation = UUID.fromString("ef00c304-ce33-45ef-9543-0b9336a2b6eb"); |
|
102 |
public static final UUID uuidSpelling = UUID.fromString("536594a1-21a5-4d99-aa46-132bc7b31316"); |
|
103 |
public static final UUID uuidPublicationdate = UUID.fromString("b996b34f-1313-4575-bf46-732676674290"); |
|
104 |
public static final UUID uuidSystematics = UUID.fromString("caac0f7f-f43e-4b7c-b296-ec2d930c4d05"); |
|
105 |
public static final UUID uuidClassification = UUID.fromString("aa9bffd3-1fa8-4bd7-9e25-e2d162177b3d"); |
|
106 |
public static final UUID uuidEnvironment = UUID.fromString("4f8ea10d-2242-443f-9d7d-4ecccdee4953"); |
|
107 |
public static final UUID uuidHabitat = UUID.fromString("b7387877-51e3-4192-b9e4-025a359f4b59"); |
|
108 |
public static final UUID uuidAuthority = UUID.fromString("9c7f8908-2530-4900-8da9-d328f7ac9031"); |
|
109 |
public static final UUID uuidMorphology = UUID.fromString("5be1f948-d85f-497f-a0d5-4e5f3b227274"); |
|
110 |
public static final UUID uuidTaxonomicRemarks = UUID.fromString("cc863aee-8da9-448b-82cd-47e3af942998"); |
|
111 |
public static final UUID uuidNote = UUID.fromString("2c66d35f-c76e-40e0-951b-f2c340e5973f"); |
|
112 |
public static final UUID uuidTaxonomy = UUID.fromString("d5734631-c86b-4212-9b8d-cb62f813e0a0"); |
|
113 |
public static final UUID uuidTaxonomicstatus = UUID.fromString("ffbadab5-a8bc-4fb6-a6b3-d1f2593187ff"); |
|
114 |
public static final UUID uuidStatus = UUID.fromString("fcc50853-bcff-4d0f-bc9a-123d7f175490"); |
|
115 |
public static final UUID uuidRank = UUID.fromString("cabada57-a098-47fc-929f-31c8c910f6cf"); |
|
116 |
public static final UUID uuidHomonymy = UUID.fromString("2791a14f-49b2-417f-a248-84c3d022d75f"); |
|
117 |
public static final UUID uuidNomenclature = UUID.fromString("15fe184f-4aab-4076-8bbb-3415d6f1f27f"); |
|
118 |
public static final UUID uuidTypespecies = UUID.fromString("cf674b0d-76e2-4628-952c-2cd06e209c6e"); |
|
119 |
public static final UUID uuidTaxonomicRemark = UUID.fromString("044e7c4e-aab8-4f44-bfa5-0339e7576c74"); |
|
120 |
public static final UUID uuidDateofPublication = UUID.fromString("2a416574-69db-4f80-b9a7-b912d5ed1816"); |
|
121 |
public static final UUID uuidAcknowledgments = UUID.fromString("3b2fd495-3f9a-480e-986a-7643741177da"); |
|
122 |
public static final UUID uuidOriginalpublication = UUID.fromString("ea9b7e53-0487-499f-a281-3d82d10e76dd"); |
|
123 |
public static final UUID uuidTypelocality = UUID.fromString("7c1c5779-2b4b-467b-b2ca-5ca2e029e116"); |
|
124 |
public static final UUID uuidValidity = UUID.fromString("bd066f25-935b-4b4e-a2eb-3fbfcd5e608f"); |
|
125 |
public static final UUID uuidIdentification = UUID.fromString("dec3cd5b-0690-4035-825d-bda9aee96bc1"); |
|
126 |
public static final UUID uuidSynonymy = UUID.fromString("f5c8be5f-8d33-47df-838e-55fc7999fc81"); |
|
127 |
|
|
97 | 128 |
|
98 | 129 |
public static NomenclaturalCode kingdomId2NomCode(Integer kingdomId){ |
99 | 130 |
switch (kingdomId){ |
... | ... | |
127 | 158 |
} |
128 | 159 |
} |
129 | 160 |
|
130 |
public static Language languageByErmsAbbrev(String ermsAbbrev) throws IllegalArgumentException {
|
|
161 |
public Language getLanguageByKey(String ermsAbbrev) throws IllegalArgumentException {
|
|
131 | 162 |
Set<String> unhandledLanguages = new HashSet<String>(); |
132 | 163 |
if (CdmUtils.isEmpty(ermsAbbrev)){return null; |
133 | 164 |
}else if (ermsAbbrev.equals("af")){return Language.AFRIKAANS(); |
... | ... | |
426 | 457 |
throw new IllegalArgumentException("Unknown note type " + type); |
427 | 458 |
} |
428 | 459 |
} |
460 |
|
|
461 |
/* (non-Javadoc) |
|
462 |
* @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getFeatureByKey(java.lang.String) |
|
463 |
*/ |
|
464 |
@Override |
|
465 |
public Feature getFeatureByKey(String key) throws UndefinedTransformerMethodException { |
|
466 |
if (CdmUtils.isEmpty(key)){return null; |
|
467 |
}else if (key.equalsIgnoreCase("Distribution")){return Feature.DISTRIBUTION(); |
|
468 |
}else if (key.equalsIgnoreCase("Ecology")){return Feature.ECOLOGY(); |
|
469 |
}else if (key.equalsIgnoreCase("Diagnosis")){return Feature.DIAGNOSIS(); |
|
470 |
}else if (key.equalsIgnoreCase("Biology")){return Feature.BIOLOGY_ECOLOGY(); |
|
471 |
}else if (key.equalsIgnoreCase("Host")){return Feature.HOSTPLANT(); |
|
472 |
}else{ |
|
473 |
return null; |
|
474 |
} |
|
475 |
} |
|
476 |
|
|
477 |
/* (non-Javadoc) |
|
478 |
* @see eu.etaxonomy.cdm.io.common.mapping.InputTransformerBase#getFeatureUuid(java.lang.String) |
|
479 |
*/ |
|
480 |
@Override |
|
481 |
public UUID getFeatureUuid(String key) |
|
482 |
throws UndefinedTransformerMethodException { |
|
483 |
if (CdmUtils.isEmpty(key)){return null; |
|
484 |
}else if (key.equalsIgnoreCase("Remark")){return uuidRemark; |
|
485 |
}else if (key.equalsIgnoreCase("Additional information")){return uuidAdditionalinformation; |
|
486 |
}else if (key.equalsIgnoreCase("Spelling")){return uuidSpelling; |
|
487 |
}else if (key.equalsIgnoreCase("Publication date")){return uuidPublicationdate; |
|
488 |
}else if (key.equalsIgnoreCase("Systematics")){return uuidSystematics; |
|
489 |
}else if (key.equalsIgnoreCase("Classification")){return uuidClassification; |
|
490 |
}else if (key.equalsIgnoreCase("Environment")){return uuidEnvironment; |
|
491 |
}else if (key.equalsIgnoreCase("Habitat")){return uuidHabitat; |
|
492 |
}else if (key.equalsIgnoreCase("Authority")){return uuidAuthority; |
|
493 |
}else if (key.equalsIgnoreCase("Morphology")){return uuidMorphology; |
|
494 |
}else if (key.equalsIgnoreCase("Taxonomic Remarks")){return uuidTaxonomicRemarks; |
|
495 |
}else if (key.equalsIgnoreCase("Note")){return uuidNote; |
|
496 |
}else if (key.equalsIgnoreCase("Taxonomy")){return uuidTaxonomy; |
|
497 |
}else if (key.equalsIgnoreCase("Taxonomic status")){return uuidTaxonomicstatus; |
|
498 |
}else if (key.equalsIgnoreCase("Status")){return uuidStatus; |
|
499 |
}else if (key.equalsIgnoreCase("Rank")){return uuidRank; |
|
500 |
}else if (key.equalsIgnoreCase("Homonymy")){return uuidHomonymy; |
|
501 |
}else if (key.equalsIgnoreCase("Nomenclature")){return uuidNomenclature; |
|
502 |
}else if (key.equalsIgnoreCase("Type species")){return uuidTypespecies; |
|
503 |
}else if (key.equalsIgnoreCase("Taxonomic Remark")){return uuidTaxonomicRemark; |
|
504 |
}else if (key.equalsIgnoreCase("Date of Publication")){return uuidDateofPublication; |
|
505 |
}else if (key.equalsIgnoreCase("Acknowledgments")){return uuidAcknowledgments; |
|
506 |
}else if (key.equalsIgnoreCase("Original publication")){return uuidOriginalpublication; |
|
507 |
}else if (key.equalsIgnoreCase("Type locality")){return uuidTypelocality; |
|
508 |
}else if (key.equalsIgnoreCase("Validity")){return uuidValidity; |
|
509 |
}else if (key.equalsIgnoreCase("Identification")){return uuidIdentification; |
|
510 |
}else if (key.equalsIgnoreCase("Synonymy")){return uuidSynonymy; |
|
511 |
}else{ |
|
512 |
return null; |
|
513 |
} |
|
514 |
} |
|
515 |
|
|
516 |
|
|
429 | 517 |
|
430 | 518 |
} |
Also available in: Unified diff
some refactoring in the IO classes