HttpSession session = request.getSession(false);
if(session == null){
return new ModelAndView("logout-personnel");
}
Personnel p = (Responsable)session.getAttribute("responsable");
if(p==null)
return new ModelAndView("logout-personnel");
String link = null;
String message = null;
ModelAndView mav = null;
Map model = new HashMap();
String filename=null;
String action = request.getParameter("action");
String sId = request.getParameter("id");
int id ;
List page = new ArrayList();
if (action == null) {
page.add("Accueil "+p.getFormation().getLabel());
model.put("page", page);
Integer admis = foldermanager.getAdvancementdao().getCountAdvancementByStateAndFormation(Folder.FOLDER_ACCEPTED, p.getFormation().getId());
model.put("countadmis", admis);
Integer complementary = foldermanager.getAdvancementdao().getCountAdvancementByStateAndFormation(Folder.FOLDER_COMPLEMENTARY, p.getFormation().getId());
model.put("countcomplementary", complementary);
Integer interviews = foldermanager.getAdvancementdao().getCountAdvancementByStateAndFormation(Folder.FOLDER_INTERVIEW, p.getFormation().getId());
model.put("countinterview", interviews);
Integer refused = foldermanager.getAdvancementdao().getCountAdvancementByStateAndFormation(Folder.FOLDER_REFUSED, p.getFormation().getId());
model.put("countrefused", refused);
mav = new ModelAndView("responsable",model);
}else if(action.equals("logout")){
return new ModelAndView("logout-personnel");
} else {
if (action.equals("choix1")){
page.add(p.getFormation().getLabel()+" : Liste des premiers choix.");
model.put("page", page);
List choix1 = foldermanager.findPersonalInfoByChoice(p.getFormation().getId(), 1);
model.put("folders", choix1);
link = "linkNotTreated";
}else if(action.equals("choix2")){
page.add(p.getFormation().getLabel()+" : Liste des seconds choix.");
model.put("page", page);
List choix2 = foldermanager.findPersonalInfoByChoice(p.getFormation().getId(), 2);
model.put("folders", choix2);
link = "linkNotTreated";
}else if(action.equals("choix3")){
page.add(p.getFormation().getLabel()+" : Liste des troisiemes choix.");
model.put("page", page);
List choix3 = foldermanager.findPersonalInfoByChoice(p.getFormation().getId(), 3);
model.put("folders", choix3);
link = "linkNotTreated";
}else if(action.equals("admis")){
page.add(p.getFormation().getLabel()+" : Liste des �tudiants admis");
model.put("page", page);
List admis = foldermanager.findByStateAndFormation(Folder.FOLDER_ACCEPTED, p.getFormation());//findPersonalInfoByChoice(1, 1);
link = "linkAccepted";
filename="Admis";
model.put("admis", admis);
}else if(action.equals("interview")){
page.add(p.getFormation().getLabel()+" : Liste des �tudiants en entretient.");
model.put("page", page);
List interviews = foldermanager.findByStateAndFormation(Folder.FOLDER_INTERVIEW, p.getFormation());//findPersonalInfoByChoice(1, 1);
model.put("entretiens", interviews);
link = "linkInterview";
filename="Entretiens";
}else if(action.equals("attente")){
page.add(p.getFormation().getLabel()+" : Liste des �tudiants sur liste compl�mentaire.");
model.put("page", page);
List attente = foldermanager.findByStateAndFormation(Folder.FOLDER_COMPLEMENTARY, p.getFormation());//findPersonalInfoByChoice(1, 1);
model.put("complementary", attente);
link = "linkComplement";
filename="ListeComplementaire";
}else if(action.equals("refused")){
page.add(p.getFormation().getLabel()+" : Liste des �tudiants refus�s.");
model.put("page", page);
List refused = foldermanager.findByStateAndFormation(Folder.FOLDER_REFUSED, p.getFormation());//findPersonalInfoByChoice(1, 1);
model.put("refused", refused);
link = "linkRefused";
filename="Refuses";
}else if (action.equals("edit")){
id = new Integer(sId);
Folder folder = foldermanager.findFolderById(id);
page.add(p.getFormation().getLabel()+" : D�tails pour "+folder.getPi().getLastname()+" "+folder.getPi().getFirstname());
model.put("page",page);
model.put("folder", folder);
}else if (action.equals("admit")){
id = new Integer(sId);
Etat etat = new Etat();
etat.setState(Folder.FOLDER_ACCEPTED);
this.foldermanager.storeAdvancement(id,etat, p.getFormation());
// foldermanager.updatePersonalInfoState(id, Folder.FOLDER_TREATED);
message = "Le dossier numero "+id+" a ete admit en liste principale.";
page.add("Confirmation");
model.put("page",page);
}else if (action.equals("complement")){
id = new Integer(sId);
Etat etat = new Etat();
etat.setState(Folder.FOLDER_COMPLEMENTARY);
// A MODIFIER
//etat.setComplemantary_pos(1);
this.foldermanager.storeAdvancement(id, etat, p.getFormation());
// foldermanager.updatePersonalInfoState(id, Folder.FOLDER_TREATED);
page.add("Confirmation");
model.put("page",page);
message = "Le dossier numero "+id+" a ete admit en liste complementaire.";
}else if (action.equals("tointerview")){
id = new Integer(sId);
Etat etat = new Etat();
etat.setState(Folder.FOLDER_INTERVIEW);
// A MODIFIER
etat.setInterview("demain");
this.foldermanager.storeAdvancement(id, etat, p.getFormation());
// foldermanager.updatePersonalInfoState(id, Folder.FOLDER_TREATED);
page.add("Confirmation");
model.put("page",page);
message = "Le dossier num�rot� "+id+" a ete convoquee en entretien.";
}else if (action.equals("refuse")){
id = new Integer(sId);
Etat etat = new Etat();
etat.setState(Folder.FOLDER_REFUSED);
this.foldermanager.storeAdvancement(id, etat, p.getFormation());
// foldermanager.updatePersonalInfoState(id, Folder.FOLDER_TREATED);
page.add("Confirmation");
model.put("page",page);
message = "Le dossier numero "+id+" a ete refuse.";
/* The page of a secretary displaying the processus of change of the password */
} else if (action.equals("changepass")) {
page.add("Changement du mot de passe");
model.put("page", page);
model.put("personnel", p);
model.put("changepass", "changepass");
return new ModelAndView("responsable", model);
}else if(action.equals("retirer")){
id = new Integer(sId);
int res = foldermanager.removeAdvancement(id, p.getFormation().getId());
if(res == 1){
page.add("Confirmation");
model.put("page",page);
message = "Le dossier numero "+id+" a ete retire de la liste principale.";
}else{