use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.
the class SelectedThesaurus method editerTheso.
/**
* Modification d'un thésaurus
*/
public void editerTheso() {
if (editTheso.getTitle() == null || editTheso.getTitle().trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error1")));
} else {
new ThesaurusHelper().UpdateThesaurus(connect.getPoolConnexion(), editTheso);
vue.setEdit(false);
}
}
use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.
the class SelectedThesaurus method maj.
/**
* ************************************ MISE A JOUR
* *************************************
*/
/**
* Met à jour le thésaurus courant lors d'un changement de thésaurus
*/
public void maj() {
tree.getSelectedTerme().reInitTerme();
tree.reInit();
tree.initTree(null, null);
statBean.reInit();
ThesaurusHelper th = new ThesaurusHelper();
nodePreference = tree.getSelectedTerme().getUser().getThesaurusPreferences(thesaurus.getId_thesaurus(), workLanguage);
if (th.getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), nodePreference.getSourceLang()) != null) {
thesaurus = th.getThisThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), nodePreference.getSourceLang());
tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
tree.setIdThesoSelected(thesaurus.getId_thesaurus());
tree.setDefaultLanguage(thesaurus.getLanguage());
} else {
thesaurus.setLanguage("");
}
uTree.reInit();
uTree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
languesTheso = new LanguageHelper().getSelectItemLanguagesOneThesaurus(connect.getPoolConnexion(), thesaurus.getId_thesaurus(), thesaurus.getLanguage());
candidat.maj(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
if (tree != null) {
tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
}
vue.setCreat(false);
// #jm pour la page de statistiques
vue.setStatTheso(false);
// idem
vue.setStatCpt(false);
majPref();
if (selectedTerme != null) {
selectedTerme.initTerme();
}
tree.getSelectedTerme().getUser().setIdTheso(thesaurus.getId_thesaurus());
if ((user.getUser().getName() != null) && (user.isIsHaveWriteToCurrentThesaurus())) {
String message = "drag & dop activé !";
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(null, new FacesMessage("", "info : " + message));
}
}
use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.
the class CurrentUser method connect.
/**
* Connect l'utilisateur si le compte existe
*
* @return le lien de l'index si le compte existe, un message d'erreur sinon
* init c'est une parametre que viens du "isUserExist" ou return une 1 si on
* fait le login normal (usuaire, pass), une 2 si on fait le login avec le
* motpasstemp (et nous sommes dirigées a la page web de changer le
* motpasstemp)
*/
public String connect() {
UserHelper userHelper = new UserHelper();
if (userHelper.isUserExist(connect.getPoolConnexion(), name, MD5Password.getEncodedPassword(pwd))) {
try {
// on vérifie si l'utilisateur est SuperAdmin, on lui donne tout les droits
if (userHelper.isAdminUser(connect.getPoolConnexion(), name)) {
user = userHelper.getInfoAdmin(connect.getPoolConnexion(), name);
if (user == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("user.roleError")));
return "";
}
user.setIdThesaurus(idTheso);
authorizedTheso = new ThesaurusHelper().getAllIdOfThesaurus(connect.getPoolConnexion());
FacesContext context = FacesContext.getCurrentInstance();
String version_Opentheso = context.getExternalContext().getInitParameter("version");
BaseDeDoneesHelper baseDeDonnesHelper = new BaseDeDoneesHelper();
baseDeDonnesHelper.updateVersionOpentheso(connect.getPoolConnexion(), version_Opentheso);
} else // on récupère ses droits par rapport au thésaurus en cours
{
NodeUser nodeUserTemp = userHelper.getInfoUser(connect.getPoolConnexion(), name, idTheso);
if (nodeUserTemp == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("info") + " :", langueBean.getMsg("user.roleErrorAll")));
nodeUserTemp = userHelper.getInfoUser(connect.getPoolConnexion(), name);
if (nodeUserTemp == null) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("user.error1")));
return "";
}
} else {
user = userHelper.getInfoUser(connect.getPoolConnexion(), name, idTheso);
}
authorizedTheso = userHelper.getAuthorizedThesaurus(connect.getPoolConnexion(), user.getId());
}
isLogged = true;
if (userEdit != null) {
isActive = userEdit.isIsActive();
}
if (userHelper.isChangeToPass(connect.getPoolConnexion(), name)) {
// nouvelle pass web pour changer le motpasstemp
return "changePass.xhtml?faces-redirect=true";
}
name = null;
pwd = null;
return "index.xhtml?faces-redirect=true";
} catch (SQLException ex) {
Logger.getLogger(CurrentUser.class.getName()).log(Level.SEVERE, null, ex);
}
}
// utilisateur ou mot de passe n'existent pas
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("user.error1")));
return "";
}
use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.
the class SelectedThesaurus method reorganizing.
/* ******************** EDITION THESO BDD * ******************** */
/**
* Cette fonction permet de nettoyer et réorganiser le thésaurus
*
* @return
*/
public boolean reorganizing() {
if (thesaurus.getId_thesaurus().isEmpty()) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error1")));
return false;
}
try {
ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
Connection conn = connect.getPoolConnexion().getConnection();
conn.setAutoCommit(false);
if (!thesaurusHelper.reorganizingTheso(conn, thesaurus.getId_thesaurus())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error.BDD")));
conn.rollback();
conn.close();
return false;
}
conn.commit();
conn.close();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("theso.infoReorganizing")));
regenerateOrphan();
// permet de supprimer les BT pour un TopTerm, c'est incohérent
removeBTofTopTerm();
// permet de supprimer les relations en boucle (100 -> BT -> 100) ou (100 -> NT -> 100)ou (100 -> RT -> 100)
removeLoopRelations();
return true;
} catch (SQLException ex) {
Logger.getLogger(CurrentUser.class.getName()).log(Level.SEVERE, null, ex);
}
return false;
}
use of mom.trd.opentheso.bdd.helper.ThesaurusHelper in project opentheso by miledrousset.
the class SelectedThesaurus method ajouterTraduction.
/**
* Création d'une traduction d'un thésaurus
*/
public void ajouterTraduction() {
if (nomTrad.trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error1")));
} else {
vue.setTrad(false);
String id = editTheso.getId_thesaurus();
Thesaurus thesoTemp = new Thesaurus();
thesoTemp.setId_thesaurus(id);
thesoTemp.setLanguage(langueTrad);
thesoTemp.setTitle(nomTrad);
new ThesaurusHelper().addThesaurusTraduction(connect.getPoolConnexion(), thesoTemp);
remplirArrayTrad(editTheso.getId_thesaurus());
}
nomTrad = "";
}
Aggregations