@@ -33,7 +33,7 @@ public class AddConferenceController extends AbstractWizardFormController {
private IConferenceManager conferenceManager ;
private IConferenceManager conferenceManager ;
private IUserManager userManager ;
private IUserManager userManager ;
private IEvaluationManager evaluationManager ;
private IEvaluationManager evaluationManager ;
public IEvaluationManager getEvaluationManager ( ) {
public IEvaluationManager getEvaluationManager ( ) {
@@ -88,7 +88,7 @@ public class AddConferenceController extends AbstractWizardFormController {
listPersonBean . remove ( truePerson ) ;
listPersonBean . remove ( truePerson ) ;
listPersonFiltered . remove ( truePerson ) ;
listPersonFiltered . remove ( truePerson ) ;
}
}
public void addInvitation ( String email ) {
public void addInvitation ( String email ) {
PersonBean invitationBean = new PersonBean ( ) ;
PersonBean invitationBean = new PersonBean ( ) ;
invitationBean . setLogin ( email ) ;
invitationBean . setLogin ( email ) ;
@@ -145,7 +145,7 @@ public class AddConferenceController extends AbstractWizardFormController {
private Set < CriterionBean > criteria ;
private Set < CriterionBean > criteria ;
private Set < CriterionBean > criteriaAll ;
private Set < CriterionBean > criteriaAll ;
public Set < CriterionBean > getCriteriaAll ( ) {
public Set < CriterionBean > getCriteriaAll ( ) {
return criteriaAll ;
return criteriaAll ;
}
}
@@ -153,7 +153,7 @@ public class AddConferenceController extends AbstractWizardFormController {
public Set < CriterionBean > getCriteriaAdded ( ) {
public Set < CriterionBean > getCriteriaAdded ( ) {
return criteria ;
return criteria ;
}
}
public CriterionBean getTrueCriteria ( int id ) {
public CriterionBean getTrueCriteria ( int id ) {
for ( CriterionBean cb : criteriaAll ) {
for ( CriterionBean cb : criteriaAll ) {
if ( cb . getId ( ) = = id ) {
if ( cb . getId ( ) = = id ) {
@@ -166,15 +166,15 @@ public class AddConferenceController extends AbstractWizardFormController {
return cb ;
return cb ;
}
}
}
}
return null ;
return null ;
}
}
public void setCriterionClick ( CriterionBean c ) {
public void setCriterionClick ( CriterionBean c ) {
if ( c . getId ( ) = = - 1 ) {
if ( c . getId ( ) = = - 1 ) {
c . setId ( getNextId ( ) ) ;
c . setId ( getNextId ( ) ) ;
}
}
criteria . remove ( c ) ;
criteria . remove ( c ) ;
criteria . add ( c ) ;
criteria . add ( c ) ;
}
}
@@ -185,18 +185,18 @@ public class AddConferenceController extends AbstractWizardFormController {
}
}
CriterionBean trueCriteria = getTrueCriteria ( c . getId ( ) ) ;
CriterionBean trueCriteria = getTrueCriteria ( c . getId ( ) ) ;
criteria . remove ( trueCriteria ) ;
criteria . remove ( trueCriteria ) ;
criteria . add ( trueCriteria ) ;
criteria . add ( trueCriteria ) ;
criteriaAll . remove ( trueCriteria ) ;
criteriaAll . remove ( trueCriteria ) ;
}
}
public void deleteCriterion ( CriterionBean c ) {
public void deleteCriterion ( CriterionBean c ) {
CriterionBean trueCriteria = getTrueCriteria ( c . getId ( ) ) ;
CriterionBean trueCriteria = getTrueCriteria ( c . getId ( ) ) ;
criteria . remove ( trueCriteria ) ;
criteria . remove ( trueCriteria ) ;
criteriaAll . add ( trueCriteria ) ;
criteriaAll . add ( trueCriteria ) ;
}
}
@@ -216,18 +216,27 @@ public class AddConferenceController extends AbstractWizardFormController {
protected Object formBackingObject ( HttpServletRequest request ) throws ModelAndViewDefiningException {
protected Object formBackingObject ( HttpServletRequest request ) throws ModelAndViewDefiningException {
logger . info ( this . getClass ( ) . toString ( ) + " dans le formBackingObject " ) ;
logger . info ( this . getClass ( ) . toString ( ) + " dans le formBackingObject " ) ;
FormConference conference = new FormConference ( ) ;
FormConference conference = new FormConference ( ) ;
String action = request . getParameter ( " action " ) ;
String action = request . getParameter ( " action " ) ;
if ( action = = null | | action . equals ( " " ) )
if ( action = = null | | action . equals ( " " ) ) {
{
// TODO : tester ici si le gars a le droit d'<27> tre ici
// TODO : tester ici si le gars a le droit d'<27> tre ici
// a-t-il le droit de cr<63> er une conf<6E> rence ?
// a-t-il le droit de cr<63> er une conf<6E> rence ?
criteria = new HashSet < CriterionBean > ( ) ;
criteria = new HashSet < CriterionBean > ( ) ;
criteriaAll = new HashSet < CriterionBean > ( ) ;
criteriaAll = new HashSet < CriterionBean > ( ) ;
List < Criterion > listCriterion = evaluationManager . getCriterions ( ) ;
List < Criterion > listCriterion = evaluationManager . getCriterions ( ) ;
int maxNext = 0 ;
for ( Criterion crit : listCriterion ) {
if ( maxNext < = crit . getId ( ) )
maxNext = crit . getId ( ) ;
}
nextId = maxNext + 1 ;
for ( Criterion crit : listCriterion ) {
for ( Criterion crit : listCriterion ) {
CriterionBean cb = new CriterionBean ( ) ;
CriterionBean cb = new CriterionBean ( ) ;
cb . setId ( crit . getId ( ) ) ;
cb . setId ( crit . getId ( ) ) ;
@@ -237,7 +246,7 @@ public class AddConferenceController extends AbstractWizardFormController {
criteriaAll . add ( cb ) ;
criteriaAll . add ( cb ) ;
getNextId ( ) ;
getNextId ( ) ;
}
}
listPersonBean = new ArrayList < PersonBean > ( ) ;
listPersonBean = new ArrayList < PersonBean > ( ) ;
listPersonAdded = new ArrayList < PersonBean > ( ) ;
listPersonAdded = new ArrayList < PersonBean > ( ) ;
listPersonFiltered = listPersonBean ;
listPersonFiltered = listPersonBean ;
@@ -250,16 +259,26 @@ public class AddConferenceController extends AbstractWizardFormController {
pb . setLogin ( user . getLogin ( ) ) ;
pb . setLogin ( user . getLogin ( ) ) ;
listPersonBean . add ( pb ) ;
listPersonBean . add ( pb ) ;
}
}
return conference ;
return conference ;
}
}
else if ( action . equals ( " modify " ) ) {
else if ( action . equals ( " modify " ) ) {
Conference conf = SessionService . getInstance ( ) . getCurrentConference ( ) ;
Conference conf = SessionService . getInstance ( ) . getCurrentConference ( ) ;
criteria = new HashSet < CriterionBean > ( ) ;
criteria = new HashSet < CriterionBean > ( ) ;
criteriaAll = new HashSet < CriterionBean > ( ) ;
criteriaAll = new HashSet < CriterionBean > ( ) ;
List < Criterion > listCriterionForConf = evaluationManager . getCriterions ( conf . getId ( ) ) ;
List < Criterion > listCriterionForConf = evaluationManager . getCriterions ( conf . getId ( ) ) ;
List < Criterion > listCriterion = evaluationManager . getCriterions ( ) ;
int maxNext = 0 ;
for ( Criterion crit : listCriterion ) {
if ( maxNext < = crit . getId ( ) )
maxNext = crit . getId ( ) ;
}
nextId = maxNext + 1 ;
for ( Criterion crit : listCriterionForConf ) {
for ( Criterion crit : listCriterionForConf ) {
CriterionBean cb = new CriterionBean ( ) ;
CriterionBean cb = new CriterionBean ( ) ;
cb . setId ( crit . getId ( ) ) ;
cb . setId ( crit . getId ( ) ) ;
@@ -269,8 +288,7 @@ public class AddConferenceController extends AbstractWizardFormController {
criteria . add ( cb ) ;
criteria . add ( cb ) ;
getNextId ( ) ;
getNextId ( ) ;
}
}
List < Criterion > listCriterion = evaluationManager . getCriterions ( ) ;
for ( Criterion crit : listCriterion ) {
for ( Criterion crit : listCriterion ) {
CriterionBean cb = new CriterionBean ( ) ;
CriterionBean cb = new CriterionBean ( ) ;
cb . setId ( crit . getId ( ) ) ;
cb . setId ( crit . getId ( ) ) ;
@@ -280,7 +298,15 @@ public class AddConferenceController extends AbstractWizardFormController {
criteriaAll . add ( cb ) ;
criteriaAll . add ( cb ) ;
getNextId ( ) ;
getNextId ( ) ;
}
}
// remove of the criteria already added
Set < CriterionBean > criteriaAllIter = new HashSet < CriterionBean > ( criteriaAll ) ;
for ( CriterionBean crit : criteriaAllIter )
for ( CriterionBean crit2 : criteria )
if ( crit . getId ( ) = = crit2 . getId ( ) )
criteriaAll . remove ( crit ) ;
listPersonBean = new ArrayList < PersonBean > ( ) ;
listPersonBean = new ArrayList < PersonBean > ( ) ;
listPersonAdded = new ArrayList < PersonBean > ( ) ;
listPersonAdded = new ArrayList < PersonBean > ( ) ;
listPersonFiltered = listPersonBean ;
listPersonFiltered = listPersonBean ;
@@ -293,11 +319,8 @@ public class AddConferenceController extends AbstractWizardFormController {
pb . setLogin ( user . getLogin ( ) ) ;
pb . setLogin ( user . getLogin ( ) ) ;
listPersonBean . add ( pb ) ;
listPersonBean . add ( pb ) ;
}
}
List < User > listUsersForConf = userManager . getUsers ( conf . getId ( ) , RoleType . PCMEMBER ) ;
// FIXME : bug here when we remove a person
// and remove the person added from the list above
List < User > listUsersForConf = userManager . getUsers ( conf . getId ( ) ) ;
for ( User user : listUsersForConf ) {
for ( User user : listUsersForConf ) {
PersonBean pb = new PersonBean ( ) ;
PersonBean pb = new PersonBean ( ) ;
pb . setId ( getNextPerson ( ) ) ;
pb . setId ( getNextPerson ( ) ) ;
@@ -306,9 +329,16 @@ public class AddConferenceController extends AbstractWizardFormController {
pb . setLogin ( user . getLogin ( ) ) ;
pb . setLogin ( user . getLogin ( ) ) ;
listPersonAdded . add ( pb ) ;
listPersonAdded . add ( pb ) ;
}
}
// remove of the person already added
List < PersonBean > listPersonIter = new ArrayList < PersonBean > ( listPersonBean ) ;
for ( PersonBean person : listPersonIter )
for ( PersonBean person2 : listPersonAdded )
if ( person . getLogin ( ) . equals ( person2 . getLogin ( ) ) )
listPersonBean . remove ( person ) ;
DateFormat format = new SimpleDateFormat ( " yyyy-MM-dd " ) ;
DateFormat format = new SimpleDateFormat ( " yyyy-MM-dd " ) ;
conference . setTitle ( conf . getTitle ( ) ) ;
conference . setTitle ( conf . getTitle ( ) ) ;
conference . setDateArticleParsed ( conf . getDateArticle ( ) ) ;
conference . setDateArticleParsed ( conf . getDateArticle ( ) ) ;
conference . setDateArticle ( format . format ( conf . getDateArticle ( ) ) ) ;
conference . setDateArticle ( format . format ( conf . getDateArticle ( ) ) ) ;
@@ -320,7 +350,7 @@ public class AddConferenceController extends AbstractWizardFormController {
conference . setDateStart ( format . format ( conf . getDateStart ( ) ) ) ;
conference . setDateStart ( format . format ( conf . getDateStart ( ) ) ) ;
conference . setDescription ( conf . getDescription ( ) ) ;
conference . setDescription ( conf . getDescription ( ) ) ;
conference . setOtherInformations ( conf . getOtherInformations ( ) ) ;
conference . setOtherInformations ( conf . getOtherInformations ( ) ) ;
// TODO : ajouter ca ds conf ejb...
// TODO : ajouter ca ds conf ejb...
/*conference.setPageNumber(pageNumber);
/*conference.setPageNumber(pageNumber);
conference.setSendInfo(sendInfo);
conference.setSendInfo(sendInfo);
@@ -328,18 +358,18 @@ public class AddConferenceController extends AbstractWizardFormController {
conference.setTypeODT(typeODT);
conference.setTypeODT(typeODT);
conference.setTypePDF(typePDF);
conference.setTypePDF(typePDF);
conference.setTypeWord(typeWord);*/
conference.setTypeWord(typeWord);*/
return conference ;
return conference ;
}
}
else {
else {
throw new ModelAndViewDefiningException ( new ModelAndView ( " 404error " ) ) ;
throw new ModelAndViewDefiningException ( new ModelAndView ( " 404error " ) ) ;
}
}
}
}
protected void validatePage ( Object command , Errors errors , int page ) {
protected void validatePage ( Object command , Errors errors , int page ) {
FormConference conference = ( FormConference ) command ;
FormConference conference = ( FormConference ) command ;
ConferenceValidator conferenceValidator = ( ConferenceValidator ) getValidator ( ) ;
ConferenceValidator conferenceValidator = ( ConferenceValidator ) getValidator ( ) ;
@@ -360,36 +390,71 @@ public class AddConferenceController extends AbstractWizardFormController {
HttpServletRequest request , HttpServletResponse response , Object command , BindException errors ) {
HttpServletRequest request , HttpServletResponse response , Object command , BindException errors ) {
FormConference conference = ( FormConference ) command ;
FormConference conference = ( FormConference ) command ;
String action = request . getParameter ( " action " ) ;
Conference c onf = conferenceManager . addConference (
if ( acti on = = null | | action . equals ( " " ) ) {
conference . getTitle ( ) ,
conference . getDescription ( ) ,
Conference conf = conferenceManager . addConference (
conference . getOtherInformations ( ) ,
conference . getTitle ( ) ,
conference . getDateArticleParsed ( ) ,
conference . getDescription ( ) ,
conference . getDateArticleParsed ( ) ,
conference . getOtherInformations ( ) ,
conference . getDateEvaluation Parsed ( ) ,
conference . getDateArticle Parsed ( ) ,
conference . getDateStart Parsed ( ) ,
conference . getDateArticle Parsed ( ) ,
conference . getDateEnd Parsed ( ) ) ;
conference . getDateEvaluatio nParsed ( ) ,
conference . getDateStartParsed ( ) ,
conference . s etConferenceId ( conf . getI d( ) ) ;
conference . g etDateEndParse d( ) ) ;
SessionService . getInstance ( ) . setCurrentConference ( conf ) ;
conference . setConferenceId ( conf . getId ( ) ) ;
for ( CriterionBean criterion : criteria ) {
SessionService . getInstance ( ) . setCurrentConference ( conf ) ;
conferenceManager . addCriterionToConference (
conf . getId ( ) ,
for ( CriterionBean criterion : criteria ) {
criterion . getLabel ( ) ,
conferenceManager . addCriterionToConference (
criteri on . getMin ( ) ,
conf . getId ( ) ,
criterion . getMax ( ) ) ;
criterion . getLabel ( ) ,
criterion . getMin ( ) ,
criterion . getMax ( ) ) ;
}
for ( PersonBean personBean : listPersonAdded ) {
conferenceManager . addPCMemberToConference (
conf . getId ( ) ,
personBean . getLogin ( ) ) ;
}
conferenceManager . addRole ( RoleType . CHAIRMAN , SessionService . getInstance ( ) . getCurrentUserLogin ( ) , conf . getId ( ) ) ;
}
}
else {
for ( PersonBean personBean : listPersonAdded ) {
Conference conf = SessionService . getInstance ( ) . getCurrentConference ( ) ;
conferenceManager . addPCMemberToConference (
conf. setTitle ( conference . getTitle ( ) ) ;
conf . getId ( ) ,
conf . setDescription ( conference . getDescription ( ) ) ;
personBean . getLogin ( ) ) ;
conf . setOtherInformations ( conference . getOtherInformations ( ) ) ;
conf . setDateArticle ( conference . getDateArticleParsed ( ) ) ;
conf . setDateAbstract ( conference . getDateArticleParsed ( ) ) ;
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 ( ) ,
criterion . getLabel ( ) ,
criterion . getMin ( ) ,
criterion . getMax ( ) ) ;
}
conferenceManager . removePCMemberForConf ( conf . getId ( ) ) ;
for ( PersonBean personBean : listPersonAdded ) {
conferenceManager . addPCMemberToConference (
conf . getId ( ) ,
personBean . getLogin ( ) ) ;
}
}
}
conferenceManager . addRole ( RoleType . CHAIRMAN , SessionService . getInstance ( ) . getCurrentUserLogin ( ) , conf . getId ( ) ) ;
return new ModelAndView ( " main " ) ;
return new ModelAndView ( " main " ) ;
}
}