/**
   * @see
   *     org.kuali.kfs.module.bc.document.service.BudgetOrganizationTreeService#resetPullFlag(java.lang.String)
   */
  public void resetPullFlag(String principalId) {

    if (StringUtils.isBlank(principalId)) {
      throw new IllegalArgumentException("String parameter principalId was null or blank.");
    }
    List<BudgetConstructionPullup> results =
        budgetConstructionDao.getBudgetConstructionPullupFlagSetByUserId(principalId);
    if (!results.isEmpty()) {
      for (BudgetConstructionPullup selOrg : results) {
        selOrg.setPullFlag(OrgSelControlOption.NO.getKey());
      }
      businessObjectService.save(results);
    }
  }
  protected void buildSubTree(
      String principalName, BudgetConstructionOrganizationReports bcOrgRpts, int curLevel) {

    curLevel++;
    BudgetConstructionPullup bcPullup = new BudgetConstructionPullup();
    bcPullup.setPrincipalId(principalName);
    bcPullup.setChartOfAccountsCode(bcOrgRpts.getChartOfAccountsCode());
    bcPullup.setOrganizationCode(bcOrgRpts.getOrganizationCode());
    bcPullup.setReportsToChartOfAccountsCode(bcOrgRpts.getReportsToChartOfAccountsCode());
    bcPullup.setReportsToOrganizationCode(bcOrgRpts.getReportsToOrganizationCode());
    bcPullup.setPullFlag(new Integer(0));
    businessObjectService.save(bcPullup);

    if (curLevel <= MAXLEVEL) {
      // getActiveChildOrgs does not return orgs that report to themselves
      List childOrgs =
          budgetConstructionOrganizationReportsService.getActiveChildOrgs(
              bcOrgRpts.getChartOfAccountsCode(), bcOrgRpts.getOrganizationCode());
      if (childOrgs.size() > 0) {
        for (Iterator iter = childOrgs.iterator(); iter.hasNext(); ) {
          BudgetConstructionOrganizationReports bcOrg =
              (BudgetConstructionOrganizationReports) iter.next();
          buildSubTree(principalName, bcOrg, curLevel);
        }
      }
    } else {
      LOG.warn(
          String.format(
              "\n%s/%s reports to organization more than maxlevel of %d",
              bcOrgRpts.getChartOfAccountsCode(), bcOrgRpts.getOrganizationCode(), MAXLEVEL));
    }
  }