@RequestMapping("/register-view")
public String doRegisterView(
@PrefParam String categoryCode, @PrefParam String templateCode,
@ModelAttribute @Valid RegisterBean registerBean, BindingResult result,
@RequestAttr Site site, Model model, WebRequest request) {
ProjectCategory category = categoryService.getProjectCategory(site, categoryCode);
//
Template template = templateService.getTemplate(category.getId(), templateCode);
List<ProjectFeature> modules = ModuleUtil.parseToModules(template.getContent());
Project project = new Project();
// set project category
project.setCategory(category);
// set features
project.setFeatures(modules);
// set default role to features
for(ProjectFeature feature : modules) {
Role role = roleService.getRole(feature.getRoleCode(), category.getId());
feature.setRole(role);
}
request.setAttribute(AttributeKeys.PROJECT_KEY, project, WebRequest.SCOPE_SESSION);
model.addAttribute(AttributeKeys.USER_KEY_READABLE, registerBean);
return "system/user-register";