* @return
*/
private static ActionConfigBean parseDefaultActionConfig(String methodName, String moduleName) {
String uriMapping = null;
String httpMethod = null;
ActionConfigBean acb = new ActionConfigBean();
if (ActionMethod.INDEX.equals(methodName)) {
uriMapping = "/";
httpMethod = HttpMethod.GET;
ResultConfigBean rcb = new ResultConfigBean();
rcb.setName("jsp");
rcb.setLocation(moduleName + "/view/index.jsp");
acb.getResult().add(rcb);
ResultConfigBean rcb2 = new ResultConfigBean();
rcb2.setName("html");
rcb2.setType(RenderType.FREEMARKER);
rcb2.setLocation(moduleName + "/view/index.html");
acb.getResult().add(rcb2);
} else if (ActionMethod.CREATE.equals(methodName)) {
uriMapping = "/";
httpMethod = HttpMethod.POST;
ResultConfigBean rcb = new ResultConfigBean();
rcb.setName(ActionMethod.INDEX);
rcb.setLocation(moduleName);
rcb.setType(RenderType.ACTION);
acb.getResult().add(rcb);
} else if (ActionMethod.UPDATE.equals(methodName)) {
uriMapping = "/{id}";
httpMethod = HttpMethod.PUT;
ResultConfigBean rcb = new ResultConfigBean();
rcb.setName(ActionMethod.INDEX);
rcb.setLocation(moduleName);
rcb.setType(RenderType.ACTION);
acb.getResult().add(rcb);
} else if (ActionMethod.SHOW.equals(methodName)) {
uriMapping = "/{id}";
httpMethod = HttpMethod.GET;
ResultConfigBean rcb = new ResultConfigBean();
rcb.setName("jsp");
rcb.setLocation(moduleName + "/view/show.jsp");
acb.getResult().add(rcb);
ResultConfigBean rcb2 = new ResultConfigBean();
rcb2.setName("html");
rcb2.setType(RenderType.FREEMARKER);
rcb2.setLocation(moduleName + "/view/show.html");
acb.getResult().add(rcb2);
} else if (ActionMethod.EDIT.equals(methodName)) {
uriMapping = "/{id}/edit";
httpMethod = HttpMethod.GET;
ResultConfigBean rcb = new ResultConfigBean();
rcb.setName("jsp");
rcb.setLocation(moduleName + "/view/edit.jsp");
acb.getResult().add(rcb);
ResultConfigBean rcb2 = new ResultConfigBean();
rcb2.setName("html");
rcb2.setType(RenderType.FREEMARKER);
rcb2.setLocation(moduleName + "/view/edit.html");
acb.getResult().add(rcb2);
} else if (ActionMethod.DESTROY.equals(methodName)) {
uriMapping = "/{id}";
httpMethod = HttpMethod.DELETE;
ResultConfigBean rcb = new ResultConfigBean();
rcb.setName(ActionMethod.INDEX);
rcb.setLocation(moduleName);
rcb.setType(RenderType.ACTION);
acb.getResult().add(rcb);
} else if (ActionMethod.NEW.equals(methodName)) {
uriMapping = "/new";
httpMethod = HttpMethod.GET;
ResultConfigBean rcb = new ResultConfigBean();
rcb.setName("jsp");
rcb.setLocation(moduleName + "/view/new.jsp");
acb.getResult().add(rcb);
ResultConfigBean rcb2 = new ResultConfigBean();
rcb2.setName("html");
rcb2.setType(RenderType.FREEMARKER);
rcb2.setLocation(moduleName + "/view/new.html");
acb.getResult().add(rcb2);
} else {
acb = null;
}
if (acb != null) {
acb.setHttpMethod(httpMethod);
acb.setUriMapping(uriMapping);
}
return acb;
}