Skip to content

Commit

Permalink
FEAT : CDE-310 ajouter erreurs dans retour du ws best ppn :
Browse files Browse the repository at this point in the history
     - renommage des paramètres "error" en "log"
  • Loading branch information
EryneKL committed Dec 12, 2023
1 parent b27c39c commit cddcae5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public PpnControllerDto bestPpn(@RequestParam(name = "provider") String provider
@RequestParam(name = "print_identifier", required = false) String printIdentifier, @RequestParam(name = "titleUrl", required = false) String titleUrl,
@RequestParam(name = "date_monograph_published_online", required = false) String dateMonographPublishedOnline, @RequestParam(name = "date_monograph_published_print", required = false) String dateMonographPublishedPrint,
@RequestParam(name = "first_author", required = false) String firstAuthor, @RequestParam(name = "force", required = false) Boolean force,
@RequestParam(name = "errors", required = false) Boolean errors) throws IOException {
@RequestParam(name = "log", required = false) Boolean errors) throws IOException {
try {
LigneKbartDto ligneKbartDto = new LigneKbartDto();
ligneKbartDto.setPublicationType(publicationType);
Expand All @@ -58,7 +58,7 @@ public PpnControllerDto bestPpn(@RequestParam(name = "provider") String provider
boolean injectKafka = (force != null) ? force : false;
boolean sendErrors = (errors != null) ? errors : false;
PpnDto ppnDto = service.getBestPpn(ligneKbartDto, provider, injectKafka, sendErrors);
return new PpnControllerDto(ppnDto.getPpn(), ppnDto.getTypeSupport(), ppnDto.getError());
return new PpnControllerDto(ppnDto.getPpn(), ppnDto.getTypeSupport(), ppnDto.getLog());
} catch (URISyntaxException e) {
throw new IllegalArgumentException("Une url dans le champ title_url du kbart n'est pas correcte");
} catch (BestPpnException | RestClientException | IllegalArgumentException | IllegalDoiException e) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/fr/abes/bestppn/dto/PpnControllerDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ public class PpnControllerDto {

@Nullable
@JsonInclude(JsonInclude.Include.NON_NULL)
private String error;
private String log;

public PpnControllerDto (String ppn, TYPE_SUPPORT typeSupport, String error) {
public PpnControllerDto (String ppn, TYPE_SUPPORT typeSupport, String log) {
this.ppn = ppn;
this.typeSupport = typeSupport;
this.error = error;
this.log = log;
}

public PpnControllerDto (String error) {
this.error = error;
public PpnControllerDto (String log) {
this.log = log;
}
}
10 changes: 5 additions & 5 deletions src/main/java/fr/abes/bestppn/dto/kafka/PpnDto.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class PpnDto {
private DESTINATION_TOPIC destination;

@Nullable
private String error;
private String log;

public PpnDto (String ppn, DESTINATION_TOPIC destination) {
this.ppn = ppn;
Expand All @@ -35,16 +35,16 @@ public PpnDto (String ppn, DESTINATION_TOPIC destination, TYPE_SUPPORT typeSuppo
this.typeSupport = typeSupport;
}

public PpnDto (String ppn, DESTINATION_TOPIC destination, String error) {
public PpnDto (String ppn, DESTINATION_TOPIC destination, String log) {
this.ppn = ppn;
this.destination = destination;
this.error = error;
this.log = log;
}

public PpnDto (String ppn, DESTINATION_TOPIC destination, TYPE_SUPPORT typeSupport, String error) {
public PpnDto (String ppn, DESTINATION_TOPIC destination, TYPE_SUPPORT typeSupport, String log) {
this.ppn = ppn;
this.destination = destination;
this.typeSupport = typeSupport;
this.error = error;
this.log = log;
}
}

0 comments on commit cddcae5

Please sign in to comment.