Search in sources :

Example 1 with ConditionType

use of io.lumeer.api.model.ConditionType 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);
}
Also used : AttributeFilter(io.lumeer.storage.api.filter.AttributeFilter) ConditionType(io.lumeer.api.model.ConditionType)

Aggregations

ConditionType (io.lumeer.api.model.ConditionType)1 AttributeFilter (io.lumeer.storage.api.filter.AttributeFilter)1