Package com.ketayao.ketacustom.entity.main

Examples of com.ketayao.ketacustom.entity.main.Organization


  }
 
  @RequiresPermissions(value={"User:edit", "User:save"}, logical=Logical.OR)
  @RequestMapping(value="/lookup2org", method={RequestMethod.GET})
  public String lookup(Map<String, Object> map) {
    Organization org = organizationService.getTree();
   
    map.put("org", org);
    return LOOK_ORG;
  }
View Full Code Here


  }
 
  @ModelAttribute("preloadOrg")
  public Organization preload(@RequestParam(value = "id", required = false) Long id) {
    if (id != null) {
      Organization organization = organizationService.get(id);
      organization.setParent(null);
      return organization;
    }
    return null;
  }
View Full Code Here

  }
 
  @RequiresPermissions("Organization:edit")
  @RequestMapping(value="/update/{id}", method=RequestMethod.GET)
  public String preUpdate(@PathVariable Long id, Map<String, Object> map) {
    Organization organization = organizationService.get(id);
   
    map.put("organization", organization);
    return UPDATE;
  }
View Full Code Here

 
  @Log(message="删除了{0}组织。")
  @RequiresPermissions("Organization:delete")
  @RequestMapping(value="/delete/{id}", method=RequestMethod.POST)
  public @ResponseBody String delete(@PathVariable Long id) {
    Organization organization = organizationService.get(id);
    try {
      organizationService.delete(id);
    } catch (ServiceException e) {
      return AjaxObject.newError("删除组织失败:" + e.getMessage()).setCallbackType("").toString();
    }
   
    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{organization.getName()}));
    return AjaxObject.newOk("删除组织成功!").setCallbackType("").toString();
  }
View Full Code Here

  }
 
  @RequiresPermissions("Organization:view")
  @RequestMapping(value="/tree", method={RequestMethod.GET, RequestMethod.POST})
  public String tree(Map<String, Object> map) {
    Organization organization = organizationService.getTree();
   
    map.put("organization", organization);
    return TREE;
  }
View Full Code Here

  @RequiresPermissions("Organization:assign")
  @RequestMapping(value="/create/organizationRole", method={RequestMethod.POST})
  public @ResponseBody void assignRole(OrganizationRole organizationRole) {
    organizationRoleService.saveOrUpdate(organizationRole);
   
    Organization organization = organizationService.get(organizationRole.getOrganization().getId());
    Role role = roleService.get(organizationRole.getRole().getId());
    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{organization.getName(), role.getName()}));
  }
View Full Code Here

  }
 
  @RequiresPermissions(value={"Organization:edit", "Organization:save"}, logical=Logical.OR)
  @RequestMapping(value="/lookupParent/{id}", method={RequestMethod.GET})
  public String lookup(@PathVariable Long id, Map<String, Object> map) {
    Organization organization  = organizationService.getTree();
   
    map.put("organization", organization);
    return LOOKUP_PARENT;
  }
View Full Code Here

   * @see com.ketayao.ketacustom.service.OrganizationService#saveOrUpdate(com.ketayao.ketacustom.entity.main.Organization
   */
  @Override
  public void saveOrUpdate(Organization organization) {
    if (organization.getId() == null) {
      Organization parentOrganization = organizationDAO.findOne(organization.getParent().getId());
      if (parentOrganization == null) {
        throw new NotExistedException("id=" + organization.getParent().getId() + "父组织不存在!");
      }
     
      if (organizationDAO.getByName(organization.getName()) != null) {
View Full Code Here

  public void delete(Long id) {
    if (isRoot(id)) {
      throw new NotDeletedException("不允许删除根组织。");
    }
   
    Organization organization = this.get(id);
   
    //先判断是否存在子模块,如果存在子模块,则不允许删除
    if(organization.getChildren().size() > 0){
      throw new NotDeletedException(organization.getName() + "组织下存在子组织,不允许删除。");
    }
   
    if (userDAO.findByOrganizationId(id).size() > 0) {
      throw new NotDeletedException(organization.getName() + "组织下存在用户,不允许删除。");
    }
   
    organizationDAO.delete(organization);
  }
View Full Code Here

TOP

Related Classes of com.ketayao.ketacustom.entity.main.Organization

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.