Пример #1
0
 /** 保存新增对象 */
 public String save() {
   // 先判断分区名称是否重复
   if (!partitionManager.isUniqueByDf(partition, "name")) {
     Flash.current().success(Partition.ALIAS_NAME + "已存在!");
     return CREATE_JSP;
   }
   partition.setDf("0");
   partition.setTs(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
   partitionManager.save(partition);
   Flash.current().success(CREATED_SUCCESS); // 存放在Flash中的数据,在下一次http请求中仍然可以读取数据,error()用于显示错误消息
   return LIST_ACTION;
 }
Пример #2
0
 /** 删除对象 */
 public String delete() {
   for (int i = 0; i < items.length; i++) {
     Hashtable params = HttpUtils.parseQueryString(items[i]);
     java.lang.String id = new java.lang.String((String) params.get("id"));
     partition = (Partition) partitionManager.getById(id);
     partition.setDf("1");
     // 删除分区时,把分区与管理员的关系 分区与角色的关系删除
     //			partition.setApplications(new HashSet<Application>(0));
     //			partition.setUsers(new HashSet<User>(0));
     partition.setOrganizations(new HashSet<Organization>(0));
     List roles = roleManager.findAllByDf("partitionId", partition.getId());
     if (!roles.isEmpty() && roles.size() > 0) {
       Flash.current().error("分区" + partition.getName() + "下已经有角色等数据,不能删除!");
       return LIST_ACTION;
     }
     partitionManager.update(this.partition);
   }
   Flash.current().success(DELETE_SUCCESS);
   return LIST_ACTION;
 }
Пример #3
0
 /**
  * 组装组织机构数 对已分配的组织机构回填
  *
  * @return
  */
 public String grantOrgnizPage() {
   try {
     // 取得所有的组织机构
     List<Organization> resultTopList = organizationManager.findTopByDf();
     String selectedIds = "";
     if (partition.getOrganizations() != null && partition.getOrganizations().size() > 0) {
       for (Organization orgByPar : partition.getOrganizations()) {
         selectedIds += orgByPar.getId() + "|";
       }
     }
     // 查找有checked属性的框
     String menuXmlString = Common.getOrganizationForFq(resultTopList, selectedIds, null);
     HttpServletResponse response = getResponse();
     response.setContentType("text/xml; charset=UTF-8");
     response.setHeader("Cache-control", "no-cache");
     response.getWriter().print(menuXmlString);
   } catch (IOException e) {
     e.printStackTrace();
   }
   return null;
 }
Пример #4
0
  /**
   * 分配组织机构
   *
   * @return
   */
  public String grantOrganiz() {
    String organizIds = this.partition.getOrgIds();
    //		String organizIds = this.getRequest().getParameter("orgIds");
    //		String oldOrgIds = this.getRequest().getParameter("oldOrgIds");
    //		Set<Organization> organizations = partition.getOrganizations();
    Set<Organization> organizations = new HashSet<Organization>();
    if (!"".equals(organizIds)) {
      String[] orgIds = organizIds.split(",");
      for (String orgId : orgIds) {
        Organization org = organizationManager.getById(orgId);
        organizations.add(org);
      }
    }
    /*if(StringUtils.isNotBlank(oldOrgIds)){
    	String[] orgIds  = oldOrgIds.split(", ");

    }*/

    //		String

    partition.setOrganizations(organizations);
    partitionManager.update(partition);
    return CLOSE_DIALOG;
  }