Class VersionService
java.lang.Object
com.eurodyn.qlack.fuse.cm.service.VersionService
- Author:
- European Dynamics
-
Constructor Summary
ConstructorDescriptionVersionService
(ConcurrencyControlService concurrencyControlService, StorageEngineFactory storageEngineFactory, NodeRepository nodeRepository, VersionRepository versionRepository, VersionDeletedRepository versionDeletedRepository, VersionMapper versionMapper) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Cleanup FS.createVersion
(String fileID, VersionDTO cmVersion, String filename, byte[] content, String userID, String lockToken) Creates the version.void
deleteAttribute
(String fileID, String attributeName, String userID, String lockToken) Delete attribute.void
deleteAttribute
(String fileID, String attributeName, String userID, String lockToken, String versionName) Delete attribute.void
deleteVersion
(String versionId, String lockToken) Delete version.getBinChunk
(String versionID, int chunkIndex) Gets the bin chunk.byte[]
getBinContent
(String fileID) Gets the bin content.byte[]
getBinContent
(String fileID, String versionName) Gets the bin content.byte[]
getFileAsZip
(String fileID, boolean includeProperties) Gets the file as zip.byte[]
getFileAsZip
(String fileID, String versionName, boolean includeProperties) Gets the file as zip.getFileLatestVersion
(String fileID) Gets the file latest version.getFileVersions
(String fileID) Gets the file versions.getMimeType
(byte[] fileContent) Retrieves the mime type of a provided binary content.getVersionById
(String versionId) Gets the version by id.getVersionsByFilenameForFile
(String fileId, List<String> filenameList) Retrieves the latest version by a given filename list under a nodevoid
init()
void
replaceVersionContent
(String versionID, byte[] content) Sets the version content.setBinChunk
(String versionID, byte[] content, int chunkIndex) Sets the bin chunk.void
transferFromFluToVersionBin
(String attachmentID, String versionID) Transfers the binary content from the flu_file temporary table to the cm_version_bin.void
updateAttribute
(String fileID, String attributeName, String attributeValue, String userID, String lockToken) Update attribute.void
updateAttribute
(String fileID, String attributeName, String attributeValue, String userID, String lockToken, String versionName) Update attribute.void
Update attributes.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.
-
Constructor Details
-
VersionService
@Autowired public VersionService(ConcurrencyControlService concurrencyControlService, StorageEngineFactory storageEngineFactory, NodeRepository nodeRepository, VersionRepository versionRepository, VersionDeletedRepository versionDeletedRepository, VersionMapper versionMapper)
-
-
Method Details
-
init
- 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 IDcmVersion
- the cm versionfilename
- the filenamecontent
- the contentuserID
- the user IDlockToken
- 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 IDversionDTO
- the version DTOcontent
- the contentuserID
- the user IDupdateAllAttributes
- 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 valueslockToken
- the lock token
-
deleteVersion
Delete version.- Parameters:
versionId
- the version idlockToken
- the lock token
-
getVersionById
Gets the version by id.- Parameters:
versionId
- the version id- Returns:
- the version by id
-
getFileVersions
Gets the file versions.- Parameters:
fileID
- the file ID- Returns:
- the file versions
-
getFileLatestVersion
Gets the file latest version.- Parameters:
fileID
- the file ID- Returns:
- the file latest version
-
getBinContent
Gets the bin content.- Parameters:
fileID
- the file ID- Returns:
- the bin content
-
getBinContent
Gets the bin content.- Parameters:
fileID
- the file IDversionName
- the version name- Returns:
- the bin content
-
getFileAsZip
Gets the file as zip.- Parameters:
fileID
- the file IDincludeProperties
- the include properties- Returns:
- the file as zip
-
getFileAsZip
Gets the file as zip.- Parameters:
fileID
- the file IDversionName
- the version nameincludeProperties
- the include properties- Returns:
- the file as zip
-
setBinChunk
Sets the bin chunk.- Parameters:
versionID
- the version IDcontent
- the contentchunkIndex
- the chunk index- Returns:
- the string
-
getBinChunk
Gets the bin chunk.- Parameters:
versionID
- the version IDchunkIndex
- 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 IDattributeName
- the attribute nameattributeValue
- the attribute valueuserID
- the user IDlockToken
- 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 IDversionName
- the version nameattributeName
- the attribute nameattributeValue
- the attribute valueuserID
- the user IDlockToken
- 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 IDattributes
- the attributesuserID
- the user IDlockToken
- the lock token- Throws:
QNodeLockException
- the q node lock exception
-
deleteAttribute
Delete attribute.- Parameters:
fileID
- the file IDattributeName
- the attribute nameuserID
- the user IDlockToken
- 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 IDversionName
- the version nameattributeName
- the attribute nameuserID
- the user IDlockToken
- the lock token- Throws:
QNodeLockException
- the q node lock exception
-
getVersionsByFilenameForFile
Retrieves the latest version by a given filename list under a node- Parameters:
fileId
- the file idfilenameList
- the filename list- Returns:
- the versions by filename for file
-
getMimeType
Retrieves the mime type of a provided binary content.- Parameters:
fileContent
- The provided binary content.- Returns:
- The mime type of the content.
-
replaceVersionContent
Sets the version content.- Parameters:
versionID
- the version IDcontent
- the content
-
transferFromFluToVersionBin
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.
-