From fe73c608a36850e43fd89701e559ac4e94e643df Mon Sep 17 00:00:00 2001 From: Frederic Debuire Date: Sat, 16 Feb 2008 22:32:30 +0000 Subject: [PATCH] =?UTF-8?q?YACOSTest:=20Correction=20du=20=C3=A0=20l'ajout?= =?UTF-8?q?=20de=20abstractText=20dans=20article=20YACOSWeb:=20Modificatio?= =?UTF-8?q?n=20d'un=20article=20qui=20marche=20(r=C3=A9envoie=20d'un=20fic?= =?UTF-8?q?hier=20ou=20pas)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WebContent/WEB-INF/jsp/manageArticle.jsp | 2 +- .../WEB-INF/jsp/submissionArticle.jsp | 140 ++++++------ .../WebContent/images/cc-kedit-128x128.png | Bin 0 -> 10025 bytes .../author/controller/SArticleController.java | 177 ++++++++++------ .../controller/AddConferenceController.java | 199 +++++++++--------- 5 files changed, 285 insertions(+), 233 deletions(-) create mode 100644 YACOSWeb/WebContent/images/cc-kedit-128x128.png diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp index ed1c8b4..1261e7f 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/manageArticle.jsp @@ -33,7 +33,7 @@ ">Download - ">Modify + ">Modify Delete diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp index e9cf92e..06f82cc 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp @@ -1,75 +1,79 @@ -<%@ include file="/WEB-INF/decorators/include.jsp"%> - - - - - - - - - - -

- +<%@ include file="/WEB-INF/decorators/include.jsp"%> + + + + + + + + + + +

- -

- - -
- -

- -

- -

- -

- -
-
- -

- : ${currentUser.firstName} ${currentUser.lastName} -

- - - "> - -
-
- -
- - -
${secAuthor}
-
-
-
- "/> - -

-
-
-
-
-
- File - - -

- "/> - "/>

-
+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
:${currentUser.firstName} ${currentUser.lastName}
+ "> + +
+
+ + +
${secAuthor}
+
+
+
+ " />
File
 " /> + " />
+
- -">Home - - - - + +">Home + + + + diff --git a/YACOSWeb/WebContent/images/cc-kedit-128x128.png b/YACOSWeb/WebContent/images/cc-kedit-128x128.png new file mode 100644 index 0000000000000000000000000000000000000000..e2f2cc2445b72cbafe3056e56f8fa3ccd52e5674 GIT binary patch literal 10025 zcmW++1ymGW8y=PgmR=g9mJTWDW+^E_K#(qJq@=qA2`Oo55Tv^s1nHKL?r!P&_xtCZ znS17*xp$r$@B6%Q!&Oz}urXd>004lkATOhiC+4-9d{k>FF+W6sbU{AA z4hqxz*m`hKQ(raPQfYYdqN1x06_cDe3a^mCL?KCz0)H~wG{33hcu(lAy`_0{IO>t^ zWl42&Nl8g_i7xx%$;H51i`TDvZzHb_TRrelO8!x&gFNSq@LcY55v?T`dF*8pEY{_>7O$Vjx zEp}1Bj=RIMXBJhFo}4X4K6*dfw`AiNv1zEOp+^ho+UwC-j~gAWx$W&wdpnul90SG7 z9@5`1Jp51oDji?^RAf36Bn@T1kK+gEua>wfA87h2ym23crN39So)0brcda&L`aj*u z@Rw=AT9Fix2w!Fpn{mg!kz~U$-MDgQwOjdSt$ssl)0Fg1Y=@Mb+|qEzzmpQ?BP3>RVecg7ELwd%#pkR99uu z*@^3dc8m4P;$qs6&YcT2Ev>NPVn9fx(qW~2fl&5#REe{#79&UiS`>ie(J}3ixni$O z@Afmit=45cnb^mmexe!C_*fDmDV$;90syXa=e{WniJ6#&xH%zr!lSh=(g}|s{rdC$o>gkae7ZY!RzkU10?%+A3XFtVj zmq^em+5c*rdEWAJq366i^-^nPdAgZ#xBp(7?X|nRz;^+M*HgUeMTGC(y^|FR%w=Yu zHS&M7llr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kVtF=X2if?=Xgnk~^b65Mos;vyn9m?L! z3`EJwH38Z`(#ElqQM)RSh!V7kO8EiA83VjYF1xV=C+oyVt*mOfKg^2L2w|OmmA?w|OTkU?bJSZ|(~8{Nm=hU=94ki?Tr5sV;2RN6*94*FW4X zG0DWFR#>PI&DQE|mB>nGozfrmIoDyqbYAZF$S1stJKccclv)8B7kBsM%i#V_z(#mP zJM~Pf$mj1ktB`ZwuWF4Q=$_C4lI9lhr1!MOm|A5u{?6RH8A4N;J0Z~e@%Xf2?C#||R=5fsJjod-{KO3JO5UrRLj4JL6o+suMYFt$_CH86oI*6jEGslzF) zUcx?hRM*! z5!Z%E#{8&?Eiv&ZItHw6}5XxLd+emDL z6sb_e-CH=!b4&(ah;3l>T#j5GiW0kcG~vsQ`X(Ja3X#xHQgT@KR_S-R2lw7qbRBYY z6om6u@8DQ!X=M<#FV@s-$7h`Ew2xpsKV2)I9lq;zN7wv@3^6@TWis>`xRCoDZGJdW z%933KF&JpWR31Uj?)N^{*<5P;RXXbax~U}(GXM!CBZi#0+}(Z6*`&I1ETeKUFP&)n z*eb%s>lIA<*kSUiX23RVTV!^)gZ$XNW_2m^;CmBG*0A831%G+=&hRPL&>B8t-FAPb zk^n7l;CKz?!M;Zh%PMMc8p@Y~#^suo41$gw(>>Yai|8j>+D_#fq}67k_F+`1I2HE} zPI@XQrbv;zc}EEnG`NXnOJMBL>99Tw(nId!`m?ebN7Ma7w%4 z?YBY)KCEb2f1(eGm4aYieAWs?hhdWr2U*nhg#w~*;0s83-kX`+@C_0k;17tjLMa2G zE@P1c=-uvB%qs->?;En40o6*$RiuYG;XvH+RDb7nwmLf^Kr{dFc`>eQ8#J0Y5UTW( z14xh7s0z&fwvwP~?3+fk^2lEDvI3Nik?@Dn8P;!H^QgZgeR*lhr2JW`qVnQ|%Pp#K5)!{ONg literal 0 HcmV?d00001 diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java index 22ac994..9638dd9 100644 --- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java +++ b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java @@ -41,9 +41,10 @@ public class SArticleController extends SimpleFormController { Conference conf = SessionService.getInstance().getCurrentConference(); // Fetching user User user = SessionService.getInstance().getCurrentUser(); - + String title = ((FormSubmission) command).getTitle(); String theme = ((FormSubmission) command).getTheme(); + String abstractText = ((FormSubmission) command).getAbstractText(); ArrayList listSecondaryAuthor = new ArrayList(); // Removes null entries from the list @@ -52,63 +53,114 @@ public class SArticleController extends SimpleFormController { listSecondaryAuthor.add(sAuthor); } } - - String nomFile=""; - - try { - MultipartFile file = ((FormSubmission) command).getFile(); - if (file == null || file.isEmpty()) { - errors.rejectValue("file", "form.submitArticle.noFile"); - try { - return showForm(request, response, errors); - } catch (Exception e) { - e.printStackTrace(); - } - } - else { - - // Creates the article - Article newArticle = articleManager.addArticle( - title, theme, nomFile, user.getLogin(), - listSecondaryAuthor, Article.State.SUBMITED, conf.getId()); - - if(newArticle==null){ - errors.reject("article.errors.didNotSave"); + + String action = request.getParameter("action"); + if (action == null || action.equals("")) + { + + String nomFile=""; + + try { + MultipartFile file = ((FormSubmission) command).getFile(); + if (file == null || file.isEmpty()) { + errors.rejectValue("file", "form.submitArticle.noFile"); try { return showForm(request, response, errors); } catch (Exception e) { e.printStackTrace(); } } - - byte b[] = file.getBytes(); - - String path = "conference"+conf.getId()+"/"; - (new File(downloadDirPath+path)).mkdirs(); - path += newArticle.getId()+"_"+file.getOriginalFilename(); - File uploadedFile = new File(downloadDirPath+path); - - FileOutputStream fos = new FileOutputStream(uploadedFile); + else { - fos.write(b); - fos.close(); - - newArticle.setURL_article(path); - articleManager.updateArticle(newArticle); + // Creates the article + Article newArticle = articleManager.addArticle( + title, theme, abstractText, nomFile, user.getLogin(), + listSecondaryAuthor, Article.State.SUBMITED, conf.getId()); + + if(newArticle==null){ + errors.reject("article.errors.didNotSave"); + try { + return showForm(request, response, errors); + } catch (Exception e) { + e.printStackTrace(); + } + } + + byte b[] = file.getBytes(); + + String path = "conference"+conf.getId()+"/"; + (new File(downloadDirPath+path)).mkdirs(); + path += newArticle.getId()+"_"+file.getOriginalFilename(); + File uploadedFile = new File(downloadDirPath+path); + + FileOutputStream fos = new FileOutputStream(uploadedFile); + + fos.write(b); + fos.close(); + + newArticle.setURL_article(path); + articleManager.updateArticle(newArticle); + } } + catch (FileNotFoundException e) { + System.out.println(e); + } catch (IOException e) { + System.out.println(e); + } + + // The role author might have been added, refresh the credentials + SessionService.getInstance().refreshAuthentication(); } - catch (FileNotFoundException e) { - System.out.println(e); - } catch (IOException e) { - System.out.println(e); + else if (action.equals("modify")) { + String articleID = request.getParameter("articleID"); + + try { + Integer id = new Integer(articleID); + + // TODO : vérifier que l'id de l'article appartient à l'auteur... vive les GET... + + Article old = articleManager.getArticle(id); + old.setTitle(title); + old.setTopic(theme); + old.setSecondaryAuthors(listSecondaryAuthor); + old.setAbstractText(abstractText); + + MultipartFile file = ((FormSubmission) command).getFile(); + if (file == null || file.isEmpty()) { + articleManager.updateArticle(old); + } + else { + byte b[] = file.getBytes(); + + String path = "conference"+conf.getId()+"/"; + (new File(downloadDirPath+path)).mkdirs(); + path += old.getId()+"_"+file.getOriginalFilename(); + File uploadedFile = new File(downloadDirPath+path); + + FileOutputStream fos = new FileOutputStream(uploadedFile); + + fos.write(b); + fos.close(); + + old.setURL_article(path); + articleManager.updateArticle(old); + } + } catch (NumberFormatException e) { + throw new ModelAndViewDefiningException(new ModelAndView("404error")); + } catch (FileNotFoundException e) { + System.out.println(e); + } catch (IOException e) { + System.out.println(e); + } + } - - // The role author might have been added, refresh the credentials - SessionService.getInstance().refreshAuthentication(); - + else { + throw new ModelAndViewDefiningException(new ModelAndView("404error")); + } + return new ModelAndView(new RedirectView(getSuccessView())); } - + protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException { String action = request.getParameter("action"); if (action == null || action.equals("")) @@ -117,44 +169,41 @@ public class SArticleController extends SimpleFormController { return myArticle; } else if (action.equals("modify")) { - + String articleID = request.getParameter("articleID"); - + try { Integer id = new Integer(articleID); - + // TODO : vérifier que l'id de l'article appartient à l'auteur... vive les GET... - + Article a = articleManager.getArticle(id); - + if (a == null) throw new ModelAndViewDefiningException(new ModelAndView("denied", "message", getMessageSourceAccessor().getMessage("submission.modify.denied"))); + + FormSubmission myArticle = new FormSubmission(); - FormSubmission myArticle = new FormSubmission(); - - - // FIXME : stocker l'abstract texte ds la BDD... et le récup après... - //myArticle.setAbstractText(); - + myArticle.setAbstractText(a.getAbstractText()); myArticle.setTitle(a.getTitle()); myArticle.setListe(a.getSecondaryAuthors()); myArticle.setTheme(a.getTopic()); - + request.getSession().setAttribute("listSecondaryAuthors", a.getSecondaryAuthors()); - + return myArticle; - + } catch (NumberFormatException e) { throw new ModelAndViewDefiningException(new ModelAndView("404error")); } - + } else { throw new ModelAndViewDefiningException(new ModelAndView("404error")); } - + } public IArticleManager getArticleManager() { @@ -164,11 +213,11 @@ public class SArticleController extends SimpleFormController { public void setArticleManager(IArticleManager articleManager) { this.articleManager = articleManager; } - + public String getDownloadDirPath() { return downloadDirPath; } - + public void setDownloadDirPath(String downloadDirPath) { this.downloadDirPath = downloadDirPath; } diff --git a/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java b/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java index b6a23bc..791087f 100644 --- a/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java +++ b/YACOSWeb/src/org/yacos/web/chairman/controller/AddConferenceController.java @@ -41,7 +41,7 @@ public class AddConferenceController extends AbstractWizardFormController { private IConferenceManager conferenceManager; private IUserManager userManager; - + private IEvaluationManager evaluationManager; public IEvaluationManager getEvaluationManager() { @@ -139,7 +139,7 @@ public class AddConferenceController extends AbstractWizardFormController { public List getUsersAdded() { return listPersonAdded; } - + public List getInvitation(){ return listInvitations; } @@ -148,16 +148,16 @@ public class AddConferenceController extends AbstractWizardFormController { email = email.toLowerCase(); Pattern emailPattern = Pattern.compile("^[a-z0-9._-]+@[a-z0-9._-]{2,}[.][a-z]{2,4}$"); // Regex Matcher emailMatcher = emailPattern.matcher(email); - + if(!emailMatcher.matches()){ return false; } - + listInvitations.add(email); - + return true; } - + public void removeInvitations(List emailList){ for(String email : emailList){ listInvitations.remove(email); @@ -172,7 +172,7 @@ public class AddConferenceController extends AbstractWizardFormController { private Set criteria; private Set criteriaAll; - + public Set getCriteriaAll() { return criteriaAll; } @@ -180,7 +180,7 @@ public class AddConferenceController extends AbstractWizardFormController { public Set getCriteriaAdded() { return criteria; } - + public CriterionBean getTrueCriteria(int id) { for (CriterionBean cb : criteriaAll) { if (cb.getId() == id){ @@ -193,15 +193,15 @@ public class AddConferenceController extends AbstractWizardFormController { return cb; } } - + return null; } - + public void setCriterionClick(CriterionBean c) { if (c.getId() == -1) { c.setId(getNextId()); } - + criteria.remove(c); criteria.add(c); } @@ -212,18 +212,18 @@ public class AddConferenceController extends AbstractWizardFormController { } CriterionBean trueCriteria = getTrueCriteria(c.getId()); - + criteria.remove(trueCriteria); criteria.add(trueCriteria); criteriaAll.remove(trueCriteria); } public void deleteCriterion(CriterionBean c) { - + CriterionBean trueCriteria = getTrueCriteria(c.getId()); - - - + + + criteria.remove(trueCriteria); criteriaAll.add(trueCriteria); } @@ -243,28 +243,28 @@ public class AddConferenceController extends AbstractWizardFormController { protected Object formBackingObject(HttpServletRequest request) throws ModelAndViewDefiningException { logger.info(this.getClass().toString() + " dans le formBackingObject"); - + FormConference conference = new FormConference(); - + String action = request.getParameter("action"); if (action == null || action.equals("")) { // TODO : tester ici si le gars a le droit d'�tre ici // a-t-il le droit de cr�er une conf�rence ? - + criteria = new HashSet(); criteriaAll = new HashSet(); List listCriterion = evaluationManager.getCriterions(); - - + + int maxNext = 0; for (Criterion crit : listCriterion) { if (maxNext <= crit.getId()) maxNext = crit.getId(); } - + nextId = maxNext + 1; - + for (Criterion crit : listCriterion) { CriterionBean cb = new CriterionBean(); cb.setId(crit.getId()); @@ -274,7 +274,7 @@ public class AddConferenceController extends AbstractWizardFormController { criteriaAll.add(cb); getNextId(); } - + listPersonBean = new ArrayList(); listPersonAdded = new ArrayList(); listInvitations = new ArrayList(); @@ -288,26 +288,26 @@ public class AddConferenceController extends AbstractWizardFormController { pb.setLogin(user.getLogin()); listPersonBean.add(pb); } - + return conference; } else if (action.equals("modify")) { Conference conf = SessionService.getInstance().getCurrentConference(); - + criteria = new HashSet(); criteriaAll = new HashSet(); List listCriterionForConf = evaluationManager.getCriterions(conf.getId()); List listCriterion = evaluationManager.getCriterions(); - + int maxNext = 0; for (Criterion crit : listCriterion) { if (maxNext <= crit.getId()) maxNext = crit.getId(); } - + nextId = maxNext + 1; - + for (Criterion crit : listCriterionForConf) { CriterionBean cb = new CriterionBean(); cb.setId(crit.getId()); @@ -369,7 +369,7 @@ public class AddConferenceController extends AbstractWizardFormController { listPersonBean.remove(person); DateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - + conference.setTitle(conf.getTitle()); conference.setDateArticleParsed(conf.getDateArticle()); conference.setDateArticle(format.format(conf.getDateArticle())); @@ -381,7 +381,7 @@ public class AddConferenceController extends AbstractWizardFormController { conference.setDateStart(format.format(conf.getDateStart())); conference.setDescription(conf.getDescription()); conference.setOtherInformations(conf.getOtherInformations()); - + // TODO : ajouter ca ds conf ejb... /*conference.setPageNumber(pageNumber); conference.setSendInfo(sendInfo); @@ -389,18 +389,18 @@ public class AddConferenceController extends AbstractWizardFormController { conference.setTypeODT(typeODT); conference.setTypePDF(typePDF); conference.setTypeWord(typeWord);*/ - + return conference; - + } else { throw new ModelAndViewDefiningException(new ModelAndView("404error")); } - + } - - + + protected void validatePage(Object command, Errors errors, int page) { FormConference conference = (FormConference) command; ConferenceValidator conferenceValidator = (ConferenceValidator) getValidator(); @@ -424,67 +424,66 @@ public class AddConferenceController extends AbstractWizardFormController { String action = request.getParameter("action"); if (action == null || action.equals("")) { - - Conference conf = null; - - try { - conf = conferenceManager.addConference( - conference.getTitle(), - SessionService.getInstance().getCurrentUserLogin(), - conference.getDescription(), - conference.getOtherInformations(), - conference.getDateArticleParsed(), - conference.getDateArticleParsed(), - conference.getDateEvaluationParsed(), - conference.getDateStartParsed(), - conference.getDateEndParsed()); - } catch (NoConferenceCreationTokenLeftException e1) { - return new ModelAndView("denied","message",getMessageSourceAccessor().getMessage("conference.error.noTokenLeft")); - } - - conference.setConferenceId(conf.getId()); - SessionService.getInstance().setCurrentConference(conf); - - for(CriterionBean criterion : criteria){ - conferenceManager.addCriterionToConference( - conf.getId(), - criterion.getLabel(), - criterion.getMin(), - criterion.getMax()); - } - - for(PersonBean personBean : listPersonAdded){ - conferenceManager.addPCMemberToConference( - conf.getId(), - personBean.getLogin()); - } - - String mailSubject = "YACOS "+conf.getTitle()+" invitation"; - String mailBody = "Greetings,\n"; - mailBody += "You've been invited to join the program comity of the conference :\n"; - mailBody += conf.getTitle()+"/n"; - mailBody += "You can register on this page : \n"; - String baseUrl = request.getSession().getServletContext().getContextPath(); - mailBody += baseUrl+"/registerUser.htm /n"; - mailBody += "Please note that you MUST use this eMail address in the registration form in order to get the appropriate credentials."; - // TODO : use a template - for(String invitationEmail : listInvitations){ + Conference conf = null; + try { - conferenceManager.addInvitationToken(invitationEmail, RoleType.PCMEMBER, conf.getId()); - MailSenderService.getInstance().sendEMail(invitationEmail, mailSubject , mailBody); - } catch (ConferenceDoesntExistException e) { - // Should never happen - e.printStackTrace(); - } catch (MailSendException e) { - // TODO : see what we can do about this - e.printStackTrace(); + conf = conferenceManager.addConference( + conference.getTitle(), + SessionService.getInstance().getCurrentUserLogin(), + conference.getDescription(), + conference.getOtherInformations(), + conference.getDateArticleParsed(), + conference.getDateArticleParsed(), + conference.getDateEvaluationParsed(), + conference.getDateStartParsed(), + conference.getDateEndParsed()); + } catch (NoConferenceCreationTokenLeftException e1) { + return new ModelAndView("denied","message",getMessageSourceAccessor().getMessage("conference.error.noTokenLeft")); } - } - - conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId()); - // Refresh the roles to take into account the chairman credentials - SessionService.getInstance().refreshAuthentication(); - } else { + + conference.setConferenceId(conf.getId()); + SessionService.getInstance().setCurrentConference(conf); + + for(CriterionBean criterion : criteria){ + conferenceManager.addCriterionToConference( + conf.getId(), + criterion.getLabel(), + criterion.getMin(), + criterion.getMax()); + } + + for(PersonBean personBean : listPersonAdded){ + conferenceManager.addPCMemberToConference( + conf.getId(), + personBean.getLogin()); + } + + String mailSubject = "YACOS "+conf.getTitle()+" invitation"; + String mailBody = "Greetings,\n"; + mailBody += "You've been invited to join the program comity of the conference :\n"; + mailBody += conf.getTitle()+"/n"; + mailBody += "You can register on this page : \n"; + String baseUrl = request.getSession().getServletContext().getContextPath(); + mailBody += baseUrl+"/registerUser.htm /n"; + mailBody += "Please note that you MUST use this eMail address in the registration form in order to get the appropriate credentials."; + // TODO : use a template + for(String invitationEmail : listInvitations){ + try { + conferenceManager.addInvitationToken(invitationEmail, RoleType.PCMEMBER, conf.getId()); + MailSenderService.getInstance().sendEMail(invitationEmail, mailSubject , mailBody); + } catch (ConferenceDoesntExistException e) { + // Should never happen + e.printStackTrace(); + } catch (MailSendException e) { + // TODO : see what we can do about this + e.printStackTrace(); + } + } + + conferenceManager.addRole(RoleType.CHAIRMAN, SessionService.getInstance().getCurrentUserLogin(), conf.getId()); + // Refresh the roles to take into account the chairman credentials + SessionService.getInstance().refreshAuthentication(); + } else if (action.equals("modify")) { Conference conf = SessionService.getInstance().getCurrentConference(); conf.setTitle(conference.getTitle()); conf.setDescription(conference.getDescription()); @@ -494,11 +493,11 @@ public class AddConferenceController extends AbstractWizardFormController { conf.setDateEnd(conference.getDateEndParsed()); conf.setDateStart(conference.getDateStartParsed()); conf.setDateEvaluation(conference.getDateEvaluationParsed()); - + conferenceManager.update(conf); - + conferenceManager.removeCriterionToConference(conf.getId()); - + for(CriterionBean criterion : criteria){ conferenceManager.addCriterionToConference( conf.getId(), @@ -506,7 +505,7 @@ public class AddConferenceController extends AbstractWizardFormController { criterion.getMin(), criterion.getMax()); } - + conferenceManager.removePCMemberForConf(conf.getId()); for(PersonBean personBean : listPersonAdded){ @@ -515,7 +514,7 @@ public class AddConferenceController extends AbstractWizardFormController { personBean.getLogin()); } } - + return new ModelAndView("main"); }