mirror of
https://github.com/Sheldan/abstracto.git
synced 2026-04-16 04:21:49 +00:00
[AB-327] adding a third state to the result of a system condition: Ignored, this means that the condition was not evaluated, and is neither true nor false, this is for example used when the feature the condition is about is disabled
adding server ID to has level condition parameters
This commit is contained in:
@@ -3,5 +3,5 @@ package dev.sheldan.abstracto.core.service;
|
||||
import dev.sheldan.abstracto.core.models.ConditionContextInstance;
|
||||
|
||||
public interface ConditionService {
|
||||
boolean checkConditions(ConditionContextInstance context);
|
||||
SystemCondition.Result checkConditions(ConditionContextInstance context);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,19 @@ import dev.sheldan.abstracto.core.models.ConditionContext;
|
||||
import dev.sheldan.abstracto.core.models.ConditionContextInstance;
|
||||
|
||||
public interface SystemCondition {
|
||||
boolean checkCondition(ConditionContextInstance conditionContext);
|
||||
Result checkCondition(ConditionContextInstance conditionContext);
|
||||
String getConditionName();
|
||||
ConditionContext getExpectedContext();
|
||||
|
||||
enum Result {
|
||||
SUCCESSFUL, FAILED, IGNORED;
|
||||
|
||||
public static Result fromBoolean(boolean value) {
|
||||
return value ? SUCCESSFUL : FAILED;
|
||||
}
|
||||
|
||||
public static boolean consideredSuccessful(Result result) {
|
||||
return result == Result.SUCCESSFUL || result == Result.IGNORED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user