class CheckAllGroupPositionValidator implements ConstraintValidator<CheckAllGroupPosition, List<ClientQueryGroup>>,
        ValidationErrorDescriptorBuilder {

    @Override
    public boolean isValid(List<ClientQueryGroup> groups, ConstraintValidatorContext context) {
        if (groups.size() > 1) {
            if (isAllGroup(groups.get(0))) {
                return true;
            }

            for (ClientQueryGroup g : groups) {
                if (isAllGroup(g)) return false;
            }
        }
        return true;
    }

}