public static void create() throws Exception {
ObjectType type = ObjectType.get(getControllerClass());
notFoundIfNull(type);
Constructor<?> constructor = type.entityClass.getDeclaredConstructor();
constructor.setAccessible(true);
Model object = (Model) constructor.newInstance();
Binder.bindBean(params.getRootParamNode(), "object", object);
validation.valid(object);
if (validation.hasErrors()) {
renderArgs.put("error", play.i18n.Messages.get("crud.hasErrors"));
try {
render(request.controller.replace(".", "/") + "/blank.html", type, object);
} catch (TemplateNotFoundException e) {
render("CRUD/blank.html", type, object);
}
}
object._save();
flash.success(play.i18n.Messages.get("crud.created", type.modelName));
if (params.get("_save") != null) {
redirect(request.controller + ".list");
}
if (params.get("_saveAndAddAnother") != null) {
redirect(request.controller + ".blank");
}
redirect(request.controller + ".show", object._key());
}