Project

General

Profile

« Previous | Next » 

Revision 96533ef2

Added by Andreas Müller about 12 years ago

getAllRelationships reimplemented to match only relevant relationship classes,
Export generics include Transformer type

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/PesiExportActivator.java
98 98
		
99 99
		//make PESI Source
100 100
		Source destination = pesiDestination;
101
		IExportTransformer transformer = new PesiTransformer(destination);
101
		PesiTransformer transformer = new PesiTransformer(destination);
102 102
		
103 103
		PesiExportConfigurator config = PesiExportConfigurator.NewInstance(destination, source, transformer);
104 104
		
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/PesiExportActivatorEM.java
34 34
	private static final Logger logger = Logger.getLogger(PesiExportActivatorEM.class);
35 35

  
36 36
	//database validation status (create, update, validate ...)
37
	static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_EM2PESI();
37
	static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_EM2PESI_tmp();
38 38
//	static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_FE2PESI();
39 39
//	static final Source pesiDestination = PesiDestinations.pesi_test_local_CDM_ERMS2PESI();
40 40
	
41
	static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql();
41
	static final ICdmDataSource cdmSource = CdmDestinations.cdm_test_local_mysql_test();
42 42
	//Taxon names can't be mapped to their CDM ids as PESI Taxon table mainly holds taxa and there IDs. We ad nameIdStart to the TaxonName id to get a unique id
43 43
	static final int nameIdStart = 10000000;
44 44
	static final IdType idType = IdType.CDM_ID_WITH_EXCEPTIONS;
45 45

  
46
	static final int partitionSize = 2000;
46
	static final int partitionSize = 1000;
47 47
	
48 48
	//check - export
49 49
	static final CHECK check = CHECK.EXPORT_WITHOUT_CHECK;
......
62 62
	//taxa
63 63
	static final boolean doTaxa = true;
64 64
	static final boolean doRelTaxa = true;
65
	static final boolean doTreeIndex = true;
66
	static final boolean doRank = true;
65
	static final boolean doTreeIndex = false;
66
	static final boolean doRank = false;
67 67
	static final boolean doInferredSynonyms = false;
68 68
	static final boolean doDescriptions = true;
69 69
	
......
99 99
		
100 100
		//make PESI Source
101 101
		Source destination = pesiDestination;
102
		IExportTransformer transformer = new PesiTransformer(destination);
102
		PesiTransformer transformer = new PesiTransformer(destination);
103 103
		
104 104
		PesiExportConfigurator config = PesiExportConfigurator.NewInstance(destination, source, transformer);
105 105
		
cdm-pesi/src/main/java/eu/etaxonomy/cdm/app/pesi/PesiExportActivatorFE.java
98 98
		
99 99
		//make PESI Source
100 100
		Source destination = pesiDestination;
101
		IExportTransformer transformer = new PesiTransformer(destination);
101
		PesiTransformer transformer = new PesiTransformer(destination);
102 102
		
103 103
		PesiExportConfigurator config = PesiExportConfigurator.NewInstance(destination, source, transformer);
104 104
		
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/ExpertsAndLastActionMapper.java
21 21
import eu.etaxonomy.cdm.io.common.mapping.out.DbLastActionMapper;
22 22
import eu.etaxonomy.cdm.io.common.mapping.out.DbSingleAttributeExportMapperBase;
23 23
import eu.etaxonomy.cdm.io.common.mapping.out.IDbExportMapper;
24
import eu.etaxonomy.cdm.io.common.mapping.out.IExportTransformer;
24 25
import eu.etaxonomy.cdm.io.common.mapping.out.IndexCounter;
25 26
import eu.etaxonomy.cdm.model.common.CdmBase;
26 27

  
......
29 30
 * @created 12.05.2009
30 31
 * @version 1.0
31 32
 */
32
public class ExpertsAndLastActionMapper extends MultipleAttributeMapperBase<DbSingleAttributeExportMapperBase<DbExportStateBase<?>>> implements IDbExportMapper<DbExportStateBase<?>>{
33
public class ExpertsAndLastActionMapper extends MultipleAttributeMapperBase<DbSingleAttributeExportMapperBase<DbExportStateBase<?, IExportTransformer>>> implements IDbExportMapper<DbExportStateBase<?, IExportTransformer>, IExportTransformer>{
33 34
	@SuppressWarnings("unused")
34 35
	private static final Logger logger = Logger.getLogger(ExpertsAndLastActionMapper.class);
35 36
	
......
55 56
	/* (non-Javadoc)
56 57
	 * @see eu.etaxonomy.cdm.io.berlinModel.out.mapper.IDbExportMapper#initialize(java.sql.PreparedStatement, eu.etaxonomy.cdm.io.berlinModel.out.mapper.IndexCounter, eu.etaxonomy.cdm.io.berlinModel.out.DbExportState)
57 58
	 */
58
	public void initialize(PreparedStatement stmt, IndexCounter index, DbExportStateBase<?> state, String tableName) {
59
		for (DbSingleAttributeExportMapperBase<DbExportStateBase<?>> mapper : singleMappers){
59
	public void initialize(PreparedStatement stmt, IndexCounter index, DbExportStateBase<?, IExportTransformer> state, String tableName) {
60
		for (DbSingleAttributeExportMapperBase<DbExportStateBase<?, IExportTransformer>> mapper : singleMappers){
60 61
			mapper.initialize(stmt, index, state, tableName);
61 62
		}	
62 63
	}
......
67 68
	 */
68 69
	public boolean invoke(CdmBase cdmBase) throws SQLException {
69 70
		boolean result = true;
70
		for (DbSingleAttributeExportMapperBase<DbExportStateBase<?>> mapper : singleMappers){
71
		for (DbSingleAttributeExportMapperBase<DbExportStateBase<?, IExportTransformer>> mapper : singleMappers){
71 72
			result &= mapper.invoke(cdmBase);
72 73
		}
73 74
		return result;
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiCollectionExportMapping.java
80 80
					}else if (mapper == this.sequenceMapper){
81 81
						this.sequenceMapper.invoke(null);
82 82
					}else if (mapper instanceof IDbExportMapper){
83
						IDbExportMapper<DbExportStateBase<?>> dbMapper = (IDbExportMapper)mapper;
83
						IDbExportMapper<DbExportStateBase<?, PesiTransformer>, PesiTransformer> dbMapper = (IDbExportMapper)mapper;
84 84
						try {
85 85
							result &= dbMapper.invoke(collectionObject);
86 86
						} catch (Exception e) {
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiDescriptionExport.java
9 9
*/
10 10
package eu.etaxonomy.cdm.io.pesi.out;
11 11

  
12
import static java.util.EnumSet.of;
13

  
12 14
import java.sql.Connection;
13 15
import java.sql.PreparedStatement;
14 16
import java.sql.SQLException;
......
22 24
import org.springframework.transaction.TransactionStatus;
23 25

  
24 26
import eu.etaxonomy.cdm.io.berlinModel.BerlinModelTransformer;
25
import eu.etaxonomy.cdm.io.berlinModel.out.mapper.RefDetailMapper;
26 27
import eu.etaxonomy.cdm.io.common.DbExportStateBase;
27 28
import eu.etaxonomy.cdm.io.common.Source;
28 29
import eu.etaxonomy.cdm.io.common.mapping.UndefinedTransformerMethodException;
29 30
import eu.etaxonomy.cdm.io.common.mapping.out.CollectionExportMapping;
30
import eu.etaxonomy.cdm.io.common.mapping.out.CreatedAndNotesMapper;
31 31
import eu.etaxonomy.cdm.io.common.mapping.out.DbAreaMapper;
32 32
import eu.etaxonomy.cdm.io.common.mapping.out.DbDescriptionElementTaxonMapper;
33 33
import eu.etaxonomy.cdm.io.common.mapping.out.DbDistributionStatusMapper;
34 34
import eu.etaxonomy.cdm.io.common.mapping.out.DbExportIgnoreMapper;
35 35
import eu.etaxonomy.cdm.io.common.mapping.out.DbExportNotYetImplementedMapper;
36 36
import eu.etaxonomy.cdm.io.common.mapping.out.DbLanguageMapper;
37
import eu.etaxonomy.cdm.io.common.mapping.out.DbMarkerMapper;
38 37
import eu.etaxonomy.cdm.io.common.mapping.out.DbObjectMapper;
39 38
import eu.etaxonomy.cdm.io.common.mapping.out.DbOriginalNameMapper;
40 39
import eu.etaxonomy.cdm.io.common.mapping.out.DbSimpleFilterMapper;
......
48 47
import eu.etaxonomy.cdm.model.common.ExtensionType;
49 48
import eu.etaxonomy.cdm.model.common.Language;
50 49
import eu.etaxonomy.cdm.model.common.LanguageString;
51
import eu.etaxonomy.cdm.model.common.MarkerType;
52 50
import eu.etaxonomy.cdm.model.description.CommonTaxonName;
53
import eu.etaxonomy.cdm.model.description.DescriptionBase;
54 51
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
55 52
import eu.etaxonomy.cdm.model.description.Distribution;
56 53
import eu.etaxonomy.cdm.model.description.Feature;
57 54
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
58
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTermBase;
59 55
import eu.etaxonomy.cdm.model.description.TaxonDescription;
60 56
import eu.etaxonomy.cdm.model.description.TaxonInteraction;
61 57
import eu.etaxonomy.cdm.model.description.TextData;
62 58
import eu.etaxonomy.cdm.model.location.NamedArea;
63 59
import eu.etaxonomy.cdm.model.location.TdwgArea;
64
import eu.etaxonomy.cdm.model.name.NomenclaturalStatus;
65 60
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
66 61
import eu.etaxonomy.cdm.model.taxon.Taxon;
67
import static java.util.EnumSet.of;
68 62
/**
69 63
 * The export class for {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase DescriptionElements}.<p>
70 64
 * Inserts into DataWarehouse database table <code>Note</code>.<p>
......
609 603
	 * @param state The {@link DbExportStateBase DbExportState}.
610 604
	 * @return
611 605
	 */
612
	private static Integer getTaxonFk(TaxonNameBase<?,?> taxonName, DbExportStateBase<?> state) {
606
	private static Integer getTaxonFk(TaxonNameBase<?,?> taxonName, DbExportStateBase<?, PesiTransformer> state) {
613 607
		return state.getDbId(taxonName);
614 608
	}
615 609

  
......
632 626
//		mapping.addMapper(MethodMapper.NewInstance("Region", this));
633 627
		mapping.addMapper(DbDescriptionElementTaxonMapper.NewInstance("taxonFk"));
634 628
		mapping.addMapper(ExpertsAndLastActionMapper.NewInstance());
629
		mapping.addCollectionMapping(getNoteSourceMapping());
630
		return mapping;
631
	}
632
	
633
	private CollectionExportMapping<PesiExportState, PesiExportConfigurator,PesiTransformer> getNoteSourceMapping() {
634
		String tableName = "NoteSource";
635
		String collectionAttribute = "sources";
636
		IdMapper parentMapper = IdMapper.NewInstance("NoteFk");
637
		CollectionExportMapping<PesiExportState, PesiExportConfigurator, PesiTransformer> mapping = CollectionExportMapping.NewInstance(tableName, collectionAttribute, parentMapper);
638
		mapping.addMapper(DbSimpleFilterMapper.NewSingleNullAttributeInstance("idInSource", "Sources with idInSource currently handle data lineage"));
639
		mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceFk"));
640
		mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceNameCache", IS_CACHE));
641
		mapping.addMapper(DbStringMapper.NewInstance("CitationMicroReference", "SourceDetail"));
635 642
		return mapping;
636 643
	}
637 644
	
......
663 670
		return mapping;
664 671
	}
665 672

  
666
	private CollectionExportMapping<PesiExportState, PesiExportConfigurator> getOccurrenceSourceMapping() {
673
	private CollectionExportMapping<PesiExportState, PesiExportConfigurator, PesiTransformer> getOccurrenceSourceMapping() {
667 674
		String tableName = "OccurrenceSource";
668 675
		String collectionAttribute = "sources";
669 676
		IdMapper parentMapper = IdMapper.NewInstance("OccurrenceFk");
670
		CollectionExportMapping<PesiExportState, PesiExportConfigurator> mapping = CollectionExportMapping.NewInstance(tableName, collectionAttribute, parentMapper);
677
		CollectionExportMapping<PesiExportState, PesiExportConfigurator, PesiTransformer> mapping = CollectionExportMapping.NewInstance(tableName, collectionAttribute, parentMapper);
671 678
		mapping.addMapper(DbSimpleFilterMapper.NewSingleNullAttributeInstance("idInSource", "Sources with idInSource currently handle data lineage"));
672 679
		mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceFk"));
673 680
		mapping.addMapper(DbObjectMapper.NewInstance("Citation", "SourceNameCache", IS_CACHE));
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiExportBase.java
24 24
import eu.etaxonomy.cdm.model.common.CdmBase;
25 25
import eu.etaxonomy.cdm.model.common.Marker;
26 26
import eu.etaxonomy.cdm.model.common.MarkerType;
27
import eu.etaxonomy.cdm.model.common.RelationshipBase;
28
import eu.etaxonomy.cdm.model.name.HybridRelationship;
27 29
import eu.etaxonomy.cdm.model.name.NameRelationship;
28 30
import eu.etaxonomy.cdm.model.name.NonViralName;
29 31
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
30 32
import eu.etaxonomy.cdm.model.taxon.Synonym;
33
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
31 34
import eu.etaxonomy.cdm.model.taxon.Taxon;
32 35
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
33 36
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
......
39 42
 * @date 12.02.2010
40 43
 *
41 44
 */
42
public abstract class PesiExportBase extends DbExportBase<PesiExportConfigurator, PesiExportState> {
43
	@SuppressWarnings("unused")
45
public abstract class PesiExportBase extends DbExportBase<PesiExportConfigurator, PesiExportState, PesiTransformer> {
44 46
	private static final Logger logger = Logger.getLogger(PesiExportBase.class);
45 47
	
46 48
	public PesiExportBase() {
......
89 91
		}
90 92
		return list;
91 93
	}
94
	
95
	protected <CLASS extends RelationshipBase> List<CLASS> getNextNameRelationshipPartition(Class<CLASS> clazz, int limit, int partitionCount, List<String> propertyPath) {
96
		List<CLASS> result = new ArrayList<CLASS>();
97
		String[] propertyPaths = null;
98
		String orderHints = null;
99
		List<CLASS> list = (List<CLASS>)getNameService().getAllRelationships(limit, partitionCount * limit);
100
		for (CLASS rel : list){
101
			if (isPesiNameRelationship(rel)){
102
				result.add(rel);
103
			}
104
		}
105
		return result;
106
	}
107
	
108
	protected <CLASS extends RelationshipBase> List<CLASS> getNextTaxonRelationshipPartition(Class<CLASS> clazz, int limit, int partitionCount, List<String> propertyPath) {
109
		List<CLASS> result = new ArrayList<CLASS>();
110
		String[] propertyPaths = null;
111
		String orderHints = null;
112
		List<CLASS> list = (List<CLASS>)getTaxonService().getAllRelationships(limit, partitionCount * limit);
113
		for (CLASS rel : list){
114
			if (isPesiTaxonOrSynonymRelationship(rel)){
115
				result.add(rel);
116
			}
117
		}
118
		return result;
119
	}
120
	
121
	protected boolean isPesiNameRelationship(RelationshipBase rel){
122
		TaxonNameBase<?,?> name1;
123
		TaxonNameBase<?,?> name2;
124
		if (rel.isInstanceOf(HybridRelationship.class)){
125
			HybridRelationship hybridRel = CdmBase.deproxy(rel, HybridRelationship.class);
126
			name1 = hybridRel.getParentName();
127
			name2 = hybridRel.getHybridName();
128
		}else if (rel.isInstanceOf(NameRelationship.class)){
129
			NameRelationship nameRel = CdmBase.deproxy(rel, NameRelationship.class);
130
			name1 = nameRel.getFromName();
131
			name2 = nameRel.getToName();
132
		}else{
133
			logger.warn ("Only hybrid- and name-relationships alowed here");
134
			return false;
135
		}
136
		return (isPesiName(name1) && isPesiName(name2));
137
		
138
	}
139
	
140
	private boolean isPesiName(TaxonNameBase<?,?> name) {
141
		return hasPesiTaxon(name) || isPurePesiName(name);
142
	}
143

  
144
	protected boolean isPesiTaxonOrSynonymRelationship(RelationshipBase rel){
145
		TaxonBase<?> taxonBase;
146
		Taxon taxon;
147
		if (rel.isInstanceOf(SynonymRelationship.class)){
148
			SynonymRelationship synRel = CdmBase.deproxy(rel, SynonymRelationship.class);
149
			taxonBase = synRel.getSynonym();
150
			taxon = synRel.getAcceptedTaxon();
151
		}else if (rel.isInstanceOf(TaxonRelationship.class)){
152
			TaxonRelationship taxRel = CdmBase.deproxy(rel, TaxonRelationship.class);
153
			taxonBase = taxRel.getFromTaxon();
154
			taxon = taxRel.getToTaxon();
155
		}else{
156
			logger.warn ("Only synonym - and taxon-relationships alowed here");
157
			return false;
158
		}
159
		return (isPesiTaxon(taxonBase) && isPesiTaxon(taxon));
160
		
161
	}
92 162

  
93 163
	
164

  
94 165
	/**
95 166
	 * Decides if a name is not used as the name part of a PESI taxon (and therefore is
96 167
	 * exported to PESI as taxon already) but is related to a name used as a PESI taxon
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiExportConfigurator.java
24 24
 * @date 12.02.2010
25 25
 *
26 26
 */
27
public class PesiExportConfigurator extends DbExportConfiguratorBase<PesiExportState> implements IExportConfigurator<PesiExportState> {
27
public class PesiExportConfigurator extends DbExportConfiguratorBase<PesiExportState, PesiTransformer> implements IExportConfigurator<PesiExportState, PesiTransformer> {
28 28
	@SuppressWarnings("unused")
29 29
	private static Logger logger = Logger.getLogger(PesiExportConfigurator.class);
30 30
	private int limitSave = 2000;
......
49 49
	
50 50
	private int nameIdStart = 10000000;
51 51

  
52
	public static PesiExportConfigurator NewInstance(Source pesiDestination, ICdmDataSource source, IExportTransformer transformer) {
52
	public static PesiExportConfigurator NewInstance(Source pesiDestination, ICdmDataSource source, PesiTransformer transformer) {
53 53
			return new PesiExportConfigurator(pesiDestination, source, transformer);
54 54
	}
55 55
	
......
75 75
	 * @param cdmSource
76 76
	 * @param transformer 
77 77
	 */
78
	private PesiExportConfigurator(Source pesiSource, ICdmDataSource cdmSource, IExportTransformer transformer) {
78
	private PesiExportConfigurator(Source pesiSource, ICdmDataSource cdmSource, PesiTransformer transformer) {
79 79
	   super(transformer);
80 80
	   setSource(cdmSource);
81 81
	   setDestination(pesiSource);
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiExportMapping.java
18 18
 * @date 24.02.2010
19 19
 *
20 20
 */
21
public class PesiExportMapping extends CdmDbExportMapping<PesiExportState,PesiExportConfigurator> {
21
public class PesiExportMapping extends CdmDbExportMapping<PesiExportState,PesiExportConfigurator, PesiTransformer> {
22 22
	private static final Logger logger = Logger.getLogger(PesiExportMapping.class);
23 23
	
24 24
	public PesiExportMapping(String tableName) {
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiExportState.java
25 25
 * @date 12.02.2010
26 26
 *
27 27
 */
28
public class PesiExportState extends DbExportStateBase<PesiExportConfigurator>{
28
public class PesiExportState extends DbExportStateBase<PesiExportConfigurator, PesiTransformer>{
29 29
	@SuppressWarnings("unused")
30 30
	private static final Logger logger = Logger.getLogger(PesiExportState.class);
31 31
	
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiNoteExport.java
495 495
	 * @see MethodMapper
496 496
	 */
497 497
	@SuppressWarnings("unused")
498
	private static Integer getTaxonFk(DescriptionElementBase descriptionElement, DbExportStateBase<?> state) {
498
	private static Integer getTaxonFk(DescriptionElementBase descriptionElement, DbExportStateBase<?, PesiTransformer> state) {
499 499
		Integer result = null;
500 500
		DescriptionBase<?> inDescription = descriptionElement.getInDescription();
501 501
		if (inDescription != null && inDescription.isInstanceOf(TaxonDescription.class)) {
......
512 512
	 * @param state The {@link DbExportStateBase DbExportState}.
513 513
	 * @return
514 514
	 */
515
	private static Integer getTaxonFk(TaxonNameBase<?,?> taxonName, DbExportStateBase<?> state) {
515
	private static Integer getTaxonFk(TaxonNameBase<?,?> taxonName, DbExportStateBase<?, PesiTransformer> state) {
516 516
		return state.getDbId(taxonName);
517 517
	}
518 518
	
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiRelTaxonExport.java
26 26
import eu.etaxonomy.cdm.model.common.CdmBase;
27 27
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
28 28
import eu.etaxonomy.cdm.model.common.RelationshipBase;
29
import eu.etaxonomy.cdm.model.name.HybridRelationship;
29 30
import eu.etaxonomy.cdm.model.name.NameRelationship;
30 31
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
31 32
import eu.etaxonomy.cdm.model.name.Rank;
......
54 55
	private static final String dbTableName = "RelTaxon";
55 56
	private static final String pluralString = "Relationships";
56 57
	private static PreparedStatement synonymsStmt;
58
	
57 59
	private HashMap<Rank, Rank> rank2endRankMap = new HashMap<Rank, Rank>();
58 60
	private List<Rank> rankList = new ArrayList<Rank>();
59 61
	private PesiExportMapping mapping;
60 62
	private int count = 0;
61
	private static NomenclaturalCode nomenclaturalCode2;
62 63
	
63 64
	public PesiRelTaxonExport() {
64 65
		super();
......
81 82
		return result;
82 83
	}
83 84

  
85
	
84 86
	/* (non-Javadoc)
85 87
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doInvoke(eu.etaxonomy.cdm.io.common.IoStateBase)
86 88
	 */
87 89
	@Override
88 90
	protected void doInvoke(PesiExportState state) {
91
		try {
92
			logger.info("*** Started Making " + pluralString + " ...");
93
	
94
			Connection connection = state.getConfig().getDestination().getConnection();
95
			String synonymsSql = "UPDATE Taxon SET KingdomFk = ?, RankFk = ?, RankCache = ? WHERE TaxonId = ?"; 
96
			synonymsStmt = connection.prepareStatement(synonymsSql);
97

  
98
			// Stores whether this invoke was successful or not.
99
			boolean success = true;
100

  
101
			// PESI: Clear the database table RelTaxon.
102
			doDelete(state);
103
	
104
			// Get specific mappings: (CDM) Relationship -> (PESI) RelTaxon
105
			mapping = getMapping();
106

  
107
			// Initialize the db mapper
108
			mapping.initialize(state);
109
			
110
			//Export Taxa..
111
//			success &= doPhase01(state, mapping);
112

  
113
			
114
			
115
			// 2nd Round: Add ParentTaxonFk, TreeIndex to each Taxon
116
			success &= doPhase02(state, mapping);
117

  
118
		} catch (SQLException e) {
119
			e.printStackTrace();
120
			logger.error(e.getMessage());
121
			state.setUnsuccessfull();
122
			return;
123
		}
124
	}
125
	
126
	
127
	private boolean doPhase01(PesiExportState state, PesiExportMapping mapping2) throws SQLException {
128
		logger.info("PHASE 1: Relationships ...");
129
		boolean success = true;
130
		
131
		int limit = state.getConfig().getLimitSave();
132
		// Start transaction
133
		TransactionStatus txStatus = startTransaction(true);
134
		logger.info("Started new transaction. Fetching some " + pluralString + " (max: " + limit + ") ...");
135
		
136
		List<RelationshipBase> list;
137
		
138
		//taxon relations
139
		int partitionCount = 0;
140
		while ((list = getNextTaxonRelationshipPartition(null, limit, partitionCount++, null)).size() > 0   ) {
141
			for (RelationshipBase rel : list){
142
				try {
143
					mapping.invoke(rel);
144
				} catch (Exception e) {
145
					logger.error(e.getMessage() + ". Relationship: " +  rel.getUuid());
146
					e.printStackTrace();
147
				}
148
			}
149
		}
150
		
151
		return success;
152
	}
153
	
154
	private boolean doPhase02(PesiExportState state, PesiExportMapping mapping2) throws SQLException {
155
		logger.info("PHASE 1: Relationships ...");
156
		boolean success = true;
157
		
158
		int limit = state.getConfig().getLimitSave();
159
		// Start transaction
160
		TransactionStatus txStatus = startTransaction(true);
161
		logger.info("Started new transaction. Fetching some " + pluralString + " (max: " + limit + ") ...");
162
		
163
		List<RelationshipBase> list;
164
		
165
		//name relations
166
		int partitionCount = 0;
167
		while ((list = getNextNameRelationshipPartition(null, limit, partitionCount++, null)).size() > 0   ) {
168
			for (RelationshipBase rel : list){
169
				try {
170
					TaxonNameBase<?,?> name1;
171
					TaxonNameBase<?,?> name2;
172
					if (rel.isInstanceOf(HybridRelationship.class)){
173
						HybridRelationship hybridRel = CdmBase.deproxy(rel, HybridRelationship.class);
174
						name1 = hybridRel.getParentName();
175
						name2 = hybridRel.getHybridName();
176
					}else if (rel.isInstanceOf(NameRelationship.class)){
177
						NameRelationship nameRel = CdmBase.deproxy(rel, NameRelationship.class);
178
						name1 = nameRel.getFromName();
179
						name2 = nameRel.getToName();
180
					}else{
181
						logger.warn ("Only hybrid- and name-relationships alowed here");
182
						continue;
183
					}
184
					List<IdentifiableEntity> fromList = new ArrayList<IdentifiableEntity>();
185
					List<IdentifiableEntity> toList = new ArrayList<IdentifiableEntity>();
186
					makeList(name1, fromList);
187
					makeList(name2, toList);
188
					
189
					for (IdentifiableEntity fromEntity : fromList){
190
						for (IdentifiableEntity toEntity : toList){
191
							//TODO set entities to state
192
							state.setCurrentFromObject(fromEntity);
193
							state.setCurrentToObject(toEntity);
194
							mapping.invoke(rel);
195
						}
196
					}
197
					
198
				} catch (Exception e) {
199
					logger.error(e.getMessage() + ". Relationship: " +  rel.getUuid());
200
					e.printStackTrace();
201
				}
202
			}
203
		}
204

  
205
		
206
		return success;
207
	}
208

  
209
	private void makeList(TaxonNameBase<?, ?> name, List<IdentifiableEntity> list) {
210
		if (! hasPesiTaxon(name)){
211
			list.add(name);
212
		}else{
213
			for (TaxonBase taxon:  getPesiTaxa(name)){
214
				list.add(taxon);
215
			}
216
		}
217
	}
218

  
219
	/* (non-Javadoc)
220
	 * @see eu.etaxonomy.cdm.io.common.CdmIoBase#doInvoke(eu.etaxonomy.cdm.io.common.IoStateBase)
221
	 */
222
	protected void doInvoke_Old(PesiExportState state) {
89 223
		try {
90 224
			logger.info("*** Started Making " + pluralString + " ...");
91 225
	
......
483 617
	 * @see MethodMapper
484 618
	 */
485 619
	@SuppressWarnings("unused")
486
	private static String getRelQualifierCache(RelationshipBase<?, ?, ?> relationship) {
620
	private static String getRelQualifierCache(RelationshipBase<?, ?, ?> relationship, PesiExportState state) {
487 621
		String result = null;
488 622
		NomenclaturalCode code = null;
489 623
		if (relationship.isInstanceOf(TaxonRelationship.class)){
......
494 628
			code = CdmBase.deproxy(relationship,  NameRelationship.class).getFromName().getNomenclaturalCode();
495 629
		}
496 630
		if (code != null) {
497
			result = PesiTransformer.taxonRelation2RelTaxonQualifierCache(relationship, code);
631
			result = state.getConfig().getTransformer().getCacheByRelationshipType(relationship, code);
498 632
		} else {
499 633
			logger.error("NomenclaturalCode is NULL while creating the following relationship: " + relationship.getUuid());
500 634
		}
......
528 662
		} else if (relationship.isInstanceOf(SynonymRelationship.class)) {
529 663
			SynonymRelationship sr = (SynonymRelationship)relationship;
530 664
			taxonBase = (isFrom) ? sr.getSynonym() : sr.getAcceptedTaxon();
531
		} else if (relationship.isInstanceOf(NameRelationship.class)) {
665
		} else if (relationship.isInstanceOf(NameRelationship.class) ||  relationship.isInstanceOf(HybridRelationship.class)) {
532 666
			if (isFrom){
533 667
				return state.getDbId(state.getCurrentFromObject());
534 668
			}else{
......
594 728
		mapping.addMapper(MethodMapper.NewInstance("TaxonFk1", this.getClass(), "getTaxonFk1", standardMethodParameter, PesiExportState.class));
595 729
		mapping.addMapper(MethodMapper.NewInstance("TaxonFk2", this.getClass(), "getTaxonFk2", standardMethodParameter, PesiExportState.class));
596 730
		mapping.addMapper(MethodMapper.NewInstance("RelTaxonQualifierFk", this));
597
		mapping.addMapper(MethodMapper.NewInstance("RelQualifierCache", this));
731
		mapping.addMapper(MethodMapper.NewInstance("RelQualifierCache", this, RelationshipBase.class, PesiExportState.class));
598 732
		mapping.addMapper(MethodMapper.NewInstance("Notes", this));
599 733

  
600 734
		return mapping;
cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiTransformer.java
38 38
import eu.etaxonomy.cdm.model.location.NamedArea;
39 39
import eu.etaxonomy.cdm.model.location.TdwgArea;
40 40
import eu.etaxonomy.cdm.model.location.WaterbodyOrCountry;
41
import eu.etaxonomy.cdm.model.name.HybridRelationshipType;
41 42
import eu.etaxonomy.cdm.model.name.NameRelationshipType;
42 43
import eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus;
43 44
import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
......
47 48
import eu.etaxonomy.cdm.model.reference.Reference;
48 49
import eu.etaxonomy.cdm.model.reference.ReferenceType;
49 50
import eu.etaxonomy.cdm.model.taxon.Synonym;
51
import eu.etaxonomy.cdm.model.taxon.SynonymRelationship;
50 52
import eu.etaxonomy.cdm.model.taxon.SynonymRelationshipType;
51 53
import eu.etaxonomy.cdm.model.taxon.Taxon;
52 54
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
......
219 221
	public static int IS_INFERRED_GENUS_FOR = 302;
220 222
	public static int IS_POTENTIAL_COMBINATION_FOR = 303;
221 223

  
222
	public static String STR_IS_BASIONYM_FOR = "is basionym for";
223 224
	public static String STR_IS_BASIONYM_FOR_ZOOL = "is original combination for";
224
	public static String STR_IS_LATER_HOMONYM_OF = "is later homonym of";
225
	public static String STR_IS_REPLACED_SYNONYM_FOR = "is replaced synonym for";
226
	public static String STR_IS_VALIDATION_OF = "is validation of";
227
	public static String STR_IS_LATER_VALIDATION_OF = "is later validation of";
228
	public static String STR_IS_TYPE_OF = "is type of";
229
	public static String STR_IS_CONSERVED_TYPE_OF = "is conserved type of";
230
	public static String STR_IS_REJECTED_TYPE_OF = "is rejected type of";
231
	public static String STR_IS_FIRST_PARENT_OF = "is first parent of";
232
	public static String STR_IS_SECOND_PARENT_OF = "is second parent of";
233
	public static String STR_IS_FEMALE_PARENT_OF = "is female parent of";
234
	public static String STR_IS_MALE_PARENT_OF = "is male parent of";
235
	public static String STR_IS_CONSERVED_AGAINST = "is conserved against";
236
	public static String STR_IS_REJECTED_IN_FAVOUR_OF = "is rejected in favour of";
237
	public static String STR_IS_TREATED_AS_LATER_HOMONYM_OF = "is treated as later homonym of";
238
	public static String STR_IS_ORTHOGRAPHIC_VARIANT_OF = "is orthographic variant of";
239
	public static String STR_IS_ALTERNATIVE_NAME_FOR = "is alternative name for";
240
	public static String STR_HAS_SAME_TYPE_AS = "has same type as";
241
	public static String STR_IS_LECTOTYPE_OF = "is lectotype of";
242
	public static String STR_TYPE_NOT_DESIGNATED = "type not designated";
243
	public static String STR_IS_TAXONOMICALLY_INCLUDED_IN  = "is taxonomically included in";
244
	public static String STR_IS_SYNONYM_OF = "is synonym of";
245
	public static String STR_IS_MISAPPLIED_NAME_FOR = "is misapplied name for";
246
	public static String STR_IS_PRO_PARTE_SYNONYM_OF = "is pro parte synonym of";
247
	public static String STR_IS_PARTIAL_SYNONYM_OF = "is partial synonym of";
248
	public static String STR_IS_HETEROTYPIC_SYNONYM_OF = "is heterotypic synonym of";
249 225
	public static String STR_IS_HETEROTYPIC_SYNONYM_OF_ZOOL = "is subjective synonym of";
250
	public static String STR_IS_HOMOTYPIC_SYNONYM_OF = "is homotypic synonym of";
251 226
	private static final String STR_IS_HOMOTYPIC_SYNONYM_OF_ZOOL = "is objective synonym of";
252
	public static String STR_IS_PRO_PARTE_AND_HOMOTYPIC_SYNONYM_OF = "is pro parte and homotypic synonym of";
253
	public static String STR_IS_PRO_PARTE_AND_HETEROTYPIC_SYNONYM_OF = "is pro parte and heterotypic synonym of";
254
	public static String STR_IS_PARTIAL_AND_HOMOTYPIC_SYNONYM_OF = "is partial and homotypic synonym of";
255
	public static String STR_IS_PARTIAL_AND_HETEROTYPIC_SYNONYM_OF = "is partial and heterotypic synonym of";
256
	public static String STR_IS_INFERRED_EPITHET_FOR = "is inferred epithet for";
257
	public static String STR_IS_INFERRED_GENUS_FOR = "is inferred genus for";
258
	public static String STR_IS_POTENTIAL_COMBINATION_FOR = "is potential combination for";
259 227
	
228
	
229
	//namespaces
260 230
	public static String STR_NAMESPACE_NOMINAL_TAXON = "Nominal taxon from TAX_ID:";
261 231
	public static String STR_NAMESPACE_INFERRED_EPITHET = "Inferred epithet from TAX_ID:";
262 232
	public static String STR_NAMESPACE_INFERRED_GENUS = "Inferred genus from TAX_ID:";
263 233
	public static String STR_NAMESPACE_POTENTIAL_COMBINATION = "Potential combination from TAX_ID:";
264 234

  
235

  
265 236
	// Kingdoms
266 237
	public static int KINGDOM_NULL = 0;
267 238
	public static int KINGDOM_ANIMALIA = 2;
......
1253 1224
	private Map<String, String> tdwgLabelMap = new HashMap<String, String>();
1254 1225
	private Map<Integer, String> nameStatusCacheMap  = new HashMap<Integer, String>();
1255 1226
	private Map<Integer, String> qualityStatusCacheMap  = new HashMap<Integer, String>();
1227
	private Map<Integer, String> taxRelQualifierCacheMap  = new HashMap<Integer, String>();
1256 1228
	
1257 1229
	
1258 1230
	private Source destination;
......
1298 1270
					this.qualityStatusCacheMap.put(key, cache);
1299 1271
				} 
1300 1272
			}
1273
			//qualityStatusCache
1274
			sql = " SELECT QualifierId, Qualifier FROM RelTaxonQualifier ";
1275
			rs = destination.getResultSet(sql);
1276
			while (rs.next()){
1277
				Integer key = rs.getInt("QualifierId");
1278
				String cache = rs.getString("Qualifier");
1279
				if (StringUtils.isNotBlank(cache)){
1280
					this.taxRelQualifierCacheMap.put(key, cache);
1281
				} 
1282
			}
1283
			
1284
			
1301 1285
					
1302 1286
		} catch (SQLException e) {
1303 1287
			logger.error("SQLException when trying to read area map", e);
......
3514 3498
	 * @param relation
3515 3499
	 * @return
3516 3500
	 */
3517
	public static String taxonRelation2RelTaxonQualifierCache(RelationshipBase<?,?,?> relation, NomenclaturalCode code){
3518
		if (relation == null) {
3501
	public String getCacheByRelationshipType(RelationshipBase relation, NomenclaturalCode code){
3502
		if (relation == null){
3519 3503
			return null;
3520
		}
3521
		RelationshipTermBase<?> type = relation.getType();
3522
		if (type.equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {
3523
			return STR_IS_MISAPPLIED_NAME_FOR;
3524
		} else if (type.equals(SynonymRelationshipType.SYNONYM_OF())) {
3525
			return STR_IS_SYNONYM_OF;
3526
		} else if (type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())) {
3527
			if (code.equals(NomenclaturalCode.ICZN)){
3528
				return STR_IS_HOMOTYPIC_SYNONYM_OF_ZOOL;
3529
			}else{
3530
				return STR_IS_HOMOTYPIC_SYNONYM_OF;
3531
			}
3532
		} else if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())) {
3533
			if (code.equals(NomenclaturalCode.ICZN)){
3534
				return STR_IS_HETEROTYPIC_SYNONYM_OF_ZOOL;
3535
			}else{
3536
				return STR_IS_HETEROTYPIC_SYNONYM_OF;
3537
			}
3538
		} else if (type.equals(SynonymRelationshipType.INFERRED_EPITHET_OF())) {
3539
			return STR_IS_INFERRED_EPITHET_FOR;
3540
		} else if (type.equals(SynonymRelationshipType.INFERRED_GENUS_OF())) {
3541
			return STR_IS_INFERRED_GENUS_FOR;
3542
		} else if (type.equals(SynonymRelationshipType.POTENTIAL_COMBINATION_OF())) {
3543
			return STR_IS_POTENTIAL_COMBINATION_FOR;
3544
		} else if (type.equals(NameRelationshipType.BASIONYM())) {
3504
		}else{
3505
			//preliminary until #2816 is fixed
3506
			RelationshipTermBase<?> type = relation.getType();
3545 3507
			if (code.equals(NomenclaturalCode.ICZN)){
3546
				return STR_IS_BASIONYM_FOR_ZOOL;
3547
			}else{
3548
				return STR_IS_BASIONYM_FOR;
3508
				if (type.equals(NameRelationshipType.BASIONYM())) {
3509
					return STR_IS_BASIONYM_FOR_ZOOL;
3510
				}else if (type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())) {
3511
					return STR_IS_HOMOTYPIC_SYNONYM_OF_ZOOL;
3512
				} else if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())) {
3513
					return STR_IS_HETEROTYPIC_SYNONYM_OF_ZOOL;
3514
				} 
3549 3515
			}
3550
		} else if (type.equals(NameRelationshipType.LATER_HOMONYM())) {
3551
			return STR_IS_LATER_HOMONYM_OF;
3552
		} else if (type.equals(NameRelationshipType.REPLACED_SYNONYM())) {
3553
			return STR_IS_REPLACED_SYNONYM_FOR;
3554
		} else if (type.equals(NameRelationshipType.VALIDATED_BY_NAME())) {
3555
			return STR_IS_VALIDATION_OF;
3556
		} else if (type.equals(NameRelationshipType.LATER_VALIDATED_BY_NAME())) {
3557
			return STR_IS_LATER_VALIDATION_OF;
3558
		} else if (type.equals(NameRelationshipType.CONSERVED_AGAINST())) {
3559
			return STR_IS_CONSERVED_AGAINST;
3560
		} else if (type.equals(NameRelationshipType.TREATED_AS_LATER_HOMONYM())) {
3561
			return STR_IS_TREATED_AS_LATER_HOMONYM_OF;
3562
		} else if (type.equals(NameRelationshipType.ORTHOGRAPHIC_VARIANT())) {
3563
			return STR_IS_ORTHOGRAPHIC_VARIANT_OF;
3564
		} else if (type.equals(NameRelationshipType.ALTERNATIVE_NAME())) {
3565
			return STR_IS_ALTERNATIVE_NAME_FOR;
3566
		} else {
3567
			logger.warn("No equivalent RelationshipType found in datawarehouse for: " + type.getTitleCache());
3568
		}
3516
			//end preliminary
3569 3517
			
3570
		// The following have no equivalent attribute in CDM
3571
//		IS_TYPE_OF
3572
//		IS_CONSERVED_TYPE_OF
3573
//		IS_REJECTED_TYPE_OF
3574
//		IS_FIRST_PARENT_OF
3575
//		IS_SECOND_PARENT_OF
3576
//		IS_FEMALE_PARENT_OF
3577
//		IS_MALE_PARENT_OF
3578
//		IS_REJECTED_IN_FAVOUR_OF
3579
//		HAS_SAME_TYPE_AS
3580
//		IS_LECTOTYPE_OF
3581
//		TYPE_NOT_DESIGNATED
3582
//		IS_PRO_PARTE_SYNONYM_OF
3583
//		IS_PARTIAL_SYNONYM_OF
3584
//		IS_PRO_PARTE_AND_HOMOTYPIC_SYNONYM_OF
3585
//		IS_PRO_PARTE_AND_HETEROTYPIC_SYNONYM_OF
3586
//		IS_PARTIAL_AND_HOMOTYPIC_SYNONYM_OF
3587
//		IS_PARTIAL_AND_HETEROTYPIC_SYNONYM_OF
3588

  
3589
		return null;
3518
			Integer key = taxonRelation2RelTaxonQualifierFk(relation);
3519
			return this.taxRelQualifierCacheMap.get(key); 
3520
		}
3590 3521
	}
3591 3522
	
3592 3523
	/**
......
3602 3533
		if (type.equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())) {
3603 3534
			return IS_MISAPPLIED_NAME_FOR;
3604 3535
		} else if (type.equals(SynonymRelationshipType.SYNONYM_OF())) {
3605
			return IS_SYNONYM_OF;
3536
			SynonymRelationship synRel = CdmBase.deproxy(relation, SynonymRelationship.class);
3537
			if (synRel.isProParte()){
3538
				return IS_PRO_PARTE_SYNONYM_OF;
3539
			}else if (synRel.isPartial()){
3540
				return IS_PARTIAL_SYNONYM_OF;
3541
			}else{
3542
				return IS_SYNONYM_OF;
3543
			}
3606 3544
		} else if (type.equals(SynonymRelationshipType.HOMOTYPIC_SYNONYM_OF())) {
3607
			return IS_HOMOTYPIC_SYNONYM_OF;
3545
			SynonymRelationship synRel = CdmBase.deproxy(relation, SynonymRelationship.class);
3546
			if (synRel.isProParte()){
3547
				return IS_PRO_PARTE_AND_HOMOTYPIC_SYNONYM_OF;
3548
			}else if (synRel.isPartial()){
3549
				return IS_PARTIAL_AND_HOMOTYPIC_SYNONYM_OF;
3550
			}else{
3551
				return IS_HOMOTYPIC_SYNONYM_OF;
3552
			}
3608 3553
		} else if (type.equals(SynonymRelationshipType.HETEROTYPIC_SYNONYM_OF())) {
3609
			return IS_HETEROTYPIC_SYNONYM_OF;
3554
			SynonymRelationship synRel = CdmBase.deproxy(relation, SynonymRelationship.class);
3555
			if (synRel.isProParte()){
3556
				return IS_PRO_PARTE_AND_HETEROTYPIC_SYNONYM_OF;
3557
			}else if (synRel.isPartial()){
3558
				return IS_PARTIAL_AND_HETEROTYPIC_SYNONYM_OF;
3559
			}else{
3560
				return IS_HETEROTYPIC_SYNONYM_OF;
3561
			}
3610 3562
		} else if (type.equals(SynonymRelationshipType.INFERRED_EPITHET_OF())) {
3611 3563
			return IS_INFERRED_EPITHET_FOR;
3612 3564
		} else if (type.equals(SynonymRelationshipType.INFERRED_GENUS_OF())) {
......
3631 3583
			return IS_ORTHOGRAPHIC_VARIANT_OF;
3632 3584
		} else if (type.equals(NameRelationshipType.ALTERNATIVE_NAME())) {
3633 3585
			return IS_ALTERNATIVE_NAME_FOR;
3586
		} else if (type.equals(HybridRelationshipType.FEMALE_PARENT())) {
3587
			return IS_FEMALE_PARENT_OF;
3588
		} else if (type.equals(HybridRelationshipType.MALE_PARENT())) {
3589
			return IS_MALE_PARENT_OF;
3590
		} else if (type.equals(HybridRelationshipType.FIRST_PARENT())) {
3591
			return IS_FIRST_PARENT_OF;
3592
		} else if (type.equals(HybridRelationshipType.SECOND_PARENT())) {
3593
			return IS_SECOND_PARENT_OF;
3594
		
3634 3595
		} else {
3635 3596
			logger.warn("No equivalent RelationshipType found in datawarehouse for: " + type.getTitleCache());
3636 3597
		}
......
3639 3600
//		IS_TYPE_OF
3640 3601
//		IS_CONSERVED_TYPE_OF
3641 3602
//		IS_REJECTED_TYPE_OF
3642
//		IS_FIRST_PARENT_OF
3643
//		IS_SECOND_PARENT_OF
3644
//		IS_FEMALE_PARENT_OF
3645
//		IS_MALE_PARENT_OF
3646 3603
//		IS_REJECTED_IN_FAVOUR_OF
3647 3604
//		HAS_SAME_TYPE_AS
3648 3605
//		IS_LECTOTYPE_OF
3649 3606
//		TYPE_NOT_DESIGNATED
3650
//		IS_PRO_PARTE_SYNONYM_OF
3651
//		IS_PARTIAL_SYNONYM_OF
3652
//		IS_PRO_PARTE_AND_HOMOTYPIC_SYNONYM_OF
3653
//		IS_PRO_PARTE_AND_HETEROTYPIC_SYNONYM_OF
3654
//		IS_PARTIAL_AND_HOMOTYPIC_SYNONYM_OF
3655
//		IS_PARTIAL_AND_HETEROTYPIC_SYNONYM_OF
3607

  
3656 3608

  
3657 3609
		return null;
3658 3610
	}
......
3748 3700
		}else{
3749 3701
			return this.qualityStatusCacheMap.get(qualityStatusId); 
3750 3702
		}
3751

  
3752 3703
	}
3753 3704

  
3754 3705
	public static String getOriginalDbBySources(BitSet sources) {

Also available in: Unified diff