package com.lightinit.hsdataportal.common; import com.lightinit.hsdataportal.json.pojo.RoleAttributesEntity; import com.lightinit.hsdataportal.json.pojo.RoleComboEntity; import com.lightinit.hsdataportal.entity.SentryRole; import java.util.ArrayList; import java.util.List; /** * Created by Mr.Yao on 2017/4/24. */ public class RoleComboUtils { public static RoleComboEntity RoleComboxConverter(SentryRole role) { RoleComboEntity entity=new RoleComboEntity(); if (role!=null) { List tmpList=new ArrayList(); List list=role.getChildren(); if(list!=null && list.size()>0){ for (SentryRole _item:list) { RoleComboEntity _entity=RoleComboxConverter(_item); if (_entity!=null) tmpList.add(_entity); } entity.setIconCls("fi-page-copy"); entity.setChildren(tmpList); }else { entity.setIconCls("fi-page"); entity.setChildren(null); } entity.setId(role.getId()); entity.setText(role.getRolename()); RoleAttributesEntity roleAttributesEntity=new RoleAttributesEntity(); if (role.getParentid()!=null) { roleAttributesEntity.setParentid(role.getParentid()); } } return entity; } }