Class SharedContentManager
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.web.repository.content.shared.SharedContentManager
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class SharedContentManager extends AbstractLogEnabled implements Serviceable, Component
Component which provides methods to manage shared contents (creation, validation, and so on).
-
-
Field Summary
Fields Modifier and Type Field Description protected CopySiteComponent
_copySiteComponent
The site copy component.protected CurrentUserProvider
_currentUserProvider
The current user provider.protected ObservationManager
_observationManager
The observation manager.protected AmetysObjectResolver
_resolver
The ametys object resolver.static String
ROLE
The avalon role.
-
Constructor Summary
Constructors Constructor Description SharedContentManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyContentData(DefaultContent originalContent, DefaultSharedContent content)
Copy the data of a content into a shared content.protected DefaultSharedContent
createContent(String desiredContentName, ModifiableTraversableAmetysObject contentsNode)
Create a shared content in the given contents root.DefaultSharedContent
createSharedContent(Site site, DefaultContent originalContent)
Create aSharedContent
from an original content.Set<SharedContent>
getSharedContents(Content content)
Get the list of shared contents created from the given content.boolean
hasSharedContents(Content content)
Test if there are shared contents created from the given content.protected void
internalUnpublishContent(DefaultSharedContent content)
Unpublish a shared content.protected void
internalValidateContent(DefaultSharedContent content)
Validate a shared content.void
invalidateSharedContent(DefaultSharedContent content)
Invalidate a shared content.protected void
removeAllChildren(ModifiableTraversableAmetysObject rootObject)
Remove all children of aModifiableTraversableAmetysObject
.protected void
removeAllData(ModifiableDataHolder dataHolder)
Remove all data of a data holder.void
removeSharedContentReferences(Content content)
Remove the list of shared contents created from the given content.void
service(ServiceManager serviceManager)
void
switchSharedContentReferences(Content content)
Switch all shared contents created from the given content into default contentsvoid
validateContent(DefaultSharedContent content)
Validate a shared content.-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver.
-
_observationManager
protected ObservationManager _observationManager
The observation manager.
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider.
-
_copySiteComponent
protected CopySiteComponent _copySiteComponent
The site copy component.
-
-
Constructor Detail
-
SharedContentManager
public SharedContentManager()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
createSharedContent
public DefaultSharedContent createSharedContent(Site site, DefaultContent originalContent)
Create aSharedContent
from an original content.- Parameters:
site
- the site in which to create the shared content.originalContent
- the original content.- Returns:
- the created shared content.
-
copyContentData
public void copyContentData(DefaultContent originalContent, DefaultSharedContent content) throws AmetysRepositoryException
Copy the data of a content into a shared content.- Parameters:
originalContent
- the content to copy data from.content
- the content to copy data to.- Throws:
AmetysRepositoryException
- if an error occurs during copy
-
validateContent
public void validateContent(DefaultSharedContent content)
Validate a shared content.- Parameters:
content
- the content to validate.
-
invalidateSharedContent
public void invalidateSharedContent(DefaultSharedContent content)
Invalidate a shared content.- Parameters:
content
- the content to invalidate.
-
hasSharedContents
public boolean hasSharedContents(Content content)
Test if there are shared contents created from the given content.- Parameters:
content
- the content to test.- Returns:
- true if at least one shared content was created from the given content, false otherwise.
-
getSharedContents
public Set<SharedContent> getSharedContents(Content content)
Get the list of shared contents created from the given content.- Parameters:
content
- the content of which to get referencing shared contents.- Returns:
- the shared contents created from the given content.
-
removeSharedContentReferences
public void removeSharedContentReferences(Content content)
Remove the list of shared contents created from the given content.- Parameters:
content
- the content of which to remove referencing shared content references.
-
switchSharedContentReferences
public void switchSharedContentReferences(Content content)
Switch all shared contents created from the given content into default contents- Parameters:
content
- the initial content with shared content references.
-
createContent
protected DefaultSharedContent createContent(String desiredContentName, ModifiableTraversableAmetysObject contentsNode)
Create a shared content in the given contents root.- Parameters:
desiredContentName
- the desired content name.contentsNode
- the contents root.- Returns:
- the created content.
-
internalValidateContent
protected void internalValidateContent(DefaultSharedContent content)
Validate a shared content.- Parameters:
content
- the content to validate.
-
internalUnpublishContent
protected void internalUnpublishContent(DefaultSharedContent content)
Unpublish a shared content.- Parameters:
content
- the content to unpublish.
-
removeAllChildren
protected void removeAllChildren(ModifiableTraversableAmetysObject rootObject)
Remove all children of aModifiableTraversableAmetysObject
.- Parameters:
rootObject
- the traversable ametys object to empty.
-
removeAllData
protected void removeAllData(ModifiableDataHolder dataHolder)
Remove all data of a data holder.- Parameters:
dataHolder
- the data holder to empty.
-
-