OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

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

Rev 18 Rev 25
Line 11... Line 11...
11
 * When distributing the software, include this License Header Notice in each file.
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
12
 */
13
 
13
 
14
 package org.openconcerto.erp.modules;
14
 package org.openconcerto.erp.modules;
15
 
15
 
-
 
16
import org.openconcerto.sql.model.DBRoot;
-
 
17
import org.openconcerto.sql.preferences.SQLPreferences;
16
import org.openconcerto.utils.cc.IPredicate;
18
import org.openconcerto.utils.cc.IPredicate;
17
 
19
 
18
import java.io.IOException;
20
import java.io.IOException;
19
import java.io.InputStream;
21
import java.io.InputStream;
20
import java.util.Collection;
22
import java.util.Collection;
21
import java.util.HashMap;
23
import java.util.HashMap;
22
import java.util.Locale;
24
import java.util.Locale;
23
import java.util.Map;
25
import java.util.Map;
24
import java.util.Properties;
26
import java.util.Properties;
25
import java.util.ResourceBundle;
27
import java.util.ResourceBundle;
-
 
28
import java.util.prefs.Preferences;
26
import java.util.regex.Matcher;
29
import java.util.regex.Matcher;
27
import java.util.regex.Pattern;
30
import java.util.regex.Pattern;
28
 
31
 
29
/**
32
/**
30
 * Parse module properties, and allow to create modules.
33
 * Parse module properties, and allow to create modules.
Line 173... Line 176...
173
 
176
 
174
    protected final AbstractModule createModule(final Class<?> c) throws Exception {
177
    protected final AbstractModule createModule(final Class<?> c) throws Exception {
175
        return (AbstractModule) c.getConstructor(ModuleFactory.class).newInstance(this);
178
        return (AbstractModule) c.getConstructor(ModuleFactory.class).newInstance(this);
176
    }
179
    }
177
 
180
 
-
 
181
    public final Preferences getLocalPreferences() {
-
 
182
        return this.getPreferences(true, null);
-
 
183
    }
-
 
184
 
-
 
185
    public final Preferences getSQLPreferences(final DBRoot root) {
-
 
186
        return this.getPreferences(false, root);
-
 
187
    }
-
 
188
 
-
 
189
    public final Preferences getPreferences(final boolean local, final DBRoot root) {
-
 
190
        final Preferences rootPrefs = local ? Preferences.userRoot() : new SQLPreferences(root);
-
 
191
        // ID is a package name, transform to path to avoid bumping into the size limit
-
 
192
        return rootPrefs.node(ModulePreferencePanel.getAppPrefPath() + this.getID().replace('.', '/'));
-
 
193
    }
-
 
194
 
178
    @Override
195
    @Override
179
    public String toString() {
196
    public String toString() {
180
        return super.toString() + " " + getID() + " (" + getMajorVersion() + "." + getMinorVersion() + ")";
197
        return getClass().getSimpleName() + " " + getID() + " (" + getMajorVersion() + "." + getMinorVersion() + ")";
181
    }
198
    }
182
}
199
}