Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge dev to test #87

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading