Skip to content

Commit

Permalink
Fix compile errors in ImportManagerV2
Browse files Browse the repository at this point in the history
  • Loading branch information
zHd4 committed Dec 6, 2024
1 parent c74f3bf commit b08b23c
Showing 1 changed file with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import java.io.File;
import java.io.IOException;
import java.util.Map;

import app.notesr.R;
import app.notesr.exception.ImportFailedException;
Expand Down Expand Up @@ -77,30 +78,33 @@ private void importData() throws ImportFailedException, IOException {
File fileInfoJsonFile = new File(tempDir, FILES_INFO_JSON_FILE_NAME);
File dataBlocksDir = new File(tempDir, DATA_BLOCKS_DIR_NAME);

JsonParser notesParser = createJsonParser(notesJsonFile);
JsonParser filesInfoParser = createJsonParser(fileInfoJsonFile);

NotesImporter notesImporter = createNotesImporter(notesParser);
FilesImporter filesImporter = createFilesImporter(filesInfoParser, dataBlocksDir);
JsonParser notesParser = getJsonParser(notesJsonFile);
JsonParser filesInfoParser = getJsonParser(fileInfoJsonFile);

NotesImporter notesImporter = getNotesImporter(notesParser);
notesImporter.importNotes();
filesImporter.importFiles();

getFilesImporter(filesInfoParser, dataBlocksDir, notesImporter.getAdaptedIdMap()).importFiles();
}

private JsonParser createJsonParser(File file) throws IOException {
private JsonParser getJsonParser(File file) throws IOException {
JsonFactory factory = new JsonFactory();
return factory.createParser(file);
}

private NotesImporter createNotesImporter(JsonParser parser) {
private NotesImporter getNotesImporter(JsonParser parser) {
return new NotesImporter(parser, getNotesTable(), getTimestampFormatter());
}

private FilesImporter createFilesImporter(JsonParser parser, File dataBlocksDir) {
private FilesImporter getFilesImporter(
JsonParser parser,
File dataBlocksDir,
Map<String, String> adaptedNotesIdMap) {
return new FilesImporter(
parser,
getFilesInfoTable(),
getDataBlocksTable(),
adaptedNotesIdMap,
dataBlocksDir,
getTimestampFormatter()
);
Expand Down

0 comments on commit b08b23c

Please sign in to comment.