use of org.primefaces.PrimeFaces in project opentheso by miledrousset.
the class AutoCompletBean method newTSpe.
/**
* Permet de créer un nouveau concept en vérifiant sa validité
*/
public void newTSpe() {
createValid = false;
terme.setValueEdit(terme.getSelectedTermComp().getTermLexicalValue());
if (terme.getValueEdit().trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error1")));
return;
}
String valueEdit = terme.getValueEdit().trim();
// vérification si c'est le même nom, on fait rien
if (valueEdit.equalsIgnoreCase(terme.getNom())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("autoComp.impossible")));
return;
}
// vérification si le term à ajouter existe déjà
if (terme.isTermExist(valueEdit) != null) {
duplicate = true;
// FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error6")));
return;
}
if (!terme.creerTermeSpe(((MyTreeNode) tree.getSelectedNode()))) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
return;
} else {
tree.reInit();
tree.reExpand();
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", valueEdit + " " + langueBean.getMsg("tree.info1")));
}
terme.setSelectedTermComp(new NodeAutoCompletion());
createValid = true;
PrimeFaces pf = PrimeFaces.current();
if (pf.isAjaxRequest()) {
pf.ajax().update("idNtEditDlg");
}
// RequestContext.getCurrentInstance().update("idNtEditDlg");
}
use of org.primefaces.PrimeFaces in project opentheso by miledrousset.
the class SelectedTerme method creerTermeSyno.
/**
* permet de créer des termes synonymes avec un type défini
*/
public void creerTermeSyno() {
editPassed = false;
if (valueEdit == null || valueEdit.trim().equals("")) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error1")));
return;
}
if (idT != null && !idT.equals("")) {
if (!duplicate) {
// on controle si a accepté un doublon ou non
if (new TermHelper().isTermExist(connect.getPoolConnexion(), valueEdit, idTheso, idlangue)) {
// FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error6")));
duplicate = true;
return;
}
if (new TermHelper().isAltLabelExist(connect.getPoolConnexion(), valueEdit, idTheso, idlangue)) {
// FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error7")));
duplicate = true;
return;
}
}
String leNom = valueEdit;
Term temp = new Term();
temp.setId_term(idT);
temp.setId_thesaurus(idTheso);
temp.setLang(idlangue);
temp.setLexical_value(valueEdit);
if (statutEdit.equalsIgnoreCase("Hidden")) {
temp.setHidden(true);
} else {
temp.setHidden(false);
}
temp.setStatus(statutEdit);
temp.setSource(String.valueOf(user.getUser().getName()));
if (!new TermHelper().addNonPreferredTerm(connect.getPoolConnexion(), temp, user.getUser().getId())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
return;
}
ArrayList<NodeEM> tempEM = new TermHelper().getNonPreferredTerms(connect.getPoolConnexion(), idT, idTheso, idlangue);
termesSynonymesE = new ArrayList<>();
termesSynonymesP = new ArrayList<>();
latitudLongitud = null;
for (NodeEM nem : tempEM) {
if (nem.getStatus().equalsIgnoreCase("USE")) {
termesSynonymesE.add(nem.getLexical_value());
}
if (nem.getStatus().equalsIgnoreCase("Hidden")) {
termesSynonymesP.add(nem.getLexical_value());
}
if (nem.getLexical_value().contains("WKT:")) {
latitudLongitud = nem.getLexical_value().substring(nem.getLexical_value().indexOf(":") + 1, nem.getLexical_value().length()).trim();
}
}
valueEdit = "";
nomEdit = "";
vue.setAddTSyno(0);
init();
PrimeFaces pf = PrimeFaces.current();
if (pf.isAjaxRequest()) {
pf.ajax().update("idTermeSynonymesEditDlg");
}
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", leNom + " " + langueBean.getMsg("sTerme.info1")));
} else {
vue.setAddTSyno(0);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error2")));
}
}
Aggregations