Package com.ketayao.ketacustom.entity.main

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


  @RequiresUser
  @RequestMapping(value="", method=RequestMethod.GET)
  public String index(ServletRequest request, Map<String, Object> map) {
    ShiroUser shiroUser = SecurityUtils.getShiroUser();
   
    Module menuModule = getMenuModule(SecurityUtils.getSubject());

    map.put(SecurityConstants.LOGIN_USER, shiroUser.getUser());
    map.put("menuModule", menuModule);

    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{shiroUser.getLoginName()}));
View Full Code Here


    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{shiroUser.getLoginName()}));
    return INDEX;
  }
 
  private Module getMenuModule(Subject subject) {
    Module rootModule = moduleService.getTree();

    check(rootModule, subject);
    return rootModule;
  }
View Full Code Here

 
  @Log(message="添加了{0}模块。")
  @RequiresPermissions("Module:save")
  @RequestMapping(value="/create", method=RequestMethod.POST)
  public @ResponseBody String create(@Valid Module module) {
    Module parentModule = moduleService.get(module.getParent().getId());
    if (parentModule == null) {
      return AjaxObject.newError("添加模块失败:id=" + module.getParent().getId() + "的父模块不存在!").toString();
    }
   
    List<Permission> permissions = new ArrayList<Permission>();
View Full Code Here

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

 
  @Log(message="修改了{0}模块的信息。")
  @RequiresPermissions("Module:edit")
  @RequestMapping(value="/update", method=RequestMethod.POST)
  public @ResponseBody String update(@Valid Module module) {
    Module oldModule = moduleService.get(module.getId());
    oldModule.setName(module.getName());
    oldModule.setPriority(module.getPriority());
    oldModule.setDescription(module.getDescription());
    oldModule.setSn(module.getSn());
    oldModule.setUrl(module.getUrl());
    oldModule.setParent(module.getParent());
    oldModule.setClassName(module.getClassName());
   
    // 模块自定义权限,删除过后新增报错,会有validate的验证错误。hibernate不能copy到permission的值,导致。
    for (Permission permission : module.getPermissions()) {
      if (StringUtils.isNotBlank(permission.getSn())) {// 已选中的
        if (permission.getId() == null) {//新增
          permission.setModule(oldModule);
          oldModule.getPermissions().add(permission);
          permissionService.saveOrUpdate(permission);
        }
      } else {// 未选中的
        if (permission.getId() != null) {//删除
          for (Permission oldPermission : oldModule.getPermissions()) {
            if (oldPermission.getId().equals(permission.getId())) {
              oldPermission.setModule(null);
              permission = oldPermission;
              break;
            }
          }
          permissionService.delete(permission.getId());
          oldModule.getPermissions().remove(permission);
        }
      }
    }
   
    moduleService.saveOrUpdate(oldModule);
    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{oldModule.getName()}));
    return AjaxObject.newOk("修改模块成功!").toString();
  }
View Full Code Here

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

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

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

  }
 
  @RequiresPermissions("Module:view")
  @RequestMapping(value="/view/{id}", method={RequestMethod.GET})
  public String view(@PathVariable Long id, Map<String, Object> map) {
    Module module = moduleService.get(id);
   
    map.put("module", module);
    return VIEW;
  }
View Full Code Here

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

TOP

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

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.