use of mom.trd.opentheso.bdd.helper.PreferencesHelper in project opentheso by miledrousset.
the class CurrentUser method initUserNodePref.
public void initUserNodePref(String idThesaurus) {
PreferencesHelper preferencesHelper = new PreferencesHelper();
nodePreference = preferencesHelper.getThesaurusPreference(connect.getPoolConnexion(), idThesaurus);
}
use of mom.trd.opentheso.bdd.helper.PreferencesHelper in project opentheso by miledrousset.
the class CurrentUser method editAllPref.
public void editAllPref() {
// nodePreference.setAlertCdt(alertCdtEdit);
nodePreference.setSourceLang(langSourceEdit);
if (!new PreferencesHelper().updateAllPreferenceUser(connect.getPoolConnexion(), nodePreference, idTheso)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("error.BDD")));
return;
}
initUserNodePref(idTheso);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("user.info6")));
}
use of mom.trd.opentheso.bdd.helper.PreferencesHelper in project opentheso by miledrousset.
the class CurrentUser method getThesaurusPreferences.
/**
* cette fonction permet de retourner les préférences d'un thésaurus, s'il y
* en a pas, on les initialises par les valeurs par defaut
*
* @param idThesaurus
* @param workLanguage
* @return
*/
public NodePreference getThesaurusPreferences(String idThesaurus, String workLanguage) {
if (user.getId() == 1) {
// superAdmin
authorizedTheso = new ThesaurusHelper().getAllIdOfThesaurus(connect.getPoolConnexion());
} else {
authorizedTheso = new UserHelper().getAuthorizedThesaurus(connect.getPoolConnexion(), user.getId());
}
PreferencesHelper preferencesHelper = new PreferencesHelper();
if (connect.getPoolConnexion() != null) {
nodePreference = preferencesHelper.getThesaurusPreference(connect.getPoolConnexion(), idThesaurus);
if (nodePreference == null) {
// cas où il n'y a pas de préférence pour ce thésaurus, il faut les créer
preferencesHelper.initPreferences(connect.getPoolConnexion(), idThesaurus, workLanguage);
nodePreference = preferencesHelper.getThesaurusPreference(connect.getPoolConnexion(), idThesaurus);
} else {
langSourceEdit = nodePreference.getSourceLang();
// alertNbCdtEdit = nodePreference.getNbAlertCdt();
// alertCdtEdit = nodePreference.isAlertCdt();
selectedThesaurus = new ArrayList<>();
selectedThesaurus.add(idTheso);
}
idTheso = idThesaurus;
versionOfOpentheso = new BaseDeDoneesHelper().getVersionOfOpentheso(connect.getPoolConnexion());
return nodePreference;
}
return null;
}
use of mom.trd.opentheso.bdd.helper.PreferencesHelper in project opentheso by miledrousset.
the class DownloadBean method thesoTxtCsv.
/**
* Permet d'exporter le thésauurus au format txt (tabulé et hiérarchisé)
* avec des options de colonnes supplémentaires NT, BT, RT, Notes, traductions
* ceci figure dans le tableau (String[] selectedOptions)
* @param idTheso
* @param selectedGroups
* @param codeLang
* @param selectedOptions
* @return
* MR
*/
public StreamedContent thesoTxtCsv(String idTheso, List<NodeGroup> selectedGroups, String codeLang, ArrayList<String> selectedOptions) {
progress_per_100 = 0;
progress_abs = 0;
NodePreference nodePreference = new PreferencesHelper().getThesaurusPreference(connect.getPoolConnexion(), idTheso);
if (nodePreference == null)
return null;
ExportTxtHelper exportTxtHelper = new ExportTxtHelper();
exportTxtHelper.setThesaurusDatas(connect.getPoolConnexion(), idTheso, codeLang, selectedGroups, nodePreference, selectedOptions);
exportTxtHelper.exportToTxtCsv();
InputStream stream;
try {
stream = new ByteArrayInputStream(exportTxtHelper.getTxtBuff().toString().getBytes("UTF-8"));
file = new DefaultStreamedContent(stream, "text/csv", "Txt_" + idTheso + ".csv");
} catch (UnsupportedEncodingException ex) {
Logger.getLogger(DownloadBean.class.getName()).log(Level.SEVERE, null, ex);
}
return file;
}
use of mom.trd.opentheso.bdd.helper.PreferencesHelper in project opentheso by miledrousset.
the class DownloadBean method thesoPDF.
public StreamedContent thesoPDF(String idTheso, List<NodeLang> selectedLanguages, List<NodeGroup> selectedGroups, String codeLang, String codeLang2, int type) {
progress_per_100 = 0;
progress_abs = 0;
NodePreference nodePreference = new PreferencesHelper().getThesaurusPreference(connect.getPoolConnexion(), idTheso);
if (nodePreference == null)
return null;
sizeOfTheso = new ConceptHelper().getAllIdConceptOfThesaurus(connect.getPoolConnexion(), idTheso).size();
ExportRdf4jHelper exportRdf4jHelper = new ExportRdf4jHelper();
exportRdf4jHelper.setInfos(connect.getPoolConnexion(), "dd-mm-yyyy", false, idTheso, nodePreference.getCheminSite());
exportRdf4jHelper.setNodePreference(nodePreference);
exportRdf4jHelper.addThesaurus(idTheso, selectedLanguages);
exportRdf4jHelper.addGroup(idTheso, selectedLanguages, selectedGroups);
exportRdf4jHelper.addConcept(idTheso, this, selectedLanguages);
WritePdf writePdf = new WritePdf(exportRdf4jHelper.getSkosXmlDocument(), codeLang, codeLang2, type);
InputStream stream;
stream = new ByteArrayInputStream(writePdf.getOutput().toByteArray());
file = new DefaultStreamedContent(stream, "application/pdf", "test.pdf");
return file;
}
Aggregations