Class ContentsArchiverHelper
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.contentio.archive.ContentsArchiverHelper
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
public class ContentsArchiverHelper extends AbstractLogEnabled implements Component, Serviceable
Export a contents collection as individual XML files.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ContentsArchiverHelper.ContentFiller
A filler in order to fill additional attributes on imported contentsprivate class
ContentsArchiverHelper.Importer
-
Field Summary
Fields Modifier and Type Field Description private static String
__ACL_ZIP_ENTRY_FILENAME
private static String
__CONTENT_ZIP_ENTRY_FILENAME
private ContentSaxer
_contentSaxer
private ContentTypeExtensionPoint
_contentTypeEP
private ModifiableContentHelper
_modifiableContentHelper
private OutgoingReferencesExtractor
_outgoingReferencesExtractor
private AmetysObjectResolver
_resolver
private ResourcesArchiverHelper
_resourcesArchiverHelper
private WorkflowProvider
_workflowProvider
static String
ROLE
Avalon role.
-
Constructor Summary
Constructors Constructor Description ContentsArchiverHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
_checkoutContents(List<DefaultContent> createdContents)
private void
_exportContent(String prefix, Content content, ZipOutputStream zos)
private void
_saveContents(AmetysObjectCollection rootContents)
void
exportContents(String prefix, Node rootNode, ZipOutputStream zos)
Exports contents from a root Node.void
exportContents(String prefix, TraversableAmetysObject rootContents, ZipOutputStream zos)
Exports contents from a root AmetysObject.ImportReport
importContents(String commonPrefix, AmetysObjectCollection rootContents, Path zipPath, Merger merger, Collection<ContentsArchiverHelper.ContentFiller> contentFillers)
Imports contents from the given ZIP archive and path, under the given root of contentsvoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
__CONTENT_ZIP_ENTRY_FILENAME
private static final String __CONTENT_ZIP_ENTRY_FILENAME
- See Also:
- Constant Field Values
-
__ACL_ZIP_ENTRY_FILENAME
private static final String __ACL_ZIP_ENTRY_FILENAME
- See Also:
- Constant Field Values
-
_resolver
private AmetysObjectResolver _resolver
-
_resourcesArchiverHelper
private ResourcesArchiverHelper _resourcesArchiverHelper
-
_workflowProvider
private WorkflowProvider _workflowProvider
-
_modifiableContentHelper
private ModifiableContentHelper _modifiableContentHelper
-
_outgoingReferencesExtractor
private OutgoingReferencesExtractor _outgoingReferencesExtractor
-
_contentSaxer
private ContentSaxer _contentSaxer
-
_contentTypeEP
private ContentTypeExtensionPoint _contentTypeEP
-
-
Constructor Detail
-
ContentsArchiverHelper
public ContentsArchiverHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
exportContents
public void exportContents(String prefix, Node rootNode, ZipOutputStream zos) throws RepositoryException, IOException
Exports contents from a root Node.- Parameters:
prefix
- the prefix for the ZIP archive.rootNode
- the root JCR Node holding the contents collection.zos
- the ZIP OutputStream.- Throws:
RepositoryException
- if an error occurs while resolving Node.IOException
- if an error occurs while archiving
-
exportContents
public void exportContents(String prefix, TraversableAmetysObject rootContents, ZipOutputStream zos) throws IOException
Exports contents from a root AmetysObject.- Parameters:
prefix
- the prefix for the ZIP archive.rootContents
- the root JCR Node holding the contents collection.zos
- the ZIP OutputStream.- Throws:
IOException
- if an error occurs while archiving
-
_exportContent
private void _exportContent(String prefix, Content content, ZipOutputStream zos) throws IOException
- Throws:
IOException
-
importContents
public ImportReport importContents(String commonPrefix, AmetysObjectCollection rootContents, Path zipPath, Merger merger, Collection<ContentsArchiverHelper.ContentFiller> contentFillers) throws IOException
Imports contents from the given ZIP archive and path, under the given root of contents- Parameters:
commonPrefix
- The common prefix in the ZIP archiverootContents
- the rootJCRTraversableAmetysObject
holding the contents collection.zipPath
- the input zip pathmerger
- TheMerger
contentFillers
- The fillers in order to fill additional attributes on imported contents- Returns:
- The
ImportReport
- Throws:
IOException
- if an error occurs while importing archive
-
_saveContents
private void _saveContents(AmetysObjectCollection rootContents)
-
_checkoutContents
private void _checkoutContents(List<DefaultContent> createdContents)
-
-