@RequestMapping(value = URL_PROFILE_ADDTAG, method = RequestMethod.POST) public ModelAndView addTag( @ModelAttribute(COMMAND_TAG) @Valid Tool tool, BindingResult result, Locale locale) { if (result.hasErrors()) { // basic validation fails ModelAndView modelAndView = constructModelAndView(tool, locale); modelAndView.addObject(COMMAND_TAG, tool); return modelAndView; } if (profileService.isKnownTag(tool.getTagName())) { profileService.storeTag(tool.getTagName()); ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA)); return modelAndView; } else if (tool.getTagName().equals(tool.getPreviousTagName())) { profileService.storeTag(tool.getTagName()); ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA)); return modelAndView; } else { List<String> alternatives = profileService.searchForTags(tool.getTagName(), locale); ModelAndView modelAndView = constructModelAndView(tool, locale); modelAndView.addObject(COMMAND_TAG, tool); modelAndView.addObject("alternatives", alternatives); tool.setPreviousTagName(tool.getTagName()); return modelAndView; } }
@RequestMapping(value = URL_PROFILE_ADDTAG + "/{tagName}", method = RequestMethod.GET) public ModelAndView addTag(Locale locale, @PathVariable String tagName) { profileService.storeTag(tagName); ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA)); return modelAndView; }
@RequestMapping(value = URL_ACCOUNT_VITEA, method = RequestMethod.GET) public ModelAndView vitea(Locale locale) { MyProfessionalProfile myProfessionalProfile = profileService.retrieveMyProfessionalProfile(); ModelAndView modelAndView = constructModelAndView(myProfessionalProfile, locale); modelAndView.addObject(COMMAND_VITEA, myProfessionalProfile); return modelAndView; }
@RequestMapping(value = URL_ACCOUNT_PROFILE, method = RequestMethod.GET) public ModelAndView jobSearchProfile(Locale locale) { JobSearchProfile jobSearchProfile = profileService.retrieveProfile(locale); ModelAndView modelAndView = constructModelAndView(jobSearchProfile, locale); modelAndView.addObject(COMMAND, jobSearchProfile); return modelAndView; }
@RequestMapping(value = "/profile/language/{language}", method = RequestMethod.GET) public ModelAndView editLanguage(@PathVariable String language, Locale locale) { LanguageSkill languageSkill = profileService.retrieveLanguageSkill(language, locale); ModelAndView modelAndView = constructModelAndView(languageSkill, locale); modelAndView.addObject(COMMAND_LANGUAGE, languageSkill); return modelAndView; }
@RequestMapping(value = "/profile/education/{id}", method = RequestMethod.GET) public ModelAndView editEducation(@PathVariable Long id, Locale locale) { Education addEducation = profileService.retrieveEducations(id, locale); ModelAndView modelAndView = constructModelAndView(addEducation, locale); modelAndView.addObject(COMMAND_EDUCATION, addEducation); return modelAndView; }
@RequestMapping(value = "/profile/workexperience/{id}", method = RequestMethod.GET) public ModelAndView editWorkExperience(@PathVariable Long id, Locale locale) { WorkExperience addWorkExperience = profileService.retrieveWorkExperiences(id, locale); ModelAndView modelAndView = constructModelAndView(addWorkExperience, locale); modelAndView.addObject( AddWorkExperienceController.COMMAND_ADD_WORK_EXPERIENCE, addWorkExperience); return modelAndView; }
@RequestMapping(value = URL_PROFILE_ADDLANGUAGE, method = RequestMethod.POST) public ModelAndView addLanguage( @ModelAttribute(COMMAND_LANGUAGE) @Valid LanguageSkill addWorkExperience, BindingResult result, Locale locale) { if (result.hasErrors()) { // basic validation fails ModelAndView modelAndView = constructModelAndView(addWorkExperience, locale); modelAndView.addObject(COMMAND_LANGUAGE, addWorkExperience); return modelAndView; } profileService.storeLanguageSkill(addWorkExperience); ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA)); return modelAndView; }
@RequestMapping(value = URL_PROFILE_ADDEDUCATION, method = RequestMethod.POST) public ModelAndView addEducation( @ModelAttribute(COMMAND_EDUCATION) @Valid Education education, BindingResult result, Locale locale) { if (result.hasErrors()) { // basic validation fails ModelAndView modelAndView = constructModelAndView(education, locale); modelAndView.addObject(COMMAND_EDUCATION, education); return modelAndView; } profileService.storeEducation(education); ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA)); return modelAndView; }
@RequestMapping(value = "/profile/language/{language}", method = RequestMethod.POST) public ModelAndView editLanguage( @ModelAttribute(COMMAND_LANGUAGE) @Valid LanguageSkill languageSkill, BindingResult result, Locale locale) { if (result.hasErrors()) { // basic validation fails ModelAndView modelAndView = constructModelAndView(languageSkill, locale); modelAndView.addObject(COMMAND_LANGUAGE, languageSkill); return modelAndView; } profileService.storeLanguageSkill(languageSkill); ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA)); return modelAndView; }
@RequestMapping(value = URL_ACCOUNT_PROFILE, method = RequestMethod.POST) public ModelAndView jobSearchProfile( @ModelAttribute(COMMAND) @Valid JobSearchProfile jobSearchProfile, BindingResult result, Locale locale) { if (result.hasErrors()) { // basic validation fails ModelAndView modelAndView = constructModelAndView(jobSearchProfile, locale); modelAndView.addObject(COMMAND, jobSearchProfile); return modelAndView; } profileService.storeProfile(jobSearchProfile, locale); ModelAndView modelAndView = constructModelAndView(jobSearchProfile, locale); modelAndView.addObject(COMMAND, jobSearchProfile); modelAndView.addObject(STORED, true); return modelAndView; }
@RequestMapping(value = URL_ACCOUNT_VITEA, method = RequestMethod.POST) public ModelAndView vitea( @ModelAttribute(COMMAND_VITEA) @Valid MyProfessionalProfile myProfessionalProfile, BindingResult result, Locale locale) { if (result.hasErrors()) { // basic validation fails ModelAndView modelAndView = constructModelAndView(myProfessionalProfile, locale); modelAndView.addObject(COMMAND, myProfessionalProfile); return modelAndView; } profileService.storeMyProfessionalProfile(myProfessionalProfile); ModelAndView modelAndView = constructModelAndView(myProfessionalProfile, locale); modelAndView.addObject(COMMAND, myProfessionalProfile); modelAndView.addObject(STORED, true); return modelAndView; }
@RequestMapping(value = "/profile/workexperience/{id}", method = RequestMethod.POST) public ModelAndView editWorkExperience( @ModelAttribute(AddWorkExperienceController.COMMAND_ADD_WORK_EXPERIENCE) @Valid WorkExperience addWorkExperience, BindingResult result, Locale locale) { if (result.hasErrors()) { // basic validation fails ModelAndView modelAndView = constructModelAndView(addWorkExperience, locale); modelAndView.addObject( AddWorkExperienceController.COMMAND_ADD_WORK_EXPERIENCE, addWorkExperience); return modelAndView; } profileService.storeWorkExperience(addWorkExperience); ModelAndView modelAndView = new ModelAndView(new RedirectView(URL_ACCOUNT_VITEA)); return modelAndView; }
private List<WorkExperience> constructAllWorkExperiences(Locale locale) { List<WorkExperience> result = profileService.retrieveWorkExperiences(locale); return result; }
private Object constructAllEducations(Locale locale) { List<Education> result = profileService.retrieveEducations(locale); return result; }