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 #621 from it-at-m/189-lesen-und-schreiben-des-stat…
…us-inklusive-update-an-monitoring-service 189 lesen und schreiben des status inklusive update an monitoring service
- Loading branch information
Showing
53 changed files
with
2,710 additions
and
26 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
46 changes: 46 additions & 0 deletions
46
stack/keycloak/migration/add-authorities-ergebnismeldung-status.yml
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,46 @@ | ||
id: add authorities ergebnismeldung status | ||
author: MrSebastian | ||
realm: ${SSO_REALM} | ||
changes: | ||
- addRole: | ||
name: Ergebnismeldung_BUSINESSACTION_GetStatus | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allErgebnismeldungAuthorities | ||
role: Ergebnismeldung_BUSINESSACTION_GetStatus | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Ergebnismeldung_BUSINESSACTION_PostStatus | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allErgebnismeldungAuthorities | ||
role: Ergebnismeldung_BUSINESSACTION_PostStatus | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Ergebnismeldung_READ_Status | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allErgebnismeldungAuthorities | ||
role: Ergebnismeldung_READ_Status | ||
clientId: ${SSO_CLIENT_ID} | ||
- addRole: | ||
name: Ergebnismeldung_WRITE_Status | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allErgebnismeldungAuthorities | ||
role: Ergebnismeldung_WRITE_Status | ||
clientId: ${SSO_CLIENT_ID} | ||
- addRole: | ||
name: Ergebnismeldung_DELETE_Status | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allErgebnismeldungAuthorities | ||
role: Ergebnismeldung_DELETE_Status | ||
clientId: ${SSO_CLIENT_ID} |
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
62 changes: 62 additions & 0 deletions
62
.../java/de/muenchen/oss/wahllokalsystem/ergebnismeldungservice/client/MonitoringClient.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,62 @@ | ||
package de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.client; | ||
|
||
import de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.configuration.Profiles; | ||
import de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.eai.monitoring.client.WahllokalZustandControllerApi; | ||
import de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.exception.ExceptionConstants; | ||
import de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.service.status.sender.StatusClient; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.WlsException; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.util.ExceptionFactory; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID; | ||
import java.time.LocalDateTime; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import lombok.val; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Profile(Profiles.NOT + Profiles.DUMMY_CLIENTS) | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class MonitoringClient implements StatusClient { | ||
|
||
private final WahllokalZustandControllerApi wahllokalZustandControllerApi; | ||
private final StatusClientMapper statusClientMapper; | ||
private final ExceptionFactory exceptionFactory; | ||
|
||
@Override | ||
public void postSchnellmeldungSendungsuhrzeit(BezirkUndWahlID bezirkUndWahlID, LocalDateTime schnellmeldungSendungsuhrzeit) | ||
throws WlsException { | ||
val schnellmeldungGesendet = statusClientMapper.toSendungsdatenDTO(bezirkUndWahlID, schnellmeldungSendungsuhrzeit); | ||
callApiWithExceptionMapping(() -> wahllokalZustandControllerApi.postSchnellmeldungSendungsuhrzeit(schnellmeldungGesendet)); | ||
} | ||
|
||
@Override | ||
public void postSchnellmeldungDruckuhrzeit(BezirkUndWahlID bezirkUndWahlID, LocalDateTime schnellmeldungDruckuhrzeit) throws WlsException { | ||
val schellmeldungGedruckt = statusClientMapper.toDruckdatenDTO(bezirkUndWahlID, schnellmeldungDruckuhrzeit); | ||
callApiWithExceptionMapping(() -> wahllokalZustandControllerApi.postSchnellmeldungDruckuhrzeit(schellmeldungGedruckt)); | ||
} | ||
|
||
@Override | ||
public void postNiederschriftSendungsuhrzeit(BezirkUndWahlID bezirkUndWahlID, LocalDateTime niederschriftSendungsuhrzeit) throws WlsException { | ||
val niederschriftGesendet = statusClientMapper.toSendungsdatenDTO(bezirkUndWahlID, niederschriftSendungsuhrzeit); | ||
callApiWithExceptionMapping(() -> wahllokalZustandControllerApi.postNiederschriftSendungsuhrzeit(niederschriftGesendet)); | ||
} | ||
|
||
@Override | ||
public void postNiederschriftDruckuhrzeit(BezirkUndWahlID bezirkUndWahlID, LocalDateTime niederschriftDruckuhrzeit) throws WlsException { | ||
val niederschriftGedruckt = statusClientMapper.toDruckdatenDTO(bezirkUndWahlID, niederschriftDruckuhrzeit); | ||
callApiWithExceptionMapping(() -> wahllokalZustandControllerApi.postNiederschriftDruckuhrzeit(niederschriftGedruckt)); | ||
} | ||
|
||
private void callApiWithExceptionMapping(final Runnable apiCall) { | ||
try { | ||
apiCall.run(); | ||
} catch (final WlsException wlsException) { | ||
log.debug("found WlsException: {}", wlsException.getMessage()); | ||
throw wlsException; | ||
} catch (final Exception exception) { | ||
throw exceptionFactory.createTechnischeWlsException(ExceptionConstants.KOMMUNIKATIONSFEHLER_MIT_MONITORING); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...ava/de/muenchen/oss/wahllokalsystem/ergebnismeldungservice/client/StatusClientMapper.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,18 @@ | ||
package de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.client; | ||
|
||
import de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.eai.monitoring.model.DruckdatenDTO; | ||
import de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.eai.monitoring.model.SendungsdatenDTO; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID; | ||
import java.time.LocalDateTime; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
@Mapper | ||
public interface StatusClientMapper { | ||
|
||
@Mapping(target = "druckuhrzeit", source = "dateTimeOfEvent") | ||
DruckdatenDTO toDruckdatenDTO(BezirkUndWahlID bezirkUndWahlID, LocalDateTime dateTimeOfEvent); | ||
|
||
@Mapping(target = "sendungsuhrzeit", source = "dateTimeOfEvent") | ||
SendungsdatenDTO toSendungsdatenDTO(BezirkUndWahlID bezirkUndWahlID, LocalDateTime dateTimeOfEvent); | ||
} |
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
24 changes: 24 additions & 0 deletions
24
...in/java/de/muenchen/oss/wahllokalsystem/ergebnismeldungservice/domain/status/Meldung.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,24 @@ | ||
package de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.domain.status; | ||
|
||
import jakarta.persistence.Embeddable; | ||
import jakarta.persistence.EnumType; | ||
import jakarta.persistence.Enumerated; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.time.LocalDateTime; | ||
import lombok.Data; | ||
|
||
@Embeddable | ||
@Data | ||
public class Meldung { | ||
|
||
@Enumerated(EnumType.STRING) | ||
@NotNull | ||
private Validierungsstatus validierungsstatus; | ||
|
||
@NotNull | ||
private boolean gedruckt; | ||
|
||
private Boolean uebermittelt; | ||
|
||
private LocalDateTime sendeuhrzeit; | ||
} |
47 changes: 47 additions & 0 deletions
47
...ain/java/de/muenchen/oss/wahllokalsystem/ergebnismeldungservice/domain/status/Status.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,47 @@ | ||
package de.muenchen.oss.wahllokalsystem.ergebnismeldungservice.domain.status; | ||
|
||
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID; | ||
import jakarta.persistence.AttributeOverride; | ||
import jakarta.persistence.AttributeOverrides; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Embedded; | ||
import jakarta.persistence.EmbeddedId; | ||
import jakarta.persistence.Entity; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Data | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Status { | ||
|
||
@EmbeddedId | ||
private BezirkUndWahlID bezirkUndWahlID; | ||
|
||
@Embedded | ||
@NotNull | ||
@AttributeOverrides( | ||
{ | ||
@AttributeOverride(name = "validierungsstatus", column = @Column(name = "schnellmeldungValidierungsstatus")), | ||
@AttributeOverride(name = "gedruckt", column = @Column(name = "schnellmeldungGedruckt")), | ||
@AttributeOverride(name = "uebermittelt", column = @Column(name = "schnellmeldungUebermittelt")), | ||
@AttributeOverride(name = "sendeuhrzeit", column = @Column(name = "schnellmeldungSendeuhrzeit")), | ||
} | ||
) | ||
private Meldung schnellmeldung; | ||
|
||
@Embedded | ||
@NotNull | ||
@AttributeOverrides( | ||
{ | ||
@AttributeOverride(name = "validierungsstatus", column = @Column(name = "niederschriftValidierungsstatus")), | ||
@AttributeOverride(name = "gedruckt", column = @Column(name = "niederschriftGedruckt")), | ||
@AttributeOverride(name = "uebermittelt", column = @Column(name = "niederschriftUebermittelt")), | ||
@AttributeOverride(name = "sendeuhrzeit", column = @Column(name = "niederschriftSendeuhrzeit")), | ||
} | ||
) | ||
private Meldung niederschrift; | ||
} |
Oops, something went wrong.