Project

General

Profile

Download (2.85 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.persistence.dto;
10

    
11
import java.io.Serializable;
12
import java.util.UUID;
13

    
14
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
15
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
16

    
17
/**
18
 * @author pplitzner
19
 * @since Apr 20, 2018
20
 *
21
 */
22
public class SpecimenNodeWrapper implements Serializable{
23

    
24
    private static final long serialVersionUID = -7137923139085928830L;
25

    
26
    private UuidAndTitleCache<SpecimenOrObservationBase> specimenUuidAndTitleCache;
27
    private SpecimenOrObservationType type;
28
    private TaxonNodeDto taxonNode;
29
    private UUID taxonDescriptionUuid;
30

    
31
    public SpecimenNodeWrapper(UuidAndTitleCache<SpecimenOrObservationBase> uuidAndTitleCache,
32
            SpecimenOrObservationType type,
33
            TaxonNodeDto taxonNode) {
34
        super();
35
        this.specimenUuidAndTitleCache = uuidAndTitleCache;
36
        this.type = type;
37
        this.taxonNode = taxonNode;
38
    }
39
    public UuidAndTitleCache<SpecimenOrObservationBase> getUuidAndTitleCache() {
40
        return specimenUuidAndTitleCache;
41
    }
42
    public SpecimenOrObservationType getType() {
43
        return type;
44
    }
45
    public TaxonNodeDto getTaxonNode() {
46
        return taxonNode;
47
    }
48
    public UUID getTaxonDescriptionUuid() {
49
        return taxonDescriptionUuid;
50
    }
51
    public void setTaxonDescriptionUuid(UUID taxonDescriptionUuid) {
52
        this.taxonDescriptionUuid = taxonDescriptionUuid;
53
    }
54

    
55
    @Override
56
    public int hashCode() {
57
        final int prime = 31;
58
        int result = 1;
59
//        result = prime * result + ((taxonNode == null) ? 0 : taxonNode.hashCode());
60
        result = prime * result + ((specimenUuidAndTitleCache == null) ? 0 : specimenUuidAndTitleCache.getUuid().hashCode());
61
        return result;
62
    }
63

    
64
    @Override
65
    public boolean equals(Object obj) {
66
        if (this == obj) {
67
            return true;
68
        }
69
        if (obj == null) {
70
            return false;
71
        }
72
        if (getClass() != obj.getClass()) {
73
            return false;
74
        }
75
        SpecimenNodeWrapper other = (SpecimenNodeWrapper) obj;
76
//        if (taxonNode == null) {
77
//            if (other.taxonNode != null) {
78
//                return false;
79
//            }
80
//        } else if (!taxonNode.equals(other.taxonNode)) {
81
//            return false;
82
//        }
83
        if (specimenUuidAndTitleCache == null) {
84
            if (other.specimenUuidAndTitleCache != null) {
85
                return false;
86
            }
87
        } else if (!specimenUuidAndTitleCache.getUuid().equals(other.specimenUuidAndTitleCache.getUuid())) {
88
            return false;
89
        }
90
        return true;
91
    }
92

    
93

    
94

    
95
}
(14-14/29)