Package org.beangle.struts2.convention.route

Examples of org.beangle.struts2.convention.route.Action


  protected void addFlashErrorNow(String msgKey, Object... args) {
    getFlash().addErrorNow(getTextInternal(msgKey, args));
  }

  protected Flash getFlash() {
    Flash flash = (Flash) ActionContext.getContext().getSession().get("flash");
    if (null == flash) {
      flash = new Flash();
      ActionContext.getContext().getSession().put("flash", flash);
    }
    return flash;
  }
View Full Code Here


      ObjectFactory objectFactory) {
    this.configuration = configuration;
    this.objectFactory = objectFactory;
    this.defaultParentPackage = "beangle";
    if (objectFactory instanceof SpringObjectFactory) {
      beanNameFinder = new SpringBeanNameFinder();
      SpringObjectFactory sf = (SpringObjectFactory) objectFactory;
      sf.autoWireBean(beanNameFinder);
    }
  }
View Full Code Here

      ObjectFactory objectFactory) {
    this.configuration = configuration;
    this.objectFactory = objectFactory;
    this.defaultParentPackage = "beangle";
    if (objectFactory instanceof SpringObjectFactory) {
      beanNameFinder = new SpringBeanNameFinder();
      SpringObjectFactory sf = (SpringObjectFactory) objectFactory;
      sf.autoWireBean(beanNameFinder);
    }
  }
View Full Code Here

        updated.add(newCategory);
      }
    }
    if (duplicatedNames.size() > 0) {
      addFlashErrorNow("dictionary.error.duplicateCategoryName", StrUtils.join(duplicatedNames,","));
      return forward(new Action(this, "categories"));
    } else {
      entityDao.save(updated);
      return redirect("categories", "info.save.success");
    }
  }
View Full Code Here

    if (!error) {
      addFlashMessage("info.save.success");
      entityDao.saveOrUpdate(meta);
      return redirect("index");
    } else {
      return forward(new Action(this, "edit"));
    }
  }
View Full Code Here

   */
  protected String saveAndForward(Entity<?> entity) {
    User user = (User) entity;
    if (entityDao.duplicate(User.class, user.getId(), "name", user.getName())) {
      addFlashMessageNow("security.error.usernameNotAvaliable", user.getName());
      return forward(new Action(this, "edit"));
    }
    String errorMsg = "";
    // // 收集用户身份
    String[] categories = StringUtils.split(get("categoryIds"), ",");
    user.getCategories().clear();
    for (int i = 0; i < categories.length; i++) {
      errorMsg = checkCategory(user, Long.valueOf(categories[i]));
      if (StringUtils.isNotEmpty(errorMsg)) { return forward(new Action("edit"), errorMsg); }
    }
    // 检验用户合法性
    errorMsg = checkUser(user);
    if (StringUtils.isNotEmpty(errorMsg)) { return forward(new Action("edit"), errorMsg); }
    processPassword(user);
    if (!user.isPersisted()) {
      User creator = userService.get(getUserId());
      userService.createUser(creator, user);
    } else {
View Full Code Here

    String name = get("name");
    if (StringUtils.isNotBlank(name)) {
      User user = userService.get(name);
      if (null != user) {
        put("user", user);
        return forward(new Action((Class<?>) null, "dashboard", "&user.id=" + user.getId()));
      } else {
        return null;
      }
    } else {
      return super.info();
View Full Code Here

    }
    newResources.retainAll(mngResources);
    authorityService.authorize(mao, newResources);
    authorityManager.refreshGroupAuthorities(new GrantedAuthorityBean(mao.getName()));

    Action redirect = Action.to(this).method("edit");
    redirect.param("group.id", mao.getId()).param("menuProfileId", menuProfile.getId());
    String displayFreezen = get("displayFreezen");
    if (null != displayFreezen) {
      redirect.param("displayFreezen", displayFreezen);
    }
    return redirect(redirect, "info.save.success");
  }
View Full Code Here

        avatarBase.updateAvatar(getUsername(), files[0], type);
      } else {
        return forward("upload");
      }
    }
    return redirect(new Action(MyAction.class, "info"), "info.upload.success");
  }
View Full Code Here

      } else {
        addActionError("不支持的文件类型");
        return forward("info");
      }
    }
    return redirect(new Action(UserAction.class, "info", "&user.name=" + userName), "info.save.success");
  }
View Full Code Here

TOP

Related Classes of org.beangle.struts2.convention.route.Action

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.