1 6 package com.daffodilwoods.daffodildb.server.datadictionarysystem; 7 8 import java.util.*; 9 10 import com.daffodilwoods.daffodildb.server.datasystem.indexsystem.*; 11 import com.daffodilwoods.database.general.*; 12 import com.daffodilwoods.database.resource.*; 13 14 public class FullTextIndexInformation implements _FullTextIndexInformation { 15 public QualifiedIdentifier sourceTableName; 16 public String indexName; 17 public String indexTableName; 18 public String [] indexColumnName; 19 public int[] indexColumnIndexes; 20 public String indexColumns; 21 public boolean isUpdate; 22 23 26 27 public FullTextIndexInformation(QualifiedIdentifier sourceTableName, String indexName, String indexTableName, 28 String [] indexColumnName, int[] indexColumnIndexes) { 29 this.sourceTableName = sourceTableName; 30 this.indexName = indexName; 31 this.indexTableName = indexTableName; 32 this.indexColumnName = indexColumnName; 33 indexColumns = ""; 34 this.indexColumnIndexes = indexColumnIndexes; 35 44 45 if (indexColumnName != null) { 46 StringBuffer st = new StringBuffer (50); 47 st.append(indexColumnName[0]); 48 for (int i = 1; i < indexColumnName.length; i++) { 49 st.append(','); 50 st.append(indexColumnName[i]); 51 } 52 indexColumns = st.toString(); 53 } 54 } 55 56 public String [] getColumns() throws DException { 57 return indexColumnName; 58 } 59 60 public int[] getColumnIndexes() throws DException { 61 return indexColumnIndexes; 62 } 63 64 public boolean isVariableColumn() throws DException { 65 throw new UnsupportedOperationException (); 66 } 67 68 69 public QualifiedIdentifier getQualifiedIdentifier() throws DException { 70 return new QualifiedIdentifier(null, null, indexName); 71 } 72 73 public QualifiedIdentifier getIndexTableName() throws DException { 74 return new QualifiedIdentifier(sourceTableName.catalog, sourceTableName.schema, indexTableName); 75 } 76 77 public Object [][] getColumnInformation() throws DException { 78 ArrayList indexStructure = new ArrayList(); 79 for (int i = 0; i < indexColumnName.length; i++) { 80 Object [] structure = new Object [] {indexColumnName[i], new Integer (indexColumnIndexes[i]), new Integer (i)}; 81 indexStructure.add(structure); 82 } 83 return (Object [][]) indexStructure.toArray(new Object [0][]); 84 } 85 86 public String getIndexName() throws DException { 87 return indexName; 88 } 89 90 public int getSize() throws DException { 91 return 0; 92 } 93 94 public boolean isDefault() { 95 96 return false; 97 } 98 99 public void update() throws DException { 100 if (!isUpdate) { 101 int size = indexColumnName.length; 102 int len = indexColumnName.length + 1; 103 String [] names = new String [len]; 104 int[] indexes = new int[len]; 105 boolean[] types = new boolean[len]; 106 System.arraycopy(indexColumnName, 0, names, 0, size); 107 System.arraycopy(indexColumnIndexes, 0, indexes, 0, size); 108 names[size] = SystemFields.systemFields[SystemFields.rowId]; 109 indexes[size] = SystemFields.rowId; 110 types[size] = true; 111 indexColumnName = names; 112 indexColumnIndexes = indexes; 113 isUpdate = true; 114 } 115 } 116 117 public boolean isUpdated() { 118 return isUpdate; 119 } 120 } 121 | Popular Tags |