Skip to content

Commit

Permalink
Merge pull request #466 from BIBSYSDEV/NP-48273-mapping-ffi-stuff
Browse files Browse the repository at this point in the history
Np 48273 mapping ffi stuff
  • Loading branch information
truhacevkir authored Jan 10, 2025
2 parents 7901c82 + f2f0d2b commit b94daa8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ public enum BrageType {
LITERARY_ARTS("Literary arts"),
POPULAR_SCIENCE_MONOGRAPH("Popular science monograph"),
EDITORIAL("Editorial"),
FILM("Film");
FILM("Film"),
VITEN("Viten"),
FAGARTIKKEL("Fagartikkel"),
EKSTERNNOTAT("Eksternnotat");

private static final String RAPPORT = "Rapport";
private static final String BOOK_CHAPTER = "Book chapter";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public enum NvaType {
EXHIBITION_CATALOGUE("Exhibition catalogue"),
LITERARY_ARTS("Literary arts"),
POPULAR_SCIENCE_MONOGRAPH("Popular science monograph"),
POPULAR_SCIENCE_ARTICLE("Popular science article"),
EDITORIAL("Editorial"),
CRISTIN_RECORD("CristinRecord");

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/no/sikt/nva/scrapers/TypeMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ public final class TypeMapper {
entry(Set.of(BrageType.JOURNAL_ARTICLE), NvaType.JOURNAL_ARTICLE),
entry(Set.of(BrageType.ARTICLE), NvaType.JOURNAL_ARTICLE),
entry(Set.of(BrageType.JOURNAL_ISSUE), NvaType.JOURNAL_ISSUE),
entry(Set.of(BrageType.VITEN), NvaType.JOURNAL_ISSUE),
entry(Set.of(BrageType.PROFESSIONAL_ARTICLE), NvaType.PROFESSIONAL_ARTICLE),
entry(Set.of(BrageType.DATASET), NvaType.DATASET),
entry(Set.of(BrageType.DATA_SET), NvaType.DATASET),
entry(Set.of(BrageType.OTHERS), NvaType.REPORT),
entry(Set.of(BrageType.OTHER), NvaType.REPORT),
entry(Set.of(BrageType.REPORT), NvaType.REPORT),
entry(Set.of(BrageType.NOTES), NvaType.REPORT),
entry(Set.of(BrageType.EKSTERNNOTAT), NvaType.REPORT),
entry(Set.of(BrageType.POSTER), NvaType.CONFERENCE_POSTER),
entry(Set.of(BrageType.NON_FICTION_CHAPTER), NvaType.CHAPTER),
entry(Set.of(BrageType.PRESENTATION), NvaType.LECTURE),
Expand Down Expand Up @@ -86,6 +88,7 @@ public final class TypeMapper {
entry(Set.of(BrageType.LITERARY_ARTS), NvaType.LITERARY_ARTS),
entry(Set.of(BrageType.EDITORIAL), NvaType.EDITORIAL),
entry(Set.of(BrageType.POPULAR_SCIENCE_MONOGRAPH), NvaType.POPULAR_SCIENCE_MONOGRAPH),
entry(Set.of(BrageType.FAGARTIKKEL), NvaType.POPULAR_SCIENCE_ARTICLE),
entry(Set.of(BrageType.FILM), NvaType.FILM));

public static String convertBrageTypeToNvaType(Set<String> inputTypes) {
Expand Down
21 changes: 21 additions & 0 deletions src/test/java/no/sikt/nva/scrapers/TypeMapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,25 @@ void shouldMapOriginalNvaTypeAndUnsupportedTypeToNvaType() {
var actualType = TypeMapper.convertBrageTypeToNvaType(Set.of("Article", "Journal article"));
assertThat(actualType, is(equalTo(expectedNvaType)));
}

@Test
void shouldMapVitenAsJournalIssue() {
var expectedNvaType = NvaType.JOURNAL_ISSUE.getValue();
var actualType = TypeMapper.convertBrageTypeToNvaType(Set.of("Viten"));
assertThat(actualType, is(equalTo(expectedNvaType)));
}

@Test
void shouldMapFagartikkelAsPopularScienceArticle() {
var expectedNvaType = NvaType.POPULAR_SCIENCE_ARTICLE.getValue();
var actualType = TypeMapper.convertBrageTypeToNvaType(Set.of("Fagartikkel"));
assertThat(actualType, is(equalTo(expectedNvaType)));
}

@Test
void shouldMapEksernnotatAsReport() {
var expectedNvaType = NvaType.REPORT.getValue();
var actualType = TypeMapper.convertBrageTypeToNvaType(Set.of("Eksternnotat"));
assertThat(actualType, is(equalTo(expectedNvaType)));
}
}

0 comments on commit b94daa8

Please sign in to comment.