Project

General

Profile

Revision dce01054

IDdce010542cdd705b4dbf8fd20eb9111e7935ecda
Parent 603aecbe
Child bc3200a9

Added by Andreas Müller almost 3 years ago

ref #7745 subtree filter to taxon search (add missing parameter for queries)

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonDaoHibernateImpl.java
196 196
        }else{
197 197
            return new ArrayList<>();
198 198
        }
199

  
200

  
201 199
    }
202 200

  
203

  
204 201
    //new search for the editor, for performance issues the return values are only uuid and titleCache, to avoid the initialisation of all objects
205 202
    @Override
206 203
    @SuppressWarnings("unchecked")
......
376 373
                // find Taxa
377 374
                Query subTaxon = getSearchQueryString(hqlQueryString, taxonSubselect);
378 375

  
379
                addRestrictions(doAreaRestriction, classification, includeUnpublished,
376
                addRestrictions(doAreaRestriction, classification, subtree, includeUnpublished,
380 377
                        namedAreasUuids, subTaxon);
381 378
                taxonIDs = subTaxon.list();
382 379
            }
......
384 381
            if(doSynonyms){
385 382
                // find synonyms
386 383
                Query subSynonym = getSearchQueryString(hqlQueryString, synonymSubselect);
387
                addRestrictions(doAreaRestriction, classification, includeUnpublished, namedAreasUuids,subSynonym);
384
                addRestrictions(doAreaRestriction, classification, subtree, includeUnpublished, namedAreasUuids,subSynonym);
388 385
                synonymIDs = subSynonym.list();
389 386
            }
390 387
            if (doConceptRelations ){
......
397 394
                    relTypeSet.addAll(TaxonRelationshipType.allSynonymTypes());
398 395
                }
399 396
                subMisappliedNames.setParameterList("rTypeSet", relTypeSet);
400
                addRestrictions(doAreaRestriction, classification, includeUnpublished, namedAreasUuids, subMisappliedNames);
397
                addRestrictions(doAreaRestriction, classification, subtree, includeUnpublished, namedAreasUuids, subMisappliedNames);
401 398
                taxonIDs.addAll(subMisappliedNames.list());
402 399
            }
403 400

  
404 401
            if(doCommonNames){
405 402
                // find Taxa
406 403
                Query subCommonNames = getSearchQueryString(hqlQueryString, commonNameSubSelect);
407
                addRestrictions(doAreaRestriction, classification, includeUnpublished, namedAreasUuids, subCommonNames);
404
                addRestrictions(doAreaRestriction, classification, subtree, includeUnpublished, namedAreasUuids, subCommonNames);
408 405
                taxonIDs.addAll(subCommonNames.list());
409 406
            }
410 407

  
......
514 511
     * @param includeUnpublished
515 512
     * @param classification
516 513
     * @param doAreaRestriction
514
     * @param subtree
517 515
     * @param namedAreasUuids
518 516
     * @param subTaxon
519 517
     */
520
    protected void addRestrictions(boolean doAreaRestriction, Classification classification, boolean includeUnpublished,
518
    protected void addRestrictions(boolean doAreaRestriction, Classification classification, TaxonNode subtree, boolean includeUnpublished,
521 519
            Set<UUID> namedAreasUuids, Query query) {
522 520
        if(doAreaRestriction){
523 521
            query.setParameterList("namedAreasUuids", namedAreasUuids);
......
525 523
        if(classification != null){
526 524
            query.setParameter("classification", classification);
527 525
        }
526
        if(subtree != null){
527
            query.setParameter("treeIndexLike", subtree.treeIndex() + "%");
528
        }
528 529
        if(!includeUnpublished){
529 530
            query.setBoolean("publish", true);
530 531
        }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)