KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > lib > ddl > impl > ForeignKeyConstraint


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.lib.ddl.impl;
21
22 import java.util.*;
23 import java.sql.*;
24 import org.netbeans.lib.ddl.*;
25
26 /**
27 * Implementation of ForeignKey constraint.
28 */

29 public class ForeignKeyConstraint extends AbstractTableColumn implements ForeignKeyConstraintDescriptor {
30     /** Refernced table */
31     String JavaDoc tname;
32
33     /** Referenced column */
34     String JavaDoc cname;
35
36     static final long serialVersionUID =9183651896170854492L;
37     /** Returns name of Referenced table */
38     public String JavaDoc getReferencedTableName()
39     {
40         return tname;
41     }
42
43     /** Sets name of Referenced table */
44     public void setReferencedTableName(String JavaDoc name)
45     {
46         tname = name;
47     }
48
49     /** Returns name of Referenced column */
50     public String JavaDoc getReferencedColumnName()
51     {
52         return cname;
53     }
54
55     /** Sets name of Referenced column */
56     public void setReferencedColumnName(String JavaDoc name)
57     {
58         cname = name;
59     }
60
61     /**
62     * Returns properties and it's values supported by this object.
63     * object.name Name of the object; use setObjectName()
64     * object.owner Name of the object; use setObjectOwner()
65     * fkobject.name Specification of foreign table
66     * fkcolumn.name Specification of foreign column
67     */

68     public Map getColumnProperties(AbstractCommand cmd) throws DDLException {
69         Map args = super.getColumnProperties(cmd);
70         args.put("fkobject.name", cmd.quote(tname)); // NOI18N
71
args.put("fkcolumn.name", cmd.quote(cname)); // NOI18N
72

73         return args;
74     }
75 }
76
Popular Tags