F
- the actual type of factory.public class DefaultContent<F extends ContentFactory> extends DefaultAmetysObject<F> implements Content, CopiableAmetysObject, JCRTraversableAmetysObject, ReactionableObject
Content
, also versionable, lockable and workflow-aware.ReactionableObject.ReactionType
Modifier and Type | Field and Description |
---|---|
private static Logger |
__logger |
private boolean |
_lockAlreadyChecked |
private List<Model> |
_models |
static String |
ATTACHMENTS_NODE_NAME
Constant for the attachment node name.
|
static Locale |
DEFAULT_CONTENT_LOCALE
The default locale for content
|
static String |
METADATA_CONTENTTYPE
Constants for contentType Metadata*
|
static String |
METADATA_CONTRIBUTOR
Constants for last contributor Metadata*
|
static String |
METADATA_CREATION
Constants for lastModified Metadata*
|
static String |
METADATA_CREATOR
Constants for author Metadata*
|
static String |
METADATA_FIRST_VALIDATION
Constants for firstValidationDate Metadata*
|
static String |
METADATA_LANGUAGE
Constants for language Metadata*
|
static String |
METADATA_LAST_MAJORVALIDATION
Constants for lastMajorValidationDate Metadata*
|
static String |
METADATA_LAST_VALIDATION
Constants for lastValidationDate Metadata*
|
static String |
METADATA_MIXINCONTENTTYPES
Constants for contentType Metadata*
|
static String |
METADATA_MODIFIED
Constants for lastModified Metadata*
|
static String |
METADATA_OUTGOING_REFERENCE_NODETYPE
Constants for the outgoing reference nodetype
|
static String |
METADATA_OUTGOING_REFERENCE_PROPERTY
Constants for the outgoing reference property
|
static String |
METADATA_OUTGOING_REFERENCES
Constants for the outgoing references node
|
static String |
METADATA_OUTGOING_REFERENCES_PATH_PROPERTY
Constants for the outgoing references path property
|
static String |
METADATA_ROOT_OUTGOING_REFERENCES
Constants for the root outgoing references node
|
PROTECTED_PROPERTIES
ATTRIBUTE_TITLE, METADATA_TITLE
Constructor and Description |
---|
DefaultContent(Node node,
String parentPath,
F factory)
Creates a JCR-based Content.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
_checkLock() |
void |
addReaction(UserIdentity user,
ReactionableObject.ReactionType reactionType)
Add the user reaction
|
ModifiableContent |
copyTo(ModifiableTraversableAmetysObject parent,
String name)
Copy the current
AmetysObject to the given object. |
ModifiableContent |
copyTo(ModifiableTraversableAmetysObject parent,
String name,
int initWorkflowActionId)
Copy the current
DefaultWorkflowAwareContent to the given object. |
ModifiableContent |
copyTo(ModifiableTraversableAmetysObject parent,
String name,
List<String> restrictTo)
Copy the current
AmetysObject to the given object if it is not in the restriction list. |
ModifiableContent |
copyTo(ModifiableTraversableAmetysObject parent,
String name,
String lang,
int initWorkflowActionId)
Copy the current
DefaultWorkflowAwareContent to the given object. |
ModifiableContent |
copyTo(ModifiableTraversableAmetysObject parent,
String name,
String lang,
int initWorkflowActionId,
boolean waitAsyncObservers,
boolean copyACL)
Copy the current
DefaultWorkflowAwareContent to the given object. |
<A extends AmetysObject> |
createChild(String name,
String type)
Creates a child below current object.
|
<A extends AmetysObject> |
getChild(String path)
Retrieves a given child from its relative path.
|
<A extends AmetysObject> |
getChildren()
Retrieves children of the current object.
|
Date |
getCreationDate()
Retrieves the creation date.
|
UserIdentity |
getCreator()
Retrieves the login of the creator.
|
ModelAwareDataHolder |
getDataHolder()
Returns the
DataHolder of this AmetysObject . |
String |
getDCContributor()
Get the Dublin Core contributor.
|
String |
getDCCoverage()
Get the Dublin Core coverage.
|
String |
getDCCreator()
Get the Dublin Core creator.
|
Date |
getDCDate()
Get the Dublin Core date.
|
String |
getDCDescription()
Get the Dublin Core description.
|
String |
getDCFormat()
Get the Dublin Core format.
|
String |
getDCIdentifier()
Get the Dublin Core identifier.
|
String |
getDCLanguage()
Get the Dublin Core language.
|
String |
getDCPublisher()
Get the Dublin Core publisher.
|
String |
getDCRelation()
Get the Dublin Core relation.
|
String |
getDCRights()
Get the Dublin Core rights.
|
String |
getDCSource()
Get the Dublin Core source.
|
String[] |
getDCSubject()
Get the Dublin Core subject.
|
String |
getDCTitle()
Get the Dublin Core title.
|
String |
getDCType()
Get the Dublin Core type.
|
ModelItem |
getDefinition(String dataPath)
Retrieves the definition of the data at the given path
|
Date |
getFirstValidationDate()
Retrieves the first validation date
|
String |
getLanguage()
Retrieves the language of this content.
|
UserIdentity |
getLastContributor()
Retrieves the login of the last contributor.
|
Date |
getLastMajorValidationDate()
Retrieves the last validation date resulting from a major modification.
|
Date |
getLastModified()
Retrieves the last modification date.
|
Date |
getLastValidationDate()
Retrieves the last validation date
|
String[] |
getMixinTypes()
Retrieves the mixin types of this content.
|
protected List<Model> |
getModels()
Retrieves the model of the content as an array
|
Map<String,OutgoingReferences> |
getOutgoingReferences()
Get the stored outgoing references of the content.
|
List<UserIdentity> |
getReactionUsers(ReactionableObject.ReactionType reactionType)
Get the list of users who react
|
Collection<Content> |
getReferencingContents()
Returns all Contents referencing this Content (as a metadata).
|
ResourceCollection |
getRootAttachments()
Retrieves the attachments root node
|
Set<String> |
getTags()
Retrieves current tags.
|
String |
getTitle()
Retrieves the title.
|
String |
getTitle(Locale locale)
Retrieves the title for the given locale.
|
String[] |
getTypes()
Retrieves the types of this content.
|
boolean |
hasChild(String name)
Tests if this Object has at least one child with the given name.
|
boolean |
hasReferencingContents()
Returns
true if there is at least one Content referencing this Content (as a metadata). |
void |
removeReaction(UserIdentity user,
ReactionableObject.ReactionType reactionType)
Remove the user reaction
|
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, addLabel, checkpoint, copyNode, getAllLabels, getAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getAllRevisions, getBaseNode, getBaseVersion, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsers, getLabels, getLabels, getNode, getRevision, getRevisionTimestamp, getRevisionTimestamp, getUnversionedMetadataHolder, getVersionHistory, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers, removeLabel, restoreFromLabel, restoreFromNode, restoreFromRevision, switchToLabel, switchToRevision
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
equals, hashCode, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getComposite, getRepeater, getType, getValue, getValue, hasValue, isMultiple
copyTo, getDataNames
toSAX, toSAX
dataToSAX, dataToSAX, dataToSAX, dataToSAX
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers
getAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsers
getNode
needsSave, rename, revertChanges, saveChanges
equals, getId, getName, getParent, getParentPath, getPath, hashCode
remove
getChildAt, getChildPosition
public static final String METADATA_ROOT_OUTGOING_REFERENCES
public static final String METADATA_OUTGOING_REFERENCES
public static final String METADATA_OUTGOING_REFERENCES_PATH_PROPERTY
public static final String METADATA_OUTGOING_REFERENCE_PROPERTY
public static final String METADATA_OUTGOING_REFERENCE_NODETYPE
public static final String METADATA_LANGUAGE
public static final String METADATA_CREATOR
public static final String METADATA_CREATION
public static final String METADATA_FIRST_VALIDATION
public static final String METADATA_LAST_VALIDATION
public static final String METADATA_LAST_MAJORVALIDATION
public static final String METADATA_CONTRIBUTOR
public static final String METADATA_MODIFIED
public static final String METADATA_CONTENTTYPE
public static final String METADATA_MIXINCONTENTTYPES
public static final String ATTACHMENTS_NODE_NAME
public static final Locale DEFAULT_CONTENT_LOCALE
private boolean _lockAlreadyChecked
public DefaultContent(Node node, String parentPath, F factory)
node
- the JCR Node backing this Content.parentPath
- the parent path in the Ametys hierarchy.factory
- the corresponding ContentFactory
.public String[] getTypes() throws AmetysRepositoryException
Content
getTypes
in interface Content
AmetysRepositoryException
- if an error occurs.public String[] getMixinTypes() throws AmetysRepositoryException
Content
getMixinTypes
in interface Content
AmetysRepositoryException
- if an error occurs.public String getLanguage() throws AmetysRepositoryException
Content
getLanguage
in interface Content
null
if the content is a multilingual contentAmetysRepositoryException
- if an error occurs.public String getTitle(Locale locale) throws UnknownDataException, AmetysRepositoryException
Content
getTitle
in interface Content
locale
- The locale. Can be null if the content is not a multilingual content or to get the title in the default locale.UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public String getTitle() throws UnknownDataException, AmetysRepositoryException
Content
Content.getTitle(Locale)
with a null locale.
Use this method only if you are manipulating no-multilingual content. If not sure, use Content.getTitle(Locale)
instead.getTitle
in interface Content
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public UserIdentity getCreator() throws UnknownDataException, AmetysRepositoryException
Content
getCreator
in interface Content
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public Date getCreationDate() throws UnknownDataException, AmetysRepositoryException
Content
getCreationDate
in interface Content
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public UserIdentity getLastContributor() throws UnknownDataException, AmetysRepositoryException
Content
getLastContributor
in interface Content
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public Date getLastModified() throws UnknownDataException, AmetysRepositoryException
Content
getLastModified
in interface Content
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public Date getFirstValidationDate() throws UnknownDataException, AmetysRepositoryException
Content
getFirstValidationDate
in interface Content
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public Date getLastValidationDate() throws UnknownDataException, AmetysRepositoryException
Content
getLastValidationDate
in interface Content
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public Date getLastMajorValidationDate() throws AmetysRepositoryException
Content
getLastMajorValidationDate
in interface Content
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.public Set<String> getTags() throws AmetysRepositoryException
TagAwareAmetysObject
getTags
in interface TagAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public Map<String,OutgoingReferences> getOutgoingReferences() throws AmetysRepositoryException
Content
getOutgoingReferences
in interface Content
AmetysRepositoryException
- if an error occurs.public Collection<Content> getReferencingContents() throws AmetysRepositoryException
Content
getReferencingContents
in interface Content
AmetysRepositoryException
- if an error occurs.public boolean hasReferencingContents() throws AmetysRepositoryException
Content
true
if there is at least one Content referencing this Content (as a metadata).hasReferencingContents
in interface Content
true
if there is at least one Content referencing this Content.AmetysRepositoryException
- if an error occurs.public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException
CopiableAmetysObject
AmetysObject
to the given object if it is not in the restriction list. Be careful, this method save changes.copyTo
in interface CopiableAmetysObject
parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied objectrestrictTo
- A restrict list of CopiableAmetysObject
authorized to be copiedAmetysRepositoryException
- if an error occurs.public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException
CopiableAmetysObject
AmetysObject
to the given object. Be careful, this method save changes.copyTo
in interface CopiableAmetysObject
parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied objectAmetysRepositoryException
- if an error occurs.public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name, int initWorkflowActionId) throws AmetysRepositoryException
DefaultWorkflowAwareContent
to the given object. Be careful, this method save changes, but do not create a new version (checkpoint)parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied object.initWorkflowActionId
- The initial workflow action idAmetysRepositoryException
- if an error occurs.public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId) throws AmetysRepositoryException
DefaultWorkflowAwareContent
to the given object. Be careful, this method save changes, but do not create a new version (checkpoint)parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied object.lang
- Language of the new object. Can be null. If null, the new language will be get from the copied object.initWorkflowActionId
- The initial workflow action idAmetysRepositoryException
- if an error occurs.public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId, boolean waitAsyncObservers, boolean copyACL) throws AmetysRepositoryException
DefaultWorkflowAwareContent
to the given object. Be careful, this method save changes, but do not create a new version (checkpoint)parent
- The parent of the new object. Can not be null.name
- Name of the new object. Can be null. If null, the new name will be get from the copied object.lang
- Language of the new object. Can be null. If null, the new language will be get from the copied object.initWorkflowActionId
- The initial workflow action idwaitAsyncObservers
- if true, waits if necessary for the asynchronous observers to completecopyACL
- true to copy ACL of source contentAmetysRepositoryException
- if an error occurs.void _checkLock() throws RepositoryException
RepositoryException
public String getDCTitle() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCTitle
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCCreator() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCCreator
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String[] getDCSubject() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCSubject
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCDescription() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCDescription
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCPublisher() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCPublisher
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCContributor() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCContributor
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public Date getDCDate() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCDate
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCType() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCType
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCFormat() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCFormat
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCIdentifier() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCIdentifier
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCSource() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCSource
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCLanguage() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCLanguage
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCRelation() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCRelation
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCCoverage() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCCoverage
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public String getDCRights() throws AmetysRepositoryException
DublinCoreAwareAmetysObject
getDCRights
in interface DublinCoreAwareAmetysObject
AmetysRepositoryException
- if an error occurs.public ResourceCollection getRootAttachments() throws AmetysRepositoryException
Content
getRootAttachments
in interface Content
AmetysRepositoryException
- if an error occurs.public boolean hasChild(String name) throws AmetysRepositoryException
TraversableAmetysObject
hasChild
in interface TraversableAmetysObject
name
- the name to test. Cannot be null
nor empty nor
begin with a '/'
and it cannot contain '/'
.true
if the named child exists,
false
otherwise.AmetysRepositoryException
- if an error occurs.public <A extends AmetysObject> A createChild(String name, String type) throws AmetysRepositoryException, RepositoryIntegrityViolationException
ModifiableTraversableAmetysObject
createChild
in interface ModifiableTraversableAmetysObject
A
- the actual type of AmetysObject
.name
- the name of the child, position ([n]
) are not supported for
same name sibling, the child will be added at the end of the children list.type
- the type of the object.AmetysRepositoryException
- if an error occurs.RepositoryIntegrityViolationException
- if an object with the same name already
exists and same name siblings is not allowed.public <A extends AmetysObject> A getChild(String path) throws AmetysRepositoryException, UnknownAmetysObjectException
TraversableAmetysObject
null
, empty nor begin with a '/'
.getChild
in interface TraversableAmetysObject
A
- the actual type of AmetysObject
.path
- the path of the child which can contains a position with.
[n]
if same name sibling is allowed.AmetysRepositoryException
- if an error occurs.UnknownAmetysObjectException
- if the object does not exist.public <A extends AmetysObject> AmetysObjectIterable<A> getChildren() throws AmetysRepositoryException
TraversableAmetysObject
getChildren
in interface TraversableAmetysObject
A
- the actual type of AmetysObject
s.AmetysObjectIterable
.AmetysRepositoryException
- if an error occurs.public ModelItem getDefinition(String dataPath)
Content
getDefinition
in interface Content
dataPath
- path of the datanull
if there is no item defined at this path.
TODO NEWATTRIBUTEAPI_CONTENT: Move this method in ModelAwareDataHolder
public ModelAwareDataHolder getDataHolder()
DataAwareAmetysObject
DataHolder
of this AmetysObject
.getDataHolder
in interface DataAwareAmetysObject
getDataHolder
in interface ModelAwareDataAwareAmetysObject
DataHolder
of this AmetysObject
protected List<Model> getModels()
public void addReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
ReactionableObject
addReaction
in interface ReactionableObject
user
- the userreactionType
- the reaction typepublic void removeReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
ReactionableObject
removeReaction
in interface ReactionableObject
user
- the userreactionType
- the reaction typepublic List<UserIdentity> getReactionUsers(ReactionableObject.ReactionType reactionType)
ReactionableObject
getReactionUsers
in interface ReactionableObject
reactionType
- the reaction type