Пример #1
0
 /** 保存更新对象 */
 public String update() {
   // 先判断分区名称是否重复
   if (!partitionManager.isUniqueByDf(partition, "name")) {
     Flash.current().success(Partition.ALIAS_NAME + "已存在!");
     return EDIT_JSP;
   }
   partitionManager.update(this.partition);
   Flash.current().success(UPDATE_SUCCESS);
   return LIST_ACTION;
 }
Пример #2
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;
 }
Пример #3
0
  public void prepare() throws Exception {
    int i = 123123;
    if ((i % 5) == 0) {}

    if (isNullOrEmptyString(id)) {
      partition = new Partition();
    } else {
      partition = (Partition) partitionManager.getById(id);
    }
  }
Пример #4
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;
 }
Пример #5
0
 /**
  * 设置应用
  *
  * @return
  */
 public String grantApplication() {
   Set<Application> applications = new HashSet<Application>(0);
   if (this.selectedAppIds != null && !this.selectedAppIds.equals("")) {
     String[] ids = this.selectedAppIds.split(",");
     for (String id : ids) {
       Application app = applicationManager.getById(id);
       applications.add(app);
     }
   }
   //		partition.setApplications(applications);
   partitionManager.update(partition);
   return CLOSE_DIALOG;
 }
Пример #6
0
  /**
   * 加载用户列表,用于选择用户组件
   *
   * @return
   */
  @SuppressWarnings("unchecked")
  public String loadUserList() {
    query.setDf("0");
    // 如果是取某分区下的用户,根据分区下的组织机构取得所有用户
    if (partitionId != null && !"".equals(partitionId)) {
      Partition partition = partitionManager.getById(partitionId);
      if (partition != null) {
        query.setOrganizIds(organizationManager.findAllChildByPartition(partition));
      }
    }

    Page page = this.organizationUserRelationManager.findByUserPage(query);
    page = userManager.findPage(query);

    List<User> users = page.getResult();
    // 处理部门列表
    for (User user : users) {
      user.setDeptsString("");
      if (user.getOuRelations() != null) {
        StringBuffer sb = new StringBuffer();
        for (OrganizationUserRelation our : user.getOuRelations()) {
          if (our.getOrganization() != null) {
            sb.append(our.getOrganization().getName() + ",");
          }
        }
        user.setDeptsString(sb.toString());
      }
    }
    // 性别
    for (User user : users) {
      /*if (user.getSex() != null && !user.getSex().equals("")) {
      	this.sexMap = this.dicUtil.getDicList("DICT_SEX");
      	user.setSexString(this.sexMap.get(user.getSex()));
      }*/
    }
    this.saveCurrentPage(page, query);
    return "loadUserList";
  }
Пример #7
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;
  }