generated from it-at-m/oss-repository-en-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #250 from it-at-m/159-implementierung-urnenwahlvor…
…bereitung-service-post-impl 159 implementierung urnenwahlvorbereitung service post impl
- Loading branch information
Showing
22 changed files
with
545 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
...uenchen/oss/wahllokalsystem/wahlvorbereitungservice/exception/GlobalExceptionHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package de.muenchen.oss.wahllokalsystem.wahlvorbereitungservice.exception; | ||
|
||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.errorhandler.AbstractExceptionHandler; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.rest.model.DTOMapper; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.rest.model.WlsExceptionDTO; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.util.ServiceIDFormatter; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.ControllerAdvice; | ||
import org.springframework.web.bind.annotation.ExceptionHandler; | ||
|
||
@ControllerAdvice | ||
@Slf4j | ||
public class GlobalExceptionHandler extends AbstractExceptionHandler { | ||
|
||
private final ServiceIDFormatter serviceIDFormatter; | ||
|
||
public GlobalExceptionHandler(final ServiceIDFormatter serviceIDFormatter, final DTOMapper dtoMapper) { | ||
super(dtoMapper); | ||
this.serviceIDFormatter = serviceIDFormatter; | ||
} | ||
|
||
@ExceptionHandler | ||
public ResponseEntity<WlsExceptionDTO> handleThrowables(final Throwable throwable) { | ||
log.info("handling throwable", throwable); | ||
return createResponse(getWahlExceptionDTO(throwable)); | ||
} | ||
|
||
@Override | ||
protected String getService() { | ||
return serviceIDFormatter.getId(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...tem/wahlvorbereitungservice/rest/urnenwahlvorbereitung/UrnenwahlvorbereitungWriteDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package de.muenchen.oss.wahllokalsystem.wahlvorbereitungservice.rest.urnenwahlvorbereitung; | ||
|
||
import de.muenchen.oss.wahllokalsystem.wahlvorbereitungservice.rest.common.WahlurneDTO; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import jakarta.validation.constraints.Size; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record UrnenwahlvorbereitungWriteDTO(@Schema(requiredMode = Schema.RequiredMode.REQUIRED) long anzahlWahlkabinen, | ||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) long anzahlWahltische, | ||
@Schema(requiredMode = Schema.RequiredMode.REQUIRED) long anzahlNebenraeume, | ||
@NotNull @Size(min = 1) List<WahlurneDTO> urnenAnzahl) { | ||
|
||
public UrnenwahlvorbereitungWriteDTO(final long anzahlWahlkabinen, final long anzahlWahltische, final long anzahlNebenraeume, | ||
final List<WahlurneDTO> urnenAnzahl) { | ||
this.anzahlWahlkabinen = anzahlWahlkabinen; | ||
this.anzahlWahltische = anzahlWahltische; | ||
this.anzahlNebenraeume = anzahlNebenraeume; | ||
this.urnenAnzahl = Objects.requireNonNullElseGet(urnenAnzahl, ArrayList::new); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.