public String updateAction() {
   String result = null;
   try {
     this.clearErrorMessages();
     validator(this.getErrorMessages(), this.getEdit());
     if (!(this.getErrorMessages().isEmpty())) {
       return null;
     }
     IAuthorityRoleService<AuthorityRole, String> objService =
         (IAuthorityRoleService<AuthorityRole, String>)
             SpringFacesUtil.getSpringBean(
                 PlatformSpringBeanConstants.AUTHORITY_ROLE_SERVICE_BEAN_NAME);
     objService.setEntityClass(AuthorityRole.class);
     objService.setPKClass(String.class);
     AuthorityRole obj = objService.findById(this.getEdit().getId());
     obj.setName(this.getEdit().getName());
     obj.setRemark(this.getEdit().getRemark());
     obj.setSort(this.getEdit().getSort());
     // 设置通用的修改数据属性 修改时间和修改人
     EntityDataUtil<AuthorityRole, String> currUtil = new EntityDataUtil<AuthorityRole, String>();
     currUtil.setModifyPropertyValue(obj);
     // end
     // 按name查找,如果有提示已存在,不能保存
     AuthorityRole theObj = objService.findUniqueBy("name", this.getEdit().getName());
     if (null != theObj && !(theObj.getId().equals(this.getEdit().getId()))) {
       String hasExistErrorN18 =
           MessageFactory.getMessage(
                   PlatformConstants.USER_BUNDLE_NAME,
                   "role.has.exist.error.message",
                   FacesMessage.SEVERITY_ERROR)
               .getDetail();
       this.getErrorMessages().add(hasExistErrorN18);
       return result;
     } else { // 修改时名称不重复,可以修改
       objService.saveOrUpdate(obj);
     }
   } catch (Exception e) {
     String updateErrorN18 =
         MessageFactory.getMessage(
                 PlatformConstants.USER_BUNDLE_NAME,
                 "update.data.version.not.same.error.message",
                 FacesMessage.SEVERITY_ERROR)
             .getDetail();
     this.setEditDataInPageFlag(false);
     this.getErrorMessages().add(updateErrorN18);
     return result;
   } finally {
     // do nothing;//关闭session的时候还会报,并且在session那里抓取了所有的Exception。
   }
   return result;
 }
 public String saveAction() { // create new
   String result = null;
   clearErrorMessages();
   validator(this.getErrorMessages(), this.getEdit());
   if (!(this.getErrorMessages().isEmpty())) {
     return null;
   }
   IAuthorityRoleService<AuthorityRole, String> objService =
       (IAuthorityRoleService<AuthorityRole, String>)
           SpringFacesUtil.getSpringBean(
               PlatformSpringBeanConstants.AUTHORITY_ROLE_SERVICE_BEAN_NAME);
   objService.setEntityClass(AuthorityRole.class);
   objService.setPKClass(String.class);
   if (null != this.getEdit() && !("".equals(this.getEdit().getName()))) {
     AuthorityRole theObj = objService.findUniqueBy("name", this.getEdit().getName()); //
     if (null != theObj) {
       String hasExistErrorN18 =
           MessageFactory.getMessage(
                   PlatformConstants.USER_BUNDLE_NAME,
                   "role.has.exist.error.message",
                   FacesMessage.SEVERITY_ERROR)
               .getDetail();
       this.getErrorMessages().add(hasExistErrorN18);
     }
   }
   if (!(this.getErrorMessages().isEmpty())) {
     return null;
   }
   AuthorityRole newObj = new AuthorityRole();
   BeanCopier copyHere = BeanCopier.create(AuthorityRoleVo.class, AuthorityRole.class, false);
   copyHere.copy(this.getEdit(), newObj, null);
   // 设置通用的修改数据属性 修改时间和修改人
   try {
     EntityDataUtil<AuthorityRole, String> currUtil = new EntityDataUtil<AuthorityRole, String>();
     currUtil.setCreatePropertyValue(newObj);
   } catch (Exception e) {
     return result;
   } finally {
     // do nothing;//关闭session的时候还会报,并且在session那里抓取了所有的Exception。
   }
   // end
   objService.save(newObj);
   return result;
 }
 public String allocateRoleResourceAction() {
   String result = null;
   String resourceStr = (String) SpringFacesUtil.getRequestParameter("resourceStr");
   IRoleResourceService<RoleResource, String> objService =
       objService =
           (IRoleResourceService<RoleResource, String>)
               SpringFacesUtil.getSpringBean(
                   PlatformSpringBeanConstants.ROLE_RESOURCE_SERVICE_BEAN_NAME);
   objService.setEntityClass(RoleResource.class);
   objService.setPKClass(String.class);
   // 删除当前用户角色关联
   if (null != this.getCurrentRoleId() && !("".equals(this.getCurrentRoleId()))) {
     List<RoleResource> roleResources = objService.findBy("roleId", this.getCurrentRoleId());
     for (RoleResource roleRes : roleResources) {
       objService.removeById(roleRes.getId());
     }
   }
   // 保存新的用户角色关联
   if (!(resourceStr.isEmpty())) {
     RoleResource newObj = null;
     String[] resources = resourceStr.split(",");
     for (int i = 0; i < resources.length; i++) {
       if (!(resources[i].isEmpty())) {
         newObj = new RoleResource();
         newObj.setRoleId(this.getCurrentRoleId());
         newObj.setResourceId(new Long(resources[i]));
         try {
           EntityDataUtil<RoleResource, String> currUtil =
               new EntityDataUtil<RoleResource, String>();
           currUtil.setCreatePropertyValue(newObj);
         } catch (Exception e) {
           return result;
         } finally {
           // do nothing;//关闭session的时候还会报,并且在session那里抓取了所有的Exception。
         }
         // save
         objService.save(newObj);
       }
     }
   }
   this.setAction(PlatformConstants.ACTION_EMPTY_TYPE);
   return result;
 }