}
// list of original author/editors associated with the citation
List<Person> currentPersons = getPeople(citation);// citation.getAuthors();
Person author_editor = (Person) command;
if (request.getParameter("method") != null) {
String id = request.getParameter("id");
if (request.getParameter("method").equals(ACTION_DELETE)) {
for (Person person : currentPersons) {
if (person.getId().equals(Long.parseLong((id)))) {
currentPersons.remove(person);
break;
}
}
request.getSession().setAttribute(
"messages",
getMessageSourceAccessor().getMessage(provideDeleteMessageParameter()));
} else if (request.getParameter("method").equals(ACTION_INSERT)) {
currentPersons.add(mPersonService.findByID(Long.parseLong(id)));
request.getSession().setAttribute(
"messages",
getMessageSourceAccessor().getMessage(provideAddMessageParameter()));
}
setPeople(citation, currentPersons);// citation.setAuthors(people);
mCitationService.update(citation); // update the author list in database
return new ModelAndView("redirect:/user/authorSearchForm.html");
} else if (request.getParameter(ACTION_SUBMIT) != null) {
String lastName = author_editor.getLastName().trim();
if (lastName.length() == 0) {
request.getSession().setAttribute("messages", "Please provide last name!");
return new ModelAndView("redirect:/user/authorSearchForm.html");
} else {
// Put the last name in session scope an control should go to another page