-
Notifications
You must be signed in to change notification settings - Fork 7
[NAE-2440] Fix PluginActionApi bean creation in Spring context #443
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
16 changes: 0 additions & 16 deletions
16
...n-engine/src/main/java/com/netgrif/application/engine/actions/ActionApiConfiguration.java
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
114 changes: 114 additions & 0 deletions
114
...ain/java/com/netgrif/application/engine/adapter/spring/actions/ProcessAvailabilities.java
This file contains hidden or 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,114 @@ | ||
| package com.netgrif.application.engine.adapter.spring.actions; | ||
|
|
||
| import java.util.List; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Wrapper for list of {@link ProcessAvailability} | ||
| * Use for convenient check of process availability | ||
| * | ||
| * @param availabilities | ||
| */ | ||
| public record ProcessAvailabilities(List<ProcessAvailability> availabilities) { | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
|
|
||
| public ProcessAvailabilities { | ||
| availabilities = List.copyOf(availabilities); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if a process with the given identifier is in the "up" state. | ||
| * @param processIdentifier process identifier | ||
| * @return true if a process is up, false otherwise | ||
| */ | ||
| public boolean isUp(String processIdentifier) { | ||
| return is(processIdentifier, ProcessAvailability.Status.UP); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Checks if a process with the given identifier is in the "down" state. | ||
| * | ||
| * @param processIdentifier the unique identifier of the process to check | ||
| * @return true if the process is down, false otherwise | ||
| */ | ||
| public boolean isDown(String processIdentifier) { | ||
| return is(processIdentifier, ProcessAvailability.Status.DOWN); | ||
| } | ||
|
|
||
| /** | ||
| * Determines if a process with the specified process ID has a status of "not found." | ||
| * | ||
| * @param processIdentifier the identifier of the process to check | ||
| * @return true if the process with the given ID has a status of "not found," false otherwise | ||
| */ | ||
| public boolean isNotFound(String processIdentifier) { | ||
| return is(processIdentifier, ProcessAvailability.Status.NOT_FOUND); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if any of the processes in the list are in the "up" status. | ||
| * | ||
| * @return true if at least one process has a status of "up"; false otherwise | ||
| */ | ||
| public boolean isAnyUp() { | ||
| return isAny(ProcessAvailability.Status.UP); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if any of the processes in the list are in the "DOWN" status. | ||
| * | ||
| * @return true if at least one process has a status of "DOWN", false otherwise | ||
| */ | ||
| public boolean isAnyDown() { | ||
| return isAny(ProcessAvailability.Status.DOWN); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if any process in the list of {@link ProcessAvailability} instances is in the "not found" state. | ||
| * | ||
| * @return true if at least one process has a status of "NOT_FOUND", false otherwise | ||
| */ | ||
| public boolean isAnyNotFound() { | ||
| return isAny(ProcessAvailability.Status.NOT_FOUND); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if all processes in the list are in the "UP" state. | ||
| * | ||
| * @return true if all processes are in the "UP" state, false otherwise | ||
| */ | ||
| public boolean isAllUp() { | ||
| return isAll(ProcessAvailability.Status.UP); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if all processes in the list are in the "down" state. | ||
| * | ||
| * @return true if all processes are in the "down" state, false otherwise | ||
| */ | ||
| public boolean isAllDown() { | ||
| return isAll(ProcessAvailability.Status.DOWN); | ||
| } | ||
|
|
||
| /** | ||
| * Determines if all processes in the list are in the "Not Found" state. | ||
| * | ||
| * @return true if all processes have a status of "Not Found," false otherwise | ||
| */ | ||
| public boolean isAllNotFound() { | ||
| return isAll(ProcessAvailability.Status.NOT_FOUND); | ||
| } | ||
|
|
||
| private boolean is(String processIdentifier, ProcessAvailability.Status status) { | ||
| return availabilities.stream() | ||
| .anyMatch(processAvailability -> Objects.equals(processIdentifier, processAvailability.processIdentifier()) && processAvailability.status() == status); | ||
| } | ||
|
|
||
| private boolean isAny(ProcessAvailability.Status status) { | ||
| return availabilities.stream().anyMatch(processAvailability -> processAvailability.status() == status); | ||
| } | ||
|
|
||
| private boolean isAll(ProcessAvailability.Status status) { | ||
| return availabilities != null && !availabilities.isEmpty() && availabilities.stream().allMatch(processAvailability -> processAvailability.status() == status); | ||
| } | ||
| } | ||
55 changes: 55 additions & 0 deletions
55
.../main/java/com/netgrif/application/engine/adapter/spring/actions/ProcessAvailability.java
This file contains hidden or 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,55 @@ | ||
| package com.netgrif.application.engine.adapter.spring.actions; | ||
|
|
||
| /** | ||
| * Represents the availability status of a process. | ||
| * This class encapsulates information about a process's identifier and its status. | ||
| * It provides utility methods to interpret and construct instances based on different inputs. | ||
| */ | ||
| public record ProcessAvailability(String processIdentifier, Status status) { | ||
|
|
||
| public static ProcessAvailability from(String processIdentifier, Boolean status) { | ||
| return new ProcessAvailability(processIdentifier, Status.from(status)); | ||
| } | ||
|
|
||
| public static ProcessAvailability notFound(String processIdentifier) { | ||
| return new ProcessAvailability(processIdentifier, Status.NOT_FOUND); | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the process is in the "UP" state. | ||
| * | ||
| * @return true if the process status is "UP"; false otherwise | ||
| */ | ||
| public boolean isUp() { | ||
| return status == Status.UP; | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the current status is "DOWN". | ||
| * | ||
| * @return true if the status is "DOWN", false otherwise | ||
| */ | ||
| public boolean isDown() { | ||
| return status == Status.DOWN; | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the status of the process is "not found." | ||
| * | ||
| * @return true if the status is "NOT_FOUND," false otherwise | ||
| */ | ||
| public boolean isNotFound() { | ||
| return status == Status.NOT_FOUND; | ||
| } | ||
|
|
||
| public enum Status { | ||
| UP, DOWN, NOT_FOUND; | ||
|
|
||
| public static Status from(Boolean isUp) { | ||
| if (isUp == null) { | ||
| return NOT_FOUND; | ||
| } | ||
| return isUp ? UP : DOWN; | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.