001 /* 002 * JBoss DNA (http://www.jboss.org/dna) 003 * See the COPYRIGHT.txt file distributed with this work for information 004 * regarding copyright ownership. Some portions may be licensed 005 * to Red Hat, Inc. under one or more contributor license agreements. 006 * See the AUTHORS.txt file in the distribution for a full listing of 007 * individual contributors. 008 * 009 * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA 010 * is licensed to you under the terms of the GNU Lesser General Public License as 011 * published by the Free Software Foundation; either version 2.1 of 012 * the License, or (at your option) any later version. 013 * 014 * JBoss DNA is distributed in the hope that it will be useful, 015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 017 * Lesser General Public License for more details. 018 * 019 * You should have received a copy of the GNU Lesser General Public 020 * License along with this software; if not, write to the Free 021 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 022 * 02110-1301 USA, or see the FSF site: http://www.fsf.org. 023 */ 024 package org.jboss.dna.common.jdbc.model.spi; 025 026 import org.jboss.dna.common.jdbc.model.api.ColumnPseudoType; 027 import org.jboss.dna.common.jdbc.model.api.TableColumn; 028 import org.jboss.dna.common.jdbc.model.api.Reference; 029 030 /** 031 * Provides all database table column specific metadata. 032 * 033 * @author <a href="mailto:litsenko_sergey@yahoo.com">Sergiy Litsenko</a> 034 */ 035 public class TableColumnBean extends ColumnBean implements TableColumn { 036 private static final long serialVersionUID = -1719977563697808831L; 037 private Boolean bestRowIdentifier; 038 private ColumnPseudoType pseudoType; 039 private Reference reference; 040 private Boolean versionColumn; 041 private Boolean primaryKeyColumn; 042 private Boolean foreignKeyColumn; 043 private Boolean indexColumn; 044 045 /** 046 * Default constructor 047 */ 048 public TableColumnBean() { 049 } 050 051 /** 052 * Is this column the part of Best Row Identifier in any scope? 053 * 054 * @return true if this column is the part of Best Row Identifier in any scope, otherwise return false (even if unknown) 055 */ 056 public Boolean isBestRowIdentifier() { 057 return bestRowIdentifier; 058 } 059 060 /** 061 * Is this column the part of Best Row Identifier in any scope? 062 * 063 * @param bestRowIdentifier true if this column is the part of Best Row Identifier in any scope, otherwise return false (even 064 * if unknown) 065 */ 066 public void setBestRowIdentifier( Boolean bestRowIdentifier ) { 067 this.bestRowIdentifier = bestRowIdentifier; 068 } 069 070 /** 071 * Return column's pseudo type 072 * 073 * @return column's pseudo type 074 */ 075 public ColumnPseudoType getPseudoType() { 076 return pseudoType; 077 } 078 079 /** 080 * Sets column's pseudo type 081 * 082 * @param pseudoType the column's pseudo type 083 */ 084 public void setPseudoType( ColumnPseudoType pseudoType ) { 085 this.pseudoType = pseudoType; 086 } 087 088 /** 089 * Returns column reference if datatype is REF 090 * 091 * @return column reference if datatype is REF 092 */ 093 public Reference getReference() { 094 return reference; 095 } 096 097 /** 098 * Sets column reference if datatype is REF 099 * 100 * @param reference the column reference if datatype is REF 101 */ 102 public void setReference( Reference reference ) { 103 this.reference = reference; 104 } 105 106 /** 107 * Retrieves true if column is automatically updated when any value in a row is updated. If it retrieves true then column can 108 * be cast to VersionColumn. 109 * 110 * @return true if column is automatically updated when any value in a row is updated, return false overwise. 111 */ 112 public Boolean isVersionColumn() { 113 return versionColumn; 114 } 115 116 /** 117 * Sets true if column is automatically updated when any value in a row is updated. If it retrieves true then column can be 118 * cast to VersionColumn. 119 * 120 * @param versionColumn true if column is automatically updated when any value in a row is updated, return false overwise. 121 */ 122 public void setVersionColumn( Boolean versionColumn ) { 123 this.versionColumn = versionColumn; 124 } 125 126 /** 127 * Retrieves true if column is part of primary key. 128 * 129 * @return true if column is part of primary key, return false overwise. 130 */ 131 public Boolean isPrimaryKeyColumn() { 132 return primaryKeyColumn; 133 } 134 135 /** 136 * Sets true if column is part of primary key. 137 * 138 * @param primaryKeyColumn true if column is part of primary key, return false overwise. 139 */ 140 public void setPrimaryKeyColumn( Boolean primaryKeyColumn ) { 141 this.primaryKeyColumn = primaryKeyColumn; 142 } 143 144 /** 145 * Retrieves true if column is part of foreign key. 146 * 147 * @return true if column is part of foreign key, return false overwise. 148 */ 149 public Boolean isForeignKeyColumn() { 150 return foreignKeyColumn; 151 } 152 153 /** 154 * Sets true if column is part of foreign key. 155 * 156 * @param foreignKeyColumn true if column is part of foreign key, return false overwise. 157 */ 158 public void setForeignKeyColumn( Boolean foreignKeyColumn ) { 159 this.foreignKeyColumn = foreignKeyColumn; 160 } 161 162 /** 163 * Retrieves true if column is part of any index. 164 * 165 * @return true if column is part of any index, return false overwise. 166 */ 167 public Boolean isIndexColumn() { 168 return indexColumn; 169 } 170 171 /** 172 * Sets true if column is part of any index. 173 * 174 * @param indexColumn true if column is part of any index, return false overwise. 175 */ 176 public void setIndexColumn( Boolean indexColumn ) { 177 this.indexColumn = indexColumn; 178 } 179 }