Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package com.megatim.fdxcommons.tools.database.queries.metadata;
 
import com.megatim.fdxcommons.tools.database.contrat.TypeFichierDataRow;
import com.megatim.fdxcommons.tools.database.contrat.TypeFichierInsertMetaData;
import java.util.List;
import java.util.stream.Collectors;
 
/**
 *
 * @author ASUS
 */
public class ConsultationTypeFichierInsertData implements TypeFichierInsertMetaData {
 
    private final List<TypeFichierDataRow> rows;
    private final String tableName;
 
    public ConsultationTypeFichierInsertData(List<TypeFichierDataRow> rows, String tableName) {
        this.rows = rows;
        this.tableName = tableName;
    }
 
    @Override
    public List<String> columnNames() throws Exception {
        return rows.get(0).columns()
                .stream()
                .map(e -> e.column())
                .sorted((e1, e2) -> e1.compareTo(e2)) //On se rassure de classer le résultat
                .collect(Collectors.toList());
    }
 
    @Override
    public String tableName() {
        return tableName;
    }
 
    @Override
    public List<TypeFichierDataRow> rows() throws Exception {
        return rows;
    }
}