Search in sources :

Example 1 with ExternalImagesHelper

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

the class ExternalResources method addExternalImage.

public void addExternalImage(String idTheso, String idConcept, int idUser) {
    String copyRight = "";
    if (inputUri == null || inputUri.isEmpty()) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("sTerme.error5")));
        return;
    }
    ExternalImagesHelper imagesHelper = new ExternalImagesHelper();
    if (inputLable == null || inputLable.isEmpty()) {
        inputLable = idConcept;
    }
    if (!imagesHelper.addExternalImage(connect.getPoolConnexion(), idConcept, idTheso, inputLable, copyRight, inputUri, idUser)) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Error-BDD")));
        return;
    }
    loadImages(idTheso, idConcept);
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "", langueBean.getMsg("externalResources.addedImage")));
}
Also used : FacesMessage(javax.faces.application.FacesMessage) ExternalImagesHelper(mom.trd.opentheso.bdd.helper.ExternalImagesHelper)

Example 2 with ExternalImagesHelper

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

the class ExternalResources method deleteExternalImage.

public void deleteExternalImage(String idTheso, String idConcept, String imageUri) {
    ExternalImagesHelper imagesHelper = new ExternalImagesHelper();
    if (!imagesHelper.deleteExternalImage(connect.getPoolConnexion(), idConcept, idTheso, imageUri)) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, langueBean.getMsg("error") + " :", langueBean.getMsg("Error-BDD")));
        return;
    }
    loadImages(idTheso, idConcept);
    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "", langueBean.getMsg("externalResources.deleteImage")));
}
Also used : FacesMessage(javax.faces.application.FacesMessage) ExternalImagesHelper(mom.trd.opentheso.bdd.helper.ExternalImagesHelper)

Example 3 with ExternalImagesHelper

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

the class SelectedThesaurus method regenIdConcept.

/**
 * Cette fonction remplace tout les id des concepts du théso
 */
private void regenIdConcept(Connection conn, String idTheso, ArrayList<String> idGroup) throws Exception {
    /*récup les concepts*/
    ConceptHelper conceptHelper = new ConceptHelper();
    ArrayList<String> idConcepts = conceptHelper.getAllIdConceptOfThesaurus(conn, idTheso);
    if (idConcepts == null || idConcepts.isEmpty()) {
        throw new Exception("No concept in this thesaurus");
    }
    /*génération des nouveaux id*/
    ArrayList<String> reservedId = idConcepts;
    reservedId.addAll(idGroup);
    ArrayList<String> newIdConcepts = createNewId(reservedId, idConcepts.size());
    /*maj des tables*/
    NoteHelper noteHelper = new NoteHelper();
    GpsHelper gpsHelper = new GpsHelper();
    ImagesHelper imagesHelper = new ImagesHelper();
    ExternalImagesHelper externalImagesHelper = new ExternalImagesHelper();
    AlignmentHelper alignmentHelper = new AlignmentHelper();
    for (int i = 0; i < idConcepts.size(); i++) {
        String id = idConcepts.get(i);
        String newId = newIdConcepts.get(i);
        // table concept
        conceptHelper.setIdConcept(conn, idTheso, id, newId);
        // table concept_group_concept
        conceptHelper.setIdConceptGroupConcept(conn, idTheso, id, newId);
        // table concept_historique
        conceptHelper.setIdConceptHistorique(conn, idTheso, id, newId);
        // table concept_orphan
        conceptHelper.setIdConceptOrphan(conn, idTheso, id, newId);
        // table gps
        gpsHelper.setIdConceptGPS(conn, idTheso, id, newId);
        // table hierarchical_relationship
        conceptHelper.setIdConceptHieraRelation(conn, idTheso, id, newId);
        // table hierarchical_relationship_historique
        conceptHelper.setIdConceptHieraRelationHisto(conn, idTheso, id, newId);
        // table note
        noteHelper.setIdConceptNote(conn, idTheso, id, newId);
        // table note_historique
        noteHelper.setIdConceptNoteHisto(conn, idTheso, id, newId);
        // table images
        imagesHelper.setIdConceptImage(conn, idTheso, id, newId);
        // table external images
        externalImagesHelper.setIdConceptExternalImage(conn, idTheso, id, newId);
        // table concept_fusion
        conceptHelper.setIdConceptFusion(conn, idTheso, id, newId);
        // table preferred_term
        conceptHelper.setIdConceptPreferedTerm(conn, idTheso, id, newId);
        // table alignement
        alignmentHelper.setIdConceptAlignement(conn, idTheso, id, newId);
    }
}
Also used : ExternalImagesHelper(mom.trd.opentheso.bdd.helper.ExternalImagesHelper) ImagesHelper(mom.trd.opentheso.bdd.helper.ImagesHelper) GpsHelper(mom.trd.opentheso.bdd.helper.GpsHelper) ConceptHelper(mom.trd.opentheso.bdd.helper.ConceptHelper) NoteHelper(mom.trd.opentheso.bdd.helper.NoteHelper) AlignmentHelper(mom.trd.opentheso.bdd.helper.AlignmentHelper) SQLException(java.sql.SQLException) ExternalImagesHelper(mom.trd.opentheso.bdd.helper.ExternalImagesHelper)

Example 4 with ExternalImagesHelper

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

the class ExternalResources method loadImages.

public void loadImages(String idTheso, String idConcept) {
    images.clear();
    ExternalImagesHelper imagesHelper = new ExternalImagesHelper();
    nodeImages = imagesHelper.getExternalImages(connect.getPoolConnexion(), idConcept, idTheso);
    if (nodeImages == null)
        return;
    for (NodeImage nodeImage : nodeImages) {
        images.add(nodeImage.getUri());
    }
}
Also used : NodeImage(mom.trd.opentheso.bdd.helper.nodes.NodeImage) ExternalImagesHelper(mom.trd.opentheso.bdd.helper.ExternalImagesHelper)

Example 5 with ExternalImagesHelper

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

the class Alignment method getExternalImagesOfConcept.

/**
 * permet de récuprer les images du concepts (URI des images)
 * pour pouvoir structurer l'objet pour comparer les images locales et distantes
 * @param idConcept
 * @param idTheso
 */
private void getExternalImagesOfConcept(String idTheso, String idConcept) {
    ExternalImagesHelper imagesHelper = new ExternalImagesHelper();
    nodeImages = imagesHelper.getExternalImages(connect.getPoolConnexion(), idConcept, idTheso);
}
Also used : ExternalImagesHelper(mom.trd.opentheso.bdd.helper.ExternalImagesHelper)

Aggregations

ExternalImagesHelper (mom.trd.opentheso.bdd.helper.ExternalImagesHelper)6 FacesMessage (javax.faces.application.FacesMessage)2 SQLException (java.sql.SQLException)1 AlignmentHelper (mom.trd.opentheso.bdd.helper.AlignmentHelper)1 ConceptHelper (mom.trd.opentheso.bdd.helper.ConceptHelper)1 GpsHelper (mom.trd.opentheso.bdd.helper.GpsHelper)1 ImagesHelper (mom.trd.opentheso.bdd.helper.ImagesHelper)1 NoteHelper (mom.trd.opentheso.bdd.helper.NoteHelper)1 NodeImage (mom.trd.opentheso.bdd.helper.nodes.NodeImage)1 SelectedResource (mom.trd.opentheso.core.alignment.SelectedResource)1