Project

General

Profile

Download (6.86 KB) Statistics
| Branch: | Tag: | Revision:
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.term.DefinedTerm;
17

    
18
public interface IIdentifiableEntity extends ISourceable<IdentifiableSource>, IAnnotatableEntity{
19

    
20
    public LSID getLsid();
21

    
22
    public void setLsid(LSID lsid);
23

    
24
    /**
25
     * Returns a title cache String created by the according cache strategy
26
     * with the given identifiable entity WITHOUT setting the titleCache
27
     * of <code>this</code> object.
28
     * This method is meant for internal use and usually not needed for
29
     * external use. Use {@link #getTitleCache()} instead.
30
     *
31
     * @see #getTitleCache()
32
     * @return the computed title cache string
33
     */
34
    public String generateTitle();
35

    
36
    /**
37
     * Returns the title cache. If the title cache does not
38
     * exist yet or if a refresh is required the title cache is
39
     * recomputed and stored in the entity.<BR>
40
     * It is currently up to the implementing classes
41
     * if the cache is recomputed each time or only if the entity
42
     * has changed.
43
     *
44
     * @see #generateTitle()
45
     * @return the titleCache
46
     */
47
    public String getTitleCache();
48

    
49
    /**
50
     * Sets the title cache without changing the <code>protectCache</code> flag.<BR><BR>
51
     * NOTE: Use with care. If this flag is <code>false</code> the <code>titleCache</code> may be
52
     * recomputed with the next call of {@link #getTitleCache()}, which is automatically the case when
53
     * the object is persisted.
54
     * @see #setTitleCache(String, boolean)
55
     * @see #getTitleCache()
56
     * @param titleCache
57
     * @deprecated this method only exists to be in line with the Java Beans Specification (JSR 220 or JSR 273) .
58
     * As it will set the {@link #isProtectedTitleCache() protected} flag to false the title cache value
59
     * may be automatically recomputed later. There are only very rare use cases were a programmer may
60
     * want to use this method directly.
61
     * Better use {@link #setTitleCache(String, boolean)} with second parameter <code>protectCache</code>
62
     * set to <code>true</code>.
63
     */
64
    @Deprecated
65
    public void setTitleCache(String titleCache);
66

    
67
    /**
68
     * Sets the title cache.<BR>
69
     * NOTE: In most cases the <code>protectCache</code> argument should be set to <code>true</code>.
70
     * See comments at {@link #setTitleCache(String)}
71
     *
72
     * @param titleCache the new title cache
73
     * @param protectCache the protect flag, <b>should in most cases be set to <code>true</code></b>
74
     */
75
    public void setTitleCache(String titleCache, boolean protectCache);
76

    
77
    public boolean isProtectedTitleCache();
78

    
79
    public void setProtectedTitleCache(boolean protectedTitleCache);
80

    
81
    public Set<Rights> getRights();
82

    
83
    public void addRights(Rights right);
84

    
85
    public void removeRights(Rights right);
86

    
87
    public List<Credit> getCredits();
88

    
89
    public Credit getCredits(Integer index);
90

    
91
    public void addCredit(Credit credig);
92

    
93
    public void addCredit(Credit credit, int index);
94

    
95
    public void removeCredit(Credit credit);
96

    
97
    public void removeCredit(int index);
98

    
99

    
100
    /**
101
     * Replaces all occurrences of oldObject in the credits list with newObject
102
     * @param newObject the replacement object
103
     * @param oldObject the object to be replaced
104
     * @return true, if an object was replaced, false otherwise
105
     */
106
    public boolean replaceCredit(Credit newObject, Credit oldObject);
107

    
108
    public Set<Extension> getExtensions();
109

    
110
    public void addExtension(Extension extension);
111

    
112
    public void addExtension(String value, ExtensionType extensionType);
113

    
114
    public void removeExtension(Extension extension);
115

    
116
    /**
117
     * Returns the list of {@link Identifier alternative identifiers}.
118
     * In case the order of these identifiers is important it should be
119
     * implemented such that the first item in the list is the most
120
     * important/most current identifier. <BR>
121
     * E.g. if a barcode identifier
122
     * is more important than the accession number for a certain
123
     * specimen, than the barcode identifier should be before the accession number.
124
     * <BR>Or if a sample designation is the most recent of all sample designations
125
     * than it should be the first in the list while all history designations come
126
     * later.
127
     * @return
128
     */
129
    public List<Identifier> getIdentifiers();
130

    
131
    /**
132
     * Create and add a new identifier.
133
     * @see #getIdentifiers()
134
     * @param identifier
135
     * @param identifierType
136
     * @return
137
     */
138
    public Identifier addIdentifier(String identifier, DefinedTerm identifierType);
139

    
140
    /**
141
     * @see #getIdentifiers()
142
     * @param identifier
143
     */
144
    public void addIdentifier(Identifier identifier);
145

    
146
    /**
147
     * Adds an identifier at the given position. For use of
148
     * <code>index</code> see {@link List#add(int, Object)} and {@link#getIdentifiers()}.
149
     * If <code>index</code> is <code>null</code> the identifier is added to the end
150
     * of the list.
151
     * @see #getIdentifiers()
152
     * @param index the list index
153
     * @param identifier the identifier
154
     */
155
    public void addIdentifier(Integer index, Identifier identifier);
156

    
157
    /**
158
     * Removes an identifier at the given position. For use of
159
     * <code>index</code> see {@link List#add(int, Object)} and {@link#getIdentifiers()}
160
     * @param index the list index
161
     */
162
    public void removeIdentifier(int index);
163

    
164

    
165
    /**
166
     * Removes an identifier
167
     * @see #getIdentifiers()
168
     * @param identifier
169
     */
170
    public void removeIdentifier(Identifier identifier);
171

    
172
    /**
173
     * Replaces all occurrences of oldObject in the identifiers list with newObject
174
     * @param newObject the replacement object
175
     * @param oldObject the object to be replaced
176
     * @return true, if an object was replaced, false otherwise
177
     */
178
    public boolean replaceIdentifier(Identifier newObject, Identifier oldObject);
179

    
180

    
181
    /**
182
     * Overrides {@link eu.etaxonomy.cdm.model.common.CdmBase#toString()}.
183
     * This returns an String that identifies the object well without beeing necessarily unique.
184
     * Specification: This method should never call other object' methods so it can be well used for debugging
185
     * without problems like lazy loading, unreal states etc.
186
     * Note: If overriding this method's javadoc always copy or link the above requirement.
187
     * If not overwritten by a subclass method returns the class, id and uuid as a string for any CDM object.
188
     * For example: Taxon#13<b5938a98-c1de-4dda-b040-d5cc5bfb3bc0>
189
     * @see java.lang.Object#toString()
190
     */
191
    @Override
192
    public String toString();
193

    
194
    public byte[] getData();
195

    
196
	void removeSources();
197

    
198
}
(15-15/60)