KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > deployment > common > api > OriginalCMPMapping


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.modules.j2ee.deployment.common.api;
21
22 import org.openide.filesystems.FileObject;
23
24 /**
25  * This interface provides an abstraction for the original relational database
26  * information used to generate an Entity container managed persistence bean.
27  * Changes to cmp or cmr fields made after generation will not be reflected in
28  * this interface and may invalidation the original mappings. Thus, this
29  * information is intended to serve only as a hint for application server
30  * mapping.
31  * @author Chris Webster
32  */

33 public interface OriginalCMPMapping {
34
35     /**
36      * @return file reference to dbschema where table and column references
37      * refer.
38      */

39     FileObject getSchema();
40     
41     /**
42      * @return ejb name.
43      */

44     String JavaDoc getEjbName();
45     
46     /**
47      * @return table name containing all column references.
48      */

49     String JavaDoc getTableName();
50     
51     /**
52      * @param cmpFieldName to use for locating column mapping.
53      * @return name of column which represents the cmp field in #getTable() or
54      * null if this cmp field does not have a mapping (this could happen because
55      * of a change to the set of cmp fields or changes to the specific cmp field).
56      */

57     String JavaDoc getFieldColumn(String JavaDoc cmpFieldName);
58     
59     /**
60      * Obtain the foreign key columns used to express a 1:N relationship. This
61      * method will return the mapping only from the dependant EJB. Consider a
62      * an Order to LineItem relationship (Order contains many line items)
63      * where Order has a cmr field called lineItems and LineItem has a cmr field
64      * named order. Invoking <code>getRelationshipColumn("lineItems")</code> on
65      * Order would return null; however, the same invocation on LineItem would
66      * return the foreign keys which reference Order. Mapping information for
67      * M:N relationships is obtain via the #getRelationshipTable(java.lang.String)
68      * method.
69      * @param cmrFieldName to use for locating column mapping.
70      * @return name of columns representing the cmr field in #getTable() or null
71      * if the field was not present during creation or is participating in a
72      * many to many relationship.
73      */

74     String JavaDoc[] getRelationshipColumn(String JavaDoc cmrFieldName);
75     
76     /**
77      * Obtain the name of the join table a cmr field is based on. Both sides
78      * of the relationship will return the same table name.
79      * @param cmrFieldName to use in decision.
80      * @return name of join table if cmrFieldName is based on a join table,
81      * null otherwise.
82      */

83     String JavaDoc getRelationshipJoinTable(String JavaDoc cmrFieldName);
84 }
85
Popular Tags