1 22 23 package org.xquark.extractor.metadata; 24 25 import java.util.ArrayList ; 26 import java.util.List ; 27 28 public class Table extends NamedNode 29 { 30 31 private static final String RCSRevision = "$Revision: 1.3 $"; 32 private static final String RCSName = "$Name: $"; 33 34 35 public static final int TABLE = 0; 36 public static final int VIEW = 1; 37 public static final int SYNONYM = 1; 38 39 protected int _type; 40 protected List _keys; 41 42 43 46 public Table() 47 { 48 49 } 50 51 55 public Table(String name) 56 { 57 super (name); 58 _alias = name; 59 } 60 61 public Table(String name, String alias) 62 { 63 super (name); 64 _alias = alias; 65 } 66 67 71 public void addKey(Attribute key) 72 { 73 if (null == _keys) { 74 _keys = new ArrayList (); 75 } 76 List list = new ArrayList (); 77 list.add(key); 78 _keys.add(list); 79 return ; 80 } 81 82 public void addKey(List key) 83 { 84 if (null == _keys) { 85 _keys = new ArrayList (); 86 } 87 _keys.add(key); 88 return ; 89 } 90 91 95 public void setKeys(List keys) 96 { 97 _keys = keys; 98 } 99 100 104 public List getKeys() 105 { 106 return _keys; 107 } 108 109 public Attribute findAttribute(String attributeName){ 110 String str = attributeName.toLowerCase() ; 111 Attribute retVal = (Attribute) findChild(attributeName) ; 112 return retVal ; 113 } 114 115 public int getType() { return _type; } 116 117 public void setType(int type) { _type = type;} 118 119 138 public String pprint() 139 { 140 StringBuffer retVal = new StringBuffer (); 141 142 String newLine = System.getProperty("line.separator"); 143 144 retVal.append("---------- Table : "); 145 retVal.append(_name); 146 retVal.append(" ----------"); 147 retVal.append(newLine); 148 149 for (int i = 0; i < _children.size(); i++) { 150 retVal.append(((NamedNode)_children.get(i)).pprint()); 151 retVal.append(newLine); 152 } 153 return retVal.toString(); 154 } 155 156 } 157 158 203 | Popular Tags |