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