Project

General

Profile

Revision b4262d8b

IDb4262d8bb5df9a78378a372ff362d0ce1fa47117
Parent a78fdbaf
Child 4926c3dc

Added by Patrick Plitzner almost 2 years ago

ref #8011 Add service method to find DerivateDtos

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java
681 681
            FindOccurrencesConfigurator config);
682 682

  
683 683
    /**
684
     * Returns a list of {@link PreservedSpecimenDTO} for the specimens found with the
685
     * given configurator
686
     * @param config the configurator for the search
687
     * @return a list of {@link PreservedSpecimenDTO} object
688
     */
689
    @Transactional(readOnly = true)
690
    public List<PreservedSpecimenDTO> findByTitlePreservedSpecimenDTO(
691
            FindOccurrencesConfigurator config);
692

  
693
    /**
684 694
     * @param queryString
685 695
     * @param propertyPaths
686 696
     * @return
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java
1612 1612
    }
1613 1613

  
1614 1614
    @Override
1615
    public List<PreservedSpecimenDTO> findByTitlePreservedSpecimenDTO(FindOccurrencesConfigurator config) {
1616
        Taxon taxon = null;
1617
        if(config.getAssociatedTaxonUuid()!=null){
1618
            TaxonBase<?> taxonBase = taxonService.load(config.getAssociatedTaxonUuid());
1619
            if(taxonBase.isInstanceOf(Taxon.class)){
1620
                taxon = CdmBase.deproxy(taxonBase, Taxon.class);
1621
            }
1622
        }
1623
        TaxonName taxonName = null;
1624
        if(config.getAssociatedTaxonNameUuid()!=null){
1625
            taxonName = nameService.load(config.getAssociatedTaxonNameUuid());
1626
        }
1627
        List<DerivedUnit> occurrences = new ArrayList<>();
1628
        occurrences.addAll(dao.findOccurrences(DerivedUnit.class,
1629
                config.getTitleSearchString(), config.getSignificantIdentifier(),
1630
                config.getSpecimenType(), taxon, taxonName, config.getMatchMode(), null, null,
1631
                config.getOrderHints(), null));
1632

  
1633
        List<PreservedSpecimenDTO> dtos = new ArrayList<>();
1634
        occurrences.forEach(derivedUnit->dtos.add(assemblePreservedSpecimenDTO(derivedUnit)));
1635
        return dtos;
1636
    }
1637

  
1638
    @Override
1615 1639
    public <S extends SpecimenOrObservationBase> Pager<S> findByTitle(
1616 1640
            IIdentifiableEntityServiceConfigurator<S> config) {
1617 1641
        if (config instanceof FindOccurrencesConfigurator) {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)