001: /*
002: * Copyright 2007 Madhav Pulipaka
003: *
004: * This file is part of Vela.
005:
006: * Vela is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * Vela is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with Vela; if not, write to the Free Software
018: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
019: */
020: package vela.model;
021:
022: import java.io.*;
023: import java.util.*;
024:
025: public class DBStructure implements Serializable {
026:
027: ArrayList allObjects = new ArrayList(0);
028: TreeMap tables = new TreeMap();
029: TreeMap functions = new TreeMap();
030: TreeMap indexes = new TreeMap();
031: TreeMap sequences = new TreeMap();
032: TreeMap procedures = new TreeMap();
033: TreeMap triggers = new TreeMap();
034: TreeMap views = new TreeMap();
035: TreeMap synonyms = new TreeMap();
036: TreeMap packages = new TreeMap();
037: ArrayList allObjectNames = new ArrayList(0);
038: TreeMap allDBObjectsMap = new TreeMap();
039:
040: public ArrayList getAllObjects() {
041: return allObjects;
042: }
043:
044: public void setAllObjects(ArrayList allObjects) {
045: this .allObjects = allObjects;
046: }
047:
048: public TreeMap getFunctions() {
049: return functions;
050: }
051:
052: public void setFunctions(TreeMap functions) {
053: this .functions = functions;
054: }
055:
056: public TreeMap getIndexes() {
057: return indexes;
058: }
059:
060: public void setIndexes(TreeMap indexes) {
061: this .indexes = indexes;
062: }
063:
064: public TreeMap getSequences() {
065: return sequences;
066: }
067:
068: public void setSequences(TreeMap sequences) {
069: this .sequences = sequences;
070: }
071:
072: public TreeMap getTables() {
073: return tables;
074: }
075:
076: public void setTables(TreeMap tables) {
077: this .tables = tables;
078: }
079:
080: public TreeMap getProcedures() {
081: return procedures;
082: }
083:
084: public void setProcedures(TreeMap procedures) {
085: this .procedures = procedures;
086: }
087:
088: public TreeMap getTriggers() {
089: return triggers;
090: }
091:
092: public void setTriggers(TreeMap triggers) {
093: this .triggers = triggers;
094: }
095:
096: public TreeMap getViews() {
097: return views;
098: }
099:
100: public void setViews(TreeMap views) {
101: this .views = views;
102: }
103:
104: public TreeMap getSynonyms() {
105: return synonyms;
106: }
107:
108: public void setSynonyms(TreeMap synonyms) {
109: this .synonyms = synonyms;
110: }
111:
112: public TreeMap getDBObjects(String objectType) {
113: if (objectType == null)
114: return new TreeMap();
115: if (objectType.equalsIgnoreCase("FUNCTION"))
116: return functions;
117: if (objectType.equalsIgnoreCase("TABLE"))
118: return tables;
119: if (objectType.equalsIgnoreCase("SEQUENCE"))
120: return sequences;
121: if (objectType.equalsIgnoreCase("INDEX"))
122: return indexes;
123: if (objectType.equalsIgnoreCase("PROCEDURE"))
124: return procedures;
125: if (objectType.equalsIgnoreCase("TRIGGER"))
126: return triggers;
127: if (objectType.equalsIgnoreCase("VIEW"))
128: return views;
129: if (objectType.equalsIgnoreCase("SYNONYM"))
130: return synonyms;
131: if (objectType.equalsIgnoreCase("PACKAGE"))
132: return packages;
133: return new TreeMap();
134: }
135:
136: public DBObject getFunction(String functionName) {
137: return (DBObject) functions.get(functionName);
138: }
139:
140: public DBObject getPackage(String packageName) {
141: return (DBObject) packages.get(packageName);
142: }
143:
144: public DBObject getTable(String tableName) {
145: return (DBObject) tables.get(tableName);
146: }
147:
148: public DBObject getSequence(String sequenceName) {
149: return (DBObject) sequences.get(sequenceName);
150: }
151:
152: public DBObject getIndex(String indexName) {
153: return (DBObject) indexes.get(indexName);
154: }
155:
156: public DBObject getProcedure(String procedureName) {
157: return (DBObject) procedures.get(procedureName);
158: }
159:
160: public DBObject getTrigger(String triggerName) {
161: return (DBObject) triggers.get(triggerName);
162: }
163:
164: public DBObject getView(String viewName) {
165: return (DBObject) views.get(viewName);
166: }
167:
168: public DBObject getSynonym(String synonymName) {
169: return (DBObject) synonyms.get(synonymName);
170: }
171:
172: public TreeMap getAllDBObjectsMap() {
173: return allDBObjectsMap;
174: }
175:
176: public void setAllDBObjectsMap(TreeMap allDBObjectsMap) {
177: this .allDBObjectsMap = allDBObjectsMap;
178: }
179:
180: public DBObject getDBObject(String objectName) {
181: return (DBObject) allDBObjectsMap.get(objectName);
182: }
183:
184: public TreeMap getPackages() {
185: return packages;
186: }
187:
188: public void setPackages(TreeMap packages) {
189: this.packages = packages;
190: }
191:
192: }
|