use of org.jabref.logic.importer.ImportFormatPreferences in project jabref by JabRef.
the class ChangeScanner method run.
@Override
public void run() {
try {
// Parse the temporary file.
Path tempFile = Globals.getFileUpdateMonitor().getTempFile(panel.fileMonitorHandle());
ImportFormatPreferences importFormatPreferences = Globals.prefs.getImportFormatPreferences();
ParserResult result = OpenDatabase.loadDatabase(tempFile.toFile(), importFormatPreferences);
databaseInTemp = result.getDatabase();
metadataInTemp = result.getMetaData();
// Parse the modified file.
result = OpenDatabase.loadDatabase(file, importFormatPreferences);
BibDatabase databaseOnDisk = result.getDatabase();
MetaData metadataOnDisk = result.getMetaData();
// Sort both databases according to a common sort key.
EntryComparator comparator = new EntryComparator(false, true, SORT_BY[2]);
comparator = new EntryComparator(false, true, SORT_BY[1], comparator);
comparator = new EntryComparator(false, true, SORT_BY[0], comparator);
EntrySorter sorterInTemp = databaseInTemp.getSorter(comparator);
comparator = new EntryComparator(false, true, SORT_BY[2]);
comparator = new EntryComparator(false, true, SORT_BY[1], comparator);
comparator = new EntryComparator(false, true, SORT_BY[0], comparator);
EntrySorter sorterOnDisk = databaseOnDisk.getSorter(comparator);
comparator = new EntryComparator(false, true, SORT_BY[2]);
comparator = new EntryComparator(false, true, SORT_BY[1], comparator);
comparator = new EntryComparator(false, true, SORT_BY[0], comparator);
EntrySorter sorterInMem = databaseInMemory.getSorter(comparator);
// Start looking at changes.
scanMetaData(metadataInMemory, metadataInTemp, metadataOnDisk);
scanPreamble(databaseInMemory, databaseInTemp, databaseOnDisk);
scanStrings(databaseInMemory, databaseInTemp, databaseOnDisk);
scanEntries(sorterInMem, sorterInTemp, sorterOnDisk);
scanGroups(metadataInTemp, metadataOnDisk);
} catch (IOException ex) {
LOGGER.warn("Problem running", ex);
}
}
use of org.jabref.logic.importer.ImportFormatPreferences in project jabref by JabRef.
the class GoogleScholarTest method setUp.
@Before
public void setUp() {
ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class);
when(importFormatPreferences.getFieldContentParserPreferences()).thenReturn(mock(FieldContentParserPreferences.class));
finder = new GoogleScholar(importFormatPreferences);
entry = new BibEntry();
}
use of org.jabref.logic.importer.ImportFormatPreferences in project jabref by JabRef.
the class RepecNepImporterTest method setUp.
@Before
public void setUp() {
ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class);
when(importFormatPreferences.getKeywordSeparator()).thenReturn(',');
testImporter = new RepecNepImporter(importFormatPreferences);
}
use of org.jabref.logic.importer.ImportFormatPreferences in project jabref by JabRef.
the class XMPUtilTest method setUp.
/**
* Create a temporary PDF-file with a single empty page.
*/
@Before
public void setUp() throws IOException, COSVisitorException {
pdfFile = tempFolder.newFile("JabRef.pdf");
try (PDDocument pdf = new PDDocument()) {
// Need page to open in Acrobat
pdf.addPage(new PDPage());
pdf.save(pdfFile.getAbsolutePath());
}
importFormatPreferences = mock(ImportFormatPreferences.class, Answers.RETURNS_DEEP_STUBS);
when(importFormatPreferences.getEncoding()).thenReturn(StandardCharsets.UTF_8);
xmpPreferences = mock(XMPPreferences.class);
// The code assumes privacy filters to be off
when(xmpPreferences.isUseXMPPrivacyFilter()).thenReturn(false);
when(xmpPreferences.getKeywordSeparator()).thenReturn(',');
}
use of org.jabref.logic.importer.ImportFormatPreferences in project jabref by JabRef.
the class MathSciNetTest method setUp.
@Before
public void setUp() throws Exception {
ImportFormatPreferences importFormatPreferences = mock(ImportFormatPreferences.class);
when(importFormatPreferences.getFieldContentParserPreferences()).thenReturn(mock(FieldContentParserPreferences.class));
fetcher = new MathSciNet(importFormatPreferences);
ratiuEntry = new BibEntry();
ratiuEntry.setType(BibtexEntryTypes.ARTICLE);
ratiuEntry.setCiteKey("MR3537908");
ratiuEntry.setField("author", "Chechkin, Gregory A. and Ratiu, Tudor S. and Romanov, Maxim S. and Samokhin, Vyacheslav N.");
ratiuEntry.setField("title", "Existence and uniqueness theorems for the two-dimensional {E}ricksen-{L}eslie system");
ratiuEntry.setField("journal", "Journal of Mathematical Fluid Mechanics");
ratiuEntry.setField("volume", "18");
ratiuEntry.setField("year", "2016");
ratiuEntry.setField("number", "3");
ratiuEntry.setField("pages", "571--589");
ratiuEntry.setField("issn", "1422-6928");
ratiuEntry.setField("keywords", "76A15 (35A01 35A02 35K61)");
ratiuEntry.setField("mrnumber", "3537908");
ratiuEntry.setField("doi", "10.1007/s00021-016-0250-0");
}
Aggregations