Search in sources :

Example 31 with GroupHelper

use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.

the class SelectedTerme method deletGroupTraduction.

/**
 * Cette fontion permet de supprimer la traduction d'un group
 *
 * #MR
 * @param lang
 */
public void deletGroupTraduction(String lang) {
    GroupHelper groupHelper = new GroupHelper();
    if (!groupHelper.deleteGroupTraduction(connect.getPoolConnexion(), idDomaine, idTheso, lang)) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("error")));
        return;
    }
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("sTerme.info10")));
    majLangueGroup();
}
Also used : GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) FacesMessage(javax.faces.application.FacesMessage)

Example 32 with GroupHelper

use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.

the class SelectedThesaurus method addGroup.

/**
 * Création d'un domaine avec mise à jour dans l'arbre
 *
 * @param codeTypeGroup
 * @param titleGroup
 * @return
 */
// private String typeDom;
public String addGroup(String codeTypeGroup, String titleGroup) {
    String idGroup = null;
    if (titleGroup.isEmpty()) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("theso.error7")));
    } else {
        nodeCG.setLexicalValue(titleGroup);
        nodeCG.setIdLang(thesaurus.getLanguage());
        nodeCG.getConceptGroup().setIdthesaurus(thesaurus.getId_thesaurus());
        /*
            if(typeDom == null || typeDom.equals("")){
                 typeDom = getTypeDomainePere();
                 haveFather = true;
            }
            

            if (typeDom != null && haveFather) {
                nodeCG.getConceptGroup().setIdtypecode(typeDom);
            } else {
                nodeCG.getConceptGroup().setIdtypecode(codeTypeGroup);

            }*/
        if (codeTypeGroup.isEmpty()) {
            codeTypeGroup = "MT";
        }
        nodeCG.getConceptGroup().setIdtypecode(codeTypeGroup);
        GroupHelper cgh = new GroupHelper();
        int idUser = tree.getSelectedTerme().getUser().getUser().getId();
        idGroup = cgh.addGroup(connect.getPoolConnexion(), nodeCG, cheminSite, arkActive, idUser);
        nodeCG = new NodeGroup();
        vue.setSelectedActionDom(PropertiesNames.noActionDom);
        tree.reInit();
        tree.initTree(thesaurus.getId_thesaurus(), thesaurus.getLanguage());
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", titleGroup + " " + langueBean.getMsg("theso.info1.2")));
    }
    return idGroup;
}
Also used : FacesMessage(javax.faces.application.FacesMessage) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) NodeGroup(mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)

Example 33 with GroupHelper

use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.

the class SelectedThesaurus method regenIdGroup.

/**
 * Cette fonction remplace tout les id des groupes du théso
 *
 * @param conn
 * @param idTheso
 * @return la liste des nouveaux id group
 */
private ArrayList<String> regenIdGroup(Connection conn, String idTheso) throws Exception {
    /*récup les concepts*/
    GroupHelper groupHelper = new GroupHelper();
    ArrayList<String> idgroup = groupHelper.getListIdOfGroup(conn, idTheso);
    if (idgroup == null || idgroup.isEmpty()) {
        throw new Exception("No group in this thesaurus");
    }
    /*génération des nouveaux id*/
    ArrayList<String> newIdGroup = createNewId(idgroup, idgroup.size());
    /*maj des tables*/
    for (int i = 0; i < idgroup.size(); i++) {
        String id = idgroup.get(i);
        String newId = newIdGroup.get(i);
        // table concept_group
        groupHelper.setIdGroup(conn, idTheso, id, newId);
        // table concept_group_concept
        groupHelper.setIdGroupConcept(conn, idTheso, id, newId);
        // table concept_group_historique
        groupHelper.setIdGroupHisto(conn, idTheso, id, newId);
        // table concept_group_label
        groupHelper.setIdGroupLabel(conn, idTheso, id, newId);
        // table concept_group_label_historique
        groupHelper.setIdGroupLabelHisto(conn, idTheso, id, newId);
        // table relation_group
        groupHelper.setIdGroupRelation(conn, idTheso, id, newId);
    }
    return newIdGroup;
}
Also used : GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) SQLException(java.sql.SQLException)

Example 34 with GroupHelper

use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.

the class AutoCompletBean method completOtherGroup.

public List<NodeAutoCompletion> completOtherGroup(String query) {
    selectedAtt = new NodeAutoCompletion();
    List<NodeAutoCompletion> liste = new ArrayList<>();
    if (theso.getThesaurus().getId_thesaurus() != null && theso.getThesaurus().getLanguage() != null) {
        liste = new GroupHelper().getAutoCompletionOtherGroup(connect.getPoolConnexion(), theso.getThesaurus().getId_thesaurus(), terme.getIdDomaine(), theso.getThesaurus().getLanguage(), query);
    }
    return liste;
}
Also used : ArrayList(java.util.ArrayList) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Example 35 with GroupHelper

use of mom.trd.opentheso.bdd.helper.GroupHelper in project opentheso by miledrousset.

the class AutoCompletBean method completGroup.

public List<NodeAutoCompletion> completGroup(String query) {
    selectedAtt = new NodeAutoCompletion();
    List<NodeAutoCompletion> liste = new ArrayList<>();
    if (theso.getThesaurus().getId_thesaurus() != null && theso.getThesaurus().getLanguage() != null) {
        liste = new GroupHelper().getAutoCompletionGroup(connect.getPoolConnexion(), theso.getThesaurus().getId_thesaurus(), theso.getThesaurus().getLanguage(), query);
    }
    return liste;
}
Also used : ArrayList(java.util.ArrayList) NodeAutoCompletion(mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper)

Aggregations

GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)79 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)38 ArrayList (java.util.ArrayList)22 NodeGroup (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroup)18 SQLException (java.sql.SQLException)16 Connection (java.sql.Connection)14 FacesMessage (javax.faces.application.FacesMessage)13 ThesaurusHelper (mom.trd.opentheso.bdd.helper.ThesaurusHelper)9 MyTreeNode (mom.trd.opentheso.bdd.helper.nodes.MyTreeNode)9 ConceptGroupLabel (mom.trd.opentheso.bdd.datas.ConceptGroupLabel)8 RelationsHelper (mom.trd.opentheso.bdd.helper.RelationsHelper)8 NodeUri (mom.trd.opentheso.bdd.helper.nodes.NodeUri)8 NodeGroupLabel (mom.trd.opentheso.bdd.helper.nodes.group.NodeGroupLabel)8 PrefixString (com.k_int.IR.QueryModels.PrefixString)7 NodeAutoCompletion (mom.trd.opentheso.bdd.helper.nodes.NodeAutoCompletion)6 DefaultTreeNode (org.primefaces.model.DefaultTreeNode)6 HashMap (java.util.HashMap)5 Concept (mom.trd.opentheso.bdd.datas.Concept)5 OrphanHelper (mom.trd.opentheso.bdd.helper.OrphanHelper)5 TermHelper (mom.trd.opentheso.bdd.helper.TermHelper)5