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.TableType;
027    
028    /**
029     * Provides database table type specific metadata.
030     * <P>
031     * The table type is:
032     * <OL>
033     * <LI><B>TABLE_TYPE</B> String => table type. Typical types are "TABLE", "VIEW", "SYSTEM TABLE", "GLOBAL TEMPORARY",
034     * "LOCAL TEMPORARY", "ALIAS", "SYNONYM".
035     * </OL>
036     *  @author <a href="mailto:litsenko_sergey@yahoo.com">Sergiy Litsenko</a>
037     */
038    public class TableTypeBean extends DatabaseNamedObjectBean implements TableType {
039        private static final long serialVersionUID = -5095835769360603900L;
040     
041        /**
042         * Default constructor
043         */
044        public TableTypeBean() {
045        }
046    
047        /**
048         * Is table type represents TABLE
049         * 
050         * @param tableTypeName the table type string
051         * @return true if table type represents TABLE
052         */
053        public Boolean isTable( String tableTypeName ) {
054            return DEF_TABLE_TYPE_TABLE.equals(tableTypeName);
055        }
056    
057        /**
058         * Is current table type represents TABLE
059         * 
060         * @return true if current table type represents TABLE
061         */
062        public Boolean isTable() {
063            return isTable(getName());
064        }
065    
066        /**
067         * Is table type represents VIEW
068         * 
069         * @param tableTypeName the table type string
070         * @return true if table type represents VIEW
071         */
072        public Boolean isView( String tableTypeName ) {
073            return DEF_TABLE_TYPE_VIEW.equals(tableTypeName);
074        }
075    
076        /**
077         * Is current table type represents VIEW
078         * 
079         * @return true if current table type represents VIEW
080         */
081        public Boolean isView() {
082            return isView(getName());
083        }
084    
085        /**
086         * Is table type represents SYSTEM TABLE
087         * 
088         * @param tableTypeName the table type string
089         * @return true if table type represents SYSTEM TABLE
090         */
091        public Boolean isSystemTable( String tableTypeName ) {
092            return DEF_TABLE_TYPE_SYS_TABLE.equals(tableTypeName);
093        }
094    
095        /**
096         * Is current table type represents SYSTEM TABLE
097         * 
098         * @return true if current table type represents SYSTEM TABLE
099         */
100        public Boolean isSystemTable() {
101            return isSystemTable(getName());
102        }
103    
104        /**
105         * Is current table type represents GLOBAL TEMPORARY
106         * 
107         * @param tableTypeName the table type string
108         * @return true if current table type represents GLOBAL TEMPORARY
109         */
110        public Boolean isGlobalTemporary( String tableTypeName ) {
111            return DEF_TABLE_TYPE_GLOBAL_TEMP.equals(tableTypeName);
112        }
113    
114        /**
115         * Is current table type represents GLOBAL TEMPORARY
116         * 
117         * @return true if table type represents GLOBAL TEMPORARY
118         */
119        public Boolean isGlobalTemporary() {
120            return isGlobalTemporary(getName());
121        }
122    
123        /**
124         * Is table type represents LOCAL TEMPORARY
125         * 
126         * @param tableTypeName the table type string
127         * @return true if table type represents LOCAL TEMPORARY
128         */
129        public Boolean islocalTemporary( String tableTypeName ) {
130            return DEF_TABLE_TYPE_LOCAL_TEMP.equals(tableTypeName);
131        }
132    
133        /**
134         * Is current table type represents LOCAL TEMPORARY
135         * 
136         * @return true if current table type represents LOCAL TEMPORARY
137         */
138        public Boolean isLocalTemporary() {
139            return islocalTemporary(getName());
140        }
141    
142        /**
143         * Is table type represents ALIAS
144         * 
145         * @param tableTypeName the table type string
146         * @return true if table type represents ALIAS
147         */
148        public Boolean isAlias( String tableTypeName ) {
149            return DEF_TABLE_TYPE_ALIAS.equals(tableTypeName);
150        }
151    
152        /**
153         * Is current table type represents ALIAS
154         * 
155         * @return true if current table type represents ALIAS
156         */
157        public Boolean isAlias() {
158            return isAlias(getName());
159        }
160    
161        /**
162         * Is table type represents SYNONYM
163         * 
164         * @param tableTypeName the table type string
165         * @return true if table type represents SYNONYM
166         */
167        public Boolean isSynonym( String tableTypeName ) {
168            return DEF_TABLE_TYPE_SYNONYM.equals(tableTypeName);
169        }
170    
171        /**
172         * Is current table type represents SYNONYM
173         * @return true if current table type represents SYNONYM
174         */
175        public Boolean isSynonym() {
176            return isSynonym(getName());
177        }
178    }