Skip to content

Commit

Permalink
Merge pull request #38 from abes-esr/develop
Browse files Browse the repository at this point in the history
merge develop dans main
  • Loading branch information
EryneKL authored Feb 21, 2024
2 parents b3ae883 + ef0ba65 commit 3c16a26
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
24 changes: 14 additions & 10 deletions src/main/java/fr/abes/kafkatosudoc/utils/NoticeMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,21 +78,24 @@ public NoticeConcrete convert(MappingContext<LigneKbartConnect, NoticeConcrete>
noticeBiblio.addSousZone("183", "$a", "ceb");
//Titre

noticeBiblio.addZone("200", "$a", "@" + kbart.getPUBLICATIONTITLE(), new char[]{'1', '#'});
noticeBiblio.addZone("200", "$a", kbart.getPUBLICATIONTITLE().toString(), new char[]{'1', '#'});
if (!kbart.getFIRSTAUTHOR().isEmpty())
noticeBiblio.addSousZone("200", "$f", kbart.getFIRSTAUTHOR().toString());
//Mention de publication / diffusion
noticeBiblio.addZone("214", "$a", "[Lieu de publication inconnu]", new char[]{'#', '0'});
Zone zone214diese0 = new Zone("214", TYPE_NOTICE.BIBLIOGRAPHIQUE, new char[]{'#', '0'});
zone214diese0.addSubLabel("$a", "[Lieu de publication inconnu]");
if (kbart.getPUBLISHERNAME() != null)
noticeBiblio.addSousZone("214", "$c", kbart.getPUBLISHERNAME().toString());
zone214diese0.addSubLabel( "$c", kbart.getPUBLISHERNAME().toString());
noticeBiblio.addZone(zone214diese0);


noticeBiblio.addZone("214", "$a", "[Lieu de diffusion inconnu]", new char[]{'#', '2'});
Zone zone214diese2 = new Zone("214", TYPE_NOTICE.BIBLIOGRAPHIQUE, new char[]{'#', '2'});
zone214diese2.addSubLabel("$a", "[Lieu de diffusion inconnu]");
if (kbart.getDATEMONOGRAPHPUBLISHEDONLIN() != null && !kbart.getDATEMONOGRAPHPUBLISHEDONLIN().toString().isEmpty()) {
noticeBiblio.addSousZone("214", "$d", Utils.getYearFromDate(kbart.getDATEMONOGRAPHPUBLISHEDONLIN().toString()), 1);
zone214diese2.addSubLabel( "$d", Utils.getYearFromDate(kbart.getDATEMONOGRAPHPUBLISHEDONLIN().toString()));
} else {
noticeBiblio.addSousZone("214", "$d", "[20..]");
zone214diese2.addSubLabel( "$d", "[20..]");
}
noticeBiblio.addZone(zone214diese2);
noticeBiblio.addZone("309", "$a", "Notice générée automatiquement à partir des métadonnées de BACON. SUPPRIMER LA PRESENTE NOTE 309 APRES MISE A JOUR");

//Note sur les conditions d'accès
Expand Down Expand Up @@ -153,7 +156,7 @@ public NoticeConcrete convert(MappingContext<KbartAndImprimeDto, NoticeConcrete>

//DOI
String doi = Utils.extractDoiFromImprime(kbart);
if (!doi.equals("")) {
if (!doi.isEmpty()) {
noticeElec.addZone("017", "$a", doi, new char[]{'7', '0'});
noticeElec.addSousZone("017", "$2", "DOI");
}
Expand All @@ -165,7 +168,8 @@ public NoticeConcrete convert(MappingContext<KbartAndImprimeDto, NoticeConcrete>
noticeElec.addZone("100", "$a", "20XX");

//langue de publication
noticeElec.addZone("101", "$a", noticeImprimee.getNoticeBiblio().findZone("101", 0).findSubLabel("$a"), new char[]{'0', '#'});
Zone zone101 = noticeImprimee.getNoticeBiblio().findZone("101", 0);
noticeElec.addZone(zone101);
//Pays de publication
noticeElec.addZone("102", "$a", "XX");
//Données générales de traitement
Expand Down Expand Up @@ -234,7 +238,7 @@ public NoticeConcrete convert(MappingContext<KbartAndImprimeDto, NoticeConcrete>

Zone zone214 = new Zone("214", TYPE_NOTICE.BIBLIOGRAPHIQUE, new char[]{'#', '2'});
zone214.addSubLabel("$a", "[Lieu de diffusion inconnu]");
if (kbart.getDateMonographPublishedOnline() != null) {
if (kbart.getDateMonographPublishedOnline() != null && !kbart.getDateMonographPublishedOnline().isEmpty()) {
zone214.addSubLabel("$d", kbart.getDateMonographPublishedOnline().toString());
} else {
zone214.addSubLabel("$d", "[20..]");
Expand Down
11 changes: 9 additions & 2 deletions src/test/java/fr/abes/kafkatosudoc/utils/NoticeMapperTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import fr.abes.cbs.exception.ZoneException;
import fr.abes.cbs.notices.Biblio;
import fr.abes.cbs.notices.NoticeConcrete;
import fr.abes.cbs.notices.TYPE_NOTICE;
import fr.abes.cbs.notices.Zone;
import fr.abes.kafkatosudoc.dto.KbartAndImprimeDto;
import org.assertj.core.util.Lists;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -62,7 +64,7 @@ void testMapperNoticeFromKbartCas1() {
Assertions.assertEquals("ceb", biblio.findZones("183").get(0).findSubLabel("$a"));

//controle titre
Assertions.assertEquals("@Test title", biblio.findZones("200").get(0).findSubLabel("$a"));
Assertions.assertEquals("Test title", biblio.findZones("200").get(0).findSubLabel("$a"));
Assertions.assertEquals('1', biblio.findZones("200").get(0).getIndicateurs()[0]);
Assertions.assertEquals('#', biblio.findZones("200").get(0).getIndicateurs()[1]);

Expand Down Expand Up @@ -174,6 +176,7 @@ void testMapperNoticeFromKbartAndImprimeMin() throws ZoneException {
Assertions.assertEquals("0-415-11262-8", biblio.findZone("010", 0).findSubLabel("$a"));
Assertions.assertEquals("20XX", biblio.findZone("100", 0).findSubLabel("$a"));
Assertions.assertEquals("fre", biblio.findZone("101", 0).findSubLabel("$a"));
Assertions.assertEquals("eng", biblio.findZone("101", 0).findSubLabel("$c"));
Assertions.assertEquals("XX", biblio.findZone("102", 0).findSubLabel("$a"));
Assertions.assertEquals("r", biblio.findZone("135", 0).findSubLabel("$b"));
Assertions.assertEquals("01", biblio.findZone("181", 0).findSubLabel("$P"));
Expand Down Expand Up @@ -458,7 +461,11 @@ private static KbartAndImprimeDto getKbartAndImprimeDto() throws ZoneException {

Biblio noticeImprimee = new Biblio();
noticeImprimee.addZone("100", "$a", "2019");
noticeImprimee.addZone("101", "$a", "fre");
Zone zone101 = new Zone("101", TYPE_NOTICE.BIBLIOGRAPHIQUE);
zone101.addSubLabel("$a", "fre");
zone101.addSubLabel("$a", "ger");
zone101.addSubLabel("$c", "eng");
noticeImprimee.addZone(zone101);
noticeImprimee.addZone("200", "$a", "Titre notice");
NoticeConcrete notice = new NoticeConcrete(noticeImprimee, null, Lists.newArrayList());

Expand Down

0 comments on commit 3c16a26

Please sign in to comment.