Package org.ametys.cms.repository
Class ModifiableContentHelper
java.lang.Object
org.ametys.cms.repository.ModifiableContentHelper
- All Implemented Interfaces:
Component
Provides helper methods to use the
ModifiableContent
API on DefaultContent
s.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_storeUserMetadata
(DefaultContent content, String metadataName, UserIdentity user) Store a metadata of type user in the contentvoid
copyTitle
(Content srcContent, ModifiableContent targetContent) Copy the title of the source content to the target contentvoid
setCreationDate
(DefaultContent content, ZonedDateTime creationDate) Set aDefaultContent
creation date.void
setCreator
(DefaultContent content, UserIdentity user) Set aDefaultContent
user.void
setFirstValidationDate
(DefaultContent content, ZonedDateTime validationDate) Set aDefaultContent
first validation date.void
setFirstValidator
(DefaultContent content, UserIdentity user) Set aDefaultContent
first validator.void
setLastContributor
(DefaultContent content, UserIdentity user) Set aDefaultContent
contributor.void
setLastMajorValidationDate
(DefaultContent content, ZonedDateTime validationDate) Set aDefaultContent
last major validation date.void
setLastMajorValidator
(DefaultContent content, UserIdentity user) Set aDefaultContent
last major validator.void
setLastModified
(DefaultContent content, ZonedDateTime lastModified) Set aDefaultContent
last modification date.void
setLastValidationDate
(DefaultContent content, ZonedDateTime validationDate) Set aDefaultContent
last validation date.void
setLastValidator
(DefaultContent content, UserIdentity user) Set aDefaultContent
last validator.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.
-
Field Details
-
ROLE
The Avalon role
-
-
Constructor Details
-
ModifiableContentHelper
public ModifiableContentHelper()
-
-
Method Details
-
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
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
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, ZonedDateTime 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, ZonedDateTime 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.
-
setFirstValidator
public void setFirstValidator(DefaultContent content, UserIdentity user) throws AmetysRepositoryException Set aDefaultContent
first validator.- Parameters:
content
- theDefaultContent
to set.user
- the validator to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setFirstValidationDate
public void setFirstValidationDate(DefaultContent content, ZonedDateTime validationDate) throws AmetysRepositoryException Set aDefaultContent
first validation date.- Parameters:
content
- theDefaultContent
to set.validationDate
- the first validation date.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLastValidator
public void setLastValidator(DefaultContent content, UserIdentity user) throws AmetysRepositoryException Set aDefaultContent
last validator.- Parameters:
content
- theDefaultContent
to set.user
- the validator to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLastValidationDate
public void setLastValidationDate(DefaultContent content, ZonedDateTime validationDate) throws AmetysRepositoryException Set aDefaultContent
last validation date.- Parameters:
content
- theDefaultContent
to set.validationDate
- the last validation date.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLastMajorValidator
public void setLastMajorValidator(DefaultContent content, UserIdentity user) throws AmetysRepositoryException Set aDefaultContent
last major validator.- Parameters:
content
- theDefaultContent
to set.user
- the validator to set.- Throws:
AmetysRepositoryException
- if an error occurs.
-
setLastMajorValidationDate
public void setLastMajorValidationDate(DefaultContent content, ZonedDateTime 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 AmetysRepositoryExceptionStore 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.
-
_storeUserMetadata
protected void _storeUserMetadata(DefaultContent content, String metadataName, UserIdentity user) throws AmetysRepositoryException Store a metadata of type user in the content- Parameters:
content
- the content described by the metadatametadataName
- the name of the metadatauser
- the value to set- Throws:
AmetysRepositoryException
- when an error occurred
-