* @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;
}