public String loadRoleResourceAction() {
    String result = null;
    String objId = (String) SpringFacesUtil.getRequestParameter("objId");
    String name = (String) SpringFacesUtil.getRequestParameter("name");
    this.setCurrentRoleId(objId);
    this.setCurrentRoleName(name);
    this.setAction("ALLOCATE");
    // 获取角色资源树
    ResourceDTree newTree = new ResourceDTree();
    newTree.getCheckBoxResource(objId);
    this.setResTree(newTree);

    /*IAuthorityResourcesService<AuthorityResources, Long> authorityResourcesService = (IAuthorityResourcesService<AuthorityResources, Long>) SpringFacesUtil
    		.getSpringBean(PlatformSpringBeanConstants.AUTHORITY_RESOURCES_SERVICE_BEAN_NAME);
    authorityResourcesService.setEntityClass(AuthorityResources.class);
    authorityResourcesService.setPKClass(Long.class);
    List<AuthorityResources> resources = authorityResourcesService.getAll(
    		"sort", GlobalConstants.ORDER_BY_ASC_TRUE);
    IRoleResourceService<RoleResource, String> roleResourceService = (IRoleResourceService<RoleResource, String>) SpringFacesUtil
    		.getSpringBean(PlatformSpringBeanConstants.ROLE_RESOURCE_SERVICE_BEAN_NAME);
    roleResourceService.setEntityClass(RoleResource.class);
    roleResourceService.setPKClass(String.class);
    List<RoleResource> roleResources = roleResourceService.findBy("roleId", objId);
    operateFor(resources,roleResources);
    this.setRoleResources(resources);*/
    return result;
  }
  public static void refreshCustomer() {
    CurrentCustomerInfoBean currentCustomer =
        (CurrentCustomerInfoBean)
            SpringFacesUtil.getManagedBean(MallManageBeanConstants.CURRENT_CUSTOMER_BEAN_NAME);
    ICustomerService<Customer, String> customerService =
        (ICustomerService<Customer, String>)
            SpringFacesUtil.getSpringBean(MallSpringBeanConstants.CUSTOMER_SERVICE_BEAN_NAME);
    customerService.setEntityClass(Customer.class);
    customerService.setPKClass(String.class);
    if (null != currentCustomer
        && null != currentCustomer.getCustomer()
        && !(currentCustomer.getCustomer().getId().equals(""))) {}

    Customer obj = customerService.findById(currentCustomer.getCustomer().getId());
    currentCustomer.setCustomer(obj);
    currentCustomer.copyCustomerToCustomerVo();
  }
 public String editAction() { // get data
   String result = null;
   clearErrorMessages();
   IAuthorityRoleService<AuthorityRole, String> objService =
       (IAuthorityRoleService<AuthorityRole, String>)
           SpringFacesUtil.getSpringBean(
               PlatformSpringBeanConstants.AUTHORITY_ROLE_SERVICE_BEAN_NAME);
   objService.setEntityClass(AuthorityRole.class);
   objService.setPKClass(String.class);
   String objId = (String) SpringFacesUtil.getRequestParameter("objId");
   AuthorityRole obj = objService.findById(objId);
   AuthorityRoleVo objVo = new AuthorityRoleVo();
   BeanCopier copyHere = BeanCopier.create(AuthorityRole.class, AuthorityRoleVo.class, false);
   copyHere.copy(obj, objVo, null);
   this.setAction(PlatformConstants.ACTION_EDIT_TYPE);
   this.setEdit(objVo);
   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;
 }
 public String selectPageNo() {
   String result = null;
   String pageNo = (String) SpringFacesUtil.getRequestParameter("pageNo");
   if (null != this.getPage().getPageNo()) {
     if (this.getPage().getPageNo().intValue() == Integer.valueOf(pageNo).intValue()) {
       return result;
     }
   }
   this.getPage().setPageNo(Integer.valueOf(pageNo).intValue());
   this.getPage().getPageDatas();
   return result;
 }
 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;
 }