-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AYS-467 | Emergency Evacuation Application Endpoint Checks with AOP A…
…nnotation (#378)
- Loading branch information
1 parent
a61440a
commit 5f9c703
Showing
6 changed files
with
62 additions
and
1 deletion.
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
14 changes: 14 additions & 0 deletions
14
...g/ays/common/util/exception/EmergencyEvacuationApplicationEndpointNotActiveException.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 org.ays.common.util.exception; | ||
|
||
import java.io.Serial; | ||
|
||
public final class EmergencyEvacuationApplicationEndpointNotActiveException extends AysAuthException { | ||
|
||
@Serial | ||
private static final long serialVersionUID = -5238438967353670872L; | ||
|
||
public EmergencyEvacuationApplicationEndpointNotActiveException() { | ||
super("emergency evacuation application endpoint is not active!"); | ||
} | ||
|
||
} |
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
11 changes: 11 additions & 0 deletions
11
...ys/emergency_application/util/annotation/CheckEmergencyEvacuationApplicationActivity.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,11 @@ | ||
package org.ays.emergency_application.util.annotation; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target(ElementType.METHOD) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface CheckEmergencyEvacuationApplicationActivity { | ||
} |
26 changes: 26 additions & 0 deletions
26
...rgency_application/util/annotation/CheckEmergencyEvacuationApplicationActivityAspect.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,26 @@ | ||
package org.ays.emergency_application.util.annotation; | ||
|
||
import org.aspectj.lang.annotation.Aspect; | ||
import org.aspectj.lang.annotation.Before; | ||
import org.ays.common.util.exception.EmergencyEvacuationApplicationEndpointNotActiveException; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.stereotype.Component; | ||
|
||
@Aspect | ||
@Component | ||
class CheckEmergencyEvacuationApplicationActivityAspect { | ||
|
||
@Value("${ays.emergency-evacuation-application.enabled}") | ||
private boolean isEmergencyEvacuationApplicationEnabled; | ||
|
||
@Before(value = "@annotation(CheckEmergencyEvacuationApplicationActivity)") | ||
public void checkEmergencyEvacuationActivity() { | ||
|
||
if (isEmergencyEvacuationApplicationEnabled) { | ||
return; | ||
} | ||
|
||
throw new EmergencyEvacuationApplicationEndpointNotActiveException(); | ||
} | ||
|
||
} |
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