Revision c32ee6d2
Added by Andreas Müller over 4 years ago
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiDescriptionExport.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.io.pesi.out; |
10 | 10 |
|
11 |
import static java.util.EnumSet.of; |
|
12 |
|
|
13 | 11 |
import java.sql.Connection; |
14 | 12 |
import java.sql.PreparedStatement; |
15 | 13 |
import java.sql.SQLException; |
... | ... | |
40 | 38 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbObjectMapper; |
41 | 39 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbOriginalNameMapper; |
42 | 40 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbSimpleFilterMapper; |
43 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbSingleSourceMapper; |
|
44 | 41 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbStringMapper; |
45 | 42 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbTextDataMapper; |
46 | 43 |
import eu.etaxonomy.cdm.io.common.mapping.out.IdMapper; |
... | ... | |
962 | 959 |
"Sources with idInSource currently handle data lineage")); |
963 | 960 |
mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceFk")); |
964 | 961 |
mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceNameCache", IS_CACHE)); |
965 |
mapping.addMapper(DbOriginalNameMapper.NewInstance("OldTaxonName", IS_CACHE, null)); |
|
962 |
mapping.addMapper(DbStringMapper.NewInstance("CitationMicroReference", "SourceDetail")); |
|
963 |
mapping.addMapper(DbOriginalNameMapper.NewInstance("OldTaxonName", IS_CACHE, null)); |
|
966 | 964 |
|
967 | 965 |
return mapping; |
968 | 966 |
} |
... | ... | |
1025 | 1023 |
mapping.addMapper(DbLanguageMapper.NewInstance(CommonTaxonName.class, "Language", "LanguageFk", ! IS_CACHE)); |
1026 | 1024 |
mapping.addMapper(DbLanguageMapper.NewInstance(CommonTaxonName.class, "Language", "LanguageCache", IS_CACHE)); |
1027 | 1025 |
|
1028 |
mapping.addMapper(DbSingleSourceMapper.NewInstance("SourceFk", of ( DbSingleSourceMapper.EXCLUDE.WITH_ID) , ! IS_CACHE)); |
|
1029 |
mapping.addMapper(DbSingleSourceMapper.NewInstance("SourceNameCache", of ( DbSingleSourceMapper.EXCLUDE.WITH_ID) , IS_CACHE)); |
|
1026 |
// Use OccurrenceSource table instead |
|
1027 |
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceFk", "Use CommonNameSource table for sources instead")); |
|
1028 |
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceNameCache", "Use CommonNameSource table for sources instead")); |
|
1029 |
//OLD |
|
1030 |
// mapping.addMapper(DbSingleSourceMapper.NewInstance("SourceFk", of ( DbSingleSourceMapper.EXCLUDE.WITH_ID) , ! IS_CACHE)); |
|
1031 |
// mapping.addMapper(DbSingleSourceMapper.NewInstance("SourceNameCache", of ( DbSingleSourceMapper.EXCLUDE.WITH_ID) , IS_CACHE)); |
|
1030 | 1032 |
|
1031 | 1033 |
mapping.addMapper(ExpertsAndLastActionMapper.NewInstance()); |
1034 |
mapping.addCollectionMapping(getCommonNameSourceMapping()); |
|
1032 | 1035 |
return mapping; |
1033 | 1036 |
} |
1034 | 1037 |
|
1038 |
private CollectionExportMapping<PesiExportState, PesiExportConfigurator, PesiTransformer> getCommonNameSourceMapping() { |
|
1039 |
String tableName = "CommonNameSource"; |
|
1040 |
String collectionAttribute = "sources"; |
|
1041 |
IdMapper parentMapper = IdMapper.NewInstance("CommonNameFk"); |
|
1042 |
@SuppressWarnings("unchecked") |
|
1043 |
CollectionExportMapping<PesiExportState, PesiExportConfigurator, PesiTransformer> mapping |
|
1044 |
= CollectionExportMapping.NewInstance(tableName, collectionAttribute, parentMapper); |
|
1045 |
mapping.addMapper(DbSimpleFilterMapper.NewSingleNullAttributeInstance("idInSource", |
|
1046 |
"Sources with idInSource currently handle data lineage")); |
|
1047 |
mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceFk")); |
|
1048 |
mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceNameCache", IS_CACHE)); |
|
1049 |
mapping.addMapper(DbStringMapper.NewInstance("CitationMicroReference", "SourceDetail")); |
|
1050 |
mapping.addMapper(DbOriginalNameMapper.NewInstance("OldTaxonName", IS_CACHE, null)); |
|
1051 |
|
|
1052 |
return mapping; |
|
1053 |
} |
|
1054 |
|
|
1035 | 1055 |
private PesiExportMapping getImageMapping() { |
1036 | 1056 |
|
1037 | 1057 |
//FIXME does not yet support multiple images per image gallery |
Also available in: Unified diff
ref #8509 adapt description source handling for ERMS export