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 #407 from it-at-m/review-393-lesen-schreiben-wahlen
Verbesserungsvorschläge zu PR 393 Lesen und Schreiben von Wahlen
- Loading branch information
Showing
32 changed files
with
420 additions
and
205 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
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
30 changes: 5 additions & 25 deletions
30
...in/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahlenClientMapper.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 |
---|---|---|
@@ -1,41 +1,21 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients; | ||
|
||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.wahl.Farbe; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahlDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlen.WahlModel; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.utils.ObjectPropertyChecker; | ||
import java.util.List; | ||
import java.util.Set; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.Named; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
@Mapper | ||
@Mapper(imports = Farbe.class) | ||
public interface WahlenClientMapper { | ||
|
||
WahlenClientMapper INSTANCE = Mappers.getMapper(WahlenClientMapper.class); | ||
|
||
@Mapping(target = "waehlerverzeichnisnummer", source = ".", qualifiedByName = "setWZeroIfNotExisting") | ||
@Mapping(target = "reihenfolge", source = ".", qualifiedByName = "setRZeroIfNotExisting") | ||
@Mapping(target = "farbe", ignore = true) | ||
@Mapping(target = "waehlerverzeichnisnummer", constant = "1l") | ||
@Mapping(target = "reihenfolge", constant = "1l") | ||
@Mapping(target = "farbe", expression = "java(new Farbe(0, 0, 0))") | ||
@Mapping(target = "wahlID", source = "identifikator") | ||
WahlModel toModel(WahlDTO wahlDTO); | ||
|
||
@Named("setWZeroIfNotExisting") | ||
default Long setWZeroIfNotExisting(final WahlDTO wahlDTO) throws NoSuchFieldException, IllegalAccessException { | ||
if (ObjectPropertyChecker.objectHasProperty(wahlDTO, "waehlerverzeichnisnummer")) { | ||
ObjectPropertyChecker.getValueFromField(wahlDTO, "waehlerverzeichnisnummer"); | ||
} | ||
return 0L; | ||
} | ||
|
||
@Named("setRZeroIfNotExisting") | ||
default Long setRZeroIfNotExisting(final WahlDTO wahlDTO) throws NoSuchFieldException, IllegalAccessException { | ||
if (ObjectPropertyChecker.objectHasProperty(wahlDTO, "reihenfolge")) { | ||
ObjectPropertyChecker.getValueFromField(wahlDTO, "reihenfolge"); | ||
} | ||
return 0L; | ||
} | ||
|
||
List<WahlModel> fromRemoteClientSetOfWahlDTOtoListOfWahlModel(Set<WahlDTO> wahlDTO); | ||
} |
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
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
7 changes: 2 additions & 5 deletions
7
.../java/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahlen/WahlenClient.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 |
---|---|---|
@@ -1,21 +1,18 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlen; | ||
|
||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.WlsException; | ||
import java.time.LocalDate; | ||
import java.util.List; | ||
|
||
public interface WahlenClient { | ||
|
||
/** | ||
* @param wahltag The Request Wahltag - Reference for requested Wahlen | ||
* @param wahltagNummer The Number of the Wahltag, it could exist more then one Wahltag at same day | ||
* if more elections on the day | ||
* @param wahltagWithNummer reference to a specific event on a date of election | ||
* @return List<WahltagModel> | ||
* @throws WlsException | ||
* {@link de.muenchen.oss.wahllokalsystem.wls.common.exception.FachlicheWlsException} if | ||
* return would be null | ||
* {@link de.muenchen.oss.wahllokalsystem.wls.common.exception.TechnischeWlsException} | ||
* if there were trouble during communication | ||
*/ | ||
List<WahlModel> getWahlen(final LocalDate wahltag, final String wahltagNummer) throws WlsException; | ||
List<WahlModel> getWahlen(final WahltagWithNummer wahltagWithNummer) throws WlsException; | ||
} |
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
19 changes: 7 additions & 12 deletions
19
...va/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahlen/WahlenValidator.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
9 changes: 9 additions & 0 deletions
9
...a/de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahlen/WahlenWriteModel.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,9 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlen; | ||
|
||
import java.util.List; | ||
|
||
public record WahlenWriteModel( | ||
String wahltagID, | ||
List<WahlModel> wahlen | ||
) { | ||
} |
9 changes: 9 additions & 0 deletions
9
.../de/muenchen/oss/wahllokalsystem/basisdatenservice/services/wahlen/WahltagWithNummer.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,9 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlen; | ||
|
||
import jakarta.validation.constraints.NotNull; | ||
import java.time.LocalDate; | ||
|
||
public record WahltagWithNummer( | ||
@NotNull LocalDate wahltag, | ||
@NotNull String wahltagNummer) { | ||
} |
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.