return "message";
} else if (Params.REGISTER.PRODUCT.LICENSES.TRIAL_LICENSE.equals(productType)) {
// The user choose a trial license
try {
LOGGER.debug("adding user in DB");
User newUser = ServiceFactory.getRegistrationService().registerTrialUser(r.getUser(), null);
LOGGER.debug("user has been registered send mail to check mail");
ServiceFactory.getRegistrationService().sendEmailVerification(newUser);
request.setAttribute(Params.REGISTER.FINISH.REQUEST.FINISH_OK, Boolean.TRUE);
forward = "account.register.showFinishForm";
} catch (RegistrationException e) {
// Ajout de license impossible
request.setAttribute(Params.GENERAL.REQUEST.ERROR_TITLE, "Trial license Error");
request.setAttribute(Params.GENERAL.REQUEST.ERROR_DETAIL, e.getMessage());
forward = "woj.error";
}
} else if (Params.REGISTER.PRODUCT.LICENSES.PERSONAL_LICENSE.equals(productType)) {
// The user chose a personal license
if (!"true".equals(request.getParameter(Params.REGISTER.PRODUCT.VALIDATE.PARAMS.CONFIRM_PERSONAL))) {
request.setAttribute(Params.REGISTER.PRODUCT.SHOW.REQUEST.ERROR, "registration.product-form.error.accept.personal.conditions.required");
return "account.register.showProductFormAction";
}
String userId = (String)request.getSession().getAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID);
if (userId == null) {
// Creating mode
try {
LOGGER.debug("adding user "+r.getUser()+" in DB");
User newUser = ServiceFactory.getRegistrationService().registerPersonalUser(r.getUser());
LOGGER.debug("user "+newUser+" has been registered send mail to check mail");
ServiceFactory.getRegistrationService().sendEmailVerification(newUser);
request.setAttribute(Params.REGISTER.FINISH.REQUEST.FINISH_OK, Boolean.TRUE);
forward = "account.register.showFinishForm";
request.getSession().setAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID, String.valueOf(newUser.getId()));
} catch (RegistrationException e) {
// Ajout de license impossible
request.setAttribute(Params.GENERAL.REQUEST.ERROR_TITLE, "Personal license Error");
request.setAttribute(Params.GENERAL.REQUEST.ERROR_DETAIL, e.getMessage());
forward = "woj.error";
}
} else {
// Modifying mode
UserImpl modifiedUser = (UserImpl) r.getUser();
LOGGER.debug("Updating user "+modifiedUser);
ServiceFactory.getLicenseService().addPersonalLicense(modifiedUser);
}
} else if (Params.REGISTER.PRODUCT.LICENSES.COMMUNITY_LICENSE.equals(productType)) {
// The user chose a community license
if (!"true".equals(request.getParameter(Params.REGISTER.PRODUCT.VALIDATE.PARAMS.CONFIRM_COMMUNITY))) {
request.setAttribute(Params.REGISTER.PRODUCT.SHOW.REQUEST.ERROR, "registration.product-form.error.accept.community.conditions.required");
return "account.register.showProductFormAction";
}
String projectHome = f.getString(Params.REGISTER.PRODUCT.VALIDATE.PARAMS.COMMUNITY_PROJECT_HOME);
if (StringUtils.isBlank(projectHome)) {
request.setAttribute(Params.REGISTER.PRODUCT.SHOW.REQUEST.ERROR, "registration.product-form.error.project.home.page.required");
return "account.register.showProductFormAction";
}
String userId = (String)request.getSession().getAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID);
if (userId == null) {
// Creating mode
try {
LOGGER.debug("adding user "+r.getUser()+" in DB");
User newUser = ServiceFactory.getRegistrationService().registerCommunityUser(r.getUser(), projectHome);
LOGGER.debug("user "+newUser+" has been registered send mail to check mail");
ServiceFactory.getRegistrationService().sendEmailVerification(newUser);
request.setAttribute(Params.REGISTER.FINISH.REQUEST.FINISH_OK, Boolean.TRUE);
forward = "account.register.showFinishForm";
request.getSession().setAttribute(Params.REGISTER.SESSION.CURRENT_USER_ID, String.valueOf(newUser.getId()));
} catch (RegistrationException e) {
// Ajout de license impossible
request.setAttribute(Params.GENERAL.REQUEST.ERROR_TITLE, "Community license Error");
request.setAttribute(Params.GENERAL.REQUEST.ERROR_DETAIL, e.getMessage());
forward = "woj.error";