KickJava   Java API By Example, From Geeks To Geeks.

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


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.JoinColumn;
25 import javax.persistence.JoinTable;
26
27 import oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns.MetadataJoinColumns;
28
29 /**
30  * Object to hold onto table metadata in a TopLink database table.
31  *
32  * @author Guy Pelletier
33  * @since TopLink EJB 3.0 Reference Implementation
34  */

35 public class MetadataJoinTable extends MetadataTable {
36     private JoinColumn[] m_joinColumns;
37     private JoinColumn[] m_inverseJoinColumns;
38     protected MetadataJoinColumns m_jColumns;
39     protected MetadataJoinColumns m_inverseJColumns;
40     
41     /**
42      * INTERNAL:
43      */

44     public MetadataJoinTable() {
45         m_joinColumns = new JoinColumn[] {};
46         m_inverseJoinColumns = new JoinColumn[] {};
47     }
48     
49     /**
50      * INTERNAL:
51      */

52     public MetadataJoinTable(JoinTable joinTable) {
53         this();
54         
55         if (joinTable != null) {
56             m_name = joinTable.name();
57             m_schema = joinTable.schema();
58             m_catalog = joinTable.catalog();
59             m_joinColumns = joinTable.joinColumns();
60             m_inverseJoinColumns = joinTable.inverseJoinColumns();
61             
62             processName();
63             processUniqueConstraints(joinTable.uniqueConstraints());
64         }
65     }
66     
67     /**
68      * INTERNAL:
69      */

70     public MetadataJoinColumns getInverseJoinColumns() {
71         if (m_inverseJColumns == null) {
72             m_inverseJColumns = processInverseJoinColumns();
73         }
74         
75         return m_inverseJColumns;
76     }
77     
78     /**
79      * INTERNAL:
80      */

81     public MetadataJoinColumns getJoinColumns() {
82         if (m_jColumns == null) {
83             m_jColumns = processJoinColumns();
84         }
85         
86         return m_jColumns;
87     }
88     
89     /**
90      * INTERNAL:
91      */

92     public boolean loadedFromXML() {
93         return false;
94     }
95     
96     /**
97      * INTERNAL: (Overridden in XMLJoinTable)
98      */

99     protected MetadataJoinColumns processInverseJoinColumns() {
100         return new MetadataJoinColumns(m_inverseJoinColumns);
101     }
102     
103     /**
104      * INTERNAL: (Overridden in XMLJoinTable)
105      */

106     protected MetadataJoinColumns processJoinColumns() {
107         return new MetadataJoinColumns(m_joinColumns);
108     }
109 }
110
Popular Tags