OpenConcerto

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

svn://code.openconcerto.org/openconcerto

Rev

Rev 132 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
17 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.sql.users.rights;
15
 
16
import org.openconcerto.sql.element.SQLComponent;
156 ilm 17
import org.openconcerto.sql.element.SQLElement;
17 ilm 18
import org.openconcerto.sql.element.UISQLComponent;
73 ilm 19
import org.openconcerto.sql.model.DBRoot;
20
import org.openconcerto.sql.utils.SQLCreateTable;
17 ilm 21
import org.openconcerto.ui.component.ITextArea;
132 ilm 22
import org.openconcerto.utils.ListMap;
17 ilm 23
 
24
import java.util.Arrays;
25
import java.util.List;
26
 
156 ilm 27
public class RightSQLElement extends SQLElement {
17 ilm 28
 
73 ilm 29
    public static final String TABLE_NAME = "RIGHT";
30
 
31
    static public SQLCreateTable getCreateTable(final DBRoot root) {
32
        final SQLCreateTable res = new SQLCreateTable(root, TABLE_NAME);
33
        res.addVarCharColumn("CODE", 128);
34
        res.addVarCharColumn("NOM", 256);
35
        res.addVarCharColumn("DESCRIPTION", 500);
36
        return res;
37
    }
38
 
156 ilm 39
    public RightSQLElement(final DBRoot root) {
40
        super(root.findTable(TABLE_NAME), null, "sql.right");
17 ilm 41
    }
42
 
43
    @Override
44
    public boolean isShared() {
45
        return true;
46
    }
47
 
48
    protected List<String> getListFields() {
49
        return Arrays.asList("CODE", "NOM", "DESCRIPTION");
50
    }
51
 
52
    protected List<String> getComboFields() {
53
        return Arrays.asList("NOM");
54
    }
55
 
56
    @Override
132 ilm 57
    public ListMap<String, String> getShowAs() {
58
        return ListMap.singleton(null, "NOM");
17 ilm 59
    }
60
 
61
    public SQLComponent createComponent() {
62
        return new UISQLComponent(this, 2, 1) {
63
            public void addViews() {
64
                this.addView("CODE");
65
                this.addView("NOM");
66
                this.addView(new ITextArea(), "DESCRIPTION", "2");
67
            }
68
        };
69
    }
70
}