private void loadOrgAccessAdd(ArrayList<OrgAccess> list,OrgAccess oa){
  if (list.contains(oa))   return;
  list.add(oa);
  if (getAD_Tree_Org_ID() == 0)   return;
  MOrg org=MOrg.get(getCtx(),oa.AD_Org_ID);
  if (!org.isSummary())   return;
  MTree_Base tree=MTree_Base.get(getCtx(),getAD_Tree_Org_ID(),get_TrxName());
  String sql="SELECT AD_Client_ID, AD_Org_ID FROM AD_Org " + "WHERE IsActive='Y' AND AD_Org_ID IN (SELECT Node_ID FROM " + tree.getNodeTableName() + " WHERE AD_Tree_ID=? AND Parent_ID=? AND IsActive='Y')";
  PreparedStatement pstmt=null;
  ResultSet rs=null;
  try {
    pstmt=DB.prepareStatement(sql,get_TrxName());
    pstmt.setInt(1,tree.getAD_Tree_ID());
    pstmt.setInt(2,org.getAD_Org_ID());
    rs=pstmt.executeQuery();
    while (rs.next()) {
      int AD_Client_ID=rs.getInt(1);
      int AD_Org_ID=rs.getInt(2);
      loadOrgAccessAdd(list,new OrgAccess(AD_Client_ID,AD_Org_ID,oa.readOnly));
    }
  }
 catch (  Exception e) {
    log.log(Level.SEVERE,sql,e);
  }
 finally {
    DB.close(rs,pstmt);
    rs=null;
    pstmt=null;
  }
}

private void loadOrgAccessAdd ( ArrayList < OrgAccess > list , OrgAccess oa ) { if ( list . contains ( oa ) ) return ; list . add ( oa ) ; if ( getAD_Tree_Org_ID ( ) == 0 ) return ; MOrg org = MOrg . get ( getCtx ( ) , oa . AD_Org_ID ) ; if ( ! org . isSummary ( ) ) return ; MTree_Base tree = MTree_Base . get ( getCtx ( ) , getAD_Tree_Org_ID ( ) , get_TrxName ( ) ) ; String sql = "SELECT AD_Client_ID, AD_Org_ID FROM AD_Org " + "WHERE IsActive='Y' AND AD_Org_ID IN (SELECT Node_ID FROM " + tree . getNodeTableName ( ) + " WHERE AD_Tree_ID=? AND Parent_ID=? AND IsActive='Y')" ; PreparedStatement pstmt = null ; ResultSet rs = null ; try { pstmt = DB . prepareStatement ( sql , get_TrxName ( ) ) ; pstmt . setInt ( 1 , tree . getAD_Tree_ID ( ) ) ; pstmt . setInt ( 2 , org . getAD_Org_ID ( ) ) ; rs = pstmt . executeQuery ( ) ; while ( rs . next ( ) ) { int AD_Client_ID = rs . getInt ( 1 ) ; int AD_Org_ID = rs . getInt ( 2 ) ; loadOrgAccessAdd ( list , new OrgAccess ( AD_Client_ID , AD_Org_ID , oa . readOnly ) ) ; } } catch ( Exception e ) { log . log ( Level . SEVERE , sql , e ) ; } finally { DB . close ( rs , pstmt ) ; rs = null ; pstmt = null ; } }
load org access add tree to list
