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 #410 from it-at-m/review-pr-397-kopfdaten-lesen-39…
…9-wahlbezirke-laden Review pr 397 kopfdaten lesen 399 wahlbezirke laden
- Loading branch information
Showing
31 changed files
with
215 additions
and
469 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
4 changes: 2 additions & 2 deletions
4
...enchen/oss/wahllokalsystem/basisdatenservice/clients/KonfigurierterWahltagClientImpl.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
16 changes: 6 additions & 10 deletions
16
...chen/oss/wahllokalsystem/basisdatenservice/clients/KonfigurierterWahltagClientMapper.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,24 +1,20 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients; | ||
|
||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.infomanagement.model.KonfigurierterWahltagDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.infomanagement.model.KonfigurierterWahltagDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.kopfdaten.KonfigurierterWahltagModel; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.Named; | ||
|
||
@Mapper | ||
public interface KonfigurierterWahltagClientMapper { | ||
|
||
@Mapping(target = "active", source = "wahltagStatus", qualifiedByName = "mapWahltagStatusEnumStringToModelBoolean") | ||
@Mapping(target = "active", source = "wahltagStatus") | ||
KonfigurierterWahltagModel fromRemoteClientDTOToModel(KonfigurierterWahltagDTO konfigurierterWahltagDTO); | ||
|
||
@Named("mapWahltagStatusEnumStringToModelBoolean") | ||
default boolean mapWahltagStatusEnumStringToModelBoolean(KonfigurierterWahltagDTO.WahltagStatusEnum wahltagStatus) { | ||
if (wahltagStatus.equals(KonfigurierterWahltagDTO.WahltagStatusEnum.AKTIV)) { | ||
return true; | ||
} else if (wahltagStatus.equals(KonfigurierterWahltagDTO.WahltagStatusEnum.INAKTIV)) { | ||
return false; | ||
} | ||
return false; | ||
return switch (wahltagStatus) { | ||
case AKTIV -> true; | ||
case INAKTIV -> false; | ||
}; | ||
} | ||
} |
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
15 changes: 1 addition & 14 deletions
15
...java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahldatenClientMapper.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,24 +1,11 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients; | ||
|
||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.BasisdatenDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahlDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahlbezirkDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.kopfdaten.BasisdatenModel; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlbezirke.WahlbezirkModel; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlen.WahlModel; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
@Mapper | ||
@Mapper(uses = { WahlbezirkeClientMapper.class, WahlenClientMapper.class }) | ||
public interface WahldatenClientMapper { | ||
|
||
BasisdatenModel fromRemoteClientDTOToModel(BasisdatenDTO basisdatenDTO); | ||
|
||
default WahlModel wahlDTOToWahlModel(WahlDTO wahlDTO) { | ||
return Mappers.getMapper(WahlenClientMapper.class).toModel(wahlDTO); | ||
} | ||
|
||
default WahlbezirkModel walbezirkDTOToWahlbezirkModel(WahlbezirkDTO wahlbezirkDTO) { | ||
return Mappers.getMapper(WahlbezirkeClientMapper.class).fromClientDTOToModel(wahlbezirkDTO); | ||
} | ||
} |
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: 3 additions & 4 deletions
7
...de/muenchen/oss/wahllokalsystem/basisdatenservice/services/kopfdaten/WahldatenClient.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,19 +1,18 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.kopfdaten; | ||
|
||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlen.WahltagWithNummer; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.WlsException; | ||
import java.time.LocalDate; | ||
|
||
public interface WahldatenClient { | ||
|
||
/** | ||
* @param forDate the date of the election | ||
* @param withNummer the number of the "Wahltermin" same with number of the "Wahltag" | ||
* @param wahltagWithNummer filter for requested Basisdaten | ||
* @return BasisdatenDTO | ||
* @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 | ||
*/ | ||
BasisdatenModel loadBasisdaten(LocalDate forDate, String withNummer) throws WlsException; | ||
BasisdatenModel loadBasisdaten(WahltagWithNummer wahltagWithNummer) throws WlsException; | ||
} |
33 changes: 2 additions & 31 deletions
33
...hen/oss/wahllokalsystem/basisdatenservice/services/wahlbezirke/WahlbezirkModelMapper.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,45 +1,16 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlbezirke; | ||
|
||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.Wahlbezirk; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahlbezirkDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.exception.ExceptionConstants; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlen.WahlModel; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.util.ExceptionFactory; | ||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.Set; | ||
import org.mapstruct.CollectionMappingStrategy; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
@Mapper(collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED) | ||
public interface WahlbezirkModelMapper { | ||
|
||
@Mapping(source = "identifikator", target = "wahlbezirkID") | ||
@Mapping(source = "wahlbezirkArt", target = "wahlbezirkart") | ||
Wahlbezirk fromDTOtoEntity(WahlbezirkDTO dto); | ||
|
||
List<Wahlbezirk> fromListOfWahlbezirkModeltoListOfWahlbezirkEntities(List<WahlbezirkModel> wahlbezirkModelList); | ||
Collection<Wahlbezirk> fromListOfWahlbezirkModeltoListOfWahlbezirkEntities(Collection<WahlbezirkModel> wahlbezirkModelList); | ||
|
||
List<WahlbezirkModel> fromListOfWahlbezirkEntityToListOfWahlbezirkModel(List<Wahlbezirk> wahlbezirkEntityList); | ||
|
||
default List<WahlbezirkModel> toWahlbezirkModelListMergedWithWahlenInfo(Set<WahlbezirkModel> remoteWahlbezirke, List<WahlModel> wahlen, | ||
ExceptionFactory exceptionFactory) { | ||
if (remoteWahlbezirke == null) { | ||
throw exceptionFactory.createFachlicheWlsException(ExceptionConstants.GETWAHLBEZIRKE_NO_DATA); | ||
} | ||
List<Wahlbezirk> list = new ArrayList<>(); | ||
List<Wahlbezirk> remoteList = this.fromListOfWahlbezirkModeltoListOfWahlbezirkEntities(remoteWahlbezirke.stream().toList()); | ||
remoteList.forEach(wahlbezirk -> { | ||
if (null != wahlen) { | ||
WahlModel searchedWahl = wahlen.stream().filter(wahl -> wahlbezirk.getWahlnummer().equals(wahl.nummer())).findFirst().orElse(null); | ||
if (null != searchedWahl) { | ||
wahlbezirk.setWahlID(searchedWahl.wahlID()); | ||
} | ||
} | ||
list.add(wahlbezirk); | ||
}); | ||
return this.fromListOfWahlbezirkEntityToListOfWahlbezirkModel(list); | ||
} | ||
|
||
} |
Oops, something went wrong.