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 #370 from it-at-m/147-implementierung-von-pflege-u…
…ngültige-wahlscheine 147 implementierung von pflege ungültige wahlscheine
- Loading branch information
Showing
42 changed files
with
1,453 additions
and
58 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
48 changes: 48 additions & 0 deletions
48
stack/keycloak/migration/add-authorities-basisdaten-ungueltigewahlscheine.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,48 @@ | ||
id: add authorities basisdaten ungueltige wahlscheine | ||
author: MrSebastian | ||
realm: ${SSO_REALM} | ||
changes: | ||
- addRole: | ||
name: Basisdaten_BUSINESSACTION_GetUngueltigews | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_BUSINESSACTION_GetUngueltigews | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_BUSINESSACTION_PostUngueltigews | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_BUSINESSACTION_PostUngueltigews | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_READ_Ungueltigews | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_READ_Ungueltigews | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_WRITE_Ungueltigews | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_WRITE_Ungueltigews | ||
clientId: ${SSO_CLIENT_ID} | ||
|
||
- addRole: | ||
name: Basisdaten_DELETE_Ungueltigews | ||
clientRole: true | ||
clientId: ${SSO_CLIENT_ID} | ||
- assignRoleToGroup: | ||
group: allBasisdatenAuthorities | ||
role: Basisdaten_DELETE_Ungueltigews | ||
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
36 changes: 36 additions & 0 deletions
36
.../java/de/muenchen/oss/wahllokalsystem/basisdatenservice/domain/UngueltigeWahlscheine.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,36 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.EmbeddedId; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.Lob; | ||
import jakarta.persistence.Table; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.AllArgsConstructor; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Entity | ||
@Table(name = "Ungueltigews") | ||
@Getter | ||
@Setter | ||
@EqualsAndHashCode | ||
@ToString | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
public class UngueltigeWahlscheine { | ||
|
||
// ========= // | ||
// Variables // | ||
// ========= // | ||
@EmbeddedId | ||
private WahltagIdUndWahlbezirksart wahltagIdUndWahlbezirksart; | ||
|
||
@Column(name = "ungueltigews") | ||
@NotNull | ||
@Lob | ||
private byte[] ungueltigeWahlscheine; | ||
} |
46 changes: 46 additions & 0 deletions
46
...uenchen/oss/wahllokalsystem/basisdatenservice/domain/UngueltigeWahlscheineRepository.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,46 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.domain; | ||
|
||
import java.util.Optional; | ||
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_Ungueltigews')") | ||
public interface UngueltigeWahlscheineRepository extends CrudRepository<UngueltigeWahlscheine, WahltagIdUndWahlbezirksart> { | ||
|
||
String CACHE = "UNGUELTIGEWS_CACHE"; | ||
|
||
@Override | ||
Iterable<UngueltigeWahlscheine> findAll(); | ||
|
||
@Override | ||
@Cacheable(value = CACHE, key = "#p0") | ||
Optional<UngueltigeWahlscheine> findById(WahltagIdUndWahlbezirksart wahltagIdUndWahlbezirksart); | ||
|
||
@Override | ||
@CachePut(value = CACHE, key = "#p0.wahltagIdUndWahlbezirksart") | ||
@PreAuthorize("hasAuthority('Basisdaten_WRITE_Ungueltigews')") | ||
<S extends UngueltigeWahlscheine> S save(S ungueltigews); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, key = "#p0") | ||
@PreAuthorize("hasAuthority('Basisdaten_DELETE_Ungueltigews')") | ||
void deleteById(WahltagIdUndWahlbezirksart wahltagIdUndWahlbezirksart); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, key = "#p0.wahltagIdUndWahlbezirksart") | ||
@PreAuthorize("hasAuthority('Basisdaten_DELETE_Ungueltigews')") | ||
void delete(UngueltigeWahlscheine entity); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, allEntries = true) | ||
@PreAuthorize("hasAuthority('Basisdaten_DELETE_Ungueltigews')") | ||
void deleteAll(Iterable<? extends UngueltigeWahlscheine> entities); | ||
|
||
@Override | ||
@CacheEvict(value = CACHE, allEntries = true) | ||
@PreAuthorize("hasAuthority('Basisdaten_DELETE_Ungueltigews')") | ||
void deleteAll(); | ||
} |
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
35 changes: 35 additions & 0 deletions
35
...c/main/java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/common/FileMapper.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,35 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.common; | ||
|
||
import java.io.IOException; | ||
import lombok.extern.slf4j.Slf4j; | ||
import lombok.val; | ||
import org.springframework.http.HttpHeaders; | ||
import org.springframework.http.HttpStatus; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.web.multipart.MultipartHttpServletRequest; | ||
|
||
@Component | ||
@Slf4j | ||
public class FileMapper { | ||
|
||
public ResponseEntity<byte[]> toResponseEntity(final FileResponseEntityModel fileResponseEntityModel) { | ||
val responseHeaders = new HttpHeaders(); | ||
responseHeaders.add(HttpHeaders.CONTENT_TYPE, fileResponseEntityModel.headerContentType()); | ||
responseHeaders.add(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + fileResponseEntityModel.attachmentFilename()); | ||
|
||
return new ResponseEntity<>(fileResponseEntityModel.responseBody(), responseHeaders, HttpStatus.OK); | ||
} | ||
|
||
public byte[] fromRequest(final MultipartHttpServletRequest request) throws IOException { | ||
val fileName = request.getFileNames().next(); | ||
log.debug("using filename > {}", fileName); | ||
val file = request.getFile(fileName); | ||
|
||
if (file == null) { | ||
throw new IOException("No file was uploaded"); | ||
} | ||
|
||
return file.getBytes(); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...e/muenchen/oss/wahllokalsystem/basisdatenservice/rest/common/FileResponseEntityModel.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,4 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.common; | ||
|
||
public record FileResponseEntityModel(byte[] responseBody, String headerContentType, String attachmentFilename) { | ||
} |
5 changes: 5 additions & 0 deletions
5
.../java/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/common/WahlbezirkArtDTO.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,5 @@ | ||
package de.muenchen.oss.wahllokalsystem.basisdatenservice.rest.common; | ||
|
||
public enum WahlbezirkArtDTO { | ||
UWB, BWB | ||
} |
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
1 change: 1 addition & 0 deletions
1
...va/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/handbuch/HandbuchDTOMapper.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
5 changes: 0 additions & 5 deletions
5
...ava/de/muenchen/oss/wahllokalsystem/basisdatenservice/rest/handbuch/WahlbezirkArtDTO.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.