Class VersionService

java.lang.Object
com.eurodyn.qlack.fuse.cm.service.VersionService

@Service public class VersionService extends Object
Author:
European Dynamics
  • Constructor Details

  • Method Details

    • init

      @PostConstruct public void init() throws org.apache.tika.exception.TikaException, IOException
      Throws:
      org.apache.tika.exception.TikaException
      IOException
    • createVersion

      public String createVersion(String fileID, VersionDTO cmVersion, String filename, byte[] content, String userID, String lockToken)
      Creates the version.
      Parameters:
      fileID - the file ID
      cmVersion - the cm version
      filename - the filename
      content - the content
      userID - the user ID
      lockToken - the lock token
      Returns:
      the string
      Throws:
      QNodeLockException - the q node lock exception
    • updateVersion

      public void updateVersion(String fileID, VersionDTO versionDTO, byte[] content, String userID, boolean updateAllAttributes, String lockToken)
      Updates the values, content as also the attributes of a specific version.
      Parameters:
      fileID - the file ID
      versionDTO - the version DTO
      content - the content
      userID - the user ID
      updateAllAttributes - A true value defines that all attributes should be updated/deleted. Only the custom created attributes are allowed to be deleted. A false value updates only the mandatory attribute values
      lockToken - the lock token
    • deleteVersion

      public void deleteVersion(String versionId, String lockToken)
      Delete version.
      Parameters:
      versionId - the version id
      lockToken - the lock token
    • getVersionById

      public VersionDTO getVersionById(String versionId)
      Gets the version by id.
      Parameters:
      versionId - the version id
      Returns:
      the version by id
    • getFileVersions

      public List<VersionDTO> getFileVersions(String fileID)
      Gets the file versions.
      Parameters:
      fileID - the file ID
      Returns:
      the file versions
    • getFileLatestVersion

      public VersionDTO getFileLatestVersion(String fileID)
      Gets the file latest version.
      Parameters:
      fileID - the file ID
      Returns:
      the file latest version
    • getBinContent

      public byte[] getBinContent(String fileID)
      Gets the bin content.
      Parameters:
      fileID - the file ID
      Returns:
      the bin content
    • getBinContent

      public byte[] getBinContent(String fileID, String versionName)
      Gets the bin content.
      Parameters:
      fileID - the file ID
      versionName - the version name
      Returns:
      the bin content
    • getFileAsZip

      public byte[] getFileAsZip(String fileID, boolean includeProperties)
      Gets the file as zip.
      Parameters:
      fileID - the file ID
      includeProperties - the include properties
      Returns:
      the file as zip
    • getFileAsZip

      public byte[] getFileAsZip(String fileID, String versionName, boolean includeProperties)
      Gets the file as zip.
      Parameters:
      fileID - the file ID
      versionName - the version name
      includeProperties - the include properties
      Returns:
      the file as zip
    • setBinChunk

      public String setBinChunk(String versionID, byte[] content, int chunkIndex)
      Sets the bin chunk.
      Parameters:
      versionID - the version ID
      content - the content
      chunkIndex - the chunk index
      Returns:
      the string
    • getBinChunk

      public BinChunkDTO getBinChunk(String versionID, int chunkIndex)
      Gets the bin chunk.
      Parameters:
      versionID - the version ID
      chunkIndex - the chunk index
      Returns:
      the bin chunk
    • updateAttribute

      public void updateAttribute(String fileID, String attributeName, String attributeValue, String userID, String lockToken)
      Update attribute.
      Parameters:
      fileID - the file ID
      attributeName - the attribute name
      attributeValue - the attribute value
      userID - the user ID
      lockToken - the lock token
      Throws:
      QNodeLockException - the q node lock exception
    • updateAttribute

      public void updateAttribute(String fileID, String attributeName, String attributeValue, String userID, String lockToken, String versionName)
      Update attribute.
      Parameters:
      fileID - the file ID
      versionName - the version name
      attributeName - the attribute name
      attributeValue - the attribute value
      userID - the user ID
      lockToken - the lock token
      Throws:
      QNodeLockException - the q node lock exception
    • updateAttributes

      public void updateAttributes(String fileID, Map<String,String> attributes, String userID, String lockToken)
      Update attributes.
      Parameters:
      fileID - the file ID
      attributes - the attributes
      userID - the user ID
      lockToken - the lock token
      Throws:
      QNodeLockException - the q node lock exception
    • deleteAttribute

      public void deleteAttribute(String fileID, String attributeName, String userID, String lockToken)
      Delete attribute.
      Parameters:
      fileID - the file ID
      attributeName - the attribute name
      userID - the user ID
      lockToken - the lock token
      Throws:
      QNodeLockException - the q node lock exception
    • deleteAttribute

      public void deleteAttribute(String fileID, String attributeName, String userID, String lockToken, String versionName)
      Delete attribute.
      Parameters:
      fileID - the file ID
      versionName - the version name
      attributeName - the attribute name
      userID - the user ID
      lockToken - the lock token
      Throws:
      QNodeLockException - the q node lock exception
    • getVersionsByFilenameForFile

      public List<VersionDTO> getVersionsByFilenameForFile(String fileId, List<String> filenameList)
      Retrieves the latest version by a given filename list under a node
      Parameters:
      fileId - the file id
      filenameList - the filename list
      Returns:
      the versions by filename for file
    • getMimeType

      public String getMimeType(byte[] fileContent)
      Retrieves the mime type of a provided binary content.
      Parameters:
      fileContent - The provided binary content.
      Returns:
      The mime type of the content.
    • replaceVersionContent

      public void replaceVersionContent(String versionID, byte[] content)
      Sets the version content.
      Parameters:
      versionID - the version ID
      content - the content
    • transferFromFluToVersionBin

      public void transferFromFluToVersionBin(String attachmentID, String versionID)
      Transfers the binary content from the flu_file temporary table to the cm_version_bin.
      Parameters:
      attachmentID - the ID of the chunks in the flu_file table. All the chunks of the same file have the same ID.
      versionID - The ID of the version to which is related with the binary content to be transfered.
    • cleanupFS

      @Scheduled(fixedDelayString="${qlack.fuse.cm.cleanupInterval:60000}") public void cleanupFS()
      Cleanup FS.