KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > datadictionarysystem > SelectedColumnCharacteristics


1 package com.daffodilwoods.daffodildb.server.datadictionarysystem;
2
3 import java.text.*;
4
5 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*;
6 import com.daffodilwoods.database.general.*;
7 import com.daffodilwoods.database.resource.*;
8 import com.daffodilwoods.daffodildb.server.datadictionarysystem.ColumnCharacteristics.ColumnProperties;
9
10 /**
11  * <p>Title: </p>
12  * <p>Description: </p>
13  * <p>Copyright: Copyright (c) 2002</p>
14  * <p>Company: </p>
15  * @author not attributable
16  * @version 1.0
17  */

18
19 public class SelectedColumnCharacteristics implements _ColumnCharacteristics, Datatype {
20    private ColumnProperties[] columnPropertiesArray;
21    private QualifiedIdentifier tableName;
22    private int columnCount = 0;
23
24    public SelectedColumnCharacteristics(ColumnProperties[] columnProperties, QualifiedIdentifier tableName0) {
25       columnPropertiesArray = columnProperties;
26       columnCount = columnProperties.length;
27       tableName = tableName0;
28    }
29
30    public int getColumnType(int index) throws DException {
31       return columnPropertiesArray[index - 1].type;
32    }
33
34    public int getColumnIndex(String JavaDoc columnName) throws DException {
35       for (int i = 0; i < columnPropertiesArray.length; i++) {
36          if (columnPropertiesArray[i].columnName.equalsIgnoreCase(columnName))
37             return i + 1;
38       }
39       throw new DException("DSE508", new Object JavaDoc[] {columnName});
40
41    }
42
43    public String JavaDoc getColumnName(int index) throws DException {
44       try {
45          return columnPropertiesArray[index - 1].columnName;
46       } catch (ArrayIndexOutOfBoundsException JavaDoc e) {
47          throw new IllegalColumnException("DSE3514", new Object JavaDoc[] {new Integer JavaDoc(index), tableName.getIdentifier()});
48       }
49
50    }
51
52    public String JavaDoc getRelatedTable(int columnIndex) throws DatabaseException, DException {
53       return columnPropertiesArray[columnIndex - 1].relatedTable;
54    }
55
56    public int getColumnCount() throws DException {
57       return columnCount;
58    }
59
60    public String JavaDoc[] getColumnNames() throws DException {
61       String JavaDoc[] columnNames = new String JavaDoc[columnCount];
62       for (int i = 0; i < columnCount; i++)
63          columnNames[i] = columnPropertiesArray[i].columnName;
64       return columnNames;
65    }
66
67    public int getSize(int columnIndex) throws DException {
68       return columnPropertiesArray[columnIndex - 1].size;
69    }
70
71    public String JavaDoc[] getPrimaryKeys() throws DatabaseException, DException {
72       throw new java.lang.UnsupportedOperationException JavaDoc("Method getPrimaryKeys() not yet implemented.");
73    }
74
75    public String JavaDoc getRelation(int columnIndex) throws DatabaseException, DException {
76       return columnPropertiesArray[columnIndex - 1].relation;
77    }
78
79    public int[] getColumnIndexes(String JavaDoc[] columnNames) throws DException {
80       if (columnNames == null)
81          throw new IllegalColumnException("DSE749", (Object JavaDoc[])null);
82       int len = columnNames.length;
83       int[] columnIndexes = new int[len];
84       for (int i = 0; i < len; i++)
85          columnIndexes[i] = getColumnIndex(columnNames[i]);
86       return columnIndexes;
87    }
88
89    public int[] getPrimaryConditionColumns() throws DException {
90       throw new java.lang.UnsupportedOperationException JavaDoc("Method getPrimaryConditionColumns() not yet implemented.");
91    }
92
93    public String JavaDoc getTableName(int columnIndex) throws DatabaseException, DException {
94       return columnPropertiesArray[columnIndex - 1].tableName;
95    }
96
97    public short getTableType() throws DException {
98       throw new java.lang.UnsupportedOperationException JavaDoc("Method getTableType() not yet implemented.");
99    }
100
101    public int getPrecision(int columnIndex) throws DException {
102       return columnPropertiesArray[columnIndex - 1].precision;
103    }
104
105    public int getScale(int columnIndex) throws DException {
106       return columnPropertiesArray[columnIndex - 1].decimal;
107    }
108
109    public String JavaDoc getSchemaName(int columnIndex) throws DException {
110       return columnPropertiesArray[columnIndex - 1].schemaName;
111    }
112
113    public String JavaDoc getCatalogName(int columnIndex) throws DException {
114       return columnPropertiesArray[columnIndex - 1].catalogName;
115    }
116
117    public int isNullable(int columnIndex) throws DException {
118       return columnPropertiesArray[columnIndex - 1].isNullable;
119    }
120
121    public boolean isAutoIncrement(int columnIndex) throws DException {
122       return columnPropertiesArray[columnIndex - 1].isAutoIncrement;
123    }
124
125    public String JavaDoc getColumnLabel(int columnIndex) throws DException {
126       return columnPropertiesArray[columnIndex - 1].columnLabel;
127    }
128
129    public String JavaDoc getQualifiedTableName(int columnIndex) throws DException {
130       return columnPropertiesArray[columnIndex - 1].QualifiedTableName.getIdentifier();
131    }
132
133    public String JavaDoc[] getRelatedColumns(int columnIndex) throws DatabaseException, DException {
134       return columnPropertiesArray[columnIndex - 1].relatedColumns;
135    }
136
137    public Collator getCollator() throws DException {
138       throw new UnsupportedOperationException JavaDoc("Method not yet implemented");
139    }
140
141    public _ColumnCharacteristics getCCFromIndexes(_ColumnCharacteristics cc, int offset, int[] columnIndexes) throws DException {
142       throw new UnsupportedOperationException JavaDoc("getCCFromIndexes(cc, offset, columnIndexes) method not implemented yet");
143    }
144 }
145
Popular Tags