Search in sources :

Example 1 with ExportPrivatesDatas

use of mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas in project opentheso by miledrousset.

the class TestExportPrivatesDatas method testWriteUsersIntoXML1.

@Test
public void testWriteUsersIntoXML1() {
    HikariDataSource conn = openConnexionPool();
    ExportPrivatesDatas exportPrivatesDatas = new ExportPrivatesDatas();
    ArrayList<Table> usersList = exportPrivatesDatas.getDatasOfTable(conn, "alignement_type");
    // ArrayList <Proposition> listPropo = exportPrivatesDatas.getProposition(conn);
    // ArrayList <Concept_Candidat> listConceptC = exportPrivatesDatas.getconceptCandidat(conn);
    // ArrayList <Term_Candidat> listTermC = exportPrivatesDatas.getTermeCandidat(conn);
    // ArrayList <Concept_orphan> list_userRol = exportPrivatesDatas.getConceptOrphelin(conn);
    // ArrayList <Concept_Fusion> list_userRol = exportPrivatesDatas.getconceptFusion(conn);
    // ArrayList <Images> list_userRol = exportPrivatesDatas.getImages(conn);
    // ArrayList <Preferences> list_userRol = exportPrivatesDatas.getPreferences(conn);
    // ArrayList <Concept_Group_Historique> list_userRol = exportPrivatesDatas.getConceptGroupHist(conn);
    // ArrayList <Concept_Group_Label_Historique> list_userRol = exportPrivatesDatas.getconceptGroupLabelH(conn);
    // ArrayList <Concept_Historique> list_userRol = exportPrivatesDatas.getConceptHistorique(conn);
    // ArrayList <Hierarchical_Relationship_Historique> list_userRol = exportPrivatesDatas.getHierarchicalRelationshipH(conn);
    // ArrayList <Non_Preferred_Term> list_userRol = exportPrivatesDatas.getNonPreferredTerm(conn);
    // ArrayList <Note_Historique> list_userRol = exportPrivatesDatas.getNoteHistorique(conn);
    // ArrayList <Term_Historique> list_userRol = exportPrivatesDatas.getTermHistorique(conn);
    conn.close();
    writeHead();
    startTable("users");
    for (Table user : usersList) {
        startLine();
        for (LineOfData lineOfData : user.getLineOfDatas()) {
            writeLine(lineOfData.getColomne(), lineOfData.getValue());
        }
        endLine();
    }
    endTable("users");
    System.out.println(xml);
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) Table(mom.trd.opentheso.core.exports.privatesdatas.tables.Table) LineOfData(mom.trd.opentheso.core.exports.privatesdatas.LineOfData) ExportPrivatesDatas(mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas) Test(org.junit.Test)

Example 2 with ExportPrivatesDatas

use of mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas in project opentheso by miledrousset.

the class BaseDeDonnesBean method backUpBaseDonnees.

/**
 * Cette fonction permet de télécharger les tables et les données ce qui
 * permet de sauvegarder toutes les données privées pour les mise à jour
 *
 * @param toutTables
 * @return
 */
public StreamedContent backUpBaseDonnees(ArrayList<String> toutTables) {
    ArrayList<Table> sortirXml;
    ExportPrivatesDatas backUp = new ExportPrivatesDatas();
    Iterator<String> it1 = toutTables.iterator();
    WriteXml write = new WriteXml();
    write.writeHead();
    write.start();
    String table = "";
    // date du jour
    java.util.Date datetoday = new java.util.Date();
    while (it1.hasNext()) {
        table = it1.next();
        sortirXml = backUp.getDatasOfTable(connect.getPoolConnexion(), table);
        write.WriteIntoXML(sortirXml, table);
    }
    write.end();
    InputStream stream;
    try {
        stream = new ByteArrayInputStream(write.getXml().toString().getBytes("UTF-8"));
        file = new DefaultStreamedContent(stream, "application/xml", "backupOpentheso_" + datetoday + ".xml");
    } catch (UnsupportedEncodingException ex) {
        Logger.getLogger(DownloadBean.class.getName()).log(Level.SEVERE, null, ex);
    }
    return file;
}
Also used : DefaultStreamedContent(org.primefaces.model.DefaultStreamedContent) Table(mom.trd.opentheso.core.exports.privatesdatas.tables.Table) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) UnsupportedEncodingException(java.io.UnsupportedEncodingException) WriteXml(mom.trd.opentheso.core.exports.privatesdatas.WriteXml) ByteArrayInputStream(java.io.ByteArrayInputStream) ExportPrivatesDatas(mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas)

Example 3 with ExportPrivatesDatas

use of mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas in project opentheso by miledrousset.

the class SelectedThesaurus method getAllTables.

public void getAllTables() {
    ExportPrivatesDatas exportData = new ExportPrivatesDatas();
    tablesList = exportData.showAllTables(connect.getPoolConnexion());
    tablesListPrivate = exportData.showPrivateTables(connect.getPoolConnexion());
}
Also used : ExportPrivatesDatas(mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas)

Example 4 with ExportPrivatesDatas

use of mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas in project opentheso by miledrousset.

the class TestExportPrivatesDatas method testGetUsers.

// TODO add test methods here.
// The methods must be annotated with annotation @Test. For example:
// 
@Test
public void testGetUsers() {
    HikariDataSource conn = openConnexionPool();
    ExportPrivatesDatas exportPrivatesDatas = new ExportPrivatesDatas();
    // ArrayList <Users> list_userRol = exportPrivatesDatas.getUSers(conn);
    // ArrayList <Role> list_userRol = exportPrivatesDatas.getRoles(conn);
    // ArrayList <User_Role> list_userRol = exportPrivatesDatas.getUser_Roles(conn);
    // ArrayList <Concept_Term_Candidat> list_userRol = exportPrivatesDatas.getConceptTermCandidat(conn);
    // ArrayList <Proposition> list_userRol = exportPrivatesDatas.getProposition(conn);
    // ArrayList <Concept_Candidat> list_userRol = exportPrivatesDatas.getconceptCandidat(conn);
    // ArrayList <Term_Candidat> list_userRol = exportPrivatesDatas.getTermeCandidat(conn);
    // ArrayList <Concept_orphan> list_userRol = exportPrivatesDatas.getConceptOrphelin(conn);
    // ArrayList <Concept_Fusion> list_userRol = exportPrivatesDatas.getconceptFusion(conn);
    // ArrayList <Images> list_userRol = exportPrivatesDatas.getImages(conn);
    // ArrayList <Preferences> list_userRol = exportPrivatesDatas.getPreferences(conn);
    // ArrayList <Concept_Group_Historique> list_userRol = exportPrivatesDatas.getConceptGroupHist(conn);
    // ArrayList <Concept_Group_Label_Historique> list_userRol = exportPrivatesDatas.getconceptGroupLabelH(conn);
    // ArrayList <Concept_Historique> list_userRol = exportPrivatesDatas.getConceptHistorique(conn);
    // ArrayList <Hierarchical_Relationship_Historique> list_userRol = exportPrivatesDatas.getHierarchicalRelationshipH(conn);
    // ArrayList <Non_Preferred_Term> list_userRol = exportPrivatesDatas.getNonPreferredTerm(conn);
    // ArrayList <Note_Historique> list_userRol = exportPrivatesDatas.getNoteHistorique(conn);
    // ArrayList <Term_Historique> list_userRol = exportPrivatesDatas.getTermHistorique(conn);
    conn.close();
}
Also used : HikariDataSource(com.zaxxer.hikari.HikariDataSource) ExportPrivatesDatas(mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas) Test(org.junit.Test)

Aggregations

ExportPrivatesDatas (mom.trd.opentheso.core.exports.helper.ExportPrivatesDatas)4 HikariDataSource (com.zaxxer.hikari.HikariDataSource)2 Table (mom.trd.opentheso.core.exports.privatesdatas.tables.Table)2 Test (org.junit.Test)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 LineOfData (mom.trd.opentheso.core.exports.privatesdatas.LineOfData)1 WriteXml (mom.trd.opentheso.core.exports.privatesdatas.WriteXml)1 DefaultStreamedContent (org.primefaces.model.DefaultStreamedContent)1