KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > internal > parsing > ModifyNode


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.parsing;
23
24 import oracle.toplink.essentials.queryframework.*;
25 import oracle.toplink.essentials.exceptions.*;
26 import oracle.toplink.essentials.expressions.*;
27 import oracle.toplink.essentials.descriptors.ClassDescriptor;
28
29 /**
30  * INTERNAL:
31  * ModifyNode is the superclass for UpdateNode and DeleteNode
32  */

33 public abstract class ModifyNode extends QueryNode {
34
35     private String JavaDoc abstractSchemaIdentifier;
36     private String JavaDoc abstractSchemaName;
37
38     /**
39      * INTERNAL
40      * Apply this node to the passed query. This node does not change the query.
41      */

42     public void applyToQuery(DatabaseQuery theQuery, GenerationContext context) {
43     }
44
45     /**
46      * INTERNAL
47      */

48     public Expression generateExpression(GenerationContext context) {
49         return null;
50     }
51
52     /**
53      * INTERNAL
54      */

55     public String JavaDoc getAbstractSchemaName() {
56         return abstractSchemaName;
57     }
58
59     /**
60      * INTERNAL
61      */

62     public void setAbstractSchemaName(String JavaDoc abstractSchemaName) {
63         this.abstractSchemaName = abstractSchemaName;
64     }
65
66     /**
67      * INTERNAL
68      */

69     public String JavaDoc getAbstractSchemaIdentifier() {
70         return abstractSchemaIdentifier;
71     }
72
73     /**
74      * INTERNAL
75      */

76     public void setAbstractSchemaIdentifier(String JavaDoc identifierName) {
77         abstractSchemaIdentifier = identifierName;
78     }
79
80     /**
81      * resolveClass: Answer the class which corresponds to my variableName. This is the class for
82      * an alias, where the variableName is registered to an alias.
83      */

84     public Class JavaDoc resolveClass(GenerationContext context) {
85         String JavaDoc alias = abstractSchemaName;
86         ClassDescriptor descriptor = context.getSession().getDescriptorForAlias(alias);
87         if (descriptor == null) {
88             throw EJBQLException.missingDescriptorException(alias);
89         }
90         Class JavaDoc theClass = descriptor.getJavaClass();
91         if (theClass == null) {
92             throw EJBQLException.resolutionClassNotFoundException(alias);
93         }
94         return theClass;
95     }
96 }
97
Popular Tags