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.model.common;
|
11
|
|
12
|
import java.util.List;
|
13
|
import java.util.Set;
|
14
|
|
15
|
import eu.etaxonomy.cdm.model.media.Rights;
|
16
|
import eu.etaxonomy.cdm.model.reference.ISourceable;
|
17
|
import eu.etaxonomy.cdm.model.term.DefinedTerm;
|
18
|
|
19
|
public interface IIdentifiableEntity extends ISourceable<IdentifiableSource>, IAnnotatableEntity{
|
20
|
|
21
|
public LSID getLsid();
|
22
|
|
23
|
public void setLsid(LSID lsid);
|
24
|
|
25
|
/**
|
26
|
* Returns a title cache String created by the according cache strategy
|
27
|
* with the given identifiable entity WITHOUT setting the titleCache
|
28
|
* of <code>this</code> object.
|
29
|
* This method is meant for internal use and usually not needed for
|
30
|
* external use. Use {@link #getTitleCache()} instead.
|
31
|
*
|
32
|
* @see #getTitleCache()
|
33
|
* @return the computed title cache string
|
34
|
*/
|
35
|
public String generateTitle();
|
36
|
|
37
|
/**
|
38
|
* Returns the title cache. If the title cache does not
|
39
|
* exist yet or if a refresh is required the title cache is
|
40
|
* recomputed and stored in the entity.<BR>
|
41
|
* It is currently up to the implementing classes
|
42
|
* if the cache is recomputed each time or only if the entity
|
43
|
* has changed.
|
44
|
*
|
45
|
* @see #generateTitle()
|
46
|
* @return the titleCache
|
47
|
*/
|
48
|
public String getTitleCache();
|
49
|
|
50
|
/**
|
51
|
* Recomputes the titleCache if it is not protected and returns
|
52
|
* the new value;
|
53
|
* @return the computed or protected titleCache
|
54
|
*/
|
55
|
public String resetTitleCache();
|
56
|
|
57
|
/**
|
58
|
* Sets the title cache without changing the <code>protectCache</code> flag.<BR><BR>
|
59
|
* NOTE: Use with care. If this flag is <code>false</code> the <code>titleCache</code> may be
|
60
|
* recomputed with the next call of {@link #getTitleCache()}, which is automatically the case when
|
61
|
* the object is persisted.
|
62
|
* @see #setTitleCache(String, boolean)
|
63
|
* @see #getTitleCache()
|
64
|
* @param titleCache
|
65
|
* @deprecated this method only exists to be in line with the Java Beans Specification (JSR 220 or JSR 273) .
|
66
|
* As it will set the {@link #isProtectedTitleCache() protected} flag to false the title cache value
|
67
|
* may be automatically recomputed later. There are only very rare use cases were a programmer may
|
68
|
* want to use this method directly.
|
69
|
* Better use {@link #setTitleCache(String, boolean)} with second parameter <code>protectCache</code>
|
70
|
* set to <code>true</code>.
|
71
|
*/
|
72
|
@Deprecated
|
73
|
public void setTitleCache(String titleCache);
|
74
|
|
75
|
/**
|
76
|
* Sets the title cache.<BR>
|
77
|
* NOTE: In most cases the <code>protectCache</code> argument should be set to <code>true</code>.
|
78
|
* See comments at {@link #setTitleCache(String)}
|
79
|
*
|
80
|
* @param titleCache the new title cache
|
81
|
* @param protectCache the protect flag, <b>should in most cases be set to <code>true</code></b>
|
82
|
*/
|
83
|
public void setTitleCache(String titleCache, boolean protectCache);
|
84
|
|
85
|
public boolean isProtectedTitleCache();
|
86
|
|
87
|
public void setProtectedTitleCache(boolean protectedTitleCache);
|
88
|
|
89
|
public Set<Rights> getRights();
|
90
|
|
91
|
public void addRights(Rights right);
|
92
|
|
93
|
public void removeRights(Rights right);
|
94
|
|
95
|
public List<Credit> getCredits();
|
96
|
|
97
|
public Credit getCredits(Integer index);
|
98
|
|
99
|
public void addCredit(Credit credig);
|
100
|
|
101
|
public void addCredit(Credit credit, int index);
|
102
|
|
103
|
public void removeCredit(Credit credit);
|
104
|
|
105
|
public void removeCredit(int index);
|
106
|
|
107
|
|
108
|
/**
|
109
|
* Replaces all occurrences of oldObject in the credits list with newObject
|
110
|
* @param newObject the replacement object
|
111
|
* @param oldObject the object to be replaced
|
112
|
* @return true, if an object was replaced, false otherwise
|
113
|
*/
|
114
|
public boolean replaceCredit(Credit newObject, Credit oldObject);
|
115
|
|
116
|
public Set<Extension> getExtensions();
|
117
|
|
118
|
public void addExtension(Extension extension);
|
119
|
|
120
|
public void addExtension(String value, ExtensionType extensionType);
|
121
|
|
122
|
public void removeExtension(Extension extension);
|
123
|
|
124
|
/**
|
125
|
* Returns the list of {@link Identifier alternative identifiers}.
|
126
|
* In case the order of these identifiers is important it should be
|
127
|
* implemented such that the first item in the list is the most
|
128
|
* important/most current identifier. <BR>
|
129
|
* E.g. if a barcode identifier
|
130
|
* is more important than the accession number for a certain
|
131
|
* specimen, than the barcode identifier should be before the accession number.
|
132
|
* <BR>Or if a sample designation is the most recent of all sample designations
|
133
|
* than it should be the first in the list while all history designations come
|
134
|
* later.
|
135
|
* @return
|
136
|
*/
|
137
|
public List<Identifier> getIdentifiers();
|
138
|
|
139
|
/**
|
140
|
* Create and add a new identifier.
|
141
|
* @see #getIdentifiers()
|
142
|
* @param identifier
|
143
|
* @param identifierType
|
144
|
* @return
|
145
|
*/
|
146
|
public Identifier addIdentifier(String identifier, DefinedTerm identifierType);
|
147
|
|
148
|
/**
|
149
|
* @see #getIdentifiers()
|
150
|
* @param identifier
|
151
|
*/
|
152
|
public void addIdentifier(Identifier identifier);
|
153
|
|
154
|
/**
|
155
|
* Adds an identifier at the given position. For use of
|
156
|
* <code>index</code> see {@link List#add(int, Object)} and {@link#getIdentifiers()}.
|
157
|
* If <code>index</code> is <code>null</code> the identifier is added to the end
|
158
|
* of the list.
|
159
|
* @see #getIdentifiers()
|
160
|
* @param index the list index
|
161
|
* @param identifier the identifier
|
162
|
*/
|
163
|
public void addIdentifier(Integer index, Identifier identifier);
|
164
|
|
165
|
/**
|
166
|
* Removes an identifier at the given position. For use of
|
167
|
* <code>index</code> see {@link List#add(int, Object)} and {@link#getIdentifiers()}
|
168
|
* @param index the list index
|
169
|
*/
|
170
|
public void removeIdentifier(int index);
|
171
|
|
172
|
|
173
|
/**
|
174
|
* Removes an identifier
|
175
|
* @see #getIdentifiers()
|
176
|
* @param identifier
|
177
|
*/
|
178
|
public void removeIdentifier(Identifier identifier);
|
179
|
|
180
|
/**
|
181
|
* Replaces all occurrences of oldObject in the identifiers list with newObject
|
182
|
* @param newObject the replacement object
|
183
|
* @param oldObject the object to be replaced
|
184
|
* @return true, if an object was replaced, false otherwise
|
185
|
*/
|
186
|
public boolean replaceIdentifier(Identifier newObject, Identifier oldObject);
|
187
|
|
188
|
|
189
|
/**
|
190
|
* Overrides {@link eu.etaxonomy.cdm.model.common.CdmBase#toString()}.
|
191
|
* This returns an String that identifies the object well without beeing necessarily unique.
|
192
|
* Specification: This method should never call other object' methods so it can be well used for debugging
|
193
|
* without problems like lazy loading, unreal states etc.
|
194
|
* Note: If overriding this method's javadoc always copy or link the above requirement.
|
195
|
* If not overwritten by a subclass method returns the class, id and uuid as a string for any CDM object.
|
196
|
* For example: Taxon#13<b5938a98-c1de-4dda-b040-d5cc5bfb3bc0>
|
197
|
* @see java.lang.Object#toString()
|
198
|
*/
|
199
|
@Override
|
200
|
public String toString();
|
201
|
|
202
|
public byte[] getData();
|
203
|
|
204
|
void removeSources();
|
205
|
|
206
|
}
|