Package com.logicaldoc.impex
Class ArchiveManager
java.lang.Object
com.logicaldoc.impex.ArchiveManager
Manager for archive operations handling
- Since:
- 4.5
- Author:
- Matteo Caruso - LogicalDOC
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addEntry
(Archive archive, com.logicaldoc.core.document.Version version, com.logicaldoc.core.security.user.User user, String sid) Adds a new entry taking care of locking the document, a default comment will be usedboolean
addEntry
(Archive archive, com.logicaldoc.core.document.Version version, com.logicaldoc.core.security.user.User user, String comment, String sid) Adds a new entry taking care of locking the documentvoid
closeArchive
(long id, com.logicaldoc.core.security.user.User user) void
Delete the archive with the given id and unlocks all its document.getArchiveDirectory
(int mode, String archiveName, String id, long tenantId) getArchiveDirectory
(int mode, String archiveName, String id, String tenantName) Retrieves the archive directory from/in which will be import/copied the archive's documentsgetArchiveDirectory
(Archive archive) Retrieves the archive directory from/in which will be import/copied the archive's documentvoid
setArchiveDao
(ArchiveDAO archiveDao) void
setConfig
(com.logicaldoc.util.config.ContextProperties config) void
setDocumentDao
(com.logicaldoc.core.document.DocumentDAO documentDao) void
setFolderDao
(com.logicaldoc.core.folder.FolderDAO folderDao) void
setTenantDao
(com.logicaldoc.core.security.TenantDAO tenantDao) void
writeHtmlIndex
(Archive archive) Writes the index.html file.void
writeIndex
(Archive archive) Writes the XML and CSV index files for the archive.void
writeIndex
(Archive archive, Writer writer) Writes the XML index file for the archive in the specified writer
-
Constructor Details
-
ArchiveManager
public ArchiveManager()
-
-
Method Details
-
getArchiveDirectory
Retrieves the archive directory from/in which will be import/copied the archive's document- Parameters:
archive
- the archive- Returns:
- the directory that contains the archive
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the data layer
-
getArchiveDirectory
public File getArchiveDirectory(int mode, String archiveName, String id, long tenantId) throws com.logicaldoc.core.PersistenceException - Throws:
com.logicaldoc.core.PersistenceException
-
getArchiveDirectory
Retrieves the archive directory from/in which will be import/copied the archive's documents- Parameters:
mode
- The mode Import or Export of an archivearchiveName
- name of the archiveid
- identifier of the archivetenantName
- name of the tenant- Returns:
- the directory that contains the archive
-
writeIndex
public void writeIndex(Archive archive) throws IOException, com.logicaldoc.core.PersistenceException Writes the XML and CSV index files for the archive. Initially the file is named "index.xml.tmp". When the creation operation is successfully completed, the file is renamed as "index.xml".- Parameters:
archive
- the archive to use for writing the index.xml- Throws:
IOException
- cannot write the index.xmlcom.logicaldoc.core.PersistenceException
- error at data layer
-
writeIndex
public void writeIndex(Archive archive, Writer writer) throws IOException, com.logicaldoc.core.PersistenceException Writes the XML index file for the archive in the specified writer- Parameters:
archive
- the archive to writewriter
- the writer for the index.xml- Throws:
IOException
- cannot write the index.xmlcom.logicaldoc.core.PersistenceException
- error at data layer
-
writeHtmlIndex
Writes the index.html file. Make sure to pass an initialized archive- Parameters:
archive
- the archive to write as HTML- Throws:
IOException
- cannot write the HTML index file
-
setConfig
public void setConfig(com.logicaldoc.util.config.ContextProperties config) -
addEntry
public boolean addEntry(Archive archive, com.logicaldoc.core.document.Version version, com.logicaldoc.core.security.user.User user, String sid) Adds a new entry taking care of locking the document, a default comment will be used- Parameters:
archive
- the archive to alterversion
- the version to add to the archiveuser
- the current usersid
- identifier of the session- Returns:
- if the entry has been successfully added
-
addEntry
public boolean addEntry(Archive archive, com.logicaldoc.core.document.Version version, com.logicaldoc.core.security.user.User user, String comment, String sid) Adds a new entry taking care of locking the document- Parameters:
archive
- the archive to alterversion
- the version to add to the archiveuser
- the current usercomment
- an optional commentsid
- identifier of the session- Returns:
- if the entry has been successfully added
-
delete
public void delete(long archiveId, com.logicaldoc.core.security.user.User user, String comment) throws com.logicaldoc.core.PersistenceException Delete the archive with the given id and unlocks all its document.- Parameters:
archiveId
- The id of the archive to deleteuser
- The user that makes the deleting operationcomment
- an optional comment to the deletion- Throws:
com.logicaldoc.core.PersistenceException
- error at data layer
-
setArchiveDao
-
setDocumentDao
public void setDocumentDao(com.logicaldoc.core.document.DocumentDAO documentDao) -
closeArchive
public void closeArchive(long id, com.logicaldoc.core.security.user.User user) throws com.logicaldoc.core.PersistenceException - Throws:
com.logicaldoc.core.PersistenceException
-
setFolderDao
public void setFolderDao(com.logicaldoc.core.folder.FolderDAO folderDao) -
setTenantDao
public void setTenantDao(com.logicaldoc.core.security.TenantDAO tenantDao)
-