Package org.ametys.web.repository.page
Class CopySiteComponent
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.web.repository.page.CopySiteComponent
-
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
public class CopySiteComponent extends AbstractLogEnabled implements Component, Serviceable
Component for copying site or pages
-
-
Field Summary
Fields Modifier and Type Field Description protected ServiceManager
_manager
The service manager.private OutgoingReferencesExtractor
_outgoingReferencesExtractor
private AmetysObjectResolver
_resolver
private CopyUpdaterExtensionPoint
_updaterEP
private WorkflowProvider
_workflowProvider
static String
ROLE
Avalon Role
-
Constructor Summary
Constructors Constructor Description CopySiteComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private String
_getDataTypeID(DataHolder dataHolder, String dataName)
private String
_getNewReferenceToAmetysObject(TraversableAmetysObject originalAO, TraversableAmetysObject createdAO, String id)
private <T> T
_getStringValue(DataHolder dataHolder, String dataName)
private boolean
_isAmetysObject(DataHolder dataHolder, String dataName)
private boolean
_isDataMultiple(DataHolder dataHolder, String dataName)
private void
_reinitWorkflow(WorkflowAwareContent content)
private void
_setStringValue(ModifiableDataHolder dataHolder, String dataName, Object value)
private void
_updatePageAfterCopy(Site originalSite, Site createdSite, Page page)
private void
_updateReferencesToAmetysObjects(DataHolder dataHolder, TraversableAmetysObject originalAO, TraversableAmetysObject createdAO)
private void
_updateReferenceToAmetysObject(DataHolder dataHolder, String dataName, TraversableAmetysObject originalAO, TraversableAmetysObject createdAO)
private void
_updateRichText(RichText richText, RichTextUpdater richTextUpdater, Map<String,Object> params, SAXParser saxParser)
private void
_updateZoneItemAfterCopy(Site originalSite, Site createdSite, ZoneItem zoneItem)
void
service(ServiceManager serviceManager)
void
updateContentsAfterCopy(Site initialSite, Site createdSite)
This method re-initializes workflow, updates the site name for web content and updates references to ametys objects on metadata after a site copyvoid
updateLinksInRichText(TraversableAmetysObject initialAO, TraversableAmetysObject createdAO, Content initialContent, Content createdContent)
This method analyzes content rich texts and update links if necessaryvoid
updatePagesAfterCopy(Site originalSite, Site createdSite)
This method updates the site name of pages and updates references to ametys objects on page's metadata after a site copyvoid
updateReferencesAfterCopy(Page originalPage, Page createdPage)
This methods must be used after callingcopyTo
on a Page.void
updateSharedContent(WebContent initialContent, WebContent destContent)
Updates references all references in a content to another one.void
updateSharedContent(WebContent initialContent, WebContent destContent, boolean reinitWorkflow)
Updates references all references in a content to another one.void
updateSiteAfterCopy(Site originalSite, Site createdSite)
This method must be used after callingcopyTo
on a Site.-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_manager
protected ServiceManager _manager
The service manager.
-
_resolver
private AmetysObjectResolver _resolver
-
_workflowProvider
private WorkflowProvider _workflowProvider
-
_updaterEP
private CopyUpdaterExtensionPoint _updaterEP
-
_outgoingReferencesExtractor
private OutgoingReferencesExtractor _outgoingReferencesExtractor
-
-
Constructor Detail
-
CopySiteComponent
public CopySiteComponent()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
updateReferencesAfterCopy
public void updateReferencesAfterCopy(Page originalPage, Page createdPage) throws AmetysRepositoryException
This methods must be used after callingcopyTo
on a Page. Its updates references to ametys objects for metadata of new created pages and contents- Parameters:
originalPage
- the original pagecreatedPage
- the created page after a copy- Throws:
AmetysRepositoryException
- if an error occurs
-
updateSiteAfterCopy
public void updateSiteAfterCopy(Site originalSite, Site createdSite) throws AmetysRepositoryException
This method must be used after callingcopyTo
on a Site. Its updates contents and pages after a site copy- Parameters:
originalSite
- the original sitecreatedSite
- the created site after copy- Throws:
AmetysRepositoryException
- if an error occurs
-
updateContentsAfterCopy
public void updateContentsAfterCopy(Site initialSite, Site createdSite) throws AmetysRepositoryException
This method re-initializes workflow, updates the site name for web content and updates references to ametys objects on metadata after a site copy- Parameters:
initialSite
- the original sitecreatedSite
- the created site after copy- Throws:
AmetysRepositoryException
- if an error occurs
-
updateSharedContent
public void updateSharedContent(WebContent initialContent, WebContent destContent)
Updates references all references in a content to another one.- Parameters:
initialContent
- the initial content.destContent
- the destination content.
-
updateSharedContent
public void updateSharedContent(WebContent initialContent, WebContent destContent, boolean reinitWorkflow)
Updates references all references in a content to another one.- Parameters:
initialContent
- the initial content.destContent
- the destination content.reinitWorkflow
- set to 'true' to reinitialize the workflow
-
updateLinksInRichText
public void updateLinksInRichText(TraversableAmetysObject initialAO, TraversableAmetysObject createdAO, Content initialContent, Content createdContent) throws AmetysRepositoryException
This method analyzes content rich texts and update links if necessary- Parameters:
initialAO
- The initial object copiedcreatedAO
- The target objectinitialContent
- The initial contentcreatedContent
- The created content after copy to update- Throws:
AmetysRepositoryException
- if an error occurs
-
_updateRichText
private void _updateRichText(RichText richText, RichTextUpdater richTextUpdater, Map<String,Object> params, SAXParser saxParser) throws Exception
- Throws:
Exception
-
updatePagesAfterCopy
public void updatePagesAfterCopy(Site originalSite, Site createdSite) throws AmetysRepositoryException
This method updates the site name of pages and updates references to ametys objects on page's metadata after a site copy- Parameters:
originalSite
- the original sitecreatedSite
- the created site after copy- Throws:
AmetysRepositoryException
- if an error occurs
-
_updatePageAfterCopy
private void _updatePageAfterCopy(Site originalSite, Site createdSite, Page page) throws AmetysRepositoryException
- Throws:
AmetysRepositoryException
-
_updateZoneItemAfterCopy
private void _updateZoneItemAfterCopy(Site originalSite, Site createdSite, ZoneItem zoneItem)
-
_updateReferencesToAmetysObjects
private void _updateReferencesToAmetysObjects(DataHolder dataHolder, TraversableAmetysObject originalAO, TraversableAmetysObject createdAO)
-
_updateReferenceToAmetysObject
private void _updateReferenceToAmetysObject(DataHolder dataHolder, String dataName, TraversableAmetysObject originalAO, TraversableAmetysObject createdAO) throws AmetysRepositoryException
- Throws:
AmetysRepositoryException
-
_getNewReferenceToAmetysObject
private String _getNewReferenceToAmetysObject(TraversableAmetysObject originalAO, TraversableAmetysObject createdAO, String id)
-
_isAmetysObject
private boolean _isAmetysObject(DataHolder dataHolder, String dataName)
-
_getDataTypeID
private String _getDataTypeID(DataHolder dataHolder, String dataName) throws UndefinedItemPathException, UnknownDataException, UnknownTypeException, NotUniqueTypeException
-
_isDataMultiple
private boolean _isDataMultiple(DataHolder dataHolder, String dataName)
-
_getStringValue
private <T> T _getStringValue(DataHolder dataHolder, String dataName)
-
_setStringValue
private void _setStringValue(ModifiableDataHolder dataHolder, String dataName, Object value)
-
_reinitWorkflow
private void _reinitWorkflow(WorkflowAwareContent content) throws AmetysRepositoryException
- Throws:
AmetysRepositoryException
-
-