RoleComboUtils.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package com.lightinit.hsdataportal.common;
  2. import com.lightinit.hsdataportal.json.pojo.RoleAttributesEntity;
  3. import com.lightinit.hsdataportal.json.pojo.RoleComboEntity;
  4. import com.lightinit.hsdataportal.entity.SentryRole;
  5. import java.util.ArrayList;
  6. import java.util.List;
  7. /**
  8. * Created by Mr.Yao on 2017/4/24.
  9. */
  10. public class RoleComboUtils {
  11. public static RoleComboEntity RoleComboxConverter(SentryRole role) {
  12. RoleComboEntity entity=new RoleComboEntity();
  13. if (role!=null)
  14. {
  15. List<RoleComboEntity> tmpList=new ArrayList<RoleComboEntity>();
  16. List<SentryRole> list=role.getChildren();
  17. if(list!=null && list.size()>0){
  18. for (SentryRole _item:list) {
  19. RoleComboEntity _entity=RoleComboxConverter(_item);
  20. if (_entity!=null)
  21. tmpList.add(_entity);
  22. }
  23. entity.setIconCls("fi-page-copy");
  24. entity.setChildren(tmpList);
  25. }else {
  26. entity.setIconCls("fi-page");
  27. entity.setChildren(null);
  28. }
  29. entity.setId(role.getId());
  30. entity.setText(role.getRolename());
  31. RoleAttributesEntity roleAttributesEntity=new RoleAttributesEntity();
  32. if (role.getParentid()!=null) {
  33. roleAttributesEntity.setParentid(role.getParentid());
  34. }
  35. }
  36. return entity;
  37. }
  38. }