Skip to content

Commit

Permalink
Export number as issue, when issue field not present
Browse files Browse the repository at this point in the history
Rework some test files
  • Loading branch information
Siedlerchr committed Aug 22, 2016
1 parent d867bad commit d37ed2a
Show file tree
Hide file tree
Showing 20 changed files with 107 additions and 231 deletions.
10 changes: 6 additions & 4 deletions src/main/java/net/sf/jabref/logic/msbib/MSBibConverter.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,25 @@ public static MSBibEntry convert(BibEntry entry) {
result.journalName = entry.getFieldOrAlias(FieldName.JOURNAL).orElse(null);
result.month = entry.getFieldOrAlias(FieldName.MONTH).orElse(null);


if (!entry.getFieldOptional(FieldName.YEAR).isPresent()) {
result.year = entry.getFieldOrAlias(FieldName.YEAR).orElse(null);
}

if (!entry.getFieldOptional(FieldName.ISSUE).isPresent()) {
result.number = entry.getFieldOptional(FieldName.NUMBER).orElse(null);
}
// Value must be converted
//Currently only english is supported

entry.getFieldOptional(FieldName.LANGUAGE)
.ifPresent(lang -> result.fields.put("LCID", String.valueOf(MSBibMapping.getLCID(lang))));

result.standardNumber = "";

entry.getFieldOptional(FieldName.ISBN).ifPresent(isbn -> result.standardNumber += " ISBN: " + isbn);
entry.getFieldOptional(FieldName.ISSN).ifPresent(issn -> result.standardNumber += " ISSN: " + issn);
entry.getFieldOptional("lccn").ifPresent(lccn -> result.standardNumber += " LCCN: " + lccn);
entry.getFieldOptional("mrnumber").ifPresent(mrnumber -> result.standardNumber += " MRN: " + mrnumber);



if (result.standardNumber.isEmpty()) {
result.standardNumber = null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/jabref/logic/msbib/MSBibMapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class MSBibMapping {
bibtexToMSBib.put(MSBIB_PREFIX + "numberofvolume", "NumberVolumes");
bibtexToMSBib.put(MSBIB_PREFIX + "periodical", "PeriodicalTitle");
//bibtexToMSBib.put(MSBIB_PREFIX + "day", "Day");
//bibtexToMSBib.put(PREFIX + "accessed", "Accessed");
bibtexToMSBib.put(MSBIB_PREFIX + "accessed", "Accessed");
bibtexToMSBib.put(MSBIB_PREFIX + "medium", "Medium");
bibtexToMSBib.put(MSBIB_PREFIX + "recordingnumber", "RecordingNumber");
bibtexToMSBib.put(MSBIB_PREFIX + "theater", "Theater");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,16 @@
import java.util.Collections;
import java.util.List;

import net.sf.jabref.Globals;
import net.sf.jabref.logic.util.FileExtensions;
import net.sf.jabref.model.entry.BibEntry;
import net.sf.jabref.preferences.JabRefPreferences;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class MsBibImporterTest {

@Before
public void setUp() throws Exception {
Globals.prefs = JabRefPreferences.getInstance();
}

@Test
public void testsGetExtensions() {
MsBibImporter importer = new MsBibImporter();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class MsBibImporterTestfiles {

@Before
public void setUp() {
//currently still necessary as it throws an NPE otherwise
Globals.prefs = JabRefPreferences.getInstance();

}
Expand Down Expand Up @@ -62,8 +63,7 @@ public void testImportEntries() throws Exception {

Path xmlFile = Paths.get(PATH_TO_FILE, fileName);

List<BibEntry> result = testImporter.importDatabase(xmlFile, StandardCharsets.UTF_8).getDatabase()
.getEntries();
List<BibEntry> result = testImporter.importDatabase(xmlFile, StandardCharsets.UTF_8).getDatabase().getEntries();
BibEntryAssert.assertEquals(MsBibImporterTest.class, bibFileName, result);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
% Encoding: UTF-8
@Unpublished{,
author = {Hanns-Jörg Stoß},
howpublished = {how},
note = {a Note},
month = {July},
abstract = {here should stand something about the content},
address = {Stuttgart Bawue Deutschland},
affiliation = {aff},
booktitle = {Turingmaschinen},
chapter = {3},
contents = {con},
copyright = {cop},
crossref = {cross},
edition = {10},
editor = {Alfred},
institution = {Institution},
intype = {intype},
isbn = {‎978-3-16-148410-0},
msbib-abbreviatedcasenumber = {abb},
msbib-accessed = {12.10.2015},
msbib-broadcaster = {broad},
Expand All @@ -34,8 +17,7 @@ @Unpublished{
msbib-station = {stat},
msbib-theater = {th},
msbib-type = {type},
organization = {Besondere Turingmaschinen},
owner = {Christoph Schwentker},
owner = {Ich},
paper = {paper},
price = {10},
school = {Gymnasium Unterrieden},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,62 +5,29 @@
<b:BIBTEX_Series>ser</b:BIBTEX_Series>
<b:BIBTEX_Entry>unpublished</b:BIBTEX_Entry>
<b:SourceType>Report</b:SourceType>
<b:ChapterNumber>3</b:ChapterNumber>
<b:Institution>Institution</b:Institution>
<b:BookTitle>Turingmaschinen</b:BookTitle>
<b:Reporter>rep</b:Reporter>
<b:Accessed>12.10.2015</b:Accessed>
<b:Court>court</b:Court>
<b:RecordingNumber>record</b:RecordingNumber>
<b:Department>Gymnasium Unterrieden</b:Department>
<b:ShortTitle>Turing</b:ShortTitle>
<b:ProductionCompany>produktion</b:ProductionCompany>
<b:BIBTEX_Paper>paper</b:BIBTEX_Paper>
<b:CaseNumber>case</b:CaseNumber>
<b:Broadcaster>broad</b:Broadcaster>
<b:BIBTEX_Abstract>here should stand something about the content</b:BIBTEX_Abstract>
<b:BIBTEX_HowPublished>how</b:BIBTEX_HowPublished>
<b:AbbreviatedCaseNumber>abb</b:AbbreviatedCaseNumber>
<b:BIBTEX_InType>intype</b:BIBTEX_InType>
<b:BIBTEX_Copyright>cop</b:BIBTEX_Copyright>
<b:Comments>a Note</b:Comments>
<b:Reporter>rep</b:Reporter>
<b:BIBTEX_Affiliation>aff</b:BIBTEX_Affiliation>
<b:Edition>10</b:Edition>
<b:Station>stat</b:Station>
<b:Theater>th</b:Theater>
<b:PeriodicalTitle>peri</b:PeriodicalTitle>
<b:Type>type</b:Type>
<b:Department>Gymnasium Unterrieden</b:Department>
<b:Distributor>dist</b:Distributor>
<b:BIBTEX_CrossRef>cross</b:BIBTEX_CrossRef>
<b:ShortTitle>Turing</b:ShortTitle>
<b:Medium>med</b:Medium>
<b:ProductionCompany>produktion</b:ProductionCompany>
<b:BIBTEX_Paper>paper</b:BIBTEX_Paper>
<b:CaseNumber>case</b:CaseNumber>
<b:Broadcaster>broad</b:Broadcaster>
<b:NumberVolumes>10</b:NumberVolumes>
<b:AbbreviatedCaseNumber>abb</b:AbbreviatedCaseNumber>
<b:BIBTEX_Size>1000</b:BIBTEX_Size>
<b:BIBTEX_Contents>con</b:BIBTEX_Contents>
<b:MonthAccessed>12</b:MonthAccessed>
<b:DayAccessed>10</b:DayAccessed>
<b:YearAccessed>2015</b:YearAccessed>
<b:Author>
<b:Author>
<b:NameList>
<b:Person>
<b:Last>Stoß</b:Last>
<b:First>Hanns-Jörg</b:First>
</b:Person>
</b:NameList>
</b:Author>
<b:Editor>
<b:NameList>
<b:Person>
<b:Last>Alfred</b:Last>
</b:Person>
</b:NameList>
</b:Editor>
</b:Author>
<b:Month>July</b:Month>
<b:StandardNumber> ISBN: ‎978-3-16-148410-0</b:StandardNumber>
<b:ConferenceName>Turingmaschinen</b:ConferenceName>
<b:City>Stuttgart</b:City>
<b:StateProvince>Bawue</b:StateProvince>
<b:CountryRegion>Deutschland</b:CountryRegion>
<b:Author/>
<b:ThesisType>unpublished</b:ThesisType>
</b:Source>
</b:Sources>
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
% Encoding: UTF-8
@phdthesis{2002,
title = {Agile Entwicklung Web-basierter Systeme},
year = {2002},
type = {type},
number = {3},
address = {a},
journal = {Wirtschaftsinformatik},
keywords = {software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development},
language = {english},
pages = {237--248},
publisher = {Gabler Verlag},
doi = {10.1007/BF03250842},
url = {http://dx.doi.org/10.1007/BF03250842},
volume = {44},
}

@Comment{jabref-meta: databaseType:biblatex;}
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" SelectedStyle="">
<b:Source>
<b:SourceType>Report</b:SourceType>
<b:BIBTEX_Entry>phdthesis</b:BIBTEX_Entry>
<b:Tag>2002</b:Tag>
<b:LCID>0</b:LCID>
<b:Title>Agile Entwicklung Web-basierter Systeme</b:Title>
<b:Year>2002</b:Year>
<b:Author/>
<b:Pages>237-248</b:Pages>
<b:Volume>44</b:Volume>
<b:StandardNumber> DOI: 10.1007/BF03250842</b:StandardNumber>
<b:BIBTEX_Entry>phdthesis</b:BIBTEX_Entry>
<b:SourceType>Report</b:SourceType>
<b:Title>Agile Entwicklung Web-basierter Systeme</b:Title>
<b:Tag>2002</b:Tag>
<b:Publisher>Gabler Verlag</b:Publisher>
<b:City>a</b:City>
<b:URL>http://dx.doi.org/10.1007/BF03250842</b:URL>
<b:DOI>10.1007/BF03250842</b:DOI>
<b:Author/>
<b:Pages>237-248</b:Pages>
<b:JournalName>Wirtschaftsinformatik</b:JournalName>
<b:City>a</b:City>
<b:ThesisType>type</b:ThesisType>
<b:DOI>10.1007/BF03250842</b:DOI>
<b:URL>http://dx.doi.org/10.1007/BF03250842</b:URL>
<b:BIBTEX_KeyWords>software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development</b:BIBTEX_KeyWords>
</b:Source>
</b:Sources>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@inbook{raey,
issn = {0937-6429},
journal = {Wirtschaftsinformatik},
keywords = {software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development},
language = {english},
pages = {237--248},
publisher = {Gabler Verlag},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" SelectedStyle="">
<b:Source>
<b:SourceType>BookSection</b:SourceType>
<b:BIBTEX_Entry>inbook</b:BIBTEX_Entry>
<b:Tag>raey</b:Tag>
<b:LCID>0</b:LCID>
<b:Title>Agile Entwicklung Web-basierter Systeme</b:Title>
<b:Year>2002</b:Year>
<b:Author/>
<b:Pages>237-248</b:Pages>
<b:Volume>44</b:Volume>
<b:StandardNumber> ISSN: 0937-6429 DOI: 10.1000/182</b:StandardNumber>
<b:BIBTEX_Entry>inbook</b:BIBTEX_Entry>
<b:SourceType>BookSection</b:SourceType>
<b:Title>Agile Entwicklung Web-basierter Systeme</b:Title>
<b:Tag>raey</b:Tag>
<b:Publisher>Gabler Verlag</b:Publisher>
<b:JournalName>Wirtschaftsinformatik</b:JournalName>
<b:DOI>10.1000/182</b:DOI>
<b:URL>http://dx.doi.org/10.1007/BF03250842</b:URL>
<b:BIBTEX_KeyWords>software development processes; agile software development environments; time-to-market; Extreme Programming; Crystal methods family; Adaptive Software Development</b:BIBTEX_KeyWords>
<b:DOI>10.1000/182</b:DOI>
<b:Author/>
<b:Pages>237-248</b:Pages>
<b:JournalName>Wirtschaftsinformatik</b:JournalName>
<b:StandardNumber> ISSN: 0937-6429</b:StandardNumber>
</b:Source>
</b:Sources>
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ @article{Orlowski;2011
doi = {10.13140/2.1.3259.2169},
journaltitle = {Information Systems Architecture and Technology: Service Oriented Networked Systems},
}

@Comment{jabref-meta: databaseType:biblatex;}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@
</b:Author>
<b:Pages>99-108</b:Pages>
<b:JournalName>Information Systems Architecture and Technology: Service Oriented Networked Systems</b:JournalName>
<b:StandardNumber> DOI: 10.13140/2.1.3259.2169</b:StandardNumber>
</b:Source>
</b:Sources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
% Encoding: UTF-8
@Article{,
series = {ser},
msbib-abbreviatedcasenumber = {abb},
msbib-accessed = {July 3, 2010},
msbib-broadcaster = {broad},
msbib-casenumber = {case},
msbib-court = {court},
msbib-distributor = {dist},
msbib-medium = {med},
msbib-numberofvolume = {10},
msbib-periodical = {Besondere Turingmaschinen},
msbib-productioncompany = {produktion},
msbib-recordingnumber = {record},
msbib-reporter = {rep},
msbib-station = {stat},
msbib-theater = {th},
msbib-type = {type},
price = {10},
school = {Gymnasium Unterrieden},
size = {1000},
}

@Comment{jabref-meta: databaseType:bibtex;}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<b:Sources xmlns:b="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" xmlns="http://schemas.openxmlformats.org/officeDocument/2006/bibliography" SelectedStyle="">
<b:Source>
<b:BIBTEX_Price>10</b:BIBTEX_Price>
<b:BIBTEX_Series>ser</b:BIBTEX_Series>
<b:BIBTEX_Entry>article</b:BIBTEX_Entry>
<b:SourceType>JournalArticle</b:SourceType>
<b:Reporter>rep</b:Reporter>
<b:Accessed>July 3, 2010</b:Accessed>
<b:Court>court</b:Court>
<b:RecordingNumber>record</b:RecordingNumber>
<b:Station>stat</b:Station>
<b:Theater>th</b:Theater>
<b:PeriodicalTitle>Besondere Turingmaschinen</b:PeriodicalTitle>
<b:Type>type</b:Type>
<b:Department>Gymnasium Unterrieden</b:Department>
<b:Distributor>dist</b:Distributor>
<b:Medium>med</b:Medium>
<b:ProductionCompany>produktion</b:ProductionCompany>
<b:CaseNumber>case</b:CaseNumber>
<b:Broadcaster>broad</b:Broadcaster>
<b:NumberVolumes>10</b:NumberVolumes>
<b:AbbreviatedCaseNumber>abb</b:AbbreviatedCaseNumber>
<b:BIBTEX_Size>1000</b:BIBTEX_Size>
<b:Author/>
</b:Source>
</b:Sources>

This file was deleted.

This file was deleted.

Loading

0 comments on commit d37ed2a

Please sign in to comment.