OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
110 ilm 1
package org.openconcerto.modules.reports.olap;
2
 
3
import java.io.File;
4
import java.io.IOException;
5
 
6
import javax.swing.JFrame;
7
import javax.swing.JOptionPane;
8
 
9
import org.openconcerto.erp.config.ComptaPropsConfiguration;
10
import org.openconcerto.erp.config.Gestion;
11
import org.openconcerto.erp.config.MainFrame;
12
import org.openconcerto.erp.modules.AbstractModule;
13
import org.openconcerto.erp.modules.ComponentsContext;
14
import org.openconcerto.erp.modules.DBContext;
15
import org.openconcerto.erp.modules.ModuleFactory;
16
import org.openconcerto.erp.modules.ModuleManager;
17
import org.openconcerto.erp.modules.ModulePackager;
18
import org.openconcerto.sql.element.SQLElementDirectory;
19
import org.openconcerto.sql.model.SQLRequestLog;
20
import org.openconcerto.sql.model.SQLSystem;
21
import org.openconcerto.sql.ui.ConnexionPanel;
22
import org.openconcerto.utils.FileUtils;
23
 
24
public final class Module extends AbstractModule {
25
 
26
    public Module(ModuleFactory f) throws IOException {
27
        super(f);
28
 
29
    }
30
 
31
    @Override
32
    protected void install(DBContext ctxt) {
33
 
34
    }
35
 
36
    @Override
37
    protected void setupElements(SQLElementDirectory dir) {
38
 
39
    }
40
 
41
    @Override
42
    protected void setupComponents(ComponentsContext ctxt) {
43
 
44
        // ctxt.addMenuItem(new SQLElementListAction(ctxt.getElement(TABLE_NAME)) {
45
        //
46
        // @Override
47
        // protected void initFrame(IListFrame f) {
48
        // super.initFrame(f);
49
        // f.getPanel().setAddVisible(false);
50
        // }
51
        //
52
        // }, MainFrame.LIST_MENU);
53
        // ctxt.addListAction("CLIENT", new CallActionFactory());
54
 
55
    }
56
 
57
    @Override
58
    protected void start() {
59
        try {
60
 
61
            Class.forName("mondrian.olap4j.MondrianOlap4jDriver");
62
            System.setProperty("mondrian.rolap.star.disableCaching", "true");
63
            System.setProperty("mondrian.expCache.enable", "false");
64
            System.setProperty("mondrian.rolap.RolapResult.flushAfterEachQuery", "true");
65
            System.setProperty("mondrian.rolap.EnableRolapCubeMemberCache", "false");
66
            System.setProperty("mondrian.rolap.generate.formatted.sql", "true");
67
            if (ComptaPropsConfiguration.getInstance().getRoot().getServer().getSQLSystem() != SQLSystem.POSTGRESQL) {
68
                JOptionPane.showMessageDialog(new JFrame(), "The Business Intelligence module requires a PostgreSQL database");
69
            } else {
70
                MainFrame.getInstance().getTabbedPane().addTab("Business Intelligence", new OLAPPanel());
71
            }
72
        } catch (Exception e) {
73
            e.printStackTrace();
74
        }
75
    }
76
 
77
    @Override
78
    protected void stop() {
79
    }
80
 
81
    public static void main(String[] args) throws IOException {
82
        System.setProperty(ConnexionPanel.QUICK_LOGIN, "true");
83
        final File propsFile = new File("module.properties");
84
 
85
        final File distDir = new File("dist");
86
        FileUtils.mkdir_p(distDir);
87
        final ModulePackager modulePackager = new ModulePackager(propsFile, new File("bin/"));
88
        modulePackager.setSkipDuplicateFiles(true);
89
        modulePackager.addJarsFromDir(new File("lib"));
90
        modulePackager.writeToDir(distDir);
91
        modulePackager.writeToDir(new File("../OpenConcerto/Modules"));
92
        SQLRequestLog.setEnabled(true);
93
        SQLRequestLog.showFrame();
94
 
95
        ModuleManager.getInstance().addFactories(new File("../OpenConcerto/Modules"));
96
        Gestion.main(args);
97
    }
98
}