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 #384 from it-at-m/143-implementierung-von-referend…
…umvorlagen-laden 143 implementierung von referendumvorlagen laden
- Loading branch information
Showing
38 changed files
with
1,668 additions
and
3 deletions.
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
stack/keycloak/migration/add-authorities-basisdaten-referendumvorlagen.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,66 @@ | ||
id: add authorities basisdaten referendumvorlagen | ||
author: MrSebastian | ||
realm: ${SSO_REALM} | ||
changes: | ||
- addRole: | ||
name: Basisdaten_BUSINESSACTION_GetReferendumvorlagen | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_BUSINESSACTION_GetReferendumvorlagen | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_READ_Referendumvorlagen | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_READ_Referendumvorlagen | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_WRITE_Referendumvorlagen | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_WRITE_Referendumvorlagen | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_DELETE_Referendumvorlagen | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_DELETE_Referendumvorlagen | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_READ_Referendumvorlage | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_READ_Referendumvorlage | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_WRITE_Referendumvorlage | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_WRITE_Referendumvorlage | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_DELETE_Referendumvorlage | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_DELETE_Referendumvorlage | ||
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
14 changes: 14 additions & 0 deletions
14
...uenchen/oss/wahllokalsystem/basisdatenservice/clients/ReferendumvorlagenClientMapper.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.ReferendumvorlageDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.eai.aou.model.ReferendumvorlagenDTO; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.referendumvorlagen.ReferendumvorlageModel; | ||
import de.muenchen.oss.wahllokalsystem.basisdatenservice.services.referendumvorlagen.ReferendumvorlagenModel; | ||
import org.mapstruct.Mapper; | ||
|
||
@Mapper | ||
public interface ReferendumvorlagenClientMapper { | ||
ReferendumvorlagenModel toModel(ReferendumvorlagenDTO referendumvorlagenDTO); | ||
|
||
ReferendumvorlageModel toModel(ReferendumvorlageDTO referendumvorlageDTO); | ||
} |
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
31 changes: 31 additions & 0 deletions
31
...hen/oss/wahllokalsystem/basisdatenservice/domain/referendumvorlagen/Referendumoption.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,31 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.referendumvorlagen; | ||
|
||
import jakarta.persistence.Embeddable; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Embeddable | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
@EqualsAndHashCode | ||
@ToString(onlyExplicitlyIncluded = true) | ||
public class Referendumoption { | ||
|
||
@NotNull | ||
@ToString.Include | ||
private String id; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private String name; | ||
|
||
@ToString.Include | ||
private Long position; | ||
} |
65 changes: 65 additions & 0 deletions
65
...en/oss/wahllokalsystem/basisdatenservice/domain/referendumvorlagen/Referendumvorlage.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,65 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.referendumvorlagen; | ||
|
||
import static java.sql.Types.VARCHAR; | ||
|
||
import jakarta.persistence.CollectionTable; | ||
import jakarta.persistence.ElementCollection; | ||
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.Set; | ||
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.UuidGenerator; | ||
|
||
@Entity | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
@Setter | ||
@EqualsAndHashCode | ||
@ToString(onlyExplicitlyIncluded = true) | ||
public class Referendumvorlage { | ||
|
||
@Id | ||
@GeneratedValue(generator = "uuid") | ||
@UuidGenerator | ||
@JdbcTypeCode(VARCHAR) | ||
@ToString.Include | ||
private UUID id; | ||
|
||
@ManyToOne | ||
@JoinColumn(name = "referendumvorlagenID") | ||
@EqualsAndHashCode.Exclude | ||
private Referendumvorlagen referendumvorlagen; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private String wahlvorschlagID; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private Long ordnungszahl; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private String kurzname; | ||
|
||
@NotNull | ||
@ToString.Include | ||
private String frage; | ||
|
||
@ElementCollection | ||
@CollectionTable(name = "referendumoption", joinColumns = @JoinColumn(name = "referendumvorlageID")) | ||
@NotNull | ||
private Set<Referendumoption> referendumoptionen; | ||
} |
54 changes: 54 additions & 0 deletions
54
...llokalsystem/basisdatenservice/domain/referendumvorlagen/ReferendumvorlageRepository.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,54 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.referendumvorlagen; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
import org.springframework.cache.annotation.CacheEvict; | ||
import org.springframework.cache.annotation.CachePut; | ||
import org.springframework.cache.annotation.Cacheable; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.security.access.prepost.PreAuthorize; | ||
|
||
@PreAuthorize("hasAuthority('Basisdaten_READ_Referendumvorlage')") | ||
public interface ReferendumvorlageRepository extends CrudRepository<Referendumvorlage, UUID> { | ||
|
||
String CACHE = "WLSREFERENDUMVORSCHLAEGE_CACHE"; | ||
|
||
@Override | ||
List<Referendumvorlage> findAll(); | ||
|
||
@Override | ||
@Cacheable(value = CACHE, key = "#p0") | ||
Optional<Referendumvorlage> findById(UUID referendumvorlageId); | ||
|
||
@Override | ||
@CachePut(value = CACHE, key = "#p0.bezirkUndWahlID") | ||
@PreAuthorize("hasAuthority('Basisdaten_WRITE_Referendumvorlage')") | ||
<S extends Referendumvorlage> S save(S entity); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, allEntries = true) | ||
@PreAuthorize("hasAuthority('Basisdaten_WRITE_Referendumvorlage')") | ||
<S extends Referendumvorlage> Iterable<S> saveAll(Iterable<S> entities); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, key = "#p0") | ||
@PreAuthorize("hasAuthority('Basisdaten_DELETE_Referendumvorlage')") | ||
void deleteById(UUID referendumvorlageId); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, key = "#p0.bezirkUndWahlID") | ||
@PreAuthorize("hasAuthority('Basisdaten_DELETE_Referendumvorlage')") | ||
void delete(Referendumvorlage entity); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, allEntries = true) | ||
@PreAuthorize("hasAuthority('Basisdaten_DELETE_Referendumvorlage')") | ||
void deleteAll(Iterable<? extends Referendumvorlage> entities); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, allEntries = true) | ||
@PreAuthorize("hasAuthority('Basisdaten_DELETE_Referendumvorlage')") | ||
void deleteAll(); | ||
|
||
} |
56 changes: 56 additions & 0 deletions
56
...n/oss/wahllokalsystem/basisdatenservice/domain/referendumvorlagen/Referendumvorlagen.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,56 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain.referendumvorlagen; | ||
|
||
import static java.sql.Types.VARCHAR; | ||
|
||
import de.muenchen.oss.wahllokalsystem.wls.common.security.domain.BezirkUndWahlID; | ||
import jakarta.persistence.Embedded; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.validation.constraints.NotNull; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
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 | ||
@EqualsAndHashCode | ||
@ToString(onlyExplicitlyIncluded = true) | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class Referendumvorlagen { | ||
|
||
@Id | ||
@GeneratedValue(generator = "uuid") | ||
@UuidGenerator | ||
@JdbcTypeCode(VARCHAR) | ||
@ToString.Include | ||
private UUID id; | ||
|
||
@NaturalId | ||
@Embedded | ||
private BezirkUndWahlID bezirkUndWahlID; | ||
|
||
@NotNull | ||
private String stimmzettelgebietID; | ||
|
||
@OneToMany(mappedBy = "referendumvorlagen", orphanRemoval = true) | ||
@NotNull | ||
private Set<Referendumvorlage> referendumvorlagen = new HashSet<>(); | ||
|
||
public void addReferendumvorlage(Referendumvorlage referendumvorlage) { | ||
referendumvorlage.setReferendumvorlagen(this); | ||
referendumvorlagen.add(referendumvorlage); | ||
} | ||
} |
Oops, something went wrong.