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_PROPERTIESATTRIBUTE_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, saveChangesequals, hashCode, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetComposite, getRepeater, getType, getValue, getValue, hasValue, isMultiplecopyTo, getDataNamestoSAX, toSAXdataToSAX, dataToSAX, dataToSAX, dataToSAXaddAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsersgetAllowedGroups, getAllowedProfilesForAnonymous, getAllowedProfilesForAnyConnectedUser, getAllowedProfilesForGroups, getAllowedProfilesForUser, getAllowedProfilesForUsers, getAllowedUsers, getDeniedGroups, getDeniedProfilesForAnonymous, getDeniedProfilesForAnyConnectedUser, getDeniedProfilesForGroups, getDeniedProfilesForUser, getDeniedProfilesForUsers, getDeniedUsersgetNodeneedsSave, rename, revertChanges, saveChangesequals, getId, getName, getParent, getParentPath, getPath, hashCoderemovegetChildAt, getChildPositionpublic 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
ContentgetTypes in interface ContentAmetysRepositoryException - if an error occurs.public String[] getMixinTypes() throws AmetysRepositoryException
ContentgetMixinTypes in interface ContentAmetysRepositoryException - if an error occurs.public String getLanguage() throws AmetysRepositoryException
ContentgetLanguage in interface Contentnull if the content is a multilingual contentAmetysRepositoryException - if an error occurs.public String getTitle(Locale locale) throws UnknownDataException, AmetysRepositoryException
ContentgetTitle in interface Contentlocale - 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
ContentContent.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 ContentUnknownDataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public UserIdentity getCreator() throws UnknownDataException, AmetysRepositoryException
ContentgetCreator in interface ContentUnknownDataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public Date getCreationDate() throws UnknownDataException, AmetysRepositoryException
ContentgetCreationDate in interface ContentUnknownDataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public UserIdentity getLastContributor() throws UnknownDataException, AmetysRepositoryException
ContentgetLastContributor in interface ContentUnknownDataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public Date getLastModified() throws UnknownDataException, AmetysRepositoryException
ContentgetLastModified in interface ContentUnknownDataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public Date getFirstValidationDate() throws UnknownDataException, AmetysRepositoryException
ContentgetFirstValidationDate in interface ContentUnknownDataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public Date getLastValidationDate() throws UnknownDataException, AmetysRepositoryException
ContentgetLastValidationDate in interface ContentUnknownDataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public Date getLastMajorValidationDate() throws AmetysRepositoryException
ContentgetLastMajorValidationDate in interface ContentUnknownDataException - if this property does not exist.AmetysRepositoryException - if an error occurs.public Set<String> getTags() throws AmetysRepositoryException
TagAwareAmetysObjectgetTags in interface TagAwareAmetysObjectAmetysRepositoryException - if an error occurs.public Map<String,OutgoingReferences> getOutgoingReferences() throws AmetysRepositoryException
ContentgetOutgoingReferences in interface ContentAmetysRepositoryException - if an error occurs.public Collection<Content> getReferencingContents() throws AmetysRepositoryException
ContentgetReferencingContents in interface ContentAmetysRepositoryException - if an error occurs.public boolean hasReferencingContents() throws AmetysRepositoryException
Contenttrue if there is at least one Content referencing this Content (as a metadata).hasReferencingContents in interface Contenttrue 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
CopiableAmetysObjectAmetysObject to the given object if it is not in the restriction list. Be careful, this method save changes.copyTo in interface CopiableAmetysObjectparent - 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
CopiableAmetysObjectAmetysObject to the given object. Be careful, this method save changes.copyTo in interface CopiableAmetysObjectparent - 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
RepositoryExceptionpublic String getDCTitle() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCTitle in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCCreator() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCCreator in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String[] getDCSubject() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCSubject in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCDescription() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCDescription in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCPublisher() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCPublisher in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCContributor() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCContributor in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public Date getDCDate() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCDate in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCType() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCType in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCFormat() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCFormat in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCIdentifier() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCIdentifier in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCSource() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCSource in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCLanguage() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCLanguage in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCRelation() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCRelation in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCCoverage() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCCoverage in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public String getDCRights() throws AmetysRepositoryException
DublinCoreAwareAmetysObjectgetDCRights in interface DublinCoreAwareAmetysObjectAmetysRepositoryException - if an error occurs.public ResourceCollection getRootAttachments() throws AmetysRepositoryException
ContentgetRootAttachments in interface ContentAmetysRepositoryException - if an error occurs.public boolean hasChild(String name) throws AmetysRepositoryException
TraversableAmetysObjecthasChild in interface TraversableAmetysObjectname - 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
ModifiableTraversableAmetysObjectcreateChild in interface ModifiableTraversableAmetysObjectA - 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
TraversableAmetysObjectnull, empty nor begin with a '/'.getChild in interface TraversableAmetysObjectA - 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
TraversableAmetysObjectgetChildren in interface TraversableAmetysObjectA - the actual type of AmetysObjects.AmetysObjectIterable.AmetysRepositoryException - if an error occurs.public ModelItem getDefinition(String dataPath)
ContentgetDefinition in interface ContentdataPath - path of the datanull if there is no item defined at this path.
TODO NEWATTRIBUTEAPI_CONTENT: Move this method in ModelAwareDataHolderpublic ModelAwareDataHolder getDataHolder()
DataAwareAmetysObjectDataHolder of this AmetysObject.getDataHolder in interface DataAwareAmetysObjectgetDataHolder in interface ModelAwareDataAwareAmetysObjectDataHolder of this AmetysObjectprotected List<Model> getModels()
public void addReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
ReactionableObjectaddReaction in interface ReactionableObjectuser - the userreactionType - the reaction typepublic void removeReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
ReactionableObjectremoveReaction in interface ReactionableObjectuser - the userreactionType - the reaction typepublic List<UserIdentity> getReactionUsers(ReactionableObject.ReactionType reactionType)
ReactionableObjectgetReactionUsers in interface ReactionableObjectreactionType - the reaction type