Project

General

Profile

Revision c2c05353

IDc2c053535437815cffa07f393410f96dc302ccdc
Parent 06bf3273
Child 0d3ee32e

Added by Katja Luther almost 5 years ago

some code cleaning

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonDaoHibernateImpl.java
224 224
                    else {
225 225
                        resultObjects.add( new UuidAndTitleCache(Taxon.class, (UUID) result[0], (Integer) result[1], (String)result[2], new Boolean(result[4].toString()), null));
226 226
                    }
227
//                }else if (doTaxa ){
228
//                        resultObjects.add( new UuidAndTitleCache(Taxon.class, (UUID) result[0], (Integer) result[1], (String)result[2], new Boolean(result[4].toString()), null));
227

  
229 228
                }else if (doSynonyms){
230 229
                    resultObjects.add( new UuidAndTitleCache(Synonym.class, (UUID) result[0], (Integer) result[1], (String)result[2], new Boolean(result[4].toString()), null));
231 230
                }
......
304 303
                selectWhat = (doCount ? "count(t)": "t");
305 304
            }
306 305

  
307
            /*
308
             *   String what = "select distinct";
309

  
310
        String hql= what + " from Taxon t " +
311
        "join t.descriptions d "+
312
        "join d.descriptionElements e " +
313
        "join e.feature f " +
314
        "where f.supportsCommonTaxonName = true and e.name "+matchMode.getMatchOperator()+" :queryString";//and ls.text like 'common%'";
315

  
316
        Query query = getSession().createQuery(hql);
317

  
318
        query.setParameter("queryString", matchMode.queryStringFrom(queryString));
319 306

  
320
        if(pageSize != null &&  !doCount) {
321
            query.setMaxResults(pageSize);
322
            if(pageNumber != null) {
323
                query.setFirstResult(pageNumber * pageSize);
324
            }
325
        }
326
        return query;
327
             */
328 307

  
329 308
            String hql = "";
330 309
            Set<NamedArea> areasExpanded = new HashSet<NamedArea>();
......
1338 1317
        return taxonBase;
1339 1318
    }
1340 1319

  
1341
    public List<TaxonBase> getTaxaByCommonName(String queryString,
1342
            Classification classification, MatchMode matchMode,
1343
            Set<NamedArea> namedAreas, Integer pageSize, Integer pageNumber) {
1344
        logger.warn("getTaxaByCommonName not yet implemented.");
1345
        return null;
1346
    }
1320

  
1347 1321

  
1348 1322
    @Override
1349 1323
    public List<String> taxaByNameNotInDB(List<String> taxonNames){
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/TaxonServiceImpl.java
645 645
        if (configurator.isDoSynonyms() || configurator.isDoTaxa() || configurator.isDoNamesWithoutTaxa() || configurator.isDoTaxaByCommonNames()){
646 646
        	results = dao.getTaxaByNameForEditor(configurator.isDoTaxa(), configurator.isDoSynonyms(), configurator.isDoNamesWithoutTaxa(), configurator.isDoMisappliedNames(), configurator.isDoTaxaByCommonNames(), configurator.getTitleSearchStringSqlized(), configurator.getClassification(), configurator.getMatchMode(), configurator.getNamedAreas());
647 647
        }
648
//        if (configurator.isDoTaxaByCommonNames()) {
649
//            //if(configurator.getPageSize() == null ){
650
//                List<UuidAndTitleCache<IdentifiableEntity>> commonNameResults = dao.getTaxaByCommonNameForEditor(configurator.getTitleSearchStringSqlized(), configurator.getClassification(), configurator.getMatchMode(), configurator.getNamedAreas());
651
//                if(commonNameResults != null){
652
//                    results.addAll(commonNameResults);
653
//                }
654
//           // }
655
//        }
648

  
656 649
        return results;
657 650
    }
658 651

  
......
719 712
            }
720 713
        }
721 714

  
722
        // Taxa from common names
723

  
724
//        if (configurator.isDoTaxaByCommonNames()) {
725
//            taxa = new ArrayList<>();
726
//            numberTaxaResults = 0;
727
//            if(configurator.getPageSize() != null){// no point counting if we need all anyway
728
//                numberTaxaResults = dao.countTaxaByCommonName(configurator.getTitleSearchStringSqlized(), configurator.getClassification(), configurator.getMatchMode(), configurator.getNamedAreas());
729
//            }
730
//            if(configurator.getPageSize() == null || numberTaxaResults > configurator.getPageSize() * configurator.getPageNumber()){
731
//                List<Taxon> commonNameResults = dao.getTaxaByCommonName(configurator.getTitleSearchStringSqlized(), configurator.getClassification(), configurator.getMatchMode(), configurator.getNamedAreas(), configurator.getPageSize(), configurator.getPageNumber(), configurator.getTaxonPropertyPath());
732
//                taxa.addAll(commonNameResults);
733
//            }
734
//            if(taxa != null){
735
//                results.addAll(taxa);
736
//            }
737
//            numberOfResults += numberTaxaResults;
738
//
739
//        }
715

  
740 716

  
741 717
       return new DefaultPagerImpl<>
742 718
            (configurator.getPageNumber(), numberOfResults, configurator.getPageSize(), results);

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)