Project

General

Profile

task #8907

replace UuidAndTitleCacheTaxonComparator by type save implementation

Added by Andreas Kohlbecker 2 months ago. Updated 2 months ago.

Status:
Resolved
Priority:
Highest
Category:
cdmlib
Target version:
Start date:
03/26/2020
Due date:
% Done:

50%

Severity:
normal

Description

copied from #8892:

UuidAndTitleCacheTaxonComparator is used by different methods which pass Object array with different content:

  • TaxonNodeDaoHibernateImpl.getTaxonNodeDto(Integer limit, String pattern, UUID classificationUuid) ==> tn.uuid, tn.id, t.titleCache, t.name, rank
  • TaxonNodeDaoHibernateImpl.getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(..) ==> nodes.uuid, nodes.id, taxon.titleCache, taxon.name, rank
  • TaxonNodeDaoHibernateImpl.getUuidAndTitleCache(Integer limit, String pattern, UUID classificationUuid) ==> 'tn.uuid, tn.id, t.titleCache, name, name_rank'
  • TaxonDaoHibernateImpl.getUuidAndTitleCache ==> tb.uuid, tb.id, tb.titleCache, tb.name.rank BUG: rank is passed instead of name here!
  • IdentifiableDaoBase.getUuidAndTitleCache ==> uuid, id, titleCache SCARY: It seems as if this comparator has initially been used to compare arbitrary IndentifieableEntities. for my feeling this comparator is too much overloaded

Since UuidAndTitleCacheTaxonComparator is used a lot by methods it is quite unsave that it takes object arrays as parameters. We need a comparator for more specific dto class instead.

Suggested solution:

  • create specific comparator SortableTaxonNodeQueryResultComparator implements Comparator<SortableTaxonNodeQueryResult> whereas SortableTaxonNodeQueryResult is a sortable dto which will never leave the persistence layer.

Additinal task:

  • clean up TaxonNodeDaoHibernateImplTest.findWithoutRank.xml from unused data

Related issues

Copied from Edit - bug #8892: Taxon search does not work for names without rank Closed 03/13/2020

Associated revisions

Revision db026829 (diff)
Added by Andreas Kohlbecker 2 months ago

ref #8907 SortableTaxonNodeQueryResultComparator to replace UuidAndTitleCacheTaxonComparator

Revision f4f6d97b (diff)
Added by Andreas Kohlbecker 2 months ago

ref #8907 SortableTaxonNodeQueryResultComparator to replace UuidAndTitleCacheTaxonComparator - step 2

Revision 49bfebfd (diff)
Added by Andreas Kohlbecker 2 months ago

ref #8907 cleaning up test data

Revision 79ff326b (diff)
Added by Andreas Kohlbecker 2 months ago

ref #8907 basing testGetTaxonNodeUuidAndTitleCacheOfacceptedTaxaByClassificationForNameWithoutRank on TaxonNodeDaoHibernateImplTest.findWithoutRank.xml

Revision 3c9af367 (diff)
Added by Andreas Kohlbecker about 2 months ago

ref #8907 adding missing constructor to hql query

Revision 5db2ebcd (diff)
Added by Andreas Kohlbecker about 2 months ago

ref #8907 adapting method to SortableTaxonNodeQueryResult and fixing NPE

Revision f84a4e81 (diff)
Added by Andreas Kohlbecker about 2 months ago

ref #8907 adapting method to SortableTaxonNodeQueryResult - adding test

History

#1 Updated by Andreas Kohlbecker 2 months ago

  • Copied from bug #8892: Taxon search does not work for names without rank added

#2 Updated by Andreas Kohlbecker 2 months ago

  • Description updated (diff)

#3 Updated by Andreas Kohlbecker 2 months ago

  • Subject changed from replace UuidAndTitleCacheTaxonComparator by typesave implementation to replace UuidAndTitleCacheTaxonComparator by type save implementation
  • Status changed from New to Resolved
  • Assignee changed from Andreas Kohlbecker to Andreas Müller
  • % Done changed from 0 to 50

ticket completed.

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)