1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.cdm.persistence.dto;
|
11
|
|
12
|
import java.io.Serializable;
|
13
|
import java.util.UUID;
|
14
|
|
15
|
import org.apache.log4j.Logger;
|
16
|
|
17
|
import eu.etaxonomy.cdm.model.common.ICdmBase;
|
18
|
|
19
|
/**
|
20
|
* @author n.hoffmann
|
21
|
* @since Aug 14, 2009
|
22
|
*/
|
23
|
public class UuidAndTitleCache<T extends ICdmBase> implements Serializable {
|
24
|
|
25
|
private static final long serialVersionUID = 3446993458279371682L;
|
26
|
|
27
|
@SuppressWarnings("unused")
|
28
|
private static final Logger logger = Logger .getLogger(UuidAndTitleCache.class);
|
29
|
|
30
|
private Class<T> type;
|
31
|
final private UUID uuid;
|
32
|
private Integer id;
|
33
|
private String titleCache;
|
34
|
private String abbrevTitleCache;
|
35
|
private boolean isProtectedTitleCache = true;
|
36
|
|
37
|
|
38
|
private boolean isOrphaned;
|
39
|
|
40
|
public UuidAndTitleCache(UUID uuid, Integer id, String titleCache, String abbrevTitleCache) {
|
41
|
this.uuid = uuid;
|
42
|
this.setTitleCache(titleCache);
|
43
|
this.id = id;
|
44
|
this.abbrevTitleCache = abbrevTitleCache;
|
45
|
}
|
46
|
public UuidAndTitleCache(UUID uuid, Integer id, String titleCache) {
|
47
|
this.uuid = uuid;
|
48
|
this.setTitleCache(titleCache);
|
49
|
this.id = id;
|
50
|
this.abbrevTitleCache = null;
|
51
|
}
|
52
|
|
53
|
public UuidAndTitleCache(Class<T> type, UUID uuid, Integer id, String titleCache, String abbrevTitleCache) {
|
54
|
this(uuid, id, titleCache, abbrevTitleCache);
|
55
|
this.type = type;
|
56
|
this.isOrphaned = false;
|
57
|
}
|
58
|
public UuidAndTitleCache(Class<T> type, UUID uuid, Integer id, String titleCache) {
|
59
|
this(uuid, id, titleCache, null);
|
60
|
this.type = type;
|
61
|
this.isOrphaned = false;
|
62
|
}
|
63
|
|
64
|
public UuidAndTitleCache(Class<T> type, UUID uuid, Integer id, String titleCache, Boolean isOrphaned, String abbrevTitleCache) {
|
65
|
this(type, uuid, id, titleCache, abbrevTitleCache);
|
66
|
this.isOrphaned = isOrphaned;
|
67
|
}
|
68
|
|
69
|
public UuidAndTitleCache(UUID uuid, String titleCache) {
|
70
|
this( uuid, null, titleCache);
|
71
|
}
|
72
|
|
73
|
|
74
|
public String getTitleCache() {
|
75
|
return titleCache;
|
76
|
}
|
77
|
|
78
|
|
79
|
public String getAbbrevTitleCache() {
|
80
|
return abbrevTitleCache;
|
81
|
}
|
82
|
|
83
|
|
84
|
public UUID getUuid() {
|
85
|
return uuid;
|
86
|
}
|
87
|
|
88
|
public Integer getId() {
|
89
|
return id;
|
90
|
}
|
91
|
|
92
|
public Class<T> getType(){
|
93
|
return type;
|
94
|
}
|
95
|
|
96
|
public boolean getIsOrphaned() {
|
97
|
return this.isOrphaned;
|
98
|
}
|
99
|
|
100
|
public void setAbbrevTitleCache(String abbrevTitleCache) {
|
101
|
this.abbrevTitleCache = abbrevTitleCache;
|
102
|
}
|
103
|
public void setTitleCache(String titleCache) {
|
104
|
this.titleCache = titleCache;
|
105
|
}
|
106
|
|
107
|
public void setType(Class<T> type) {
|
108
|
this.type = type;
|
109
|
}
|
110
|
|
111
|
//************************** toString **********************************/
|
112
|
|
113
|
public boolean isProtectedTitleCache() {
|
114
|
return isProtectedTitleCache;
|
115
|
}
|
116
|
public void setProtectedTitleCache(boolean isProtectedTitleCache) {
|
117
|
this.isProtectedTitleCache = isProtectedTitleCache;
|
118
|
}
|
119
|
@Override
|
120
|
public String toString() {
|
121
|
return "UuidAndTitleCache [type= " + type + ", uuid= " + uuid + ", id=" + id + ", titleCache= " + getTitleCache()
|
122
|
+ ", isOrphaned=" + isOrphaned + ", abbrevTitleCache= " + abbrevTitleCache +"]";
|
123
|
}
|
124
|
|
125
|
|
126
|
}
|