KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > ejb > cmp3 > metadata > tables > MetadataSecondaryTable


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2006, Oracle. All rights reserved.
22
package oracle.toplink.essentials.internal.ejb.cmp3.metadata.tables;
23
24 import javax.persistence.SecondaryTable;
25 import javax.persistence.PrimaryKeyJoinColumn;
26
27 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns.MetadataPrimaryKeyJoinColumns;
28
29 /**
30  * Object to hold onto a secondary table metadata in a TopLink database table.
31  *
32  * @author Guy Pelletier
33  * @since TopLink EJB 3.0 Reference Implementation
34  */

35 public class MetadataSecondaryTable extends MetadataTable {
36     private PrimaryKeyJoinColumn[] m_pkJoinColumns;
37     protected MetadataPrimaryKeyJoinColumns m_primaryKeyJoinColumns;
38     
39     /**
40      * INTERNAL:
41      */

42     public MetadataSecondaryTable() {
43        m_primaryKeyJoinColumns = null;
44     }
45     
46     /**
47      * INTERNAL:
48      */

49     public MetadataSecondaryTable(SecondaryTable secondaryTable) {
50         this();
51         
52         if (secondaryTable != null) {
53             m_name = secondaryTable.name();
54             m_schema = secondaryTable.schema();
55             m_catalog = secondaryTable.catalog();
56             m_pkJoinColumns = secondaryTable.pkJoinColumns();
57             
58             processName();
59             processUniqueConstraints(secondaryTable.uniqueConstraints());
60         }
61     }
62     
63     /**
64      * INTERNAL:
65      */

66     public MetadataPrimaryKeyJoinColumns getPrimaryKeyJoinColumns(String JavaDoc sourceTableName) {
67         if (m_primaryKeyJoinColumns == null) {
68             processPrimaryKeyJoinColumns(sourceTableName);
69         }
70         
71         return m_primaryKeyJoinColumns;
72     }
73     
74     /**
75      * INTERNAL: (Overridden in XMLSecondaryTable)
76      */

77     protected void processPrimaryKeyJoinColumns(String JavaDoc sourceTableName) {
78         m_primaryKeyJoinColumns = new MetadataPrimaryKeyJoinColumns(m_pkJoinColumns, sourceTableName, m_databaseTable.getQualifiedName());
79     }
80 }
81
Popular Tags