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 StringATTACHMENTS_NODE_NAMEConstant for the attachment node name.static LocaleDEFAULT_CONTENT_LOCALEThe default locale for contentstatic StringMETADATA_CONTENTTYPEConstants for contentType Metadata*static StringMETADATA_CONTRIBUTORConstants for last contributor Metadata*static StringMETADATA_CREATIONConstants for lastModified Metadata*static StringMETADATA_CREATORConstants for author Metadata*static StringMETADATA_FIRST_VALIDATIONConstants for firstValidationDate Metadata*static StringMETADATA_LANGUAGEConstants for language Metadata*static StringMETADATA_LAST_MAJORVALIDATIONConstants for lastMajorValidationDate Metadata*static StringMETADATA_LAST_VALIDATIONConstants for lastValidationDate Metadata*static StringMETADATA_MIXINCONTENTTYPESConstants for contentType Metadata*static StringMETADATA_MODIFIEDConstants for lastModified Metadata*static StringMETADATA_OUTGOING_REFERENCE_NODETYPEConstants for the outgoing reference nodetypestatic StringMETADATA_OUTGOING_REFERENCE_PROPERTYConstants for the outgoing reference propertystatic StringMETADATA_OUTGOING_REFERENCESConstants for the outgoing references nodestatic StringMETADATA_OUTGOING_REFERENCES_PATH_PROPERTYConstants for the outgoing references path propertystatic StringMETADATA_ROOT_OUTGOING_REFERENCESConstants 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 voidaddReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)Add the user reactionvoidaddReport()Add a report to the objectvoidclearReports()Remove all reports on the objectModifiableContentcopyTo(ModifiableTraversableAmetysObject parent, String name)Copy the currentAmetysObjectto the given object.ModifiableContentcopyTo(ModifiableTraversableAmetysObject parent, String name, int initWorkflowActionId)Copy the currentDefaultWorkflowAwareContentto the given object.ModifiableContentcopyTo(ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId)Copy the currentDefaultWorkflowAwareContentto the given object.ModifiableContentcopyTo(ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId, boolean waitAsyncObservers, boolean copyACL)Copy the currentDefaultWorkflowAwareContentto the given object.ModifiableContentcopyTo(ModifiableTraversableAmetysObject parent, String name, List<String> restrictTo)Copy the currentAmetysObjectto 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.DategetCreationDate()Retrieves the creation date.UserIdentitygetCreator()Retrieves the login of the creator.ModelAwareDataHoldergetDataHolder()Returns theDataHolderof thisAmetysObject.StringgetDCContributor()Get the Dublin Core contributor.StringgetDCCoverage()Get the Dublin Core coverage.StringgetDCCreator()Get the Dublin Core creator.DategetDCDate()Get the Dublin Core date.StringgetDCDescription()Get the Dublin Core description.StringgetDCFormat()Get the Dublin Core format.StringgetDCIdentifier()Get the Dublin Core identifier.StringgetDCLanguage()Get the Dublin Core language.StringgetDCPublisher()Get the Dublin Core publisher.StringgetDCRelation()Get the Dublin Core relation.StringgetDCRights()Get the Dublin Core rights.StringgetDCSource()Get the Dublin Core source.String[]getDCSubject()Get the Dublin Core subject.StringgetDCTitle()Get the Dublin Core title.StringgetDCType()Get the Dublin Core type.DategetFirstValidationDate()Retrieves the first validation dateModifiableModelLessDataHoldergetInternalDataHolder()Returns theDataHolderfor internal data of thisContent.StringgetLanguage()Retrieves the language of this content.UserIdentitygetLastContributor()Retrieves the login of the last contributor.DategetLastMajorValidationDate()Retrieves the last validation date resulting from a major modification.DategetLastModified()Retrieves the last modification date.DategetLastValidationDate()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).longgetReportsCount()Retrieves the number of reports on the objectResourceCollectiongetRootAttachments()Retrieves the attachments root nodeSet<String>getTags()Retrieves current tags.StringgetTitle()Retrieves the title.StringgetTitle(Locale locale)Retrieves the title for the given locale.String[]getTypes()Retrieves the type identifiers of this content.booleanhasChild(String name)Tests if this Object has at least one child with the given name.booleanhasReferencingContents()Returnstrueif there is at least one Content referencing this Content (as a metadata).voidremoveReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)Remove the user reactionvoidsetLanguage(String language)Set the type of this Content.
This method may only be called on a new Content, ie.voidsetMixinTypes(String[] mixins)Set the mixins of this Content.voidsetReportsCount(long reportsCount)Sets the number of reports on the objectvoidsetType(String type)Set the type of this contentvoidsetTypes(String[] types)Set the types of this Content.voidtoSAX(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:ContentRetrieves the type identifiers of this content.- Specified by:
getTypesin 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:ContentSet the type of this content- Specified by:
setTypein 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:ContentSet the types of this Content.- Specified by:
setTypesin interfaceContent- Parameters:
types- the types of this content.- Throws:
AmetysRepositoryException- if an error occurs.
-
getMixinTypes
public String[] getMixinTypes() throws AmetysRepositoryException
Description copied from interface:ContentRetrieves the mixin type identifiers of this content.- Specified by:
getMixinTypesin 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:ContentSet the mixins of this Content.- Specified by:
setMixinTypesin interfaceContent- Parameters:
mixins- the mixins of this content.- Throws:
AmetysRepositoryException- if an error occurs.
-
getLanguage
public String getLanguage() throws AmetysRepositoryException
Description copied from interface:ContentRetrieves the language of this content.- Specified by:
getLanguagein interfaceContent- Returns:
- the language of this content or
nullif the content is a multilingual content - Throws:
AmetysRepositoryException- if an error occurs.
-
setLanguage
public void setLanguage(String language) throws AmetysRepositoryException
Description copied from interface:ContentSet the type of this Content.
This method may only be called on a new Content, ie. before its first save.- Specified by:
setLanguagein 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:ContentRetrieves the title for the given locale. If the locale is null or does not exist, the first locale will be used.- Specified by:
getTitlein 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:ContentRetrieves 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:
getTitlein 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:ContentRetrieves the login of the creator.- Specified by:
getCreatorin 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:ContentRetrieves the creation date.- Specified by:
getCreationDatein 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:ContentRetrieves the login of the last contributor.- Specified by:
getLastContributorin 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:ContentRetrieves the last modification date.- Specified by:
getLastModifiedin 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:ContentRetrieves the first validation date- Specified by:
getFirstValidationDatein 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:ContentRetrieves the last validation date- Specified by:
getLastValidationDatein 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:ContentRetrieves the last validation date resulting from a major modification. At least this is the first validation date- Specified by:
getLastMajorValidationDatein 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:TagAwareAmetysObjectRetrieves current tags.- Specified by:
getTagsin interfaceTagAwareAmetysObject- Returns:
- the current tags.
- Throws:
AmetysRepositoryException- if an error occurs.
-
getOutgoingReferences
public Map<String,OutgoingReferences> getOutgoingReferences() throws AmetysRepositoryException
Description copied from interface:ContentGet the stored outgoing references of the content. This references can be used for different purposes, such as testing link consistency for example.- Specified by:
getOutgoingReferencesin 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:ContentReturns all Contents referencing this Content (as a metadata).- Specified by:
getReferencingContentsin interfaceContent- Returns:
- all Contents referencing this Content.
- Throws:
AmetysRepositoryException- if an error occurs.
-
hasReferencingContents
public boolean hasReferencingContents() throws AmetysRepositoryException
Description copied from interface:ContentReturnstrueif there is at least one Content referencing this Content (as a metadata).- Specified by:
hasReferencingContentsin interfaceContent- Returns:
trueif 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:CopiableAmetysObjectCopy the currentAmetysObjectto the given object if it is not in the restriction list. Be careful, this method save changes.- Specified by:
copyToin 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 ofCopiableAmetysObjectauthorized 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:CopiableAmetysObjectCopy the currentAmetysObjectto the given object. Be careful, this method save changes.- Specified by:
copyToin 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 currentDefaultWorkflowAwareContentto 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 currentDefaultWorkflowAwareContentto 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 currentDefaultWorkflowAwareContentto 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:DublinCoreAwareAmetysObjectGet the Dublin Core title.- Specified by:
getDCTitlein 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:DublinCoreAwareAmetysObjectGet the Dublin Core creator.- Specified by:
getDCCreatorin 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:DublinCoreAwareAmetysObjectGet the Dublin Core subject.- Specified by:
getDCSubjectin 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:DublinCoreAwareAmetysObjectGet the Dublin Core description.- Specified by:
getDCDescriptionin 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:DublinCoreAwareAmetysObjectGet the Dublin Core publisher.- Specified by:
getDCPublisherin 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:DublinCoreAwareAmetysObjectGet the Dublin Core contributor.- Specified by:
getDCContributorin 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:DublinCoreAwareAmetysObjectGet the Dublin Core date.- Specified by:
getDCDatein 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:DublinCoreAwareAmetysObjectGet the Dublin Core type.- Specified by:
getDCTypein 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:DublinCoreAwareAmetysObjectGet the Dublin Core format.- Specified by:
getDCFormatin 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:DublinCoreAwareAmetysObjectGet the Dublin Core identifier.- Specified by:
getDCIdentifierin 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:DublinCoreAwareAmetysObjectGet the Dublin Core source.- Specified by:
getDCSourcein 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:DublinCoreAwareAmetysObjectGet the Dublin Core language.- Specified by:
getDCLanguagein 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:DublinCoreAwareAmetysObjectGet the Dublin Core relation.- Specified by:
getDCRelationin 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:DublinCoreAwareAmetysObjectGet the Dublin Core coverage.- Specified by:
getDCCoveragein 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:DublinCoreAwareAmetysObjectGet the Dublin Core rights.- Specified by:
getDCRightsin 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:ContentRetrieves the attachments root node- Specified by:
getRootAttachmentsin 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:TraversableAmetysObjectTests if this Object has at least one child with the given name.- Specified by:
hasChildin interfaceTraversableAmetysObject- Parameters:
name- the name to test. Cannot benullnor empty nor begin with a'/'and it cannot contain'/'.- Returns:
trueif the named child exists,falseotherwise.- Throws:
AmetysRepositoryException- if an error occurs.
-
createChild
public <A extends AmetysObject> A createChild(String name, String type) throws AmetysRepositoryException, RepositoryIntegrityViolationException
Description copied from interface:ModifiableTraversableAmetysObjectCreates a child below current object.- Specified by:
createChildin 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:TraversableAmetysObjectRetrieves a given child from its relative path. The path cannot benull, empty nor begin with a'/'.- Specified by:
getChildin 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:TraversableAmetysObjectRetrieves children of the current object.- Specified by:
getChildrenin interfaceTraversableAmetysObject- Type Parameters:
A- the actual type ofAmetysObjects.- Returns:
- the children or an empty
AmetysObjectIterable. - Throws:
AmetysRepositoryException- if an error occurs.
-
getDataHolder
public ModelAwareDataHolder getDataHolder()
Description copied from interface:DataAwareAmetysObjectReturns theDataHolderof thisAmetysObject.- Specified by:
getDataHolderin interfaceDataAwareAmetysObject- Specified by:
getDataHolderin interfaceModelAwareDataAwareAmetysObject- Returns:
- the
DataHolderof thisAmetysObject
-
getInternalDataHolder
public ModifiableModelLessDataHolder getInternalDataHolder()
Description copied from interface:ContentReturns theDataHolderfor internal data of thisContent.- Specified by:
getInternalDataHolderin interfaceContent- Returns:
- the
DataHolderfor internal data of thisContent
-
addReaction
public void addReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
Description copied from interface:ReactionableObjectAdd the user reaction- Specified by:
addReactionin interfaceReactionableObject- Parameters:
user- the userreactionType- the reaction type
-
removeReaction
public void removeReaction(UserIdentity user, ReactionableObject.ReactionType reactionType)
Description copied from interface:ReactionableObjectRemove the user reaction- Specified by:
removeReactionin interfaceReactionableObject- Parameters:
user- the userreactionType- the reaction type
-
getReactionUsers
public List<UserIdentity> getReactionUsers(ReactionableObject.ReactionType reactionType)
Description copied from interface:ReactionableObjectGet the list of users who react- Specified by:
getReactionUsersin interfaceReactionableObject- Parameters:
reactionType- the reaction type- Returns:
- the list of users
-
addReport
public void addReport()
Description copied from interface:ReportableObjectAdd a report to the object- Specified by:
addReportin interfaceReportableObject
-
setReportsCount
public void setReportsCount(long reportsCount)
Description copied from interface:ReportableObjectSets the number of reports on the object- Specified by:
setReportsCountin interfaceReportableObject- Parameters:
reportsCount- the number of reports to set
-
clearReports
public void clearReports()
Description copied from interface:ReportableObjectRemove all reports on the object- Specified by:
clearReportsin interfaceReportableObject
-
getReportsCount
public long getReportsCount()
Description copied from interface:ReportableObjectRetrieves the number of reports on the object- Specified by:
getReportsCountin interfaceReportableObject- Returns:
- the number of reports
-
toSAX
public void toSAX(ContentHandler contentHandler, Locale locale, View view, boolean saxWorkflowStep) throws SAXException
Description copied from interface:ContentGenerates SAX events representing this Content.- Specified by:
toSAXin interfaceContent- Parameters:
contentHandler- theContentHandlerthat will receive the SAX events.locale- theLocaleto 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.
-
-