@SuppressWarnings("unchecked")
 @Override
 public DataModel getRoles(String... args) {
   DataModel model = new DataModel();
   model.setRows(roleServices.getRoles(args));
   return model;
 }
  @Override
  public TreeModel getResourceOfRole(String roleId) {

    List<ResourceExtForm> r = resourceService.getResources();
    List<RoleResource> ur = roleServices.getResoucerOfRole(roleId);

    for (ResourceExtForm ref : r) {
      if (ur != null && ur.size() > 0) {
        boolean checked = false;
        for (RoleResource uref : ur) {
          if (ref.getId().equals(uref.getResourceId())) {
            ref.setChecked(true);
            checked = true;
            break;
          }
        }
        if (!checked) ref.setChecked(false);
      } else {
        ref.setChecked(false);
      }
    }
    return roleServices.generateResourceTree(r);
  }
 @Override
 public void updateRole(RoleExtForm roleExtForm) {
   roleServices.updateRole(roleExtForm);
 }
 @Override
 public RoleExtForm getRoleById(String roleId) {
   return roleServices.getRoleById(roleId);
 }
 @Override
 public void deleteRole(String... roleIds) {
   roleServices.deleteRole(roleIds);
 }
 @Override
 public void exeAssignResouces(String roleId, String[] resourceIds) {
   roleServices.exeAssignResouces(roleId, resourceIds);
 }
 @Override
 public void addRole(RoleExtForm roleExtForm) {
   roleServices.addRole(roleExtForm);
 }