Package org.ametys.cms.repository
Class DefaultContent<F extends ContentFactory>
- java.lang.Object
-
- org.ametys.plugins.repository.AbstractAmetysObject
-
- org.ametys.plugins.repository.jcr.SimpleAmetysObject<F>
-
- org.ametys.plugins.repository.jcr.DefaultAmetysObject<F>
-
- org.ametys.cms.repository.DefaultContent<F>
-
- Type Parameters:
F
- the actual type of factory.
- All Implemented Interfaces:
Content
,ReactionableObject
,ReportableObject
,ACLAmetysObject
,AmetysObject
,CopiableAmetysObject
,DataAwareAmetysObject
,ModelAwareDataAwareAmetysObject
,DataHolder
,ModelAwareDataHolder
,DublinCoreAwareAmetysObject
,JCRAmetysObject
,JCRTraversableAmetysObject
,MetadataAwareAmetysObject
,ModifiableMetadataAwareAmetysObject
,ModifiableACLAmetysObject
,ModifiableAmetysObject
,ModifiableTraversableAmetysObject
,RemovableAmetysObject
,TagAwareAmetysObject
,TraversableAmetysObject
,DataAndVersionAwareAmetysObject
,ModifiableDataAwareVersionableAmetysObject
,VersionableAmetysObject
,VersionAwareAmetysObject
- Direct Known Subclasses:
DefaultWebContent
,DefaultWorkflowAwareContent
,ModifiableDefaultContent
public class DefaultContent<F extends ContentFactory> extends DefaultAmetysObject<F> implements Content, CopiableAmetysObject, JCRTraversableAmetysObject, ReactionableObject, ReportableObject
Default implementation of aContent
, also versionable, lockable and workflow-aware.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ametys.cms.repository.ReactionableObject
ReactionableObject.ReactionType
-
-
Field Summary
Fields Modifier and Type Field Description static String
ATTACHMENTS_NODE_NAME
Constant for the attachment node name.static Locale
DEFAULT_CONTENT_LOCALE
The default locale for contentstatic 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 nodetypestatic String
METADATA_OUTGOING_REFERENCE_PROPERTY
Constants for the outgoing reference propertystatic String
METADATA_OUTGOING_REFERENCES
Constants for the outgoing references nodestatic String
METADATA_OUTGOING_REFERENCES_PATH_PROPERTY
Constants for the outgoing references path propertystatic String
METADATA_ROOT_OUTGOING_REFERENCES
Constants for the root outgoing references node-
Fields inherited from class org.ametys.plugins.repository.jcr.DefaultAmetysObject
PROTECTED_PROPERTIES
-
Fields inherited from interface org.ametys.cms.repository.Content
ATTRIBUTE_TITLE, METADATA_TITLE
-
Fields inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
ALTERNATIVE_SUFFIX, COMMENTS_SUFFIX, STATUS_SUFFIX
-
-
Constructor Summary
Constructors Constructor Description DefaultContent(Node node, String parentPath, F factory)
Creates a JCR-based Content.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
Add the user reactionvoid
addReport()
Add a report to the objectvoid
clearReports()
Remove all reports on the objectModifiableContent
copyTo(ModifiableTraversableAmetysObject parent, String name)
Copy the currentAmetysObject
to the given object.ModifiableContent
copyTo(ModifiableTraversableAmetysObject parent, String name, int initWorkflowActionId)
Copy the currentDefaultWorkflowAwareContent
to the given object.ModifiableContent
copyTo(ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId)
Copy the currentDefaultWorkflowAwareContent
to the given object.ModifiableContent
copyTo(ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId, boolean waitAsyncObservers, boolean copyACL)
Copy the currentDefaultWorkflowAwareContent
to the given object.ModifiableContent
copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo)
Copy the currentAmetysObject
to the given object if it is not in the restriction list.<A extends AmetysObject>
AcreateChild(String name, String type)
Creates a child below current object.<A extends AmetysObject>
AgetChild(String path)
Retrieves a given child from its relative path.<A extends AmetysObject>
AmetysObjectIterable<A>getChildren()
Retrieves children of the current object.Date
getCreationDate()
Retrieves the creation date.UserIdentity
getCreator()
Retrieves the login of the creator.ModelAwareDataHolder
getDataHolder()
Returns theDataHolder
of thisAmetysObject
.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.Date
getFirstValidationDate()
Retrieves the first validation dateModifiableModelLessDataHolder
getInternalDataHolder()
Returns theDataHolder
for internal data of thisContent
.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 dateString[]
getMixinTypes()
Retrieves the mixin type identifiers of this content.Map<String,OutgoingReferences>
getOutgoingReferences()
Get the stored outgoing references of the content.List<UserIdentity>
getReactionUsers(ReactionableObject.ReactionType reactionType)
Get the list of users who reactCollection<Content>
getReferencingContents()
Returns all Contents referencing this Content (as a metadata).long
getReportsCount()
Retrieves the number of reports on the objectResourceCollection
getRootAttachments()
Retrieves the attachments root nodeSet<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 type identifiers of this content.boolean
hasChild(String name)
Tests if this Object has at least one child with the given name.boolean
hasReferencingContents()
Returnstrue
if there is at least one Content referencing this Content (as a metadata).void
removeReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
Remove the user reactionvoid
setLanguage(String language)
Set the type of this Content.
This method may only be called on a new Content, ie.void
setMixinTypes(String[] mixins)
Set the mixins of this Content.void
setReportsCount(long reportsCount)
Sets the number of reports on the objectvoid
setType(String type)
Set the type of this contentvoid
setTypes(String[] types)
Set the types of this Content.void
toSAX(ContentHandler contentHandler, Locale locale, View view, boolean saxWorkflowStep)
Generates SAX events representing this Content.-
Methods inherited from class org.ametys.plugins.repository.jcr.DefaultAmetysObject
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, addLabel, checkpoint, copyNode, disallowInheritance, getAllLabels, getAllRevisions, getBaseNode, getBaseVersion, getLabels, getLabels, getNode, getProfilesForAnonymousAndAnyConnectedUser, getProfilesForGroups, getProfilesForUsers, getRevision, getRevisionTimestamp, getRevisionTimestamp, getUnversionedDataHolder, getVersionHistory, isInheritanceDisallowed, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers, removeLabel, restoreFromLabel, restoreFromNode, restoreFromRevision, switchToLabel, switchToRevision
-
Methods inherited from class org.ametys.plugins.repository.jcr.SimpleAmetysObject
_getFactory, _invalidateName, _invalidateParentPath, getId, getMetadataHolder, getName, getParent, getParentPath, getPath, needsSave, remove, rename, revertChanges, saveChanges
-
Methods inherited from class org.ametys.plugins.repository.AbstractAmetysObject
equals, hashCode, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.repository.ACLAmetysObject
getProfilesForAnonymousAndAnyConnectedUser, getProfilesForGroups, getProfilesForUsers, isInheritanceDisallowed
-
Methods inherited from interface org.ametys.plugins.repository.AmetysObject
equals, getId, getName, getParent, getParentPath, getPath, hashCode
-
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.DataAwareAmetysObject
copyTo, dataToSAX, dataToSAX, getRepositoryData
-
Methods inherited from interface org.ametys.plugins.repository.jcr.JCRAmetysObject
getNode
-
Methods inherited from interface org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject
getComments, getComposite, getDataNames, getDefinition, getExternalComposite, getExternalRepeater, getExternalValue, getLocalComposite, getLocalRepeater, getLocalValue, getModel, getParentDataHolder, getRepeater, getRootDataHolder, getStatus, getValue, getValue, hasComments, hasDefinition, hasExternalValue, hasExternalValueOrEmpty, hasLocalValue, hasLocalValueOrEmpty, hasValue, hasValueOrEmpty
-
Methods inherited from interface org.ametys.plugins.repository.data.holder.ModelAwareDataHolder
commentsToSAX, dataToMap, dataToMap, dataToMap, dataToMap, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, getType, getValue, isMultiple
-
Methods inherited from interface org.ametys.plugins.repository.ModifiableACLAmetysObject
addAllowedGroups, addAllowedProfilesForAnonymous, addAllowedProfilesForAnyConnectedUser, addAllowedUsers, addDeniedGroups, addDeniedProfilesForAnonymous, addDeniedProfilesForAnyConnectedUser, addDeniedUsers, disallowInheritance, removeAllowedGroups, removeAllowedGroups, removeAllowedProfilesForAnonymous, removeAllowedProfilesForAnyConnectedUser, removeAllowedUsers, removeAllowedUsers, removeDeniedGroups, removeDeniedGroups, removeDeniedProfilesForAnonymous, removeDeniedProfilesForAnyConnectedUser, removeDeniedUsers, removeDeniedUsers
-
Methods inherited from interface org.ametys.plugins.repository.ModifiableAmetysObject
needsSave, rename, revertChanges, saveChanges
-
Methods inherited from interface org.ametys.plugins.repository.metadata.ModifiableMetadataAwareAmetysObject
getMetadataHolder
-
Methods inherited from interface org.ametys.plugins.repository.RemovableAmetysObject
remove
-
Methods inherited from interface org.ametys.plugins.repository.TraversableAmetysObject
getChildAt, getChildPosition
-
-
-
-
Field Detail
-
METADATA_ROOT_OUTGOING_REFERENCES
public static final String METADATA_ROOT_OUTGOING_REFERENCES
Constants for the root outgoing references node- See Also:
- Constant Field Values
-
METADATA_OUTGOING_REFERENCES
public static final String METADATA_OUTGOING_REFERENCES
Constants for the outgoing references node- See Also:
- Constant Field Values
-
METADATA_OUTGOING_REFERENCES_PATH_PROPERTY
public static final String METADATA_OUTGOING_REFERENCES_PATH_PROPERTY
Constants for the outgoing references path property- See Also:
- Constant Field Values
-
METADATA_OUTGOING_REFERENCE_PROPERTY
public static final String METADATA_OUTGOING_REFERENCE_PROPERTY
Constants for the outgoing reference property- See Also:
- Constant Field Values
-
METADATA_OUTGOING_REFERENCE_NODETYPE
public static final String METADATA_OUTGOING_REFERENCE_NODETYPE
Constants for the outgoing reference nodetype- See Also:
- Constant Field Values
-
METADATA_LANGUAGE
public static final String METADATA_LANGUAGE
Constants for language Metadata*- See Also:
- Constant Field Values
-
METADATA_CREATOR
public static final String METADATA_CREATOR
Constants for author Metadata*- See Also:
- Constant Field Values
-
METADATA_CREATION
public static final String METADATA_CREATION
Constants for lastModified Metadata*- See Also:
- Constant Field Values
-
METADATA_FIRST_VALIDATION
public static final String METADATA_FIRST_VALIDATION
Constants for firstValidationDate Metadata*- See Also:
- Constant Field Values
-
METADATA_LAST_VALIDATION
public static final String METADATA_LAST_VALIDATION
Constants for lastValidationDate Metadata*- See Also:
- Constant Field Values
-
METADATA_LAST_MAJORVALIDATION
public static final String METADATA_LAST_MAJORVALIDATION
Constants for lastMajorValidationDate Metadata*- See Also:
- Constant Field Values
-
METADATA_CONTRIBUTOR
public static final String METADATA_CONTRIBUTOR
Constants for last contributor Metadata*- See Also:
- Constant Field Values
-
METADATA_MODIFIED
public static final String METADATA_MODIFIED
Constants for lastModified Metadata*- See Also:
- Constant Field Values
-
METADATA_CONTENTTYPE
public static final String METADATA_CONTENTTYPE
Constants for contentType Metadata*- See Also:
- Constant Field Values
-
METADATA_MIXINCONTENTTYPES
public static final String METADATA_MIXINCONTENTTYPES
Constants for contentType Metadata*- See Also:
- Constant Field Values
-
ATTACHMENTS_NODE_NAME
public static final String ATTACHMENTS_NODE_NAME
Constant for the attachment node name.- See Also:
- Constant Field Values
-
DEFAULT_CONTENT_LOCALE
public static final Locale DEFAULT_CONTENT_LOCALE
The default locale for content
-
-
Constructor Detail
-
DefaultContent
public DefaultContent(Node node, String parentPath, F factory)
Creates a JCR-based Content.- Parameters:
node
- the JCR Node backing this Content.parentPath
- the parent path in the Ametys hierarchy.factory
- the correspondingContentFactory
.
-
-
Method Detail
-
getTypes
public String[] getTypes() throws AmetysRepositoryException
Description copied from interface:Content
Retrieves the type identifiers of this content.- Specified by:
getTypes
in interfaceContent
- Returns:
- the type identifiers of this content.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setType
public void setType(String type) throws AmetysRepositoryException
Description copied from interface:Content
Set the type of this content- Specified by:
setType
in interfaceContent
- Parameters:
type
- the type to set- Throws:
AmetysRepositoryException
- if an error occurs.
-
setTypes
public void setTypes(String[] types) throws AmetysRepositoryException
Description copied from interface:Content
Set the types of this Content.- Specified by:
setTypes
in interfaceContent
- Parameters:
types
- the types of this content.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getMixinTypes
public String[] getMixinTypes() throws AmetysRepositoryException
Description copied from interface:Content
Retrieves the mixin type identifiers of this content.- Specified by:
getMixinTypes
in interfaceContent
- Returns:
- the mixin type identifiers of this content.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
setMixinTypes
public void setMixinTypes(String[] mixins) throws AmetysRepositoryException
Description copied from interface:Content
Set the mixins of this Content.- Specified by:
setMixinTypes
in interfaceContent
- Parameters:
mixins
- the mixins of this content.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getLanguage
public String getLanguage() throws AmetysRepositoryException
Description copied from interface:Content
Retrieves the language of this content.- Specified by:
getLanguage
in interfaceContent
- Returns:
- the language of this content or
null
if the content is a multilingual content - Throws:
AmetysRepositoryException
- if an error occurs.
-
setLanguage
public void setLanguage(String language) throws AmetysRepositoryException
Description copied from interface:Content
Set the type of this Content.
This method may only be called on a new Content, ie. before its first save.- Specified by:
setLanguage
in interfaceContent
- Parameters:
language
- the language of this content.- Throws:
AmetysRepositoryException
- if an error occurs.
-
getTitle
public String getTitle(Locale locale) throws UnknownDataException, AmetysRepositoryException
Description copied from interface:Content
Retrieves the title for the given locale. If the locale is null or does not exist, the first locale will be used.- Specified by:
getTitle
in interfaceContent
- Parameters:
locale
- The locale. Can be null if the content is not a multilingual content or to get the title in the default locale.- Returns:
- the title.
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getTitle
public String getTitle() throws UnknownDataException, AmetysRepositoryException
Description copied from interface:Content
Retrieves the title. This method is same asContent.getTitle(Locale)
with a null locale. Use this method only if you are manipulating no-multilingual content. If not sure, useContent.getTitle(Locale)
instead.- Specified by:
getTitle
in interfaceContent
- Returns:
- the title.
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getCreator
public UserIdentity getCreator() throws UnknownDataException, AmetysRepositoryException
Description copied from interface:Content
Retrieves the login of the creator.- Specified by:
getCreator
in interfaceContent
- Returns:
- the login of the creator.
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getCreationDate
public Date getCreationDate() throws UnknownDataException, AmetysRepositoryException
Description copied from interface:Content
Retrieves the creation date.- Specified by:
getCreationDate
in interfaceContent
- Returns:
- the creation date.
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getLastContributor
public UserIdentity getLastContributor() throws UnknownDataException, AmetysRepositoryException
Description copied from interface:Content
Retrieves the login of the last contributor.- Specified by:
getLastContributor
in interfaceContent
- Returns:
- the login of the last contributor.
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getLastModified
public Date getLastModified() throws UnknownDataException, AmetysRepositoryException
Description copied from interface:Content
Retrieves the last modification date.- Specified by:
getLastModified
in interfaceContent
- Returns:
- the last modification date.
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getFirstValidationDate
public Date getFirstValidationDate() throws UnknownDataException, AmetysRepositoryException
Description copied from interface:Content
Retrieves the first validation date- Specified by:
getFirstValidationDate
in interfaceContent
- Returns:
- the first validation date
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getLastValidationDate
public Date getLastValidationDate() throws UnknownDataException, AmetysRepositoryException
Description copied from interface:Content
Retrieves the last validation date- Specified by:
getLastValidationDate
in interfaceContent
- Returns:
- the last validation date
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getLastMajorValidationDate
public Date getLastMajorValidationDate() throws AmetysRepositoryException
Description copied from interface:Content
Retrieves the last validation date resulting from a major modification. At least this is the first validation date- Specified by:
getLastMajorValidationDate
in interfaceContent
- Returns:
- the last validation date resulting from a major modification
- Throws:
UnknownDataException
- if this property does not exist.AmetysRepositoryException
- if an error occurs.
-
getTags
public Set<String> getTags() throws AmetysRepositoryException
Description copied from interface:TagAwareAmetysObject
Retrieves current tags.- Specified by:
getTags
in interfaceTagAwareAmetysObject
- Returns:
- the current tags.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getOutgoingReferences
public Map<String,OutgoingReferences> getOutgoingReferences() throws AmetysRepositoryException
Description copied from interface:Content
Get the stored outgoing references of the content. This references can be used for different purposes, such as testing link consistency for example.- Specified by:
getOutgoingReferences
in interfaceContent
- Returns:
- A non null map of outgoing references grouped by metadata (key are metadata path)
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getReferencingContents
public Collection<Content> getReferencingContents() throws AmetysRepositoryException
Description copied from interface:Content
Returns all Contents referencing this Content (as a metadata).- Specified by:
getReferencingContents
in interfaceContent
- Returns:
- all Contents referencing this Content.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
hasReferencingContents
public boolean hasReferencingContents() throws AmetysRepositoryException
Description copied from interface:Content
Returnstrue
if there is at least one Content referencing this Content (as a metadata).- Specified by:
hasReferencingContents
in interfaceContent
- Returns:
true
if there is at least one Content referencing this Content.- Throws:
AmetysRepositoryException
- if an error occurs.
-
copyTo
public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo) throws AmetysRepositoryException
Description copied from interface:CopiableAmetysObject
Copy the currentAmetysObject
to the given object if it is not in the restriction list. Be careful, this method save changes.- Specified by:
copyTo
in interfaceCopiableAmetysObject
- Parameters:
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 ofCopiableAmetysObject
authorized to be copied- Returns:
- the created object
- Throws:
AmetysRepositoryException
- if an error occurs.
-
copyTo
public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name) throws AmetysRepositoryException
Description copied from interface:CopiableAmetysObject
Copy the currentAmetysObject
to the given object. Be careful, this method save changes.- Specified by:
copyTo
in interfaceCopiableAmetysObject
- Parameters:
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- Returns:
- the created object
- Throws:
AmetysRepositoryException
- if an error occurs.
-
copyTo
public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name, int initWorkflowActionId) throws AmetysRepositoryException
Copy the currentDefaultWorkflowAwareContent
to the given object. Be careful, this method save changes, but do not create a new version (checkpoint)- Parameters:
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 id- Returns:
- the created object
- Throws:
AmetysRepositoryException
- if an error occurs.
-
copyTo
public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId) throws AmetysRepositoryException
Copy the currentDefaultWorkflowAwareContent
to the given object. Be careful, this method save changes, but do not create a new version (checkpoint)- Parameters:
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 id- Returns:
- the created object
- Throws:
AmetysRepositoryException
- if an error occurs.
-
copyTo
public ModifiableContent copyTo(ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId, boolean waitAsyncObservers, boolean copyACL) throws AmetysRepositoryException
Copy the currentDefaultWorkflowAwareContent
to the given object. Be careful, this method save changes, but do not create a new version (checkpoint)- Parameters:
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 content- Returns:
- the created object
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCTitle
public String getDCTitle() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core title.- Specified by:
getDCTitle
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core title. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCCreator
public String getDCCreator() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core creator.- Specified by:
getDCCreator
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core creator. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCSubject
public String[] getDCSubject() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core subject.- Specified by:
getDCSubject
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core subject. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCDescription
public String getDCDescription() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core description.- Specified by:
getDCDescription
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core description. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCPublisher
public String getDCPublisher() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core publisher.- Specified by:
getDCPublisher
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core publisher. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCContributor
public String getDCContributor() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core contributor.- Specified by:
getDCContributor
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core contributor. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCDate
public Date getDCDate() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core date.- Specified by:
getDCDate
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core date. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCType
public String getDCType() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core type.- Specified by:
getDCType
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core type. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCFormat
public String getDCFormat() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core format.- Specified by:
getDCFormat
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core format. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCIdentifier
public String getDCIdentifier() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core identifier.- Specified by:
getDCIdentifier
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core identifier. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCSource
public String getDCSource() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core source.- Specified by:
getDCSource
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core source. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCLanguage
public String getDCLanguage() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core language.- Specified by:
getDCLanguage
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core language. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCRelation
public String getDCRelation() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core relation.- Specified by:
getDCRelation
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core relation. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCCoverage
public String getDCCoverage() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core coverage.- Specified by:
getDCCoverage
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core coverage. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getDCRights
public String getDCRights() throws AmetysRepositoryException
Description copied from interface:DublinCoreAwareAmetysObject
Get the Dublin Core rights.- Specified by:
getDCRights
in interfaceDublinCoreAwareAmetysObject
- Returns:
- the Dublin Core rights. Can be null.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
getRootAttachments
public ResourceCollection getRootAttachments() throws AmetysRepositoryException
Description copied from interface:Content
Retrieves the attachments root node- Specified by:
getRootAttachments
in interfaceContent
- Returns:
- The attachments root node, or null if the content is working on an (unmodifiable) old version and the attachments root is missing.
- Throws:
AmetysRepositoryException
- if an error occurs.
-
hasChild
public boolean hasChild(String name) throws AmetysRepositoryException
Description copied from interface:TraversableAmetysObject
Tests if this Object has at least one child with the given name.- Specified by:
hasChild
in interfaceTraversableAmetysObject
- Parameters:
name
- the name to test. Cannot benull
nor empty nor begin with a'/'
and it cannot contain'/'
.- Returns:
true
if the named child exists,false
otherwise.- Throws:
AmetysRepositoryException
- if an error occurs.
-
createChild
public <A extends AmetysObject> A createChild(String name, String type) throws AmetysRepositoryException, RepositoryIntegrityViolationException
Description copied from interface:ModifiableTraversableAmetysObject
Creates a child below current object.- Specified by:
createChild
in interfaceModifiableTraversableAmetysObject
- Type Parameters:
A
- the actual type ofAmetysObject
.- Parameters:
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.- Returns:
- the new object created.
- Throws:
AmetysRepositoryException
- if an error occurs.RepositoryIntegrityViolationException
- if an object with the same name already exists and same name siblings is not allowed.
-
getChild
public <A extends AmetysObject> A getChild(String path) throws AmetysRepositoryException, UnknownAmetysObjectException
Description copied from interface:TraversableAmetysObject
Retrieves a given child from its relative path. The path cannot benull
, empty nor begin with a'/'
.- Specified by:
getChild
in interfaceTraversableAmetysObject
- Type Parameters:
A
- the actual type ofAmetysObject
.- Parameters:
path
- the path of the child which can contains a position with.[n]
if same name sibling is allowed.- Returns:
- the child found.
- Throws:
AmetysRepositoryException
- if an error occurs.UnknownAmetysObjectException
- if the object does not exist.
-
getChildren
public <A extends AmetysObject> AmetysObjectIterable<A> getChildren() throws AmetysRepositoryException
Description copied from interface:TraversableAmetysObject
Retrieves children of the current object.- Specified by:
getChildren
in interfaceTraversableAmetysObject
- Type Parameters:
A
- the actual type ofAmetysObject
s.- Returns:
- the children or an empty
AmetysObjectIterable
. - Throws:
AmetysRepositoryException
- if an error occurs.
-
getDataHolder
public ModelAwareDataHolder getDataHolder()
Description copied from interface:DataAwareAmetysObject
Returns theDataHolder
of thisAmetysObject
.- Specified by:
getDataHolder
in interfaceDataAwareAmetysObject
- Specified by:
getDataHolder
in interfaceModelAwareDataAwareAmetysObject
- Returns:
- the
DataHolder
of thisAmetysObject
-
getInternalDataHolder
public ModifiableModelLessDataHolder getInternalDataHolder()
Description copied from interface:Content
Returns theDataHolder
for internal data of thisContent
.- Specified by:
getInternalDataHolder
in interfaceContent
- Returns:
- the
DataHolder
for internal data of thisContent
-
addReaction
public void addReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
Description copied from interface:ReactionableObject
Add the user reaction- Specified by:
addReaction
in interfaceReactionableObject
- Parameters:
user
- the userreactionType
- the reaction type
-
removeReaction
public void removeReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
Description copied from interface:ReactionableObject
Remove the user reaction- Specified by:
removeReaction
in interfaceReactionableObject
- Parameters:
user
- the userreactionType
- the reaction type
-
getReactionUsers
public List<UserIdentity> getReactionUsers(ReactionableObject.ReactionType reactionType)
Description copied from interface:ReactionableObject
Get the list of users who react- Specified by:
getReactionUsers
in interfaceReactionableObject
- Parameters:
reactionType
- the reaction type- Returns:
- the list of users
-
addReport
public void addReport()
Description copied from interface:ReportableObject
Add a report to the object- Specified by:
addReport
in interfaceReportableObject
-
setReportsCount
public void setReportsCount(long reportsCount)
Description copied from interface:ReportableObject
Sets the number of reports on the object- Specified by:
setReportsCount
in interfaceReportableObject
- Parameters:
reportsCount
- the number of reports to set
-
clearReports
public void clearReports()
Description copied from interface:ReportableObject
Remove all reports on the object- Specified by:
clearReports
in interfaceReportableObject
-
getReportsCount
public long getReportsCount()
Description copied from interface:ReportableObject
Retrieves the number of reports on the object- Specified by:
getReportsCount
in interfaceReportableObject
- Returns:
- the number of reports
-
toSAX
public void toSAX(ContentHandler contentHandler, Locale locale, View view, boolean saxWorkflowStep) throws SAXException
Description copied from interface:Content
Generates SAX events representing this Content.- Specified by:
toSAX
in interfaceContent
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX events.locale
- theLocale
to use for eg. multilingual attributes.view
- the associated View, or null to generate SAX events for all attributes from the model.saxWorkflowStep
- if true, also generates SAX events for the current workflow step.- Throws:
SAXException
- if an error occurs during the SAX events generation.
-
-