Project

General

Profile

« Previous | Next » 

Revision 2d4607f2

Added by Anahit Babadshanjan over 15 years ago

TypeDesignationStatus renamed to SpecimenTypeDesignationStatus

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/common/IdentifiableEntity.java
335 335
		 // TODO: Avoid using instanceof operator
336 336
		 // Use Class.getDeclaredMethod() instead to find out whether class has getNameCache() method?
337 337

  
338
		 // Compare name cache
339 338
		 String specifiedNameCache = "";
340 339
		 String thisNameCache = "";
340
		 String specifiedTitleCache = "";
341
		 String thisTitleCache = "";
342
		 String specifiedReferenceTitleCache = "";
343
		 String thisReferenceTitleCache = "";	
341 344
		 
342 345
		 if(identifiableEntity instanceof NonViralName) {
343 346
			 specifiedNameCache = HibernateProxyHelper.deproxy(identifiableEntity, NonViralName.class).getNameCache();
347
			 specifiedTitleCache = identifiableEntity.getTitleCache();
344 348
		 } else if(identifiableEntity instanceof TaxonBase) {
345 349
			 TaxonBase taxonBase = HibernateProxyHelper.deproxy(identifiableEntity, TaxonBase.class);
346 350
			 TaxonNameBase<?,?> taxonNameBase= taxonBase.getName();
347 351
			 specifiedNameCache = HibernateProxyHelper.deproxy(taxonNameBase, NonViralName.class).getNameCache();
352
			 specifiedTitleCache = taxonNameBase.getTitleCache();
353
			 specifiedReferenceTitleCache = ((TaxonBase)identifiableEntity).getSec().getTitleCache();
348 354
		 }
349 355
		 
350 356
		 if(this instanceof NonViralName) {
351 357
			 thisNameCache = HibernateProxyHelper.deproxy(this, NonViralName.class).getNameCache();
358
			 thisTitleCache = getTitleCache();
352 359
		 } else if(this instanceof TaxonBase) {
353 360
			 TaxonNameBase<?,?> taxonNameBase= HibernateProxyHelper.deproxy(this, TaxonBase.class).getName();
354 361
			 thisNameCache = HibernateProxyHelper.deproxy(taxonNameBase, NonViralName.class).getNameCache();
362
			 thisTitleCache = taxonNameBase.getTitleCache();
363
			 thisReferenceTitleCache = getTitleCache();
355 364
		 }
356 365
		 
366
		 // Compare name cache of taxon names
367

  
357 368
		 if (!specifiedNameCache.equals("") && !thisNameCache.equals("")) {
358 369
			 result = thisNameCache.compareTo(specifiedNameCache);
359 370
		 }
360 371
		 
361
		 // Compare title cache
362
		 if (result == 0) {
363
			 String thisTitleCache = getTitleCache();
364
			 String specifiedTitleCache = identifiableEntity.getTitleCache();
372
		 // Compare title cache of taxon names
373
		 
374
		 if ((result == 0) && !specifiedTitleCache.equals("") && !thisTitleCache.equals("")) {
365 375
			 result = thisTitleCache.compareTo(specifiedTitleCache);
366 376
		 }
377
		 
378
		 // Compare title cache of taxon references
379
		 
380
		 if ((result == 0) && !specifiedReferenceTitleCache.equals("") && !thisReferenceTitleCache.equals("")) {
381
			 result = thisReferenceTitleCache.compareTo(specifiedReferenceTitleCache);
382
		 }
383
		 
367 384
		 return result;
368 385
	 }
369 386
	 

Also available in: Unified diff