158159160161162163164165166167168169
List<PrivTree> ptList = new ArrayList<PrivTree>(); if (list == null) return null; for (int i = 0; i < list.size(); i++) { Priv pri = list.get(i); if (pri.getPid() == null) { ptList.add(findAllChildPrivs(pri, null, list)); } } return ptList;
172173174175176177178179180181182183
@SuppressWarnings("unused") private Priv findParentPriv(Priv priv, List<Priv> list) { for (int i = 0; i < list.size(); i++) { Priv pri = list.get(i); if (priv.getPid() == pri.getId()) { return pri; } } return null;
190191192193194195196197198199200201
topTree.setPriv(cur); List<PrivTree> temp = new ArrayList<PrivTree>(); for (int i = 0; i < list.size(); i++) { Priv pri = list.get(i); if (cur.getId() == pri.getPid()) { temp.add(findAllChildPrivs(pri, topTree, list)); } } if (temp.size() == 0)
213214215216217218219220221222223224
private List<Priv> findChildPrivs(Priv priv, List<Priv> list) { List<Priv> temp = new ArrayList<Priv>(); for (int i = 0; i < list.size(); i++) { Priv pri = list.get(i); if (priv.getId() == pri.getPid()) { temp.add(pri); } } return temp;