13 |
13 |
import java.sql.SQLException;
|
14 |
14 |
import java.sql.Types;
|
15 |
15 |
import java.util.Arrays;
|
|
16 |
import java.util.EnumSet;
|
16 |
17 |
import java.util.HashSet;
|
17 |
18 |
import java.util.List;
|
18 |
19 |
import java.util.Map;
|
... | ... | |
34 |
35 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbDistributionStatusMapper;
|
35 |
36 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbExportIgnoreMapper;
|
36 |
37 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbLanguageMapper;
|
|
38 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbNullMapper;
|
37 |
39 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbObjectMapper;
|
38 |
40 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbOriginalNameMapper;
|
39 |
41 |
import eu.etaxonomy.cdm.io.common.mapping.out.DbSimpleFilterMapper;
|
... | ... | |
46 |
48 |
import eu.etaxonomy.cdm.model.common.ExtensionType;
|
47 |
49 |
import eu.etaxonomy.cdm.model.common.Language;
|
48 |
50 |
import eu.etaxonomy.cdm.model.common.LanguageString;
|
49 |
|
import eu.etaxonomy.cdm.model.common.Marker;
|
50 |
|
import eu.etaxonomy.cdm.model.common.MarkerType;
|
51 |
51 |
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
|
52 |
52 |
import eu.etaxonomy.cdm.model.description.DescriptionBase;
|
53 |
53 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
... | ... | |
62 |
62 |
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
|
63 |
63 |
import eu.etaxonomy.cdm.model.media.MediaRepresentationPart;
|
64 |
64 |
import eu.etaxonomy.cdm.model.name.TaxonName;
|
|
65 |
import eu.etaxonomy.cdm.model.reference.OriginalSourceType;
|
65 |
66 |
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
66 |
67 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
67 |
68 |
import eu.etaxonomy.cdm.profiler.ProfilerController;
|
... | ... | |
98 |
99 |
//debugging
|
99 |
100 |
private static int countDescriptions;
|
100 |
101 |
private static int countTaxa;
|
101 |
|
private static int countDistribution;
|
|
102 |
private static int countDistributionFiltered;
|
102 |
103 |
private static int countAdditionalSources;
|
103 |
104 |
private static int countImages;
|
104 |
105 |
private static int countNotes;
|
... | ... | |
229 |
230 |
logger.info("Partition: " + partitionCount);
|
230 |
231 |
logger.info("Taxa: " + countTaxa);
|
231 |
232 |
logger.info("Desc: " + countDescriptions);
|
232 |
|
logger.info("Distr: " + countDistribution);
|
233 |
|
logger.info("Occur: " + countOccurrence);
|
|
233 |
logger.info("Distr: " + countOccurrence);
|
|
234 |
logger.info("Distr(Pesi): " + countDistributionFiltered);
|
234 |
235 |
logger.info("Commons: " + countCommonName);
|
235 |
236 |
logger.info("AddSrc: " + countAdditionalSources);
|
236 |
237 |
logger.info("Images: " + countImages);
|
... | ... | |
305 |
306 |
logger.info("Partition: " + partitionCount);
|
306 |
307 |
logger.info("Taxa: " + countTaxa);
|
307 |
308 |
logger.info("Desc: " + countDescriptions);
|
308 |
|
logger.info("Distr: " + countDistribution);
|
309 |
309 |
logger.info("Occur: " + countOccurrence);
|
|
310 |
logger.info("Distr(Pesi): " + countDistributionFiltered);
|
310 |
311 |
logger.info("Commons: " + countCommonName);
|
311 |
312 |
logger.info("AddSrc: " + countAdditionalSources);
|
312 |
313 |
logger.info("Images: " + countImages);
|
... | ... | |
364 |
365 |
}else if (isOccurrence(element)){
|
365 |
366 |
countOccurrence++;
|
366 |
367 |
Distribution distribution = CdmBase.deproxy(element, Distribution.class);
|
367 |
|
MarkerType markerType = getUuidMarkerType(PesiTransformer.uuidMarkerTypeHasNoLastAction, state);
|
368 |
|
distribution.addMarker(Marker.NewInstance(markerType, true));
|
|
368 |
// MarkerType markerType = getUuidMarkerType(PesiTransformer.uuidMarkerTypeHasNoLastAction, state);
|
|
369 |
// distribution.addMarker(Marker.NewInstance(markerType, true));
|
369 |
370 |
if (!isPesiDistribution(state, distribution)){
|
370 |
371 |
logger.debug("Distribution is not PESI distribution: " + distribution.toString());
|
371 |
372 |
}else{
|
372 |
|
countDistribution++;
|
|
373 |
countDistributionFiltered++;
|
373 |
374 |
try{
|
374 |
375 |
success &=occurrenceMapping.invoke(distribution);
|
375 |
376 |
}catch(Exception e){
|
... | ... | |
872 |
873 |
//TODO
|
873 |
874 |
mapping.addMapper(MethodMapper.NewInstance("Note_2", this, standardMethodParameter));
|
874 |
875 |
mapping.addMapper(MethodMapper.NewInstance("NoteCategoryFk", this, standardMethodParameter ));
|
875 |
|
|
876 |
876 |
mapping.addMapper(MethodMapper.NewInstance("NoteCategoryCache", this, standardMethodParameter, PesiExportState.class ));
|
|
877 |
|
877 |
878 |
mapping.addMapper(MethodMapper.NewInstance("LanguageFk", this));
|
878 |
879 |
mapping.addMapper(MethodMapper.NewInstance("LanguageCache", this, standardMethodParameter, PesiExportState.class));
|
879 |
880 |
|
880 |
881 |
// mapping.addMapper(MethodMapper.NewInstance("Region", this));
|
881 |
882 |
mapping.addMapper(DbDescriptionElementTaxonMapper.NewInstance("taxonFk"));
|
|
883 |
|
882 |
884 |
mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());
|
|
885 |
|
883 |
886 |
mapping.addCollectionMapping(getNoteSourceMapping());
|
884 |
887 |
return mapping;
|
885 |
888 |
}
|
... | ... | |
892 |
895 |
CollectionExportMapping<PesiExportState, PesiExportConfigurator, PesiTransformer> mapping
|
893 |
896 |
= CollectionExportMapping.NewInstance(tableName, collectionAttribute, parentMapper);
|
894 |
897 |
mapping.addMapper(DbSimpleFilterMapper.NewSingleNullAttributeInstance("idInSource", "Sources with idInSource currently handle data lineage"));
|
895 |
|
mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceFk"));
|
|
898 |
mapping.addMapper(DbObjectMapper.NewNotNullInstance("Citation", "SourceFk"));
|
896 |
899 |
mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceNameCache", IS_CACHE));
|
897 |
900 |
mapping.addMapper(DbStringMapper.NewInstance("CitationMicroReference", "SourceDetail"));
|
898 |
901 |
return mapping;
|
... | ... | |
915 |
918 |
mapping.addMapper(DbDistributionStatusMapper.NewInstance("OccurrenceStatusCache", IS_CACHE));
|
916 |
919 |
|
917 |
920 |
// Use OccurrenceSource table instead
|
918 |
|
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceFk", "Use OccurrenceSource table for sources instead"));
|
919 |
|
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceCache", "Use OccurrenceSource table for sources instead"));
|
|
921 |
mapping.addMapper(DbNullMapper.NewIntegerInstance("SourceFk"));
|
|
922 |
mapping.addMapper(DbNullMapper.NewStringInstance("SourceCache"));
|
920 |
923 |
|
921 |
924 |
mapping.addMapper(DbAnnotationMapper.NewExludedInstance(getLastActionAnnotationTypes(), "Notes"));
|
922 |
925 |
mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());
|
|
926 |
|
923 |
927 |
mapping.addCollectionMapping(getOccurrenceSourceMapping());
|
924 |
928 |
|
925 |
929 |
return mapping;
|
... | ... | |
934 |
938 |
= CollectionExportMapping.NewInstance(tableName, collectionAttribute, parentMapper);
|
935 |
939 |
mapping.addMapper(DbSimpleFilterMapper.NewSingleNullAttributeInstance("idInSource",
|
936 |
940 |
"Sources with idInSource currently handle data lineage"));
|
937 |
|
mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceFk"));
|
|
941 |
mapping.addMapper(DbSimpleFilterMapper.NewAllowedValueInstance("idInSource",
|
|
942 |
EnumSet.of(OriginalSourceType.PrimaryTaxonomicSource, OriginalSourceType.PrimaryMediaSource, OriginalSourceType.Aggregation),
|
|
943 |
null, "Only primary taxonomic sources should be exported"));
|
|
944 |
mapping.addMapper(DbObjectMapper.NewNotNullInstance("Citation", "SourceFk"));
|
938 |
945 |
mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceNameCache", IS_CACHE));
|
939 |
946 |
mapping.addMapper(DbStringMapper.NewInstance("CitationMicroReference", "SourceDetail"));
|
940 |
947 |
mapping.addMapper(DbOriginalNameMapper.NewInstance("OldTaxonName", IS_CACHE, null));
|
... | ... | |
1000 |
1007 |
mapping.addMapper(DbLanguageMapper.NewInstance(CommonTaxonName.class, "Language", "LanguageFk", ! IS_CACHE));
|
1001 |
1008 |
mapping.addMapper(DbLanguageMapper.NewInstance(CommonTaxonName.class, "Language", "LanguageCache", IS_CACHE));
|
1002 |
1009 |
|
1003 |
|
// Use OccurrenceSource table instead
|
1004 |
|
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceFk", "Use CommonNameSource table for sources instead"));
|
1005 |
|
mapping.addMapper(DbExportIgnoreMapper.NewInstance("SourceNameCache", "Use CommonNameSource table for sources instead"));
|
|
1010 |
// Use CommonNameSource table instead
|
|
1011 |
mapping.addMapper(DbNullMapper.NewIntegerInstance("SourceFk"));
|
|
1012 |
mapping.addMapper(DbNullMapper.NewStringInstance("SourceNameCache"));
|
1006 |
1013 |
//OLD
|
1007 |
1014 |
// mapping.addMapper(DbSingleSourceMapper.NewInstance("SourceFk", of ( DbSingleSourceMapper.EXCLUDE.WITH_ID) , ! IS_CACHE));
|
1008 |
1015 |
// mapping.addMapper(DbSingleSourceMapper.NewInstance("SourceNameCache", of ( DbSingleSourceMapper.EXCLUDE.WITH_ID) , IS_CACHE));
|
1009 |
1016 |
|
1010 |
|
mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());
|
|
1017 |
//no SpeciesExpertGUID and SpeciesExpertName for E+M according to SQL
|
|
1018 |
mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());
|
|
1019 |
|
1011 |
1020 |
mapping.addCollectionMapping(getCommonNameSourceMapping());
|
1012 |
1021 |
return mapping;
|
1013 |
1022 |
}
|
ref #2717 some fixes E+M Pesi export