Skip to main content
summaryrefslogtreecommitdiffstats
blob: 65f3956dc77f0bf6b8d3cb6f12816f4e5e2f6878 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*******************************************************************************
 *  Copyright (c) 2007 Oracle. 
 *  All rights reserved.  This program and the accompanying materials 
 *  are made available under the terms of the Eclipse Public License v1.0 
 *  which accompanies this distribution, and is available at 
 *  http://www.eclipse.org/legal/epl-v10.html
 *  
 *  Contributors: 
 *  	Oracle - initial API and implementation
 *******************************************************************************/
package org.eclipse.jpt.core.internal.context.base;

import org.eclipse.jpt.core.internal.IJpaNode;
import org.eclipse.jpt.core.internal.JpaNode;
import org.eclipse.jpt.core.internal.context.orm.EntityMappings;
import org.eclipse.jpt.core.internal.context.orm.XmlPersistentType;
import org.eclipse.jpt.core.internal.platform.base.IJpaBaseContextFactory;

public abstract class JpaContextNode extends JpaNode
	implements IJpaContextNode
{
	// **************** constructor ********************************************
	
	protected JpaContextNode(IJpaNode parent) {
		super(parent);
	}
	
	
	// **************** IJpaContextNode impl ***********************************
	
	@Override
	protected IJpaBaseContextFactory jpaFactory() {
		return (IJpaBaseContextFactory) super.jpaFactory();
	}
	
	//TODO casting to IJpaContextNode here(possible CCE).
	/**
	 * Overidden in BaseJpaContext, Persistence, PersitsenceXml to throw UnsupportedOperationException
	 * Overidden in PersistenceUnit to return it.
	 */
	public IPersistenceUnit persistenceUnit() {
		return ((IJpaContextNode) parent()).persistenceUnit();
	}
	
	/**
	 * Overidden in BaseJpaContext to return null
	 * Overidden in EntityMappings to return it.
	 */
	public EntityMappings entityMappings() {
		return ((IJpaContextNode) parent()).entityMappings();
	}
	
	/**
	 * Overidden in BaseJpaContext to return null
	 * Overidden in XmlPersistentType to return it.
	 */
	public XmlPersistentType xmlPersistentType() {
		return ((IJpaContextNode) parent()).xmlPersistentType();
	}
	
	public IJpaStructureNode structureNode(int offset) {
		return null;
	}
}

Back to the top