Recursive Implementation of jquery easyui authorization tree (part of Java code)

Source: Internet
Author: User

/*** Click all function permission trees obtained by the role tree subnode * @ param roleID * @ return */public List
 
  
GetRoleRightManageTree (int roleID) {List
  
   
TreeNodeList = new ArrayList
   
    
(); TreeNode rootNode = new TreeNode ("root", "All functions"); // List of root nodes
    
     
FistTreeNodeList = new ArrayList
     
      
(); // List of upper-level nodes in the function group
      
        FirstFuncGroupList = getFirstFuncGroup (); // get the id and namefor (FuncGroup fGroup: firstFuncGroupList) {TreeNode firstFuncGroupNode = new TreeNode ("firstFuncGroup" + fGroup. getGroupID (), fGroup. getGroupName (); firstFuncGroupNode. setIconCls ("icon-line"); fistTreeNodeList. add (firstFuncGroupNode); recurrenceFuncGroups (roleID, firstFuncGroupNode, fGroup);} rootNode. setChildren (fistTreeNodeList); treeNodeList. add (rootNode); return treeNodeList;}/*** role management -- Recursive Function Group * @ param roleID * @ param treeNode * @ param funcGroup */public void recurrenceFuncGroups (int roleID, treeNode treeNode, FuncGroup funcGroup) {List
       
         TreeNodeFuncGroupList = new ArrayList
        
          (); List
         
           FuncGroupList = getFuncGroupFromGroupList (funcGroup. getGroupID (); if (funcGroupList. size ()> 0) {for (FuncGroup fGroup: funcGroupList) {TreeNode funcGroupNode = new TreeNode ("funcGroup" + fGroup. getGroupID (), fGroup. getGroupName (); funcGroupNode. setIconCls ("icon-folder"); treeNodeFuncGroupList. add (funcGroupNode); recurrenceFuncGroups (roleID, funcGroupNode, fGroup) ;}} List
          
            FunctionNodeList = new ArrayList
           
             (); // List of function nodes
            
              FunctionList = getFunctionList (funcGroup. getGroupID (); // obtain all functions if (functionList. size ()> 0) {for (Function function: functionList) {TreeNode functionNode = new TreeNode ("function _" + function. getFunctionID (), function. getFunctionName (); functionNode. setIconCls ("icon-line"); functionNodeList. add (functionNode); List
             
               RoleFunctionList = getRoleFunctionListByRoleID (roleID); for (RoleFunctionRelation roleFunctionRelation: roleFunctionList) {if (function. getFunctionID () = roleFunctionRelation. getFunctionID () {functionNode. setChecked (true) ;}} treeNodeFuncGroupList. add (functionNode) ;}} if (treeNodeFuncGroupList. size ()> 0) {treeNode. setChildren (treeNodeFuncGroupList );}}
             
            
           
          
         
        
       
      
     
    
   
  
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.