Project

General

Profile

Revision 47c3158d

ID47c3158d48dfb58a923c6de32a1434b4c93dab25
Parent 47def0a1
Child ff159227

Added by Patrick Plitzner about 1 year ago

ref #8539 Add taxon description to wrapper

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/occurrence/OccurrenceDaoHibernateImpl.java
33 33
import eu.etaxonomy.cdm.model.common.CdmBase;
34 34
import eu.etaxonomy.cdm.model.description.DescriptionBase;
35 35
import eu.etaxonomy.cdm.model.description.IndividualsAssociation;
36
import eu.etaxonomy.cdm.model.description.TaxonDescription;
36 37
import eu.etaxonomy.cdm.model.location.Point;
37 38
import eu.etaxonomy.cdm.model.media.Media;
38 39
import eu.etaxonomy.cdm.model.molecular.DnaSample;
......
538 539

  
539 540
    private List<SpecimenNodeWrapper> querySpecimen(Query query, List<UUID> taxonNodeUuids,
540 541
            Integer limit, Integer start){
541
        return querySpecimen(query, taxonNodeUuids, false, limit, start);
542
    }
543

  
544
    private List<SpecimenNodeWrapper> querySpecimen(Query query, List<UUID> taxonNodeUuids,
545
            boolean isIndividualsAssociation, Integer limit, Integer start){
546 542
        query.setParameterList("taxonNodeUuids", taxonNodeUuids);
547 543

  
548 544
        addLimitAndStart(query, limit, start);
......
551 547
        @SuppressWarnings("unchecked")
552 548
        List<Object[]> result = query.list();
553 549
        for(Object[] object : result){
554
            list.add(new SpecimenNodeWrapper(
550
            SpecimenNodeWrapper wrapper = new SpecimenNodeWrapper(
555 551
                    new UuidAndTitleCache<>(
556 552
                            (UUID) object[0],
557 553
                            (Integer) object[1],
558 554
                            (String) object[2]),
559 555
                    (SpecimenOrObservationType)object[3],
560
                    isIndividualsAssociation,
561
                    (TaxonNode)object[4]));
556
                    (TaxonNode)object[4]);
557
            if(object.length>5) {
558
                wrapper.setTaxonDescription((TaxonDescription)object[5]);
559
            }
560
            list.add(wrapper);
562 561
        }
563 562
        return list;
564 563
    }
......
570 569
                + "de.associatedSpecimenOrObservation.id, "
571 570
                + "de.associatedSpecimenOrObservation.titleCache, "
572 571
                + "de.associatedSpecimenOrObservation.recordBasis, "
573
                + "tn "
572
                + "tn, "
573
                + "d "
574 574
                + "FROM DescriptionElementBase AS de "
575 575
                + "LEFT JOIN de.inDescription AS d "
576 576
                + "LEFT JOIN d.taxon AS t "
......
579 579
                + "AND tn.uuid in (:taxonNodeUuids) "
580 580
                ;
581 581
        Query query = getSession().createQuery(queryString);
582
        return querySpecimen(query, taxonNodeUuids, true, limit, start);
582
        return querySpecimen(query, taxonNodeUuids, limit, start);
583 583
    }
584 584

  
585 585
    private List<SpecimenNodeWrapper> queryTypeSpecimen(List<UUID> taxonNodeUuids,
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/SpecimenNodeWrapper.java
10 10

  
11 11
import java.io.Serializable;
12 12

  
13
import eu.etaxonomy.cdm.model.description.TaxonDescription;
13 14
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
14 15
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
15 16
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
......
25 26

  
26 27
    private UuidAndTitleCache<SpecimenOrObservationBase> uuidAndTitleCache;
27 28
    private SpecimenOrObservationType type;
28
    private boolean isIndividualsAssociation;
29 29
    private TaxonNode taxonNode;
30
    private TaxonDescription taxonDescription;
30 31

  
31 32
    public SpecimenNodeWrapper(UuidAndTitleCache<SpecimenOrObservationBase> uuidAndTitleCache,
32 33
            SpecimenOrObservationType type,
33
            boolean isIndividualsAssociation,
34 34
            TaxonNode taxonNode) {
35 35
        super();
36 36
        this.uuidAndTitleCache = uuidAndTitleCache;
37 37
        this.type = type;
38
        this.isIndividualsAssociation = isIndividualsAssociation;
39 38
        this.taxonNode = taxonNode;
40 39
    }
41 40
    public UuidAndTitleCache<SpecimenOrObservationBase> getUuidAndTitleCache() {
......
44 43
    public SpecimenOrObservationType getType() {
45 44
        return type;
46 45
    }
47
    public boolean isIndividualsAssociation() {
48
        return isIndividualsAssociation;
49
    }
50 46
    public TaxonNode getTaxonNode() {
51 47
        return taxonNode;
52 48
    }
49
    public TaxonDescription getTaxonDescription() {
50
        return taxonDescription;
51
    }
52
    public void setTaxonDescription(TaxonDescription taxonDescription) {
53
        this.taxonDescription = taxonDescription;
54
    }
53 55

  
54 56
    @Override
55 57
    public int hashCode() {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)