Search in sources :

Example 1 with HandleHelper

use of mom.trd.opentheso.ws.handle.HandleHelper in project opentheso by miledrousset.

the class NewTreeBean method delSubGroup.

/**
 * Supprime le groupe sélectionné
 */
public void delSubGroup() {
    Connection conn;
    try {
        conn = connect.getPoolConnexion().getConnection();
        conn.setAutoCommit(false);
        if (!new GroupHelper().deleteConceptGroupRollBack(conn, selectedTerme.getIdC(), selectedTerme.getIdTheso(), selectedTerme.getUser().getUser().getIdUser())) {
            conn.rollback();
            conn.close();
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("group.errorDelete")));
            return;
        }
        // pour supprimer le Handle si c'est activé
        if (roleOnTheso.getNodePreference() != null) {
            if (roleOnTheso.getNodePreference().isUseHandle()) {
                HandleHelper handleHelper = new HandleHelper(roleOnTheso.getNodePreference());
                if (!handleHelper.deleteIdHandle(selectedTerme.getIdHandle(), selectedTerme.getIdTheso())) {
                    conn.rollback();
                    conn.close();
                    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("group.errorDelete")));
                    return;
                }
            }
        }
        conn.commit();
        conn.close();
    } catch (Exception e) {
        System.err.println(e.toString());
    }
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("tree.info7")));
    reInit();
    initTree(selectedTerme.getIdTheso(), selectedTerme.getIdlangue());
    selectedTerme.reInitTerme();
}
Also used : Connection(java.sql.Connection) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) FacesMessage(javax.faces.application.FacesMessage) HandleHelper(mom.trd.opentheso.ws.handle.HandleHelper) IOException(java.io.IOException)

Example 2 with HandleHelper

use of mom.trd.opentheso.ws.handle.HandleHelper in project opentheso by miledrousset.

the class NewTreeBean method delGroup.

/**
 * ************************** ACTIONS SELECTEDTERME
 * ***************************
 */
/**
 * Supprime le groupe sélectionné
 * @param idGroup
 * @param idTheso
 * @param idHandle
 * @param idUser
 */
public void delGroup(String idGroup, String idTheso, String idHandle, int idUser) {
    Connection conn;
    try {
        conn = connect.getPoolConnexion().getConnection();
        conn.setAutoCommit(false);
        if (!new GroupHelper().deleteConceptGroupRollBack(conn, idGroup, idTheso, idUser)) {
            conn.rollback();
            conn.close();
            FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("group.errorDelete")));
            return;
        }
        // pour supprimer le Handle si c'est activé
        if (roleOnTheso.getNodePreference() != null) {
            if (roleOnTheso.getNodePreference().isUseHandle()) {
                HandleHelper handleHelper = new HandleHelper(roleOnTheso.getNodePreference());
                if (!handleHelper.deleteIdHandle(idHandle, selectedTerme.getIdTheso())) {
                    conn.rollback();
                    conn.close();
                    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("error") + " :", langueBean.getMsg("group.errorDelete")));
                    return;
                }
            }
        }
        conn.commit();
        conn.close();
    } catch (Exception e) {
        System.err.println(e.toString());
    }
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(langueBean.getMsg("info") + " :", langueBean.getMsg("tree.info7")));
    reInit();
    initTree(selectedTerme.getIdTheso(), selectedTerme.getIdlangue());
    selectedTerme.reInitTerme();
}
Also used : Connection(java.sql.Connection) GroupHelper(mom.trd.opentheso.bdd.helper.GroupHelper) FacesMessage(javax.faces.application.FacesMessage) HandleHelper(mom.trd.opentheso.ws.handle.HandleHelper) IOException(java.io.IOException)

Example 3 with HandleHelper

use of mom.trd.opentheso.ws.handle.HandleHelper in project opentheso by miledrousset.

the class ConceptHelper method updateIdHandle.

/**
 * Permet de mettre à jour l'identifiant Handle
 *
 * @param ds
 * @param idConcept
 * @param idThesaurus
 * @return
 */
public boolean updateIdHandle(HikariDataSource ds, String idConcept, String idThesaurus) {
    if (nodePreference == null) {
        return false;
    }
    if (!nodePreference.isUseHandle()) {
        return false;
    }
    ConceptHelper conceptHelper = new ConceptHelper();
    String idHandle = conceptHelper.getIdHandleOfConcept(ds, idConcept, idThesaurus);
    String privateUri = "?idc=" + idConcept + "&idt=" + idThesaurus;
    HandleHelper handleHelper = new HandleHelper(nodePreference);
    idHandle = handleHelper.updateIdHandle(idHandle, privateUri);
    if (idHandle == null) {
        message = handleHelper.getMessage();
        return false;
    }
    return updateHandleIdOfConcept(ds, idConcept, idThesaurus, idHandle);
}
Also used : HandleHelper(mom.trd.opentheso.ws.handle.HandleHelper)

Example 4 with HandleHelper

use of mom.trd.opentheso.ws.handle.HandleHelper in project opentheso by miledrousset.

the class GroupHelper method addIdHandle.

/**
 * @param conn
 * @param idConcept
 * @param idThesaurus
 * @param urlSite
 * @return
 */
private boolean addIdHandle(Connection conn, String idGroup, String idThesaurus) {
    if (nodePreference == null) {
        return false;
    }
    if (!nodePreference.isUseHandle()) {
        return false;
    }
    String privateUri = "?idg=" + idGroup + "&idt=" + idThesaurus;
    HandleHelper handleHelper = new HandleHelper(nodePreference);
    String idHandle = handleHelper.addIdHandle(privateUri);
    if (idHandle == null) {
        message = handleHelper.getMessage();
        return false;
    }
    return updateHandleIdOfGroup(conn, idGroup, idThesaurus, idHandle);
}
Also used : HandleHelper(mom.trd.opentheso.ws.handle.HandleHelper)

Example 5 with HandleHelper

use of mom.trd.opentheso.ws.handle.HandleHelper in project opentheso by miledrousset.

the class ConceptHelper method addIdHandle.

/**
 * @param conn
 * @param idConcept
 * @param idThesaurus
 * @param urlSite
 * @return
 */
private boolean addIdHandle(Connection conn, String idConcept, String idThesaurus) {
    if (nodePreference == null) {
        return false;
    }
    if (!nodePreference.isUseHandle()) {
        return false;
    }
    String privateUri = "?idc=" + idConcept + "&idt=" + idThesaurus;
    HandleHelper handleHelper = new HandleHelper(nodePreference);
    String idHandle = handleHelper.addIdHandle(privateUri);
    if (idHandle == null) {
        message = handleHelper.getMessage();
        return false;
    }
    return updateHandleIdOfConcept(conn, idConcept, idThesaurus, idHandle);
}
Also used : HandleHelper(mom.trd.opentheso.ws.handle.HandleHelper)

Aggregations

HandleHelper (mom.trd.opentheso.ws.handle.HandleHelper)6 IOException (java.io.IOException)2 Connection (java.sql.Connection)2 FacesMessage (javax.faces.application.FacesMessage)2 GroupHelper (mom.trd.opentheso.bdd.helper.GroupHelper)2