// Path: src/main/java/net/nandgr/cba/exception/BadRulesException.java
// public class BadRulesException extends Exception {
// 
//   public BadRulesException(String message) {
//     super(message);
//   }
// }
// 
// Path: src/main/java/net/nandgr/cba/custom/visitor/helper/RuleHelper.java
// public static boolean allEmpty(Method method) {
//   if (method == null) {
//     return false;
//   }
//   return StringUtils.isBlank(method.getName()) && method.getParameters() == null && StringUtils.isBlank(method.getVisibility());
// }


import java.util.Arrays;
import java.util.List;
import net.nandgr.cba.exception.BadRulesException;
import org.apache.commons.lang.StringUtils;
import static net.nandgr.cba.custom.visitor.helper.RuleHelper.allEmpty;
  public void validateRules() throws BadRulesException {
    for (Rule rule : this.getRules()) {
      if (StringUtils.isBlank(rule.getName())) {
        throw new BadRulesException("Rule name cannot be blank.");
      }
      validateRule(rule);
    }
  }

  private static void validateRule(Rule rule) throws BadRulesException {
    if (rule.getInvocations() != null) {
      for (Invocation invocation : rule.getInvocations()) {

        Method notFrom = invocation.getNotFrom();
        checkEmpty(notFrom, "\"invocation.notFrom\" property cannot have all the fields blank.");

        Method from = invocation.getFrom();
        checkEmpty(from, "\"invocation.from\" property cannot have all the fields blank.");

        Method method = invocation.getMethod();
        checkEmpty(method, "\"invocation.method\" property cannot have all the fields blank.");

        if (notFrom != null && from != null) {
          throw new BadRulesException("\"invocation.notFrom\" and \"invocation.from\" cannot be defined at the same time in the same rule.");
        }
      }
    }
  }

  private static void checkEmpty(Method method, String message) throws BadRulesException {
// Path: src/main/java/net/nandgr/cba/exception/BadRulesException.java
// public class BadRulesException extends Exception {
// 
//   public BadRulesException(String message) {
//     super(message);
//   }
// }
// 
// Path: src/main/java/net/nandgr/cba/custom/visitor/helper/RuleHelper.java
// public static boolean allEmpty(Method method) {
//   if (method == null) {
//     return false;
//   }
//   return StringUtils.isBlank(method.getName()) && method.getParameters() == null && StringUtils.isBlank(method.getVisibility());
// }


// Path: src/main/java/net/nandgr/cba/custom/model/Rules.java
import java.util.Arrays;
import java.util.List;
import net.nandgr.cba.exception.BadRulesException;
import org.apache.commons.lang.StringUtils;
import static net.nandgr.cba.custom.visitor.helper.RuleHelper.allEmpty;

  public void validateRules() throws BadRulesException {
    for (Rule rule : this.getRules()) {
      if (StringUtils.isBlank(rule.getName())) {
        throw new BadRulesException("Rule name cannot be blank.");
      }
      validateRule(rule);
    }
  }

  private static void validateRule(Rule rule) throws BadRulesException {
    if (rule.getInvocations() != null) {
      for (Invocation invocation : rule.getInvocations()) {

        Method notFrom = invocation.getNotFrom();
        checkEmpty(notFrom, "\"invocation.notFrom\" property cannot have all the fields blank.");

        Method from = invocation.getFrom();
        checkEmpty(from, "\"invocation.from\" property cannot have all the fields blank.");

        Method method = invocation.getMethod();
        checkEmpty(method, "\"invocation.method\" property cannot have all the fields blank.");

        if (notFrom != null && from != null) {
          throw new BadRulesException("\"invocation.notFrom\" and \"invocation.from\" cannot be defined at the same time in the same rule.");
        }
      }
    }
  }

  private static void checkEmpty(Method method, String message) throws BadRulesException {
    if (allEmpty(method)) {