[New] Allow to search activities and order by state in inspector
This commit is contained in:
parent
84cf1471ea
commit
7c778d334a
|
@ -6,6 +6,7 @@ import static li.strolch.search.PredicatesSupport.isEqualTo;
|
|||
import static li.strolch.utils.helper.StringHelper.trimOrEmpty;
|
||||
|
||||
import li.strolch.model.ParameterBag;
|
||||
import li.strolch.model.State;
|
||||
import li.strolch.model.StrolchRootElement;
|
||||
import li.strolch.model.Tags;
|
||||
import li.strolch.model.parameter.Parameter;
|
||||
|
@ -112,7 +113,20 @@ public class SearchBuilder {
|
|||
|
||||
String[] paramParts = parseParts(part);
|
||||
if (paramParts.length != 3) {
|
||||
se = add(and, negate, se, id(containsIgnoreCase(part)).or(name(containsIgnoreCase(part))));
|
||||
|
||||
SearchExpression<T> expression;
|
||||
if (part.startsWith("$state") && (search instanceof OrderSearch || search instanceof ActivitySearch)) {
|
||||
part = part.substring("$state".length() + 1);
|
||||
if (part.isEmpty() || State.parseAllowNull(part) == null) {
|
||||
expression = id(containsIgnoreCase(part)).or(name(containsIgnoreCase(part)));
|
||||
} else {
|
||||
expression = state(isEqualTo(part));
|
||||
}
|
||||
} else {
|
||||
expression = id(containsIgnoreCase(part)).or(name(containsIgnoreCase(part)));
|
||||
}
|
||||
|
||||
se = add(and, negate, se, expression);
|
||||
} else {
|
||||
String bagId = paramParts[0];
|
||||
String paramId = paramParts[1];
|
||||
|
|
|
@ -161,7 +161,7 @@ public enum State {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return true if {@link #STARTING} or {@link #EXECUTION} or {@link #WARNING}
|
||||
* @return true if {@link #EXECUTION} or {@link #WARNING}
|
||||
*/
|
||||
public boolean canSetToError() {
|
||||
return this == EXECUTION || this == WARNING || this == ERROR;
|
||||
|
@ -174,6 +174,15 @@ public enum State {
|
|||
return this == EXECUTION || this == WARNING || this == STOPPED;
|
||||
}
|
||||
|
||||
public static State parseAllowNull(String s) {
|
||||
for (State state : values()) {
|
||||
if (state.state.toLowerCase().equals(s.toLowerCase()))
|
||||
return state;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static State parse(String s) {
|
||||
DBC.PRE.assertNotEmpty("Value may not be null", s);
|
||||
for (State state : values()) {
|
||||
|
|
Loading…
Reference in New Issue