mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-04 22:47:35 +00:00
Added loading of AttachmentNode blobs.
This commit is contained in:
parent
f429c4bf8b
commit
1db7670f05
4 changed files with 13 additions and 6 deletions
|
@ -27,9 +27,14 @@ public class AttachmentNode extends FileNode {
|
|||
initBlob(fileIndexes);
|
||||
}
|
||||
|
||||
public AttachmentNode(String filePath, boolean changed, String url) {
|
||||
public AttachmentNode(String filePath, boolean changed, String url, FileIndexStore fileIndexStore) {
|
||||
super(filePath, changed);
|
||||
this.url = url;
|
||||
try {
|
||||
initBlob(fileIndexStore);
|
||||
} catch (FailedConnectionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public AttachmentNode(String url, byte[] blob) {
|
||||
|
|
|
@ -46,11 +46,11 @@ public class WLDirectoryNode implements PersistentStoreSource, PersistentStoreUp
|
|||
|
||||
@Override
|
||||
public void initFromPersistentStore(PersistentStoreAPI persistentStore) {
|
||||
fileIndexStore = new FileIndexStore(projectName, persistentStore);
|
||||
fileNodeTable = new HashMap<String, FileNode>();
|
||||
for (FileNode fileNode : persistentStore.getFileNodesForProjectName(projectName)) {
|
||||
for (FileNode fileNode : persistentStore.getFileNodesForProjectName(projectName, fileIndexStore)) {
|
||||
fileNodeTable.put(fileNode.getFilePath(), fileNode);
|
||||
}
|
||||
fileIndexStore = new FileIndexStore(projectName, persistentStore);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package uk.ac.ic.wlgitbridge.writelatex.model.db;
|
||||
|
||||
import uk.ac.ic.wlgitbridge.writelatex.filestore.node.FileNode;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.filestore.store.FileIndexStore;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.filestore.store.WLFileStore;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.model.WLProjectStore;
|
||||
|
||||
|
@ -23,7 +24,7 @@ public interface PersistentStoreAPI {
|
|||
|
||||
public List<String> getProjectNames();
|
||||
public List<Integer> getVersionIDsForProjectName(String projectName);
|
||||
public List<FileNode> getFileNodesForProjectName(String projectName);
|
||||
public List<FileNode> getFileNodesForProjectName(String projectName, FileIndexStore fileIndexStore);
|
||||
public Map<String, FileNode> getURLIndexTableForProjectName(String projectName);
|
||||
|
||||
public void deleteFileNodesForProjectName(String projectName);
|
||||
|
|
|
@ -2,6 +2,7 @@ package uk.ac.ic.wlgitbridge.writelatex.model.db;
|
|||
|
||||
import uk.ac.ic.wlgitbridge.util.Util;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.filestore.node.FileNode;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.filestore.store.FileIndexStore;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.filestore.store.WLFileStore;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.model.WLProjectStore;
|
||||
import uk.ac.ic.wlgitbridge.writelatex.model.db.sql.SQLiteWLDatabase;
|
||||
|
@ -104,9 +105,9 @@ public class WLGBPersistentStore implements PersistentStoreAPI {
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<FileNode> getFileNodesForProjectName(String projectName) {
|
||||
public List<FileNode> getFileNodesForProjectName(String projectName, FileIndexStore fileIndexStore) {
|
||||
try {
|
||||
return database.getFileNodesForProjectName(projectName);
|
||||
return database.getFileNodesForProjectName(projectName, fileIndexStore);
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue