Package org.ametys.cms.repository
Class ModifiableContentHelper
- java.lang.Object
-
- org.ametys.cms.repository.ModifiableContentHelper
-
- All Implemented Interfaces:
Component
public class ModifiableContentHelper extends Object implements Component
Provides helper methods to use theModifiableContent
API onDefaultContent
s.
-
-
Constructor Summary
Constructors Constructor Description ModifiableContentHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyTitle(Content srcContent, ModifiableContent targetContent)
Copy the title of the source content to the target contentvoid
setCreationDate(DefaultContent content, Date creationDate)
Set aDefaultContent
creation date.void
setCreator(DefaultContent content, UserIdentity user)
Set aDefaultContent
user.void
setFirstValidationDate(DefaultContent content, Date validationDate)
Set aDefaultContent
first validation date.void
setLanguage(DefaultContent content, String language)
Set aDefaultContent
language.void
setLastContributor(DefaultContent content, UserIdentity user)
Set aDefaultContent
contributor.void
setLastMajorValidationDate(DefaultContent content, Date validationDate)
Set aDefaultContent
last major validation date.void
setLastModified(DefaultContent content, Date lastModified)
Set aDefaultContent
last modification date.void
setLastValidationDate(DefaultContent content, Date validationDate)
Set aDefaultContent
last validation date.void
setMixinTypes(DefaultContent content, String[] mixins)
SetDefaultContent
mixins.void
setOutgoingReferences(DefaultContent content, Map<String,OutgoingReferences> references)
Store the outgoing references on the content.void
setTitle(DefaultContent content, String title)
Set the title of non-multilingualDefaultContent
.void
setTitle(DefaultContent content, String title, Locale locale)
Set aDefaultContent
title for the given locale.void
setType(DefaultContent content, String type)
Set aDefaultContent
type.void
setTypes(DefaultContent content, String[] types)
SetDefaultContent
types.
-
-
-
Constructor Detail
-
ModifiableContentHelper
public ModifiableContentHelper()
-
-
Method Detail
-
setType
public void setType(DefaultContent content, String type) throws AmetysRepositoryException
Set aDefaultContent
type.- Parameters:
content
- theDefaultContent
to set.type
- the type.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setTypes
public void setTypes(DefaultContent content, String[] types) throws AmetysRepositoryException
SetDefaultContent
types.- Parameters:
content
- theDefaultContent
to set.types
- the types.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setMixinTypes
public void setMixinTypes(DefaultContent content, String[] mixins) throws AmetysRepositoryException
SetDefaultContent
mixins.- Parameters:
content
- theDefaultContent
to set.mixins
- the mixins.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLanguage
public void setLanguage(DefaultContent content, String language) throws AmetysRepositoryException
Set aDefaultContent
language.- Parameters:
content
- theDefaultContent
to modify.language
- the language to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setTitle
public void setTitle(DefaultContent content, String title, Locale locale) throws AmetysRepositoryException
Set aDefaultContent
title for the given locale.- Parameters:
content
- theDefaultContent
to set.title
- the title to set.locale
- The locale. Can be null if the content is not a multilingual content.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setTitle
public void setTitle(DefaultContent content, String title) throws AmetysRepositoryException
Set the title of non-multilingualDefaultContent
. Be careful! Use only if content's title is not a multilingual string. If not sure usesetTitle(DefaultContent, String, Locale)
instead.- Parameters:
content
- theDefaultContent
to set.title
- the title to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
copyTitle
public void copyTitle(Content srcContent, ModifiableContent targetContent) throws AmetysRepositoryException
Copy the title of the source content to the target content- Parameters:
srcContent
- The source contenttargetContent
- The target content- Throws:
AmetysRepositoryException
- if an error occurs.
-
setCreator
public void setCreator(DefaultContent content, UserIdentity user) throws AmetysRepositoryException
Set aDefaultContent
user.- Parameters:
content
- theDefaultContent
to set.user
- the user to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setCreationDate
public void setCreationDate(DefaultContent content, Date creationDate) throws AmetysRepositoryException
Set aDefaultContent
creation date.- Parameters:
content
- theDefaultContent
to set.creationDate
- the creation date to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLastContributor
public void setLastContributor(DefaultContent content, UserIdentity user) throws AmetysRepositoryException
Set aDefaultContent
contributor.- Parameters:
content
- theDefaultContent
to set.user
- the contributor to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLastModified
public void setLastModified(DefaultContent content, Date lastModified) throws AmetysRepositoryException
Set aDefaultContent
last modification date.- Parameters:
content
- theDefaultContent
to set.lastModified
- the last modification date to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setFirstValidationDate
public void setFirstValidationDate(DefaultContent content, Date validationDate) throws AmetysRepositoryException
Set aDefaultContent
first validation date.- Parameters:
content
- theDefaultContent
to set.validationDate
- the first validation date.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLastValidationDate
public void setLastValidationDate(DefaultContent content, Date validationDate) throws AmetysRepositoryException
Set aDefaultContent
last validation date.- Parameters:
content
- theDefaultContent
to set.validationDate
- the last validation date.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLastMajorValidationDate
public void setLastMajorValidationDate(DefaultContent content, Date validationDate) throws AmetysRepositoryException
Set aDefaultContent
last major validation date.- Parameters:
content
- theDefaultContent
to set.validationDate
- the last major validation date.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setOutgoingReferences
public void setOutgoingReferences(DefaultContent content, Map<String,OutgoingReferences> references) throws AmetysRepositoryException
Store the outgoing references on the content.- Parameters:
content
- The content concerned by these outgoing references.references
- A non null map of outgoing references grouped by metadata (key are metadata path)- Throws:
AmetysRepositoryException
- if an error occurs.
-
-