private void updateFullDatabaseVersionCache(DatabaseVersion newDatabaseVersion) { // Chunks for (ChunkEntry sourceChunk : newDatabaseVersion.getChunks()) { if (fullDatabaseVersionCache.getChunk(sourceChunk.getChecksum()) == null) { fullDatabaseVersionCache.addChunk(sourceChunk); } } // Multichunks for (MultiChunkEntry sourceMultiChunk : newDatabaseVersion.getMultiChunks()) { if (fullDatabaseVersionCache.getMultiChunk(sourceMultiChunk.getId()) == null) { fullDatabaseVersionCache.addMultiChunk(sourceMultiChunk); } } // Contents for (FileContent sourceFileContent : newDatabaseVersion.getFileContents()) { if (fullDatabaseVersionCache.getFileContent(sourceFileContent.getChecksum()) == null) { fullDatabaseVersionCache.addFileContent(sourceFileContent); } } // Histories for (PartialFileHistory sourceFileHistory : newDatabaseVersion.getFileHistories()) { PartialFileHistory targetFileHistory = fullDatabaseVersionCache.getFileHistory(sourceFileHistory.getFileId()); if (targetFileHistory == null) { fullDatabaseVersionCache.addFileHistory((PartialFileHistory) sourceFileHistory.clone()); } else { for (FileVersion sourceFileVersion : sourceFileHistory.getFileVersions().values()) { if (targetFileHistory.getFileVersion(sourceFileVersion.getVersion()) == null) { targetFileHistory.addFileVersion(sourceFileVersion); } } } } }
public PartialFileHistory getFileHistory(FileHistoryId fileId) { return fullDatabaseVersionCache.getFileHistory(fileId); }