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
|
|
13
|
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
|
14
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
15
|
|
16
|
/**
|
17
|
* @author pplitzner
|
18
|
* @since Apr 20, 2018
|
19
|
*
|
20
|
*/
|
21
|
public class SpecimenNodeWrapper implements Serializable{
|
22
|
|
23
|
private static final long serialVersionUID = -7137923139085928830L;
|
24
|
|
25
|
private UuidAndTitleCache<SpecimenOrObservationBase> uuidAndTitleCache;
|
26
|
private TaxonNode taxonNode;
|
27
|
public SpecimenNodeWrapper(UuidAndTitleCache<SpecimenOrObservationBase> uuidAndTitleCache, TaxonNode taxonNode) {
|
28
|
super();
|
29
|
this.uuidAndTitleCache = uuidAndTitleCache;
|
30
|
this.taxonNode = taxonNode;
|
31
|
}
|
32
|
public UuidAndTitleCache<SpecimenOrObservationBase> getUuidAndTitleCache() {
|
33
|
return uuidAndTitleCache;
|
34
|
}
|
35
|
public TaxonNode getTaxonNode() {
|
36
|
return taxonNode;
|
37
|
}
|
38
|
|
39
|
@Override
|
40
|
public int hashCode() {
|
41
|
final int prime = 31;
|
42
|
int result = 1;
|
43
|
result = prime * result + ((taxonNode == null) ? 0 : taxonNode.hashCode());
|
44
|
result = prime * result + ((uuidAndTitleCache == null) ? 0 : uuidAndTitleCache.getUuid().hashCode());
|
45
|
return result;
|
46
|
}
|
47
|
|
48
|
@Override
|
49
|
public boolean equals(Object obj) {
|
50
|
if (this == obj) {
|
51
|
return true;
|
52
|
}
|
53
|
if (obj == null) {
|
54
|
return false;
|
55
|
}
|
56
|
if (getClass() != obj.getClass()) {
|
57
|
return false;
|
58
|
}
|
59
|
SpecimenNodeWrapper other = (SpecimenNodeWrapper) obj;
|
60
|
if (taxonNode == null) {
|
61
|
if (other.taxonNode != null) {
|
62
|
return false;
|
63
|
}
|
64
|
} else if (!taxonNode.equals(other.taxonNode)) {
|
65
|
return false;
|
66
|
}
|
67
|
if (uuidAndTitleCache == null) {
|
68
|
if (other.uuidAndTitleCache != null) {
|
69
|
return false;
|
70
|
}
|
71
|
} else if (!uuidAndTitleCache.getUuid().equals(other.uuidAndTitleCache.getUuid())) {
|
72
|
return false;
|
73
|
}
|
74
|
return true;
|
75
|
}
|
76
|
|
77
|
|
78
|
|
79
|
}
|