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