Class ArchiveManager

java.lang.Object
com.logicaldoc.impex.ArchiveManager

@Component("archiveManager") public class ArchiveManager extends Object
Manager for archive operations handling
Since:
4.5
Author:
Matteo Caruso - LogicalDOC
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    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
    void
    closeArchive(long id, com.logicaldoc.core.security.user.User user)
     
    void
    delete(long archiveId, com.logicaldoc.core.security.user.User user, String comment)
    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 documents
    Retrieves the archive directory from/in which will be import/copied the archive's document
    void
     
    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
    Writes the index.html file.
    void
    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

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ArchiveManager

      public ArchiveManager()
  • Method Details

    • getArchiveDirectory

      public File getArchiveDirectory(Archive archive) throws com.logicaldoc.core.PersistenceException
      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

      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 archive
      archiveName - name of the archive
      id - identifier of the archive
      tenantName - 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.xml
      com.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 write
      writer - the writer for the index.xml
      Throws:
      IOException - cannot write the index.xml
      com.logicaldoc.core.PersistenceException - error at data layer
    • 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 user, String sid)
      Adds a new entry taking care of locking the document, a default comment will be used
      Parameters:
      archive - the archive to alter
      version - the version to add to the archive
      user - the current user
      sid - 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 alter
      version - the version to add to the archive
      user - the current user
      comment - an optional comment
      sid - 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 delete
      user - The user that makes the deleting operation
      comment - an optional comment to the deletion
      Throws:
      com.logicaldoc.core.PersistenceException - error at data layer
    • setArchiveDao

      public void setArchiveDao(ArchiveDAO archiveDao)
    • 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)