OpenConcerto

Dépôt officiel du code source de l'ERP OpenConcerto
sonarqube

svn://code.openconcerto.org/openconcerto

Rev

Rev 140 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 140 Rev 159
Line 18... Line 18...
18
import org.openconcerto.sql.model.SQLDataSource;
18
import org.openconcerto.sql.model.SQLDataSource;
19
import org.openconcerto.utils.ExceptionHandler;
19
import org.openconcerto.utils.ExceptionHandler;
20
import org.openconcerto.utils.FileUtils;
20
import org.openconcerto.utils.FileUtils;
21
 
21
 
22
public class OLAPPanel extends JPanel {
22
public class OLAPPanel extends JPanel {
-
 
23
    private String loadInfo = "";
-
 
24
 
23
    public OLAPPanel() {
25
    public OLAPPanel() {
24
        this.setOpaque(false);
26
        this.setOpaque(false);
25
        this.setLayout(new GridLayout(1, 1));
27
        this.setLayout(new GridLayout(1, 1));
26
 
28
 
27
        reload();
29
        reload();
Line 36... Line 38...
36
            final File f = new File(dir, "openconcerto_catalog.xml");
38
            final File f = new File(dir, "openconcerto_catalog.xml");
37
            String catalog = "empty";
39
            String catalog = "empty";
38
            if (f.exists()) {
40
            if (f.exists()) {
39
                System.out.println("OLAP: using catalog " + f.getAbsolutePath());
41
                System.out.println("OLAP: using catalog " + f.getAbsolutePath());
40
                catalog = FileUtils.read(f, "UTF8");
42
                catalog = FileUtils.read(f, "UTF8");
-
 
43
                loadInfo = f.getAbsolutePath() + " ok";
41
            } else {
44
            } else {
42
                System.out.println("OLAP: using embedded catalog (" + f.getAbsolutePath() + " missing)");
45
                System.out.println("OLAP: using embedded catalog (" + f.getAbsolutePath() + " missing)");
43
                final InputStream in = this.getClass().getResourceAsStream("openconcerto_catalog.xml");
46
                final InputStream in = this.getClass().getResourceAsStream("openconcerto_catalog.xml");
44
                catalog = FileUtils.readUTF8(in);
47
                catalog = FileUtils.readUTF8(in);
-
 
48
                loadInfo = f.getAbsolutePath() + " missing";
45
            }
49
            }
46
            final String url = getOlapURL(ComptaPropsConfiguration.getInstanceCompta(), catalog);
50
            final String url = getOlapURL(ComptaPropsConfiguration.getInstanceCompta(), catalog);
47
            final Connection rConnection = DriverManager.getConnection(url);
51
            final Connection rConnection = DriverManager.getConnection(url);
48
 
52
 
49
            final OlapConnection oConnection = rConnection.unwrap(OlapConnection.class);
53
            final OlapConnection oConnection = rConnection.unwrap(OlapConnection.class);
Line 88... Line 92...
88
        } catch (Exception e) {
92
        } catch (Exception e) {
89
            ExceptionHandler.handle("OLAP configuration issue", e);
93
            ExceptionHandler.handle("OLAP configuration issue", e);
90
        }
94
        }
91
        return url;
95
        return url;
92
    }
96
    }
-
 
97
 
-
 
98
    public String getLoadInfo() {
-
 
99
        return this.loadInfo;
-
 
100
    }
93
}
101
}