Search in sources :

Example 1 with InvalidParameterizedAttributeException

use of com.yahoo.elide.core.exceptions.InvalidParameterizedAttributeException in project elide by yahoo.

the class SQLTimeDimensionProjection method getGrainFromArguments.

private TimeDimensionGrain getGrainFromArguments(Map<String, Argument> arguments, TimeDimension column) {
    Argument grainArgument = arguments.get("grain");
    if (grainArgument == null) {
        return column.getDefaultGrain();
    }
    String grainName = grainArgument.getValue().toString().toLowerCase(Locale.ENGLISH);
    return column.getSupportedGrains().stream().filter(grain -> grain.getGrain().name().toLowerCase(Locale.ENGLISH).equals(grainName)).findFirst().orElseThrow(() -> new InvalidParameterizedAttributeException(name, grainArgument));
}
Also used : Argument(com.yahoo.elide.core.request.Argument) InvalidParameterizedAttributeException(com.yahoo.elide.core.exceptions.InvalidParameterizedAttributeException)

Aggregations

InvalidParameterizedAttributeException (com.yahoo.elide.core.exceptions.InvalidParameterizedAttributeException)1 Argument (com.yahoo.elide.core.request.Argument)1