Package com.logicaldoc.impex
Class ArchiveManager
- java.lang.Object
-
- com.logicaldoc.impex.ArchiveManager
-
public class ArchiveManager extends Object
Manager for archive operations handling- Since:
- 4.5
- Author:
- Matteo Caruso - LogicalDOC
-
-
Constructor Summary
Constructors Constructor Description ArchiveManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addEntry(Archive archive, com.logicaldoc.core.document.Version version, com.logicaldoc.core.security.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, String comment, String sid)
Adds a new entry taking care of locking the documentvoid
closeArchive(long id, com.logicaldoc.core.security.User user)
boolean
delete(long archiveId, com.logicaldoc.core.security.User user, String comment)
Delete the archive with the given id and unlocks all its document.File
getArchiveDirectory(int mode, String archiveName, String id, long tenantId)
File
getArchiveDirectory(int mode, String archiveName, String id, String tenantName)
Retrieves the archive directory from/in which will be import/copied the archive's documentsFile
getArchiveDirectory(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.dao.DocumentDAO documentDao)
void
setDocumentHistoryDao(com.logicaldoc.core.document.dao.DocumentHistoryDAO documentHistoryDao)
void
setFolderDao(com.logicaldoc.core.folder.FolderDAO folderDao)
void
setTenantDao(com.logicaldoc.core.security.dao.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
-
-
-
Method Detail
-
getArchiveDirectory
public File getArchiveDirectory(Archive archive)
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
-
getArchiveDirectory
public File getArchiveDirectory(int mode, String archiveName, String id, long tenantId)
-
getArchiveDirectory
public File getArchiveDirectory(int mode, String archiveName, String id, String tenantName)
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 in the database
-
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 in the database
-
writeHtmlIndex
public void writeHtmlIndex(Archive archive) throws IOException
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, 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, 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 boolean delete(long archiveId, com.logicaldoc.core.security.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- Returns:
- true if the archive was deleted
- Throws:
com.logicaldoc.core.PersistenceException
- error in the database
-
setArchiveDao
public void setArchiveDao(ArchiveDAO archiveDao)
-
setDocumentDao
public void setDocumentDao(com.logicaldoc.core.document.dao.DocumentDAO documentDao)
-
setDocumentHistoryDao
public void setDocumentHistoryDao(com.logicaldoc.core.document.dao.DocumentHistoryDAO documentHistoryDao)
-
closeArchive
public void closeArchive(long id, com.logicaldoc.core.security.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.dao.TenantDAO tenantDao)
-
-