OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 151 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
18 ilm 1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
4
 * Copyright 2011 OpenConcerto, by ILM Informatique. All rights reserved.
5
 *
6
 * The contents of this file are subject to the terms of the GNU General Public License Version 3
7
 * only ("GPL"). You may not use this file except in compliance with the License. You can obtain a
8
 * copy of the License at http://www.gnu.org/licenses/gpl-3.0.html See the License for the specific
9
 * language governing permissions and limitations under the License.
10
 *
11
 * When distributing the software, include this License Header Notice in each file.
12
 */
13
 
14
 package org.openconcerto.erp.core.common.element;
15
 
16
import org.openconcerto.sql.Configuration;
17
import org.openconcerto.sql.model.DBRoot;
151 ilm 18
import org.openconcerto.sql.model.SQLTable;
93 ilm 19
import org.openconcerto.task.config.ComptaBasePropsConfiguration;
18 ilm 20
 
21
/**
22
 * SQLElement de la base société
23
 *
24
 * @author Administrateur
25
 *
26
 */
132 ilm 27
public abstract class ComptaSQLConfElement extends SocieteSQLConfElement {
18 ilm 28
 
29
    private static DBRoot baseSociete;
30
 
31
    private static DBRoot getBaseSociete() {
32
        if (baseSociete == null)
93 ilm 33
            baseSociete = ((ComptaBasePropsConfiguration) Configuration.getInstance()).getRootSociete();
18 ilm 34
        return baseSociete;
35
    }
36
 
156 ilm 37
    protected static SQLTable findTable(String tableName) {
38
        return getBaseSociete().findTable(tableName, true);
80 ilm 39
    }
40
 
18 ilm 41
    public ComptaSQLConfElement(String tableName, String singular, String plural) {
156 ilm 42
        this(findTable(tableName), singular, plural);
18 ilm 43
    }
44
 
156 ilm 45
    public ComptaSQLConfElement(SQLTable table, String singular, String plural) {
46
        super(table, singular, plural);
47
    }
48
 
73 ilm 49
    public ComptaSQLConfElement(String tableName) {
151 ilm 50
        this(tableName, null);
27 ilm 51
    }
52
 
73 ilm 53
    public ComptaSQLConfElement(String tableName, String code) {
156 ilm 54
        this(findTable(tableName), code);
73 ilm 55
    }
56
 
151 ilm 57
    public ComptaSQLConfElement(SQLTable table) {
58
        this(table, null);
59
    }
144 ilm 60
 
151 ilm 61
    public ComptaSQLConfElement(SQLTable table, String code) {
62
        super(table, code);
63
    }
64
 
18 ilm 65
}