Skip to content

Commit

Permalink
Merge pull request #87 from abes-esr/develop
Browse files Browse the repository at this point in the history
merge dev to test
  • Loading branch information
pierre-maraval authored May 15, 2024
2 parents 34123e5 + d9ca80b commit a5581f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>fr.abes</groupId>
<artifactId>sudoc</artifactId>
<version>0.0.10</version>
<version>0.0.11-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sudoc</name>
<description>webservices de récupération de ppns dans le sudoc</description>
Expand Down
17 changes: 4 additions & 13 deletions src/main/java/fr/abes/sudoc/service/NoticeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.*;

@Service
@Slf4j
Expand Down Expand Up @@ -49,29 +47,22 @@ public NoticeXml getNoticeByPpn(String ppn) throws IllegalPpnException, IOExcept

public List<String> getEquivalentElectronique(NoticeXml notice) throws IOException, IllegalPpnException {
log.debug("entrée dans getEquivalentElectronique");
List<String> ppnlies;

//on cherche une 452$0 dans la notice
List<String> ppn452 = notice.get4XXDollar0("452");
ppnlies = getNoticeElectroniqueLiee(ppn452);
if (ppnlies.size() > 0) return ppnlies;
Set<String> ppnlies = new HashSet<>(getNoticeElectroniqueLiee(ppn452));

//on cherche une 456$0 dans la notice
List<String> ppn456 = notice.get4XXDollar0("456");
ppnlies = getNoticeElectroniqueLiee(ppn456);
if (ppnlies.size() > 0) return ppnlies;
ppnlies.addAll(getNoticeElectroniqueLiee(ppn456));

//Si pas de résultat trouvé, on interroge la table biblio_table_frbr_4XX
ppnlies.addAll(this.biblioTableFrbr4XXRepository.findAllByTagAndDatas("452$0", notice.getPpn()).stream().map(BiblioTableFrbr4XX::getPpn).toList());
//on renvoie les ppn trouvés via la requête
if (ppnlies.size() > 0) return ppnlies;

ppnlies.addAll(this.biblioTableFrbr4XXRepository.findAllByTagAndDatas("455$0", notice.getPpn()).stream().map(BiblioTableFrbr4XX::getPpn).toList());
//on renvoie les ppn trouvés via la requête
if (ppnlies.size() > 0) return ppnlies;

//aucune des conditions n'a été respectée, on renvoie une liste vide
return new ArrayList<>();
return ppnlies.stream().toList();
}

public List<String> getNoticeElectroniqueLiee(List<String> ppn4XX) throws IllegalPpnException, IOException {
Expand Down

0 comments on commit a5581f5

Please sign in to comment.