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)); } }
protected void buildSubTreeSql( String principalName, BudgetConstructionOrganizationReports bcOrgRpts, int curLevel) { curLevel++; budgetPullupDao.buildSubTree( principalName, bcOrgRpts.getChartOfAccountsCode(), bcOrgRpts.getOrganizationCode(), curLevel); // budgetPullupDao.initPointOfView(principalName, bcOrgRpts.getChartOfAccountsCode(), // bcOrgRpts.getOrganizationCode(), curLevel); // budgetPullupDao.insertChildOrgs(principalName, curLevel); // force OJB to go to DB since it is populated using JDBC persistenceServiceOjb.clearCache(); }