use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class StatBean method loadStatTheso.
public void loadStatTheso(String idTheso, String langue) {
statTheso = new ArrayList<>();
nbCpt = new StatisticHelper().getNbCpt(connect.getPoolConnexion(), idTheso);
ArrayList<NodeGroup> lng = new GroupHelper().getListConceptGroup(connect.getPoolConnexion(), idTheso, langue);
Collections.sort(lng);
StatisticHelper sh = new StatisticHelper();
for (NodeGroup ng : lng) {
NodeStatTheso nst = new NodeStatTheso();
nst.setGroup(ng.getLexicalValue() + "(" + ng.getConceptGroup().getIdgroup() + ")");
nst.setNbDescripteur(sh.getNbDescOfGroup(connect.getPoolConnexion(), idTheso, ng.getConceptGroup().getIdgroup()));
nst.setNbNonDescripteur(sh.getNbNonDescOfGroup(connect.getPoolConnexion(), idTheso, ng.getConceptGroup().getIdgroup(), langue));
int termNonTraduit = nst.getNbDescripteur() - sh.getNbTradOfGroup(connect.getPoolConnexion(), idTheso, ng.getConceptGroup().getIdgroup(), langue);
nst.setNbNoTrad(termNonTraduit);
int nombreNote = sh.getNbDefinitionNoteOfGroup(connect.getPoolConnexion(), idTheso, langue, ng.getConceptGroup().getIdgroup());
nst.setNbNotes(nombreNote);
statTheso.add(nst);
}
vue.setStatTheso(true);
vue.setStatCpt(false);
vue.setStatPermuted(false);
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class showPermuted method loadStatPermuted.
public void loadStatPermuted(String idTheso, String idLange) throws SQLException {
Thesaurus datatheso = new Thesaurus();
Connexion conn = new Connexion();
String id_theso = datatheso.getId_thesaurus();
String langue = datatheso.getLanguage();
statTheso = new ArrayList<>();
ArrayList<NodeGroup> lng = new GroupHelper().getListConceptGroup2(connect.getPoolConnexion(), idTheso, idLange);
StatisticHelper sh = new StatisticHelper();
for (NodeGroup ng : lng) {
prendrePermuted nst = new prendrePermuted();
nst.setOrd(ng.getOrde());
nst.setId_concept(ng.getId_concept());
nst.setId_group(ng.getId_group());
nst.setId_theso(idTheso);
nst.setId_lang(idLange);
nst.setLexical_value(ng.getLexicalValue());
nst.setIspreferredterm(ng.isIspreferredterm());
nst.setOriginal_value(ng.getOriginal_value());
statTheso.add(nst);
}
vue.setStatPermuted(true);
vue.setStatTheso(false);
vue.setStatCpt(false);
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class skosExportBean method init.
public void init(String idTheso, String idLang) {
this.idTheso = idTheso;
ThesaurusHelper thesaurusHelper = new ThesaurusHelper();
languagesOfTheso = thesaurusHelper.getAllUsedLanguagesOfThesaurusNode(connect.getPoolConnexion(), idTheso);
GroupHelper groupHelper = new GroupHelper();
groupList = groupHelper.getListRootConceptGroup(connect.getPoolConnexion(), idTheso, idLang);
selectedLanguages = new ArrayList<>();
selectedGroups = new ArrayList<>();
selectedLanguages = new ArrayList<>();
for (NodeLang nodeLang : languagesOfTheso) {
selectedLanguages.add(nodeLang);
}
selectedGroups = new ArrayList<>();
for (NodeGroup nodeGroup : groupList) {
selectedGroups.add(nodeGroup);
}
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class NewTreeBean method reExpandChild.
private void reExpandChild(ArrayList<String> listeId, TreeNode node, int cpt) {
if (!node.isExpanded()) {
ArrayList<NodeConceptTree> listeConcept;
ArrayList<NodeConceptTree> listeSubGroup = new ArrayList<>();
ArrayList<String> idGroupList;
ConceptHelper conceptHelper = new ConceptHelper();
GroupHelper groupHelper = new GroupHelper();
int type = 3;
if (node.getChildCount() == 1) {
node.getChildren().remove(0);
}
MyTreeNode myTreeNode = (MyTreeNode) node;
String idConcept = myTreeNode.getIdConcept();
if (groupHelper.isIdOfGroup(connect.getPoolConnexion(), idConcept, myTreeNode.getIdTheso())) {
// pour group ?
myTreeNode.setTypeConcept(1);
myTreeNode.setIsGroup(true);
listeSubGroup = groupHelper.getRelationGroupOf(connect.getPoolConnexion(), idConcept, myTreeNode.getIdTheso(), myTreeNode.getLangue());
if (listeSubGroup == null) {
listeSubGroup = new ArrayList<>();
}
// pour récupérer les concepts mélangés avec les Sous_Groupes
listeConcept = conceptHelper.getListTopConcepts(connect.getPoolConnexion(), idConcept, myTreeNode.getIdTheso(), myTreeNode.getLangue());
} else {
listeConcept = conceptHelper.getListConcepts(connect.getPoolConnexion(), idConcept, myTreeNode.getIdTheso(), myTreeNode.getLangue());
// myTreeNode.setIsTopConcept(true);
}
TreeNode treeNode = null;
String value = "";
String idTC = "";
String icon;
boolean isTopTerm;
/**
* Ajout des Groupes (MT, C, G, T ..)
*/
for (NodeConceptTree nodeConceptTreeGroup : listeSubGroup) {
value = nodeConceptTreeGroup.getTitle();
if (groupHelper.haveSubGroup(connect.getPoolConnexion(), nodeConceptTreeGroup.getIdThesaurus(), nodeConceptTreeGroup.getIdConcept()) || nodeConceptTreeGroup.isHaveChildren()) {
icon = getTypeOfSubGroup(myTreeNode.getTypeDomaine());
treeNode = new MyTreeNode(1, nodeConceptTreeGroup.getIdConcept(), myTreeNode.getIdTheso(), myTreeNode.getLangue(), myTreeNode.getIdCurrentGroup(), myTreeNode.getTypeDomaine(), idTC, icon, value, myTreeNode);
((MyTreeNode) treeNode).setIsSubGroup(true);
((MyTreeNode) treeNode).setIdCurrentGroup(nodeConceptTreeGroup.getIdConcept());
new DefaultTreeNode("fake", treeNode);
/**
*code poour la numérotation des sous groupes ***
*/
((MyTreeNode) treeNode).setPrefix(((MyTreeNode) node).getNumerotation());
String suffix = groupHelper.getSuffixFromNode(connect.getPoolConnexion(), nodeConceptTreeGroup.getIdThesaurus(), nodeConceptTreeGroup.getIdConcept());
if (suffix.length() < 2)
suffix = "0" + suffix;
((MyTreeNode) treeNode).setSuffix(suffix);
((MyTreeNode) treeNode).setData(((MyTreeNode) treeNode).getNumerotation() + " " + treeNode.getData());
/**
*fin code numérotation des sous groupes****
*/
if (listeId.contains(((MyTreeNode) treeNode).getIdConcept()))
((MyTreeNode) treeNode).setExpanded(true);
if (listeId.get(cpt).equals(((MyTreeNode) treeNode).getIdConcept())) {
if (cpt + 1 < listeId.size()) {
treeNode.setSelected(false);
reExpandChild(listeId, treeNode, cpt + 1);
} else {
treeNode.setSelected(true);
selectedNode = treeNode;
selectedNodes.add(treeNode);
}
}
}
}
// Ajout dans l'arbre
for (NodeConceptTree nodeConceptTree : listeConcept) {
isTopTerm = false;
if (conceptHelper.haveChildren(connect.getPoolConnexion(), nodeConceptTree.getIdThesaurus(), nodeConceptTree.getIdConcept()) || nodeConceptTree.isHaveChildren()) {
icon = "dossier";
if (nodeConceptTree.isIsGroup()) {
icon = "domaine";
// String type = getTypeOfGroup(typeCode);
} else if (nodeConceptTree.isIsSubGroup()) {
icon = getTypeOfSubGroup(myTreeNode.getTypeDomaine());
}
if (nodeConceptTree.isIsTopTerm()) {
// Création de topConcepts
if (nodeConceptTree.getTitle().trim().isEmpty()) {
value = nodeConceptTree.getIdConcept();
} else {
value = nodeConceptTree.getTitle();
}
idTC = value;
isTopTerm = true;
} else {
// Création de concepts
idTC = ((MyTreeNode) node).getIdTopConcept();
if (nodeConceptTree.getTitle().trim().isEmpty()) {
value = nodeConceptTree.getIdConcept();
} else {
value = nodeConceptTree.getTitle();
}
}
if (nodeConceptTree.getStatusConcept() != null) {
if (nodeConceptTree.getStatusConcept().equals("hidden")) {
icon = "hidden";
}
}
treeNode = new MyTreeNode(type, nodeConceptTree.getIdConcept(), ((MyTreeNode) node).getIdTheso(), ((MyTreeNode) node).getLangue(), ((MyTreeNode) node).getIdCurrentGroup(), ((MyTreeNode) node).getTypeDomaine(), idTC, icon, value, node);
if (isTopTerm) {
((MyTreeNode) treeNode).setIsTopConcept(true);
}
idGroupList = groupHelper.getListIdGroupOfConcept(connect.getPoolConnexion(), nodeConceptTree.getIdThesaurus(), nodeConceptTree.getIdConcept());
((MyTreeNode) treeNode).setOtherGroup(idGroupList);
new DefaultTreeNode("fake", treeNode);
if (listeId.get(cpt).equals(((MyTreeNode) treeNode).getIdConcept())) {
if (cpt + 1 < listeId.size()) {
treeNode.setSelected(false);
reExpandChild(listeId, treeNode, cpt + 1);
} else {
treeNode.setSelected(true);
selectedNode = treeNode;
selectedNodes.add(treeNode);
}
}
} else {
icon = "fichier";
if (nodeConceptTree.isIsTopTerm()) {
// Création de topConcepts
idTC = nodeConceptTree.getIdConcept();
if (nodeConceptTree.getTitle().trim().isEmpty()) {
value = nodeConceptTree.getIdConcept();
} else {
value = nodeConceptTree.getTitle();
}
isTopTerm = true;
} else {
// Création de concepts
idTC = ((MyTreeNode) node).getIdTopConcept();
if (nodeConceptTree.getTitle().trim().isEmpty()) {
value = nodeConceptTree.getIdConcept();
} else {
value = nodeConceptTree.getTitle();
}
}
if (nodeConceptTree.getStatusConcept().equals("hidden")) {
icon = "hidden";
}
treeNode = new MyTreeNode(type, nodeConceptTree.getIdConcept(), ((MyTreeNode) node).getIdTheso(), ((MyTreeNode) node).getLangue(), ((MyTreeNode) node).getIdCurrentGroup(), ((MyTreeNode) node).getTypeDomaine(), idTC, icon, value, node);
if (isTopTerm) {
((MyTreeNode) treeNode).setIsTopConcept(true);
}
idGroupList = groupHelper.getListIdGroupOfConcept(connect.getPoolConnexion(), nodeConceptTree.getIdThesaurus(), nodeConceptTree.getIdConcept());
((MyTreeNode) treeNode).setOtherGroup(idGroupList);
if (listeId.get(cpt).equals(((MyTreeNode) treeNode).getIdConcept())) {
treeNode.setSelected(true);
selectedNode = treeNode;
selectedNodes.add(treeNode);
} else {
treeNode.setSelected(false);
}
}
}
node.setExpanded(true);
} else {
List<TreeNode> children = node.getChildren();
for (TreeNode mtn : children) {
if (listeId.get(cpt).equals(((MyTreeNode) mtn).getIdConcept())) {
if (cpt + 1 < listeId.size()) {
mtn.setSelected(false);
reExpandChild(listeId, mtn, cpt + 1);
} else {
mtn.setSelected(true);
selectedNode = mtn;
selectedNodes.add(mtn);
}
}
}
}
}
use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.
the class NewTreeBean method renameGroup.
public boolean renameGroup() {
MyTreeNode myTreeNode = (MyTreeNode) selectedNode;
String valueEdit = selectedTerme.getNomEdit().trim();
if (valueEdit.isEmpty()) {
return false;
}
// si c'est la même valeur, on fait rien
if (selectedTerme.getNom().trim().equals(valueEdit)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("tree.error2")));
// selectedTerme.setNomEdit(selectedTerme.getNom());
return false;
}
// vérification si le Groupe à ajouter existe déjà
if (new GroupHelper().isDomainExist(connect.getPoolConnexion(), valueEdit, myTreeNode.getIdTheso(), myTreeNode.getLangue())) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error6")));
return false;
}
if (myTreeNode.isIsGroup() || myTreeNode.isIsSubGroup()) {
if (!selectedTerme.editGroupName(myTreeNode.getIdTheso(), myTreeNode.getIdConcept(), myTreeNode.getLangue(), valueEdit)) {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", "erreur BDD"));
// selectedTerme.setNomEdit(selectedTerme.getNom());
return false;
}
myTreeNode.setData(valueEdit);
selectedTerme.setNom(valueEdit);
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", valueEdit + " " + langueBean.getMsg("tree.info2")));
return true;
}
return false;
}
Aggregations