DBVIEW
src/org/dbview/resources/AbstractSotfForeignKeyDetector.java
00001 /*
00002         DbView - Graph Visualization
00003     Copyright (C) 2012  Denis BEURIVE
00004 
00005     This program is free software: you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation, either version 3 of the License, or
00008     (at your option) any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 /**
00020  * @author Denis Beurive
00021  */
00022 
00023 package org.dbview.resources;
00024 
00025 /**
00026  * This class defines the interface for a "soft foreign key" detector.
00027  * Please note that a soft foreign key is defined by the field's name only.
00028  * There is no constraint declared in the database.
00029  * This kind of foreign key is used with database systems that don't support foreign keys (ex: MyIsam).
00030  * @author Denis Beurive
00031  */
00032 public abstract class AbstractSotfForeignKeyDetector
00033 {
00034     /**
00035      * This method tests whether a field, identified by its name, is a soft foreign key or not.
00036      * @param in_field_name Name of the field to test.
00037      * @return If the field is a (soft) foreign key, then the method returns the value TRUE.
00038      *         Otherwise, it returns the value FALSE.
00039      */
00040     public abstract Boolean isFk(String in_field_name);
00041 
00042     /**
00043      * If the field is a soft foreign key, then the method returns the name of the "reference" table.
00044      * @param in_field_name Name of the field.
00045      * @return If the field is a (soft) foreign key, then the method returns the name of the "reference" table.
00046      *         Otherwise, the method returns the value null.
00047      */
00048     public abstract String referenceTable(String in_field_name);
00049 
00050     /**
00051      * If the field is a (soft) foreign key, then the method returns the name of the "reference" field (within the "reference" table).
00052      * @param in_field_name Name of the field.
00053      * @return If the field is a (soft) foreign key, then the method returns the name of the "reference" field.
00054      *         Otherwise, the method returns the value null.
00055      */
00056     public abstract String referenceField(String in_field_name);
00057 
00058     /**
00059      * This method returns a description of the detector.
00060      * @return The method returns a description of the detector.
00061      */
00062     public abstract String description();
00063 }