use of io.lumeer.storage.api.filter.AttributeFilter in project engine by Lumeer.
the class FilterParser method parse.
public static AttributeFilter parse(String filter) {
String[] parts = filter.split(":", 3);
if (parts.length < 3) {
return null;
}
String collectionId = parts[0].trim();
String attributeName = parts[1].trim();
String condition = parts[2].trim();
// one or more spaces
String[] conditionParts = condition.split(" +", 2);
if (conditionParts.length < 2) {
return null;
}
ConditionType conditionType = ConditionType.fromString(conditionParts[0].trim().toLowerCase());
if (conditionType == null) {
return null;
}
String value = conditionParts[1].trim();
return new AttributeFilter(collectionId, conditionType, attributeName, value);
}
Aggregations