Browse Source

Listable config manager work

master
Chris Smith 15 years ago
parent
commit
8fe1e75b77

+ 4
- 2
src/uk/co/md87/evetool/sql/pageconfigelements.sql View File

@@ -1,6 +1,8 @@
1 1
 CREATE TABLE PageConfigElements (
2 2
     pce_id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
3
+    pc_id INT,
4
+    pce_location INT,
5
+    pce_order INT,
3 6
     pce_type INT,
4
-    pce_value VARCHAR(512),
5
-    pce_next INT
7
+    pce_value VARCHAR(512)
6 8
 )

+ 1
- 5
src/uk/co/md87/evetool/sql/pageconfigs.sql View File

@@ -1,8 +1,4 @@
1 1
 CREATE TABLE PageConfigs (
2 2
     pc_id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
3
-    pc_page VARCHAR(50),
4
-    pc_tl INT,
5
-    pc_tr INT,
6
-    pc_bl INT,
7
-    pb_br INT
3
+    pc_page VARCHAR(50)
8 4
 )

+ 72
- 0
src/uk/co/md87/evetool/ui/listable/ListableConfigManager.java View File

@@ -0,0 +1,72 @@
1
+/*
2
+ * Copyright (c) 2009 Chris Smith
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
5
+ * of this software and associated documentation files (the "Software"), to deal
6
+ * in the Software without restriction, including without limitation the rights
7
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ * copies of the Software, and to permit persons to whom the Software is
9
+ * furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ * SOFTWARE.
21
+ */
22
+
23
+package uk.co.md87.evetool.ui.listable;
24
+
25
+import java.sql.Connection;
26
+import java.sql.PreparedStatement;
27
+import java.sql.SQLException;
28
+import java.util.logging.Level;
29
+import java.util.logging.Logger;
30
+
31
+/**
32
+ * TODO: Document ListableConfigManager
33
+ *
34
+ * @author chris
35
+ */
36
+public class ListableConfigManager {
37
+
38
+    /** A logger for this class. */
39
+    private static final Logger LOGGER = Logger.getLogger(ListableConfigManager.class.getName());
40
+
41
+    private final Connection conn;
42
+
43
+    private PreparedStatement prepSelect = null;
44
+    private PreparedStatement prepSelpid = null;
45
+    private PreparedStatement prepInsert = null;
46
+    private PreparedStatement prepDelete = null;
47
+
48
+    public ListableConfigManager(final Connection conn) {
49
+        this.conn = conn;
50
+
51
+        try {
52
+            prepSelect = conn.prepareStatement("SELECT pce_location, pce_type, "
53
+                    + "pce_value FROM PageConfigs NATURAL JOIN PageConfigElements "
54
+                    + "WHERE pc_page = ? ORDER BY pce_location, pce_order");
55
+            prepSelpid = conn.prepareStatement("SELECT pc_id FROM PageConfigs "
56
+                    + "WHERE pc_page = ?");
57
+            prepDelete = conn.prepareStatement("DELETE FROM PageConfigElements "
58
+                   + "WHERE pc_id = ?");
59
+        } catch (SQLException ex) {
60
+            LOGGER.log(Level.SEVERE, "Error preparing statements", ex);
61
+        }
62
+    }
63
+
64
+    public ListableConfig getConfig(final String page) {
65
+        return null;
66
+    }
67
+
68
+    public void setConfig(final String page, final ListableConfig config) {
69
+        
70
+    }
71
+
72
+}

Loading…
Cancel
Save