Project

General

Profile

« Previous | Next » 

Revision b6b6d586

Added by Patrick Plitzner over 8 years ago

Add new service method for retrieving all associated taxa for a specimen

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IOccurrenceService.java
419 419
     */
420 420
    public Collection<IndividualsAssociation> listIndividualsAssociations(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
421 421

  
422
    /**
423
     * Retrieves all associated taxa for the given specimen
424
     * @param specimen
425
     * @param limit
426
     * @param start
427
     * @param orderHints
428
     * @param propertyPaths
429
     * @return
430
     */
431
    public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths);
432

  
422 433
    /**
423 434
     * Retrieves all {@link SpecimenTypeDesignation}s which have the given specimen as a type specimen.
424 435
     * @param specimen the type specimen
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/OccurrenceServiceImpl.java
1296 1296
        return dao.listIndividualsAssociations(specimen, null, null, null, null);
1297 1297
    }
1298 1298

  
1299
    /**
1300
     * {@inheritDoc}
1301
     */
1302
    @Override
1303
    public Collection<TaxonBase<?>> listAssociatedTaxa(SpecimenOrObservationBase<?> specimen, Integer limit, Integer start,
1304
            List<OrderHint> orderHints, List<String> propertyPaths) {
1305
        Collection<TaxonBase<?>> associatedTaxa = new HashSet<TaxonBase<?>>();
1306
        for (IndividualsAssociation individualsAssociation : listIndividualsAssociations(specimen, limit, start, orderHints, propertyPaths)) {
1307
            if(individualsAssociation.getInDescription().isInstanceOf(TaxonDescription.class)){
1308
                TaxonDescription taxonDescription = HibernateProxyHelper.deproxy(individualsAssociation.getInDescription(), TaxonDescription.class);
1309
                associatedTaxa.add(taxonDescription.getTaxon());
1310
            }
1311
        }
1312
        return associatedTaxa;
1313
    }
1314

  
1299 1315
    @Override
1300 1316
    public Collection<SpecimenTypeDesignation> listTypeDesignations(SpecimenOrObservationBase<?> specimen,
1301 1317
            Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths) {

Also available in: Unified diff