Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.db / org.gvsig.fmap.dal.db.jdbc / src / main / java / org / gvsig / fmap / dal / store / jdbc / JDBCNewStoreParameters.java @ 41638

History | View | Annotate | Download (5.21 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or modify it under
7
 * the terms of the GNU General Public License as published by the Free Software
8
 * Foundation; either version 3 of the License, or (at your option) any later
9
 * version.
10
 *
11
 * This program is distributed in the hope that it will be useful, but WITHOUT
12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
13
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
14
 * details.
15
 *
16
 * You should have received a copy of the GNU General Public License along with
17
 * this program; if not, write to the Free Software Foundation, Inc., 51
18
 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us at info AT
21
 * gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.fmap.dal.store.jdbc;
24

    
25
import org.apache.commons.lang3.StringUtils;
26
import org.gvsig.fmap.dal.feature.EditableFeatureType;
27
import org.gvsig.fmap.dal.feature.FeatureType;
28
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters;
29
import org.gvsig.fmap.dal.store.db.DBNewStoreParameters;
30

    
31
import static org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters.CATALOG_PARAMTER_NAME;
32
import static org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters.JDBC_DRIVER_CLASS_PARAMTER_NAME;
33
import static org.gvsig.fmap.dal.store.jdbc.JDBCConnectionParameters.SCHEMA_PARAMTER_NAME;
34

    
35
public class JDBCNewStoreParameters extends DBNewStoreParameters implements
36
        JDBCConnectionParameters {
37

    
38
    public static final String PARAMETERS_DEFINITION_NAME = "JDBCNewStoreParameters";
39

    
40
    public JDBCNewStoreParameters() {
41
        super(PARAMETERS_DEFINITION_NAME, JDBCStoreProvider.NAME);
42
    }
43

    
44
    protected JDBCNewStoreParameters(String parametersDefinitionName, String providerName) {
45
        super(parametersDefinitionName, providerName);
46
    }
47

    
48
    /**
49
     * Set <code>JDBC Driver class name</code> parameter
50
     *
51
     * @param className
52
     */
53
    public void setJDBCDriverClassName(String className) {
54
        this.setDynValue(JDBC_DRIVER_CLASS_PARAMTER_NAME, className);
55
    }
56

    
57
    public String getJDBCDriverClassName() {
58
        return (String) this.getDynValue(JDBC_DRIVER_CLASS_PARAMTER_NAME);
59
    }
60

    
61
    public String getCatalog() {
62
        return (String) this.getDynValue(CATALOG_PARAMTER_NAME);
63
    }
64

    
65
    /**
66
     * Set <code>catalog</code> parameter
67
     *
68
     * @param className
69
     */
70
    public void setCatalog(String catalog) {
71
        this.setDynValue(CATALOG_PARAMTER_NAME, catalog);
72
    }
73

    
74
    public String getSchema() {
75
        return (String) this.getDynValue(SCHEMA_PARAMTER_NAME);
76
    }
77

    
78
    /**
79
     * Set <code>schema</code> parameter
80
     *
81
     * @param className
82
     */
83
    public void setSchema(String schema) {
84
        this.setDynValue(SCHEMA_PARAMTER_NAME, schema);
85
    }
86

    
87
    public String getUrl() {
88
        return (String) this.getDynValue(URL_PARAMTER_NAME);
89
    }
90

    
91
    /**
92
     * Set <code>JDBC connection url</code> parameter
93
     *
94
     * @param url
95
     */
96
    public void setUrl(String url) {
97
        this.setDynValue(URL_PARAMTER_NAME, url);
98
    }
99

    
100
    /**
101
     * Return table <code>name</code> or <code>schema.tableName</code> if
102
     * <code>schema</code> parameter is set.
103
     *
104
     * @return
105
     */
106
    public String tableID() {
107
        if (this.getSchema() == null || this.getSchema() == "") {
108
            return escapeName(this.getTable());
109
        }
110
        return escapeName(this.getSchema()) + "." + escapeName(this.getTable());
111
    }
112

    
113
    protected String escapeName(String name) {
114
        return "\"".concat(name).concat("\"");
115
    }
116

    
117
    public String getSelectRole() {
118
        String value = (String) this.getDynValue("SelectRole");
119
        return StringUtils.defaultIfBlank(value, null);
120
    }
121
    
122
    public String getInsertRole() {
123
        String value = (String) this.getDynValue("InsertRole");
124
        return StringUtils.defaultIfBlank(value, null);
125
    }
126
    
127
    
128
    public String getUpdateRole() {
129
        String value = (String) this.getDynValue("UpdateRole");
130
        return StringUtils.defaultIfBlank(value, null);
131
    }
132
    
133
    
134
    public String getDeleteRole() {
135
        String value = (String) this.getDynValue("DeleteRole");
136
        return StringUtils.defaultIfBlank(value, null);
137
    }
138
    
139
    
140
    public String getTruncateRole() {
141
        String value = (String) this.getDynValue("TruncateRole");
142
        return StringUtils.defaultIfBlank(value, null);
143
    }
144
    
145
    
146
    public String getReferenceRole() {
147
        String value = (String) this.getDynValue("ReferenceRole");
148
        return StringUtils.defaultIfBlank(value, null);
149
    }
150
    
151
    
152
    public String getTriggerRole() {
153
        String value = (String) this.getDynValue("TriggerRole");
154
        return StringUtils.defaultIfBlank(value, null);
155
    }
156
    
157
    
158
    public String getAllRole() {
159
        String value = (String) this.getDynValue("AllRole");
160
        return StringUtils.defaultIfBlank(value, null);
161
    }
162
    
163
    
164
    public String getPostCreatingStatement() {
165
        String value = (String) this.getDynValue("PostCreatingStatement");
166
        return StringUtils.defaultIfBlank(value, null);
167
    }
168
    
169
}