From 45b4fe5a1fad44497435c1e736585d38bd8db513 Mon Sep 17 00:00:00 2001 From: EryneKL <97091460+EryneKL@users.noreply.github.com> Date: Fri, 8 Dec 2023 14:37:22 +0100 Subject: [PATCH] FEAT : CDE-310 ajouter logs dans retour du ws best ppn : - renommage de la classe PpnWithLogsDto.java en PpnWithErrorsDto.java --- src/main/java/fr/abes/bestppn/dto/PpnDto.java | 11 +++++++-- .../fr/abes/bestppn/dto/PpnWithErrorsDto.java | 23 +++++++++++++++++++ .../fr/abes/bestppn/dto/PpnWithLogsDto.java | 16 ------------- .../dto/kafka/PpnWithDestinationDto.java | 16 +++++++++---- .../bestppn/dto/wscall/PpnWithTypeDto.java | 16 ++++++------- 5 files changed, 51 insertions(+), 31 deletions(-) create mode 100644 src/main/java/fr/abes/bestppn/dto/PpnWithErrorsDto.java delete mode 100644 src/main/java/fr/abes/bestppn/dto/PpnWithLogsDto.java diff --git a/src/main/java/fr/abes/bestppn/dto/PpnDto.java b/src/main/java/fr/abes/bestppn/dto/PpnDto.java index 0273e7d..860d744 100644 --- a/src/main/java/fr/abes/bestppn/dto/PpnDto.java +++ b/src/main/java/fr/abes/bestppn/dto/PpnDto.java @@ -1,10 +1,12 @@ package fr.abes.bestppn.dto; import fr.abes.bestppn.utils.TYPE_SUPPORT; -import lombok.Data; +import lombok.Getter; +import lombok.Setter; import lombok.NoArgsConstructor; -@Data +@Getter +@Setter @NoArgsConstructor public abstract class PpnDto { @@ -12,4 +14,9 @@ public abstract class PpnDto { private TYPE_SUPPORT typeSupport; + public PpnDto(String ppn, TYPE_SUPPORT typeSupport) { + this.ppn = ppn; + this.typeSupport = typeSupport; + } + } diff --git a/src/main/java/fr/abes/bestppn/dto/PpnWithErrorsDto.java b/src/main/java/fr/abes/bestppn/dto/PpnWithErrorsDto.java new file mode 100644 index 0000000..b556651 --- /dev/null +++ b/src/main/java/fr/abes/bestppn/dto/PpnWithErrorsDto.java @@ -0,0 +1,23 @@ +package fr.abes.bestppn.dto; + +import fr.abes.bestppn.utils.TYPE_SUPPORT; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +@Getter +@Setter +public class PpnWithErrorsDto extends PpnDto { + + private List errors; + + public PpnWithErrorsDto(String ppn, TYPE_SUPPORT typeSupport, List errors){ + super(ppn, typeSupport); + this.errors = errors; + } + + public void addError(String error) { + this.errors.add(error); + } +} diff --git a/src/main/java/fr/abes/bestppn/dto/PpnWithLogsDto.java b/src/main/java/fr/abes/bestppn/dto/PpnWithLogsDto.java deleted file mode 100644 index 86b9f29..0000000 --- a/src/main/java/fr/abes/bestppn/dto/PpnWithLogsDto.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.abes.bestppn.dto; - -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -@Data -public class PpnWithLogsDto extends PpnDto { - - private List logs; - - public PpnWithLogsDto(){ - - } -} diff --git a/src/main/java/fr/abes/bestppn/dto/kafka/PpnWithDestinationDto.java b/src/main/java/fr/abes/bestppn/dto/kafka/PpnWithDestinationDto.java index dcde83c..963a836 100644 --- a/src/main/java/fr/abes/bestppn/dto/kafka/PpnWithDestinationDto.java +++ b/src/main/java/fr/abes/bestppn/dto/kafka/PpnWithDestinationDto.java @@ -1,12 +1,20 @@ package fr.abes.bestppn.dto.kafka; +import fr.abes.bestppn.dto.PpnDto; import fr.abes.bestppn.utils.DESTINATION_TOPIC; +import fr.abes.bestppn.utils.TYPE_SUPPORT; import lombok.AllArgsConstructor; -import lombok.Data; +import lombok.Getter; +import lombok.Setter; -@Data +@Getter +@Setter @AllArgsConstructor -public class PpnWithDestinationDto { - private String ppn; +public class PpnWithDestinationDto extends PpnDto { private DESTINATION_TOPIC destination; + + public PpnWithDestinationDto(String ppn, TYPE_SUPPORT typeSupport, DESTINATION_TOPIC destination) { + super(ppn, typeSupport); + this.destination = destination; + } } diff --git a/src/main/java/fr/abes/bestppn/dto/wscall/PpnWithTypeDto.java b/src/main/java/fr/abes/bestppn/dto/wscall/PpnWithTypeDto.java index 4858c0f..4709968 100644 --- a/src/main/java/fr/abes/bestppn/dto/wscall/PpnWithTypeDto.java +++ b/src/main/java/fr/abes/bestppn/dto/wscall/PpnWithTypeDto.java @@ -3,32 +3,30 @@ import fr.abes.bestppn.dto.PpnDto; import fr.abes.bestppn.utils.TYPE_DOCUMENT; import fr.abes.bestppn.utils.TYPE_SUPPORT; -import lombok.Data; +import lombok.Getter; +import lombok.Setter; import lombok.NoArgsConstructor; -@Data +@Getter +@Setter @NoArgsConstructor public class PpnWithTypeDto extends PpnDto { - private String ppn; - private TYPE_SUPPORT typeSupport; private TYPE_DOCUMENT typeDocument; private Boolean providerPresent = false; public PpnWithTypeDto(String ppn, TYPE_SUPPORT typeSupport, TYPE_DOCUMENT typeDocument) { - this.ppn = ppn; - this.typeSupport = typeSupport; + super(ppn, typeSupport); this.typeDocument = typeDocument; } public PpnWithTypeDto(String ppn, TYPE_SUPPORT typeSupport) { - this.ppn = ppn; - this.typeSupport = typeSupport; + super(ppn, typeSupport); } public PpnWithTypeDto(String ppn) { - this.ppn = ppn; + super.setPpn(ppn); } public boolean isProviderPresent() {