Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/dave 451 und dave 452 #252

Merged
merged 3 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@
public class MessstelleController {

private static final String REQUEST_PARAMETER_ID = "id";
private static final String REQUEST_PARAMETER_MSTID = "mstid";
private final MessstelleService messstelleService;

@PreAuthorize(
"hasAnyRole(T(de.muenchen.dave.security.AuthoritiesEnum).ANWENDER.name(), " +
"T(de.muenchen.dave.security.AuthoritiesEnum).POWERUSER.name())"
)
@GetMapping(value = "/info", produces = MediaType.APPLICATION_JSON_VALUE)
@GetMapping(value = "/info", params = REQUEST_PARAMETER_ID, produces = MediaType.APPLICATION_JSON_VALUE)
@Transactional(readOnly = true)
public ResponseEntity<ReadMessstelleInfoDTO> readMessstelleInfo(@RequestParam(value = REQUEST_PARAMETER_ID) final String messstelleId) {
log.debug("#readMessstelleInfo with id {}", messstelleId);
public ResponseEntity<ReadMessstelleInfoDTO> readMessstelleInfoById(
@RequestParam(value = REQUEST_PARAMETER_ID) final String messstelleId) {
log.debug("#readMessstelleInfoById with id {}", messstelleId);
try {
final ReadMessstelleInfoDTO readMessstelleDTO = this.messstelleService.readMessstelleInfo(messstelleId);
return ResponseEntity.ok(readMessstelleDTO);
Expand All @@ -53,6 +55,23 @@ public ResponseEntity<ReadMessstelleInfoDTO> readMessstelleInfo(@RequestParam(va
}
}

@GetMapping(value = "/info", params = REQUEST_PARAMETER_MSTID, produces = MediaType.APPLICATION_JSON_VALUE)
@Transactional(readOnly = true)
public ResponseEntity<ReadMessstelleInfoDTO> readMessstelleInfoByMstId(
@RequestParam(value = REQUEST_PARAMETER_MSTID) final String mstId) {
log.debug("#readMessstelleInfoByMstId with id {}", mstId);
try {
final ReadMessstelleInfoDTO readMessstelleDTO = this.messstelleService.readMessstelleInfoByMstId(mstId);
return ResponseEntity.ok(readMessstelleDTO);
} catch (final ResourceNotFoundException e) {
log.error("Fehler im MessstelleController, Messstelle konnte nicht gefunden werden. ID: {}", mstId, e);
throw e;
} catch (final Exception e) {
log.error("Unerwarteter Fehler im MessstelleController beim Laden der Messstelle mit der ID: {}", mstId, e);
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "Es ist ein unerwarteter Fehler beim Laden der Messstelle aufgetreten.");
}
}

/**
* Diese Methode erlaubt das Aktualisieren einer Messstelle.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public ReadMessstelleInfoDTO readMessstelleInfo(final String messstelleId) {
return messstelleMapper.bean2readDto(byIdOrThrowException, stadtbezirkMapper);
}

public ReadMessstelleInfoDTO readMessstelleInfoByMstId(final String mstId) {
final Messstelle byIdOrThrowException = messstelleIndexService.findByMstIdOrThrowException(mstId);
return messstelleMapper.bean2readDto(byIdOrThrowException, stadtbezirkMapper);
}

public EditMessstelleDTO getMessstelleToEdit(final String messstelleId) {
final Messstelle byIdOrThrowException = messstelleIndexService.findByIdOrThrowException(messstelleId);
byIdOrThrowException.setMessfaehigkeiten(
Expand Down
Loading