refactor(common,community,mako): fix typos and remove dead code
- Rename MakoConsens* -> MakoConsent* (3 event classes + listener) - Rename EdaCommuncationEventListener -> EdaCommunicationEventListener - Rename PointType.PROSUME -> PROSUMER - Remove dead SecurityConfig admin path matchers (actual security via @PreAuthorize) - Regenerate OpenAPI spec and frontend API client
This commit is contained in:
parent
6770be9bef
commit
7baa1c72af
@ -1,3 +0,0 @@
|
||||
package at.mueller.eeg.backend.common.event;
|
||||
|
||||
public record MakoConsensApprovedEvent(String atNumber) {}
|
||||
@ -1,3 +0,0 @@
|
||||
package at.mueller.eeg.backend.common.event;
|
||||
|
||||
public record MakoConsensRejectedEvent(String atNumber, String reason) {}
|
||||
@ -1,3 +0,0 @@
|
||||
package at.mueller.eeg.backend.common.event;
|
||||
|
||||
public record MakoConsensTechnicalFailedEvent(String atNumber, String reason) {}
|
||||
@ -0,0 +1,3 @@
|
||||
package at.mueller.eeg.backend.common.event;
|
||||
|
||||
public record MakoConsentApprovedEvent(String atNumber) {}
|
||||
@ -0,0 +1,3 @@
|
||||
package at.mueller.eeg.backend.common.event;
|
||||
|
||||
public record MakoConsentRejectedEvent(String atNumber, String reason) {}
|
||||
@ -0,0 +1,3 @@
|
||||
package at.mueller.eeg.backend.common.event;
|
||||
|
||||
public record MakoConsentTechnicalFailedEvent(String atNumber, String reason) {}
|
||||
@ -47,7 +47,7 @@ public class NotificationListener {
|
||||
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void handleMakoConsensApproved(MakoConsensApprovedEvent event) {
|
||||
public void handleMakoConsentApproved(MakoConsentApprovedEvent event) {
|
||||
findMeteringPointByAtNumber(event.atNumber()).ifPresent(point -> {
|
||||
notificationService.create(
|
||||
point.getUserId(),
|
||||
@ -61,7 +61,7 @@ public class NotificationListener {
|
||||
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void handleMakoConsensRejected(MakoConsensRejectedEvent event) {
|
||||
public void handleMakoConsentRejected(MakoConsentRejectedEvent event) {
|
||||
findMeteringPointByAtNumber(event.atNumber()).ifPresent(point -> {
|
||||
notificationService.create(
|
||||
point.getUserId(),
|
||||
|
||||
@ -4,5 +4,5 @@ public enum PointType {
|
||||
CONSUMER,
|
||||
PRODUCER,
|
||||
//TODO: Prüfen ob PROSUMER wirklich ein eigener Typ ist und sich nicht aus Consumer/Producer ergibt
|
||||
PROSUME;
|
||||
PROSUMER;
|
||||
}
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
package at.mueller.eeg.backend.community.event.listener;
|
||||
|
||||
import at.mueller.eeg.backend.common.event.EdaTopologyCheckEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsensApprovedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsensRejectedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsensTechnicalFailedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsentApprovedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsentRejectedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsentTechnicalFailedEvent;
|
||||
import at.mueller.eeg.backend.community.domain.MeteringPoint;
|
||||
import at.mueller.eeg.backend.community.domain.state.MakoTrigger;
|
||||
import at.mueller.eeg.backend.community.repository.MeteringPointRepository;
|
||||
@ -17,14 +17,14 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class MakoConsensListener {
|
||||
public class MakoConsentListener {
|
||||
|
||||
private final MeteringPointRepository meteringPointRepository;
|
||||
private final ApplicationEventPublisher eventPublisher;
|
||||
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void handleMakoConsensApproved(MakoConsensApprovedEvent event) {
|
||||
public void handleMakoConsentApproved(MakoConsentApprovedEvent event) {
|
||||
log.info("MaKo-Consent erteilt für AT-Nummer: {}", event.atNumber());
|
||||
|
||||
meteringPointRepository.findByAtNumber(event.atNumber()).ifPresentOrElse(point -> {
|
||||
@ -49,7 +49,7 @@ public class MakoConsensListener {
|
||||
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void handleMakoConsensRejected(MakoConsensRejectedEvent event) {
|
||||
public void handleMakoConsentRejected(MakoConsentRejectedEvent event) {
|
||||
log.info("MaKo-Consent abgelehnt für AT-Nummer: {}. Grund: {}", event.atNumber(), event.reason());
|
||||
|
||||
meteringPointRepository.findByAtNumber(event.atNumber()).ifPresentOrElse(point -> {
|
||||
@ -67,7 +67,7 @@ public class MakoConsensListener {
|
||||
|
||||
@EventListener
|
||||
@Transactional
|
||||
public void handleMakoConsensTechnicalFailed(MakoConsensTechnicalFailedEvent event) {
|
||||
public void handleMakoConsentTechnicalFailed(MakoConsentTechnicalFailedEvent event) {
|
||||
log.warn("MaKo-Consent technischer Fehler für AT-Nummer: {}. Grund: {}", event.atNumber(), event.reason());
|
||||
|
||||
meteringPointRepository.findByAtNumber(event.atNumber()).ifPresentOrElse(point -> {
|
||||
@ -57,11 +57,6 @@ public class SecurityConfig {
|
||||
.requestMatchers("/", "/index.html", "/assets/**", "/static/**", "/*.js", "/*.css", "/*.ico").permitAll()
|
||||
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**", "/swagger-ui.html").permitAll()
|
||||
.requestMatchers("/api/auth/**").permitAll()
|
||||
.requestMatchers(
|
||||
"/api/community/admin/**",
|
||||
"/api/iam/admin/**",
|
||||
"/api/mako/admin/**"
|
||||
).hasRole("ADMIN")
|
||||
.requestMatchers("/api/**").authenticated()
|
||||
.anyRequest().denyAll()
|
||||
)
|
||||
|
||||
@ -15,7 +15,7 @@ import org.springframework.stereotype.Component;
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class EdaCommuncationEventListener {
|
||||
public class EdaCommunicationEventListener {
|
||||
|
||||
private final EdaTopologyService edaTopologyService;
|
||||
private final EdaConsentService edaConsentService;
|
||||
@ -70,7 +70,7 @@ public class EdaCommuncationEventListener {
|
||||
log.error("MaKo-Domain: Fehler beim Senden des Consent-Requests für AT-Nummer {}: {}",
|
||||
event.atNumber(), e.getMessage());
|
||||
|
||||
eventPublisher.publishEvent(new MakoConsensTechnicalFailedEvent(
|
||||
eventPublisher.publishEvent(new MakoConsentTechnicalFailedEvent(
|
||||
event.atNumber(),
|
||||
e.getMessage()
|
||||
));
|
||||
@ -1,8 +1,8 @@
|
||||
package at.mueller.eeg.backend.mako.service.impl;
|
||||
|
||||
import at.mueller.eeg.backend.common.event.MakoConsensApprovedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsensRejectedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsensTechnicalFailedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsentApprovedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsentRejectedEvent;
|
||||
import at.mueller.eeg.backend.common.event.MakoConsentTechnicalFailedEvent;
|
||||
import at.mueller.eeg.backend.mako.service.EdaConsentService;
|
||||
import jakarta.annotation.PreDestroy;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -49,15 +49,15 @@ public class SimulatedEdaConsentService implements EdaConsentService {
|
||||
try {
|
||||
if (atNumber.toUpperCase().endsWith("REJECT")) {
|
||||
log.info("[EDA-SIMULATION] OUTCOME: Zustimmung verweigert (Magic Value erkannt).");
|
||||
eventPublisher.publishEvent(new MakoConsensRejectedEvent(atNumber, "Kunde hat im Portal abgelehnt."));
|
||||
eventPublisher.publishEvent(new MakoConsentRejectedEvent(atNumber, "Kunde hat im Portal abgelehnt."));
|
||||
}
|
||||
else if (atNumber.toUpperCase().endsWith("ERROR")) {
|
||||
log.warn("[EDA-SIMULATION] OUTCOME: Technischer EDA-Fehler (Magic Value erkannt).");
|
||||
eventPublisher.publishEvent(new MakoConsensTechnicalFailedEvent(atNumber, "EDA-Gateway Timeout (504)."));
|
||||
eventPublisher.publishEvent(new MakoConsentTechnicalFailedEvent(atNumber, "EDA-Gateway Timeout (504)."));
|
||||
}
|
||||
else {
|
||||
log.info("[EDA-SIMULATION] OUTCOME: Zustimmung erteilt!");
|
||||
eventPublisher.publishEvent(new MakoConsensApprovedEvent(atNumber));
|
||||
eventPublisher.publishEvent(new MakoConsentApprovedEvent(atNumber));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("[EDA-SIMULATION] Kritischer Fehler im Simulator: {}", e.getMessage());
|
||||
|
||||
@ -638,7 +638,7 @@ components:
|
||||
enum:
|
||||
- CONSUMER
|
||||
- PRODUCER
|
||||
- PROSUME
|
||||
- PROSUMER
|
||||
required:
|
||||
- type
|
||||
MeteringPointResponse:
|
||||
@ -657,7 +657,7 @@ components:
|
||||
enum:
|
||||
- CONSUMER
|
||||
- PRODUCER
|
||||
- PROSUME
|
||||
- PROSUMER
|
||||
makoState:
|
||||
type: string
|
||||
enum:
|
||||
@ -707,7 +707,7 @@ components:
|
||||
enum:
|
||||
- CONSUMER
|
||||
- PRODUCER
|
||||
- PROSUME
|
||||
- PROSUMER
|
||||
required:
|
||||
- atNumber
|
||||
- type
|
||||
|
||||
Loading…
Reference in New Issue
Block a user