001: /*
002: * Copyright (C) 2007 Rob Manning
003: * manningr@users.sourceforge.net
004: *
005: * This library is free software; you can redistribute it and/or
006: * modify it under the terms of the GNU Lesser General Public
007: * License as published by the Free Software Foundation; either
008: * version 2.1 of the License, or (at your option) any later version.
009: *
010: * This library is distributed in the hope that it will be useful,
011: * but WITHOUT ANY WARRANTY; without even the implied warranty of
012: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
013: * Lesser General Public License for more details.
014: *
015: * You should have received a copy of the GNU Lesser General Public
016: * License along with this library; if not, write to the Free Software
017: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018: */
019: package net.sourceforge.squirrel_sql.fw.sql;
020:
021: /**
022: * Encapsulates metadata about a single index column.
023: *
024: * @author manningr
025: */
026: public class IndexInfo extends DatabaseObjectInfo {
027:
028: private static final long serialVersionUID = 4146807206360206252L;
029:
030: public static enum IndexType {
031: STATISTIC, CLUSTERED, HASHED, OTHER
032: }
033:
034: public static enum SortOrder {
035: ASC, DESC, NONE
036: }
037:
038: /**
039: * the name of the column which belongs to a list of columns that form an
040: * index for a table
041: */
042: private String columnName = null;
043:
044: private String tableName = null;
045:
046: private boolean nonUnique = false;
047:
048: private String indexQualifier = null;
049:
050: private IndexType indexType = null;
051:
052: private short ordinalPosition;
053:
054: private SortOrder sortOrder = null;
055:
056: private int cardinality;
057:
058: private int pages;
059:
060: private String filterCondition = null;
061:
062: public IndexInfo(String catalog, String schema, String indexName,
063: String tableName, String columnName, boolean nonUnique,
064: String indexQualifier, IndexType indexType,
065: short ordinalPosition, SortOrder sortOrder,
066: int cardinality, int pages, String filterCondition,
067: ISQLDatabaseMetaData md) {
068: super (catalog, schema, indexName, DatabaseObjectType.INDEX, md);
069: this .tableName = tableName;
070: this .columnName = columnName;
071: this .nonUnique = nonUnique;
072: this .indexType = indexType;
073: this .ordinalPosition = ordinalPosition;
074: this .sortOrder = sortOrder;
075: this .cardinality = cardinality;
076: this .pages = pages;
077: this .filterCondition = filterCondition;
078: }
079:
080: /**
081: * @param columnName the columnName to set
082: */
083: public void setColumnName(String columnName) {
084: this .columnName = columnName;
085: }
086:
087: /**
088: * @return the columnName
089: */
090: public String getColumnName() {
091: return columnName;
092: }
093:
094: /**
095: * @param tableName the tableName to set
096: */
097: public void setTableName(String tableName) {
098: this .tableName = tableName;
099: }
100:
101: /**
102: * @return the tableName
103: */
104: public String getTableName() {
105: return tableName;
106: }
107:
108: /**
109: * @param nonUnique the nonUnique to set
110: */
111: public void setNonUnique(boolean nonUnique) {
112: this .nonUnique = nonUnique;
113: }
114:
115: /**
116: * @return the nonUnique
117: */
118: public boolean isNonUnique() {
119: return nonUnique;
120: }
121:
122: /**
123: * @param indexType the indexType to set
124: */
125: public void setIndexType(IndexType indexType) {
126: this .indexType = indexType;
127: }
128:
129: /**
130: * @return the indexType
131: */
132: public IndexType getIndexType() {
133: return indexType;
134: }
135:
136: /**
137: * @param ordinalPosition the ordinalPosition to set
138: */
139: public void setOrdinalPosition(short ordinalPosition) {
140: this .ordinalPosition = ordinalPosition;
141: }
142:
143: /**
144: * @return the ordinalPosition
145: */
146: public short getOrdinalPosition() {
147: return ordinalPosition;
148: }
149:
150: /**
151: * @param sortOrder the sortOrder to set
152: */
153: public void setSortOrder(SortOrder sortOrder) {
154: this .sortOrder = sortOrder;
155: }
156:
157: /**
158: * @return the sortOrder
159: */
160: public SortOrder getSortOrder() {
161: return sortOrder;
162: }
163:
164: /**
165: * @param cardinality the cardinality to set
166: */
167: public void setCardinality(int cardinality) {
168: this .cardinality = cardinality;
169: }
170:
171: /**
172: * @return the cardinality
173: */
174: public int getCardinality() {
175: return cardinality;
176: }
177:
178: /**
179: * @param pages the pages to set
180: */
181: public void setPages(int pages) {
182: this .pages = pages;
183: }
184:
185: /**
186: * @return the pages
187: */
188: public int getPages() {
189: return pages;
190: }
191:
192: /**
193: * @param filterCondition the filterCondition to set
194: */
195: public void setFilterCondition(String filterCondition) {
196: this .filterCondition = filterCondition;
197: }
198:
199: /**
200: * @return the filterCondition
201: */
202: public String getFilterCondition() {
203: return filterCondition;
204: }
205:
206: /**
207: * @param indexQualifier the indexQualifier to set
208: */
209: public void setIndexQualifier(String indexQualifier) {
210: this .indexQualifier = indexQualifier;
211: }
212:
213: /**
214: * @return the indexQualifier
215: */
216: public String getIndexQualifier() {
217: return indexQualifier;
218: }
219: }
|