@MappedSuperclass public abstract class IdentifiableEntity<S extends IIdentifiableEntityCacheStrategy> extends SourcedEntityBase<IdentifiableSource> implements IIdentifiableEntity
Extensions
, basically a string value with a type term.
Any number of right statements can be attached as well as multiple OriginalSourceBase
objects.
Original sources carry a reference to the source, an ID within that source and the original title/label of this object as it was used in that source (originalNameString).
A Taxon for example that was taken from 2 sources like FaunaEuropaea and IPNI would have two originalSource objects.
The originalSource representing that taxon as it was found in IPNI would contain IPNI as the reference, the IPNI id of the taxon and the name of the taxon exactly as it was used in IPNI.Modifier and Type | Field and Description |
---|---|
protected S |
cacheStrategy |
static boolean |
NOT_PROTECTED |
static boolean |
PROTECTED |
protected boolean |
protectedTitleCache |
protected java.lang.String |
titleCache |
annotations, markers
CLOB_LENGTH, uuid
Modifier | Constructor and Description |
---|---|
protected |
IdentifiableEntity() |
Modifier and Type | Method and Description |
---|---|
void |
addCredit(Credit credit) |
void |
addCredit(Credit credit,
int index) |
void |
addExtension(Extension extension) |
void |
addExtension(java.lang.String value,
ExtensionType extensionType) |
void |
addIdentifier(Identifier identifier) |
void |
addIdentifier(java.lang.Integer index,
Identifier identifier)
Adds an identifier at the given position.
|
Identifier |
addIdentifier(java.lang.String identifier,
DefinedTerm identifierType)
Create and add a new identifier.
|
void |
addRights(Rights right) |
void |
addSource(IdentifiableSource source)
Adds a source to this object
|
void |
addSources(java.util.Set<IdentifiableSource> sources)
Adds a set of original sources (citations) for this sourceable object
|
java.lang.Object |
clone()
Clones this versionable entity.
|
protected IdentifiableSource |
createNewSource(OriginalSourceType type,
java.lang.String idInSource,
java.lang.String idNamespace,
Reference reference,
java.lang.String microReference,
java.lang.String originalInfo,
ICdmTarget target) |
java.lang.String |
generateTitle()
Returns a title cache String created by the according cache strategy
with the given identifiable entity WITHOUT setting the titleCache
of
this object. |
S |
getCacheStrategy()
Returns the
cache strategy used to generate
several strings corresponding to this identifiable entity
(in particular taxon name caches and author strings). |
java.util.List<Credit> |
getCredits() |
Credit |
getCredits(java.lang.Integer index) |
byte[] |
getData()
By default, we expect most cdm objects to be abstract things
i.e.
|
java.util.Set<Extension> |
getExtensions() |
java.util.Set<java.lang.String> |
getExtensions(ExtensionType type) |
java.util.Set<java.lang.String> |
getExtensions(java.util.UUID extensionTypeUuid) |
java.lang.String |
getExtensionsConcat(java.util.Collection<java.util.UUID> extensionTypeUuids,
java.lang.String separator)
Return all extensions matching the given extension type as
concatenated string.
|
java.lang.String |
getExtensionsConcat(java.util.UUID extensionTypeUuid,
java.lang.String separator) |
java.util.Set<Extension> |
getFilteredExtensions(java.util.UUID extensionTypeUuid) |
java.util.List<Identifier> |
getIdentifiers()
Returns the list of
alternative identifiers . |
java.util.Set<java.lang.String> |
getIdentifiers(DefinedTerm type) |
java.util.Set<java.lang.String> |
getIdentifiers(java.util.UUID identifierTypeUuid) |
LSID |
getLsid() |
java.util.Set<Rights> |
getRights() |
java.lang.String |
getTitleCache()
Returns the title cache.
|
protected java.lang.String |
getTruncatedCache(java.lang.String cache) |
boolean |
hasEmptyTitleCache() |
boolean |
hasExtension(ExtensionType extensionType,
java.lang.String value) |
boolean |
hasExtension(java.util.UUID extensionTypeUuid,
java.lang.String value)
Has this entity an extension of given type with value 'value'.
|
void |
initListener()
This method was initially added to
CdmBase to fix #5161. |
boolean |
isProtectedTitleCache() |
void |
removeCredit(Credit credit) |
void |
removeCredit(int index) |
void |
removeExtension(Extension extension) |
void |
removeIdentifier(Identifier identifier)
Removes an identifier
|
void |
removeIdentifier(int index)
Removes an identifier at the given position.
|
void |
removeRights(Rights right) |
boolean |
replaceCredit(Credit newObject,
Credit oldObject)
Replaces all occurrences of oldObject in the credits list with newObject
|
boolean |
replaceIdentifier(Identifier newObject,
Identifier oldObject)
Replaces all occurrences of oldObject in the identifiers list with newObject
|
java.lang.String |
resetTitleCache()
Recomputes the titleCache if it is not protected and returns
the new value;
|
void |
setCacheStrategy(S cacheStrategy) |
void |
setLsid(LSID lsid) |
void |
setProtectedTitleCache(boolean protectedTitleCache) |
void |
setTitleCache(java.lang.String titleCache)
Deprecated.
|
void |
setTitleCache(java.lang.String titleCache,
boolean protectCache)
Sets the title cache.
NOTE: In most cases the protectCache argument should be set to true . |
java.lang.String |
toString()
Overrides
Object.toString() . |
boolean |
updateCaches() |
boolean |
updateCaches(S entityCacheStrategy)
Updates the caches with the given cache strategy
|
addAggregationSource, addImportSource, addPrimaryTaxonomicSource, addPrimaryTaxonomicSource, addSource, addSource, getSources, removeSource, removeSources
addAnnotation, addMarker, addMarker, getAnnotations, getAnnotations, getMarkers, getMarkers, hasMarker, hasMarker, markerValue, removeAnnotation, removeMarker, removeMarker, setAnnotations
cloneLanguageString, equals, getUpdated, getUpdatedBy, setUpdated, setUpdatedBy
addPropertyChangeListener, addPropertyChangeListener, addToSetWithChangeEvent, deproxy, deproxy, fireOnCreateEvent, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getCreated, getCreatedBy, getId, getUserFriendlyDescription, getUserFriendlyFieldName, getUserFriendlyTypeName, getUuid, hashCode, hasListeners, instanceToString, invokeSetMethod, invokeSetMethodWithNull, isBlank, isInstanceOf, isNotBlank, isPersited, removeFromSetWithChangeEvent, removePropertyChangeListener, removePropertyChangeListener, replaceInList, setCreated, setCreatedBy, setId, setNewEntityListener, setUuid
finalize, getClass, notify, notifyAll, wait, wait, wait
removeSources
addAggregationSource, addImportSource, addPrimaryTaxonomicSource, addPrimaryTaxonomicSource, addSource, addSource, getSources, removeSource
addAnnotation, addMarker, getAnnotations, getMarkers, getMarkers, hasMarker, hasMarker, markerValue, removeAnnotation, removeMarker, removeMarker
getUpdated, getUpdatedBy, setUpdated, setUpdatedBy
getCreated, getCreatedBy, getId, getUuid, isInstanceOf, isPersited, setCreated, setCreatedBy, setId, setUuid
public static final boolean PROTECTED
public static final boolean NOT_PROTECTED
@NotEmpty(groups=Level2.class) @Field(store=YES) @Field(name="titleCache__sort",analyze=NO,store=NO,index=NO) @SortableField(forField="titleCache__sort") @FieldBridge(impl=StripHtmlBridge.class) protected java.lang.String titleCache
protected boolean protectedTitleCache
protected S extends IIdentifiableEntityCacheStrategy cacheStrategy
public void initListener()
CdmBase
CdmBase
to fix #5161.
It can be overridden by subclasses such as IdentifiableEntity
to explicitly initialize listeners. This is needed e.g. after de-serialization
as listeners are not serialized due to the @Transient annotation.
However, it can be generally used for other use-cases as wellinitListener
in class CdmBase
public byte[] getData()
getData
in interface IIdentifiableEntity
public java.lang.String getTitleCache()
IIdentifiableEntity
getTitleCache
in interface IIdentifiableEntity
IIdentifiableEntity.generateTitle()
@Deprecated public void setTitleCache(java.lang.String titleCache)
IIdentifiableEntity
protectCache
flag.false
the titleCache
may be
recomputed with the next call of IIdentifiableEntity.getTitleCache()
, which is automatically the case when
the object is persisted.setTitleCache
in interface IIdentifiableEntity
IIdentifiableEntity.setTitleCache(String, boolean)
,
IIdentifiableEntity.getTitleCache()
public void setTitleCache(java.lang.String titleCache, boolean protectCache)
IIdentifiableEntity
protectCache
argument should be set to true
.
See comments at IIdentifiableEntity.setTitleCache(String)
setTitleCache
in interface IIdentifiableEntity
titleCache
- the new title cacheprotectCache
- the protect flag, should in most cases be set to true
public java.lang.String resetTitleCache()
IIdentifiableEntity
resetTitleCache
in interface IIdentifiableEntity
protected java.lang.String getTruncatedCache(java.lang.String cache)
cache
- public boolean isProtectedTitleCache()
isProtectedTitleCache
in interface IIdentifiableEntity
public void setProtectedTitleCache(boolean protectedTitleCache)
setProtectedTitleCache
in interface IIdentifiableEntity
public boolean hasEmptyTitleCache()
null
or the empty string. This is primarily meant for internal use.public boolean updateCaches()
public boolean updateCaches(S entityCacheStrategy)
entityCacheStrategy
- true
if some cache was updated, false
otherwisepublic LSID getLsid()
getLsid
in interface IIdentifiableEntity
public void setLsid(LSID lsid)
setLsid
in interface IIdentifiableEntity
public java.util.Set<Rights> getRights()
getRights
in interface IIdentifiableEntity
public void addRights(Rights right)
addRights
in interface IIdentifiableEntity
public void removeRights(Rights right)
removeRights
in interface IIdentifiableEntity
public java.util.List<Credit> getCredits()
getCredits
in interface IIdentifiableEntity
public Credit getCredits(java.lang.Integer index)
getCredits
in interface IIdentifiableEntity
public void addCredit(Credit credit)
addCredit
in interface IIdentifiableEntity
public void addCredit(Credit credit, int index)
addCredit
in interface IIdentifiableEntity
public void removeCredit(Credit credit)
removeCredit
in interface IIdentifiableEntity
public void removeCredit(int index)
removeCredit
in interface IIdentifiableEntity
public boolean replaceCredit(Credit newObject, Credit oldObject)
IIdentifiableEntity
replaceCredit
in interface IIdentifiableEntity
newObject
- the replacement objectoldObject
- the object to be replacedpublic java.util.List<Identifier> getIdentifiers()
IIdentifiableEntity
alternative identifiers
.
In case the order of these identifiers is important it should be
implemented such that the first item in the list is the most
important/most current identifier. getIdentifiers
in interface IIdentifiableEntity
public java.util.Set<java.lang.String> getIdentifiers(DefinedTerm type)
type
- public java.util.Set<java.lang.String> getIdentifiers(java.util.UUID identifierTypeUuid)
identifierTypeUuid
- public Identifier addIdentifier(java.lang.String identifier, DefinedTerm identifierType)
IIdentifiableEntity
addIdentifier
in interface IIdentifiableEntity
IIdentifiableEntity.getIdentifiers()
public void addIdentifier(java.lang.Integer index, Identifier identifier)
IIdentifiableEntity
index
see List.add(int, Object)
and .
If index
is null
the identifier is added to the end
of the list.addIdentifier
in interface IIdentifiableEntity
index
- the list indexidentifier
- the identifierIIdentifiableEntity.getIdentifiers()
public void addIdentifier(Identifier identifier)
addIdentifier
in interface IIdentifiableEntity
IIdentifiableEntity.getIdentifiers()
public void removeIdentifier(Identifier identifier)
IIdentifiableEntity
removeIdentifier
in interface IIdentifiableEntity
IIdentifiableEntity.getIdentifiers()
public void removeIdentifier(int index)
IIdentifiableEntity
index
see List.add(int, Object)
and removeIdentifier
in interface IIdentifiableEntity
index
- the list indexpublic boolean replaceIdentifier(Identifier newObject, Identifier oldObject)
IIdentifiableEntity
replaceIdentifier
in interface IIdentifiableEntity
newObject
- the replacement objectoldObject
- the object to be replacedpublic java.util.Set<Extension> getExtensions()
getExtensions
in interface IIdentifiableEntity
public java.util.Set<Extension> getFilteredExtensions(java.util.UUID extensionTypeUuid)
public java.util.Set<java.lang.String> getExtensions(ExtensionType type)
type
- public java.util.Set<java.lang.String> getExtensions(java.util.UUID extensionTypeUuid)
extensionTypeUuid
- hasExtension(UUID, String)
public java.lang.String getExtensionsConcat(java.util.UUID extensionTypeUuid, java.lang.String separator)
getExtensionsConcat(Collection, String)
public java.lang.String getExtensionsConcat(java.util.Collection<java.util.UUID> extensionTypeUuids, java.lang.String separator)
extensionTypeUuids
- collection of the extension types to be consideredseparator
- the separator for concatenationgetExtensionsConcat(Collection, String)
public boolean hasExtension(java.util.UUID extensionTypeUuid, java.lang.String value)
null
true
is returned if
an Extension exists with given type and 'value' is null
.extensionTypeUuid
- value
- hasExtension(ExtensionType, String)
,
getExtensions(UUID)
public boolean hasExtension(ExtensionType extensionType, java.lang.String value)
hasExtension(UUID, String)
public void addExtension(java.lang.String value, ExtensionType extensionType)
addExtension
in interface IIdentifiableEntity
public void addExtension(Extension extension)
addExtension
in interface IIdentifiableEntity
public void removeExtension(Extension extension)
removeExtension
in interface IIdentifiableEntity
public void addSource(IdentifiableSource source)
ISourceable
addSource
in interface ISourceable<IdentifiableSource>
addSource
in class SourcedEntityBase<IdentifiableSource>
public void addSources(java.util.Set<IdentifiableSource> sources)
ISourceable
addSources
in interface ISourceable<IdentifiableSource>
addSources
in class SourcedEntityBase<IdentifiableSource>
protected IdentifiableSource createNewSource(OriginalSourceType type, java.lang.String idInSource, java.lang.String idNamespace, Reference reference, java.lang.String microReference, java.lang.String originalInfo, ICdmTarget target)
createNewSource
in class SourcedEntityBase<IdentifiableSource>
public java.lang.String toString()
CdmBase
Object.toString()
.
This returns an String that identifies the object well without being necessarily unique. Internally the method is delegating the
call to {link CdmBase.instanceToString()
.Note: If overriding this method's javadoc always copy or link the above requirement. If not overwritten by a subclass method returns the class, id and uuid as a string for any CDM object.
For example: Taxon#13<b5938a98-c1de-4dda-b040-d5cc5bfb3bc0>
toString
in interface IIdentifiableEntity
toString
in class CdmBase
Object.toString()
public S getCacheStrategy()
cache strategy
used to generate
several strings corresponding to this identifiable entity
(in particular taxon name caches and author strings).IIdentifiableEntityCacheStrategy
public void setCacheStrategy(S cacheStrategy)
getCacheStrategy()
public java.lang.String generateTitle()
IIdentifiableEntity
this
object.
This method is meant for internal use and usually not needed for
external use. Use IIdentifiableEntity.getTitleCache()
instead.generateTitle
in interface IIdentifiableEntity
IIdentifiableEntity.getTitleCache()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
VersionableEntity
clone
in class SourcedEntityBase<IdentifiableSource>
java.lang.CloneNotSupportedException
Object.clone()
Copyright © 2007-2020 EDIT. All Rights Reserved.