1 19 20 package org.netbeans.lib.ddl.impl; 21 22 import java.util.*; 23 import org.netbeans.lib.ddl.*; 24 import org.netbeans.lib.ddl.impl.*; 25 26 33 34 public class AddColumn extends ColumnListCommand 35 { 36 static final long serialVersionUID =8822373040877885121L; 37 public AbstractTableColumn specifyColumn(String type, String name) 38 throws ClassNotFoundException , IllegalAccessException , InstantiationException 39 { 40 return specifyColumn(type, name, Specification.ADD_COLUMN); 41 } 42 43 public AbstractTableColumn createColumn(String name) 44 throws ClassNotFoundException , IllegalAccessException , InstantiationException 45 { 46 return specifyColumn(TableColumn.COLUMN, name, Specification.ADD_COLUMN); 47 } 48 49 public TableColumn createUniqueColumn(String name) 50 throws ClassNotFoundException , IllegalAccessException , InstantiationException 51 { 52 TableColumn col = specifyColumn(TableColumn.UNIQUE, name, Specification.ADD_COLUMN); 53 col.setObjectName(name+"_UQ"); return col; 55 } 56 57 public TableColumn createPrimaryKeyColumn(String name) 58 throws ClassNotFoundException , IllegalAccessException , InstantiationException 59 { 60 TableColumn col = specifyColumn(TableColumn.PRIMARY_KEY, name, Specification.ADD_COLUMN); 61 col.setObjectName(name+"_PK"); return col; 63 } 64 65 public TableColumn createCheckColumn(String name, String expression) 66 throws ClassNotFoundException , IllegalAccessException , InstantiationException 67 { 68 TableColumn col = specifyColumn(TableColumn.CHECK, name, Specification.ADD_COLUMN); 69 col.setObjectName(name+"_CH"); col.setCheckCondition(expression); 71 return col; 72 } 73 74 public TableColumn createCheckConstraint(String name, String expression) 75 throws ClassNotFoundException , IllegalAccessException , InstantiationException 76 { 77 TableColumn col = specifyColumn(TableColumn.CHECK_CONSTRAINT, name, Specification.ADD_COLUMN); 78 col.setObjectName(name+"_CH"); col.setCheckCondition(expression); 80 return col; 81 } 82 } 83 84 96 | Popular Tags |