Project

General

Profile

« Previous | Next » 

Revision 055909db

Added by Andreas Müller over 12 years ago

exclude relationships to Misapplied names

View differences:

cdm-pesi/src/main/java/eu/etaxonomy/cdm/io/pesi/out/PesiExportBase.java
15 15
import java.util.Iterator;
16 16
import java.util.List;
17 17
import java.util.Set;
18
import java.util.UUID;
18 19

  
19 20
import org.apache.log4j.Logger;
20 21

  
......
26 27
import eu.etaxonomy.cdm.model.common.Marker;
27 28
import eu.etaxonomy.cdm.model.common.MarkerType;
28 29
import eu.etaxonomy.cdm.model.common.RelationshipBase;
30
import eu.etaxonomy.cdm.model.description.Feature;
29 31
import eu.etaxonomy.cdm.model.description.TaxonNameDescription;
30 32
import eu.etaxonomy.cdm.model.name.HybridRelationship;
31 33
import eu.etaxonomy.cdm.model.name.NameRelationship;
......
208 210
			logger.warn ("Only synonym - and taxon-relationships alowed here");
209 211
			return false;
210 212
		}
211
		return (isPesiTaxon(taxonBase) && isPesiTaxon(taxon));
213
		return (isPesiTaxon(taxonBase, true) && isPesiTaxon(taxon, true));
212 214
		
213 215
	}
214 216

  
......
308 310
	}
309 311

  
310 312

  
313
	protected static boolean isPesiTaxon(TaxonBase taxonBase) {
314
		return isPesiTaxon(taxonBase, false);
315
	}
316

  
317
	
311 318
	/**
312 319
	 * Checks if this taxon base is a taxon that is to be exported to PESI. This is generally the case
313 320
	 * but not for taxa that are marked as "unpublish". Synonyms and misapplied names are exported if they are
......
317 324
	 * @param taxonBase
318 325
	 * @return
319 326
	 */
320
	protected static boolean isPesiTaxon(TaxonBase taxonBase) {
327
	protected static boolean isPesiTaxon(TaxonBase taxonBase, boolean excludeMisappliedNames) {
321 328
		//handle accepted taxa
322 329
		if (taxonBase.isInstanceOf(Taxon.class)){
323 330
			Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
......
341 348
				return true;
342 349
			//handle misapplied names
343 350
			}else{
351
				if (excludeMisappliedNames){
352
					return false;
353
				}
344 354
				for (Marker marker : taxon.getMarkers()){
345 355
					//probably not needed any more after #2786 was fixed
346 356
					if (marker.getValue() == true && marker.getMarkerType().getUuid().equals(BerlinModelTransformer.uuidMisappliedCommonName)){
......
350 360
				}
351 361
				for (TaxonRelationship taxRel : taxon.getRelationsFromThisTaxon()){
352 362
					if (taxRel.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())){
353
						if (isPesiTaxon(taxRel.getToTaxon())){
363
//						logger.warn(taxRel.getUuid() + "; " + taxRel.getToTaxon().getUuid() + " + " + taxRel.getToTaxon().getTitleCache());
364
						if (isPesiTaxon(taxRel.getToTaxon(), true)){
354 365
							return true;
355 366
						}
356 367
					}

Also available in: Unified diff