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 #326 from it-at-m/144-implementierung-von-wahlvors…
…chläge-laden 144 implementierung von wahlvorschläge laden
- Loading branch information
Showing
47 changed files
with
2,029 additions
and
4 deletions.
There are no files selected for viewing
87 changes: 87 additions & 0 deletions
87
stack/keycloak/migration/add-authorities-basisdaten-wahlvorschlaege.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,87 @@ | ||
id: add authorities basisdaten wahlvorschlaege | ||
author: MrSebastian | ||
realm: ${SSO_REALM} | ||
changes: | ||
- addRole: | ||
name: Basisdaten_BUSINESSACTION_GetWahlvorschlaege | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_BUSINESSACTION_GetWahlvorschlaege | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_READ_WLSWahlvorschlaege | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_READ_WLSWahlvorschlaege | ||
clientId: ${SSO_CLIENT_ID} | ||
- addRole: | ||
name: Basisdaten_WRITE_WLSWahlvorschlaege | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_WRITE_WLSWahlvorschlaege | ||
clientId: ${SSO_CLIENT_ID} | ||
- addRole: | ||
name: Basisdaten_DELETE_WLSWahlvorschlaege | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_DELETE_WLSWahlvorschlaege | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_READ_Wahlvorschlag | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_READ_Wahlvorschlag | ||
clientId: ${SSO_CLIENT_ID} | ||
- addRole: | ||
name: Basisdaten_WRITE_Wahlvorschlag | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_WRITE_Wahlvorschlag | ||
clientId: ${SSO_CLIENT_ID} | ||
- addRole: | ||
name: Basisdaten_DELETE_Wahlvorschlag | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_DELETE_Wahlvorschlag | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_READ_Kandidat | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_READ_Kandidat | ||
clientId: ${SSO_CLIENT_ID} | ||
- addRole: | ||
name: Basisdaten_WRITE_Kandidat | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_WRITE_Kandidat | ||
clientId: ${SSO_CLIENT_ID} | ||
- addRole: | ||
name: Basisdaten_DELETE_Kandidat | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_DELETE_Kandidat | ||
clientId: ${SSO_CLIENT_ID} |
15 changes: 15 additions & 0 deletions
15
stack/keycloak/migration/create-group-all-basisdaten-authorities.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,15 @@ | ||
id: create group allBasisdatenAuthorities and link wls_all* | ||
author: MrSebastian | ||
realm: ${SSO_REALM} | ||
changes: | ||
- addGroup: | ||
name: allBasisdatenAuthorities | ||
- assignGroup: | ||
user: wls_all | ||
group: allBasisdatenAuthorities | ||
- assignGroup: | ||
user: wls_all_uwb | ||
group: allBasisdatenAuthorities | ||
- assignGroup: | ||
user: wls_all_bwb | ||
group: allBasisdatenAuthorities |
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
42 changes: 42 additions & 0 deletions
42
...e/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/ClientImpl.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,42 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients; | ||
|
||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.configuration.Profiles; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.client.WahlvorschlagControllerApi; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahlvorschlaegeDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.exception.ExceptionConstants; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlaegeClient; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlaegeModel; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.exception.util.ExceptionFactory; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Profile(Profiles.NOT + Profiles.DUMMY_CLIENTS) | ||
@RequiredArgsConstructor | ||
@Slf4j | ||
public class ClientImpl implements WahlvorschlaegeClient { | ||
|
||
private final ExceptionFactory exceptionFactory; | ||
|
||
private final WahlvorschlagControllerApi wahlvorschlagControllerApi; | ||
private final WahlvorschlaegeClientMapper wahlvorschlaegeClientMapper; | ||
|
||
@Override | ||
public WahlvorschlaegeModel getWahlvorschlaege(final BezirkUndWahlID bezirkUndWahlID) { | ||
final WahlvorschlaegeDTO wahlvorschlaege; | ||
try { | ||
wahlvorschlaege = wahlvorschlagControllerApi.loadWahlvorschlaege(bezirkUndWahlID.getWahlID(), bezirkUndWahlID.getWahlbezirkID()); | ||
} catch (final Exception exception) { | ||
log.info("exception on loadwahlvorschlaege from external", exception); | ||
throw exceptionFactory.createTechnischeWlsException(ExceptionConstants.FAILED_COMMUNICATION_WITH_EAI); | ||
} | ||
if (wahlvorschlaege == null) { | ||
throw exceptionFactory.createFachlicheWlsException(ExceptionConstants.NULL_FROM_CLIENT); | ||
} | ||
|
||
return wahlvorschlaegeClientMapper.toModel(wahlvorschlaege); | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
.../main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/clients/DummyClientImpl.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,28 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients; | ||
|
||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.configuration.Profiles; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.KandidatModel; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlaegeClient; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlaegeModel; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlagModel; | ||
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
import org.springframework.context.annotation.Profile; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
@Profile(Profiles.DUMMY_CLIENTS) | ||
public class DummyClientImpl implements WahlvorschlaegeClient { | ||
|
||
@Override | ||
public WahlvorschlaegeModel getWahlvorschlaege(BezirkUndWahlID bezirkUndWahlID) { | ||
return new WahlvorschlaegeModel(bezirkUndWahlID, "stimmzettelgebiedID", | ||
Set.of(new WahlvorschlagModel(UUID.randomUUID().toString(), 1L, "kurzname1", true, | ||
Set.of(new KandidatModel(UUID.randomUUID().toString(), "kandidat11", 1L, true, 1L, true), | ||
new KandidatModel(UUID.randomUUID().toString(), "kandidat21", 2L, false, 1L, false))), | ||
new WahlvorschlagModel(UUID.randomUUID().toString(), 2L, "kurzname2", true, | ||
Set.of(new KandidatModel(UUID.randomUUID().toString(), "kandidat21", 1L, true, 1L, true), | ||
new KandidatModel(UUID.randomUUID().toString(), "kandidat22", 2L, false, 1L, false))))); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...e/muenchen/oss/wahllokalsystem/basisdatenservice/clients/WahlvorschlaegeClientMapper.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,14 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.clients; | ||
|
||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.WahlvorschlaegeDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.wahlvorschlag.WahlvorschlaegeModel; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
|
||
@Mapper | ||
public interface WahlvorschlaegeClientMapper { | ||
|
||
@Mapping(target = "bezirkUndWahlID.wahlID", source = "wahlID") | ||
@Mapping(target = "bezirkUndWahlID.wahlbezirkID", source = "wahlbezirkID") | ||
WahlvorschlaegeModel toModel(WahlvorschlaegeDTO wahlvorschlaegeDTO); | ||
} |
12 changes: 12 additions & 0 deletions
12
...c/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/configuration/Profiles.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,12 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.configuration; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor(access = AccessLevel.PRIVATE) | ||
public class Profiles { | ||
|
||
public static final String NOT = "!"; | ||
|
||
public static final String DUMMY_CLIENTS = "dummy.clients"; | ||
} |
67 changes: 67 additions & 0 deletions
67
...vice/src/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/Kandidat.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,67 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain; | ||
|
||
import static java.sql.Types.VARCHAR; | ||
|
||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.util.UUID; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
import org.hibernate.annotations.JdbcTypeCode; | ||
import org.hibernate.annotations.NaturalId; | ||
import org.hibernate.annotations.UuidGenerator; | ||
|
||
@Entity | ||
@Getter | ||
@Setter | ||
@ToString(onlyExplicitlyIncluded = true) | ||
@EqualsAndHashCode | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Kandidat { | ||
|
||
@Id | ||
@GeneratedValue(generator = "uuid") | ||
@UuidGenerator | ||
@JdbcTypeCode(VARCHAR) | ||
private UUID id; | ||
|
||
@NaturalId | ||
@NotNull | ||
@ToString.Include | ||
private String identifikator; | ||
|
||
@ManyToOne | ||
@NotNull | ||
@JoinColumn(name = "wahlvorschlagID") | ||
@EqualsAndHashCode.Exclude | ||
private Wahlvorschlag wahlvorschlag; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private String name; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private long listenposition; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private boolean direktkandidat; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private long tabellenSpalteInNiederschrift; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private boolean einzelbewerber; | ||
} |
Oops, something went wrong.