Revision 0844524a
Added by Andreas Kohlbecker about 6 years ago
src/main/java/eu/etaxonomy/cdm/vaadin/model/EntityReference.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.vaadin.model; |
10 | 10 |
|
11 |
import java.util.UUID; |
|
12 |
|
|
11 | 13 |
import org.apache.commons.lang.builder.HashCodeBuilder; |
12 | 14 |
|
13 | 15 |
public class EntityReference { |
14 |
int id;
|
|
16 |
UUID uuid;
|
|
15 | 17 |
String label; |
16 | 18 |
|
17 |
public EntityReference(int id, String label) {
|
|
18 |
this.id = id;
|
|
19 |
public EntityReference(UUID uuid, String label) {
|
|
20 |
this.uuid = uuid;
|
|
19 | 21 |
this.label = label; |
20 | 22 |
} |
21 | 23 |
|
22 |
public int getId() { |
|
23 |
return id; |
|
24 |
|
|
25 |
public UUID getUuid() { |
|
26 |
return uuid; |
|
24 | 27 |
} |
25 | 28 |
|
26 | 29 |
public String getLabel() { |
... | ... | |
34 | 37 |
public int hashCode() { |
35 | 38 |
return new HashCodeBuilder(17, 31) |
36 | 39 |
.append(label) |
37 |
.append(id) |
|
40 |
.append(uuid)
|
|
38 | 41 |
.toHashCode(); |
39 | 42 |
} |
40 | 43 |
|
... | ... | |
45 | 48 |
public boolean equals(Object obj) { |
46 | 49 |
try { |
47 | 50 |
EntityReference other = (EntityReference) obj; |
48 |
return id == other.id && label.equals(other.label);
|
|
51 |
return uuid.equals(other.uuid) && label.equals(other.label);
|
|
49 | 52 |
|
50 | 53 |
} catch (Exception e) { |
51 | 54 |
return false; |
Also available in: Unified diff
switching vom id based to uuid based ui navigation and entity references