Project

General

Profile

Revision 51f7c673

ID51f7c673f6de3dca79c1a36894a3f1ea0d245706
Parent 7659b935
Child 869c3f85

Added by Andreas Kohlbecker over 5 years ago

performance improvement
- avoiding cast
- avoiding sorting the list of taxa

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/description/TransmissionEngineDistribution.java
59 59
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
60 60
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
61 61
import eu.etaxonomy.cdm.persistence.dto.ClassificationLookupDTO;
62
import eu.etaxonomy.cdm.persistence.query.OrderHint;
62 63

  
63 64
/**
64 65
 *
......
144 145

  
145 146
    private final Map<NamedArea, Set<NamedArea>> subAreaMap = new HashMap<NamedArea, Set<NamedArea>>();
146 147

  
148
    private final List<OrderHint> emptyOrderHints = new ArrayList<OrderHint>(0);
149

  
147 150

  
148 151
    /**
149 152
     * byAreaIgnoreStatusList contains by default:
......
440 443

  
441 444
//            logger.debug("accumulateByArea() - taxon " + taxonPager.getFirstRecord() + " to " + taxonPager.getLastRecord() + " of " + taxonPager.getCount() + "]");
442 445

  
443
            taxa = taxonService.listByIds(taxonIds, null, null, null, TAXONDESCRIPTION_INIT_STRATEGY);
446
            taxa = taxonService.listByIds(taxonIds, null, null, emptyOrderHints, TAXONDESCRIPTION_INIT_STRATEGY);
444 447

  
445 448
            // iterate over the taxa and accumulate areas
446
            for(TaxonBase taxon : taxa) {
449
            for(TaxonBase taxonBase : taxa) {
447 450
                if(logger.isDebugEnabled()){
448
                    logger.debug("accumulateByArea() - taxon :" + taxonToString(taxon));
451
                    logger.debug("accumulateByArea() - taxon :" + taxonToString(taxonBase));
449 452
                }
450 453

  
451
                TaxonDescription description = findComputedDescription((Taxon)taxon, doClearDescriptions);
452
                List<Distribution> distributions = distributionsFor((Taxon)taxon);
454
                Taxon taxon = (Taxon)taxonBase;
455
                TaxonDescription description = findComputedDescription(taxon, doClearDescriptions);
456
                List<Distribution> distributions = distributionsFor(taxon);
457

  
453 458

  
454 459
                // Step through superAreas for accumulation of subAreas
455 460
                for (NamedArea superArea : superAreaList){
......
511 516
        subMonitor.done();
512 517
    }
513 518

  
514
    /**
515
     * @param taxon
516
     * @param logger2
517
     * @return
518
     */
519
    private String taxonToString(TaxonBase taxon) {
520
        if(logger.isTraceEnabled()) {
521
            return taxon.getTitleCache();
522
        } else {
523
            return taxon.toString();
524
        }
525
    }
526

  
527
    /**
528
     * @param taxon
529
     * @param logger2
530
     * @return
531
     */
532
    private String termToString(OrderedTermBase<?> term) {
533
        if(logger.isTraceEnabled()) {
534
            return term.getLabel() + " [" + term.getIdInVocabulary() + "]";
535
        } else {
536
            return term.getIdInVocabulary();
537
        }
538
    }
539

  
540 519
   /**
541 520
    * Step 2: Accumulate by ranks staring from lower rank to upper rank, the status of all children
542 521
    * are accumulated on each rank starting from lower rank to upper rank.
......
834 813
    }
835 814

  
836 815
    /**
816
     * @param taxon
817
     * @param logger2
818
     * @return
819
     */
820
    private String taxonToString(TaxonBase taxon) {
821
        if(logger.isTraceEnabled()) {
822
            return taxon.getTitleCache();
823
        } else {
824
            return taxon.toString();
825
        }
826
    }
827

  
828
    /**
829
     * @param taxon
830
     * @param logger2
831
     * @return
832
     */
833
    private String termToString(OrderedTermBase<?> term) {
834
        if(logger.isTraceEnabled()) {
835
            return term.getLabel() + " [" + term.getIdInVocabulary() + "]";
836
        } else {
837
            return term.getIdInVocabulary();
838
        }
839
    }
840

  
841
    /**
837 842
     * Sets the priorities for presence and absence terms, the priorities are stored in extensions.
838 843
     * This method will start a new transaction and commits it after the work is done.
839 844
     */

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)