001/*
002 * HA-JDBC: High-Availability JDBC
003 * Copyright (c) 2004-2007 Paul Ferraro
004 * 
005 * This library is free software; you can redistribute it and/or modify it 
006 * under the terms of the GNU Lesser General Public License as published by the 
007 * Free Software Foundation; either version 2.1 of the License, or (at your 
008 * option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful, but WITHOUT
011 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
012 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
013 * for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public License
016 * along with this library; if not, write to the Free Software Foundation, 
017 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
018 * 
019 * Contact: ferraro@users.sourceforge.net
020 */
021package net.sf.hajdbc.cache;
022
023import java.util.LinkedList;
024import java.util.List;
025
026import net.sf.hajdbc.ForeignKeyConstraint;
027
028/**
029 * @author Paul Ferraro
030 */
031public class ForeignKeyConstraintImpl extends UniqueConstraintImpl implements ForeignKeyConstraint
032{
033        private String foreignTable;
034        private List<String> foreignColumnList = new LinkedList<String>();
035        private int updateRule;
036        private int deleteRule;
037        private int deferrability;
038        
039        /**
040         * Constructs a new ForeignKey.
041         * @param name the name of this constraint
042         * @param table a schema qualified table name
043         */
044        public ForeignKeyConstraintImpl(String name, String table)
045        {
046                super(name, table);
047        }
048        
049        /**
050         * @see net.sf.hajdbc.ForeignKeyConstraint#getForeignTable()
051         */
052        @Override
053        public String getForeignTable()
054        {
055                return this.foreignTable;
056        }
057        
058        /**
059         * @see net.sf.hajdbc.ForeignKeyConstraint#getForeignColumnList()
060         */
061        @Override
062        public List<String> getForeignColumnList()
063        {
064                return this.foreignColumnList;
065        }
066        
067        /**
068         * @see net.sf.hajdbc.ForeignKeyConstraint#getDeleteRule()
069         */
070        @Override
071        public int getDeleteRule()
072        {
073                return this.deleteRule;
074        }
075
076        /**
077         * @see net.sf.hajdbc.ForeignKeyConstraint#getUpdateRule()
078         */
079        @Override
080        public int getUpdateRule()
081        {
082                return this.updateRule;
083        }
084
085        /**
086         * @see net.sf.hajdbc.ForeignKeyConstraint#getDeferrability()
087         */
088        @Override
089        public int getDeferrability()
090        {
091                return this.deferrability;
092        }
093
094        /**
095         * @see net.sf.hajdbc.ForeignKeyConstraint#setDeferrability(int)
096         */
097        @Override
098        public void setDeferrability(int deferrability)
099        {
100                this.deferrability = deferrability;
101        }
102
103        /**
104         * @see net.sf.hajdbc.ForeignKeyConstraint#setDeleteRule(int)
105         */
106        @Override
107        public void setDeleteRule(int deleteRule)
108        {
109                this.deleteRule = deleteRule;
110        }
111
112        /**
113         * @see net.sf.hajdbc.ForeignKeyConstraint#setForeignTable(java.lang.String)
114         */
115        @Override
116        public void setForeignTable(String foreignTable)
117        {
118                this.foreignTable = foreignTable;
119        }
120
121        /**
122         * @see net.sf.hajdbc.ForeignKeyConstraint#setUpdateRule(int)
123         */
124        @Override
125        public void setUpdateRule(int updateRule)
126        {
127                this.updateRule = updateRule;
128        }
129}