OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 19 | Rev 67 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 25
Line 12... Line 12...
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.modules;
14
 package org.openconcerto.erp.modules;
15
 
15
 
16
import org.openconcerto.sql.element.SQLComponent;
16
import org.openconcerto.sql.element.SQLComponent;
-
 
17
import org.openconcerto.sql.element.SQLElement;
17
import org.openconcerto.sql.element.SQLElementDirectory;
18
import org.openconcerto.sql.element.SQLElementDirectory;
-
 
19
import org.openconcerto.sql.model.DBRoot;
18
 
20
 
-
 
21
import java.io.File;
19
import java.io.IOException;
22
import java.io.IOException;
20
import java.util.ArrayList;
23
import java.util.ArrayList;
21
import java.util.Collections;
24
import java.util.Collections;
22
import java.util.HashMap;
25
import java.util.HashMap;
23
import java.util.List;
26
import java.util.List;
Line 51... Line 54...
51
    public final int getVersion() {
54
    public final int getVersion() {
52
        return this.getFactory().getMajorVersion();
55
        return this.getFactory().getMajorVersion();
53
    }
56
    }
54
 
57
 
55
    /**
58
    /**
-
 
59
     * The directory this module should use while running. During installation use
-
 
60
     * {@link DBContext#getLocalDirectory()}.
-
 
61
     * 
-
 
62
     * @return the directory for this module.
-
 
63
     */
-
 
64
    protected final File getLocalDirectory() {
-
 
65
        return ModuleManager.getInstance().getLocalDirectory(this.getFactory().getID());
-
 
66
    }
-
 
67
 
-
 
68
    /**
56
     * Should create permanent items. NOTE: all items created through <code>ctxt</code> will be
69
     * Should create permanent items. NOTE: all structure items created through <code>ctxt</code>
57
     * dropped automatically, i.e. no action is necessary in {@link #uninstall()}.
70
     * will be dropped automatically, and similarly all files created in
-
 
71
     * {@link DBContext#getLocalDirectory()} will be deleted automatically, i.e. no action is
-
 
72
     * necessary in {@link #uninstall(DBRoot)}.
58
     * 
73
     * 
59
     * @param ctxt to create database objects.
74
     * @param ctxt to create database objects.
60
     */
75
     */
61
    protected void install(DBContext ctxt) {
76
    protected void install(DBContext ctxt) {
62
 
77
 
63
    }
78
    }
64
 
79
 
65
    /**
80
    /**
66
     * Should add elements for the tables of this module. It's also the place to
81
     * Should add elements for the tables of this module. It's also the place to
67
     * {@link SQLElement#setAction(String, org.openconcerto.sql.element.SQLElement.ReferenceAction)set actions}
82
     * {@link SQLElement#setAction(String, SQLElement.ReferenceAction) set actions} for foreign keys
68
     * for foreign keys of this module. NOTE: this method is called as long as the module is
83
     * of this module. NOTE: this method is called as long as the module is installed in the
69
     * installed in the database, even if it is stopped.
84
     * database, even if it is stopped.
70
     * 
85
     * 
71
     * @param dir the directory where to add elements.
86
     * @param dir the directory where to add elements.
72
     */
87
     */
73
    protected void setupElements(SQLElementDirectory dir) {
88
    protected void setupElements(SQLElementDirectory dir) {
74
    }
89
    }
Line 103... Line 118...
103
        return res;
118
        return res;
104
    }
119
    }
105
 
120
 
106
    protected abstract void stop();
121
    protected abstract void stop();
107
 
122
 
108
    protected void uninstall() {
123
    protected void uninstall(DBRoot root) {
109
 
124
 
110
    }
125
    }
111
}
126
}