Package org.beangle.struts2.convention.config

Examples of org.beangle.struts2.convention.config.SmartActionConfigBuilderTest$MyPackageConfig


   *
   * @param clazz
   * @return
   */
  public Action build(String className) {
    Profile profile = profileService.getProfile(className);
    Action action = new Action();
    StringBuilder sb = new StringBuilder();
    // namespace
    sb.append(profile.getUriPath());
    if (Constants.SHORT_URI.equals(profile.getUriPathStyle())) {
      String simpleName = className.substring(className.lastIndexOf('.') + 1);
      sb.append(StringUtils.uncapitalize(simpleName.substring(0, simpleName.length()
          - profile.getActionSuffix().length())));
    } else if (Constants.SIMPLE_URI.equals(profile.getUriPathStyle())) {
      sb.append(profile.getInfix(className));
    } else if (Constants.SEO_URI.equals(profile.getUriPathStyle())) {
      sb.append(StrUtils.unCamel(profile.getInfix(className)));
    } else {
      throw new RuntimeException("unsupported uri style " + profile.getUriPathStyle());
    }
    action.path(sb.toString()).method(profile.getDefaultMethod()).extention(profile.getUriExtension());
    return action;
  }
View Full Code Here


      switch (beanNames.length) {
      case 0:
        logger.warn("Cannot find bean definition for {}.", actionClass);
        break;
      case 1:
        Profile profile = actionBuilder.getProfileService().getProfile(actionClass.getName());
        Action action = actionBuilder.build(actionClass.getName());
        PackageConfig.Builder packageConfig = getPackageConfig(profile, packageConfigs, action,
            actionClass);
        if (createActionConfig(packageConfig, action, actionClass, beanNames[0])) {
          createCount++;
View Full Code Here

      throw new RuntimeException(e);
    }
  }

  public Profile getProfile(String className) {
    Profile matched = cache.get(className);
    if (null != matched) { return matched; }
    int index = -1;
    int patternLen = 0;
    for (Profile profile : profiles) {
      int newIndex = profile.matchedIndex(className);
View Full Code Here

  private List<Profile> buildProfiles(URL url, boolean isDefault) {
    List<Profile> myProfiles = CollectUtils.newArrayList();
    Properties props = getProperties(url);
    if (isDefault) {
      Profile profile = populatProfile(props, "default");
      myProfiles.add(profile);
    } else {
      int profileIndex = 0;
      while (true) {
        Profile profile = populatProfile(props, "profile" + profileIndex);
        if (null == profile) {
          break;
        } else {
          myProfiles.add(profile);
        }
View Full Code Here

    }
    return myProfiles;
  }

  private Profile populatProfile(Properties props, String name) {
    Profile profile = new Profile();
    profile.setName(name);
    String actionPattern = props.getProperty(profile.getName() + ".actionPattern");
    if (isEmpty(actionPattern)) { return null; }
    populateAttr(profile, "actionPattern", props);
    populateAttr(profile, "actionSuffix", props);
    populateAttr(profile, "viewPath", props);
    populateAttr(profile, "viewExtension", props);
View Full Code Here

   *
   * @param clazz
   * @return
   */
  public Action build(String className) {
    Profile profile = profileService.getProfile(className);
    Action action = new Action();
    StringBuilder sb = new StringBuilder();
    // namespace
    sb.append(profile.getUriPath());
    if (Constants.SHORT_URI.equals(profile.getUriPathStyle())) {
      String simpleName = className.substring(className.lastIndexOf('.') + 1);
      sb.append(StringUtils.uncapitalize(simpleName.substring(0, simpleName.length()
          - profile.getActionSuffix().length())));
    } else if (Constants.SIMPLE_URI.equals(profile.getUriPathStyle())) {
      sb.append(profile.getInfix(className));
    } else if (Constants.SEO_URI.equals(profile.getUriPathStyle())) {
      sb.append(StrUtils.unCamel(profile.getInfix(className)));
    } else {
      throw new RuntimeException("unsupported uri style " + profile.getUriPathStyle());
    }
    action.path(sb.toString()).method(profile.getDefaultMethod()).extention(
        profile.getUriExtension());
    return action;
  }
View Full Code Here

      switch (beanNames.length) {
      case 0:
        logger.warn("Cannot find bean definition for {}.", actionClass);
        break;
      case 1:
        Profile profile = actionBuilder.getProfileService().getProfile(
            actionClass.getName());
        Action action = actionBuilder.build(actionClass.getName());
        PackageConfig.Builder packageConfig = getPackageConfig(profile, packageConfigs,
            action, actionClass);
        if(createActionConfig(packageConfig, action, actionClass, beanNames[0])){
View Full Code Here

      switch (beanNames.length) {
      case 0:
        logger.warn("Cannot find bean definition for {}.", actionClass);
        break;
      case 1:
        Profile profile = actionBuilder.getProfileService().getProfile(actionClass.getName());
        Action action = actionBuilder.build(actionClass.getName());
        PackageConfig.Builder packageConfig = getPackageConfig(profile, packageConfigs, action,
            actionClass);
        if (createActionConfig(packageConfig, action, actionClass, beanNames[0])) {
          createCount++;
View Full Code Here

      throw new RuntimeException(e);
    }
  }

  public Profile getProfile(String className) {
    Profile matched = cache.get(className);
    if (null != matched) { return matched; }
    int index = -1;
    int patternLen = 0;
    for (Profile profile : profiles) {
      int newIndex = profile.matchedIndex(className);
View Full Code Here

  private List<Profile> buildProfiles(URL url, boolean isDefault) {
    List<Profile> myProfiles = CollectUtils.newArrayList();
    Properties props = getProperties(url);
    if (isDefault) {
      Profile profile = populatProfile(props, "default");
      myProfiles.add(profile);
    } else {
      int profileIndex = 0;
      while (true) {
        Profile profile = populatProfile(props, "profile" + profileIndex);
        if (null == profile) {
          break;
        } else {
          myProfiles.add(profile);
        }
View Full Code Here

TOP

Related Classes of org.beangle.struts2.convention.config.SmartActionConfigBuilderTest$MyPackageConfig

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.