Skip to main content
summaryrefslogtreecommitdiffstats
blob: ef797b970fdb839aa92ec9f71d239e0ad8bd93ff (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*******************************************************************************
 * Copyright (c) 2006, 2011 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.jpa.core.internal.context.orm;

import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
import org.eclipse.jpt.jpa.core.MappingKeys;
import org.eclipse.jpt.jpa.core.context.Query;
import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable;
import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType;
import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable;
import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable;
import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings;

/**
 * <code>orm.xml</code> embeddable type mapping
 */
public abstract class AbstractOrmEmbeddable<X extends XmlEmbeddable>
	extends AbstractOrmTypeMapping<X>
	implements OrmEmbeddable
{
	protected AbstractOrmEmbeddable(OrmPersistentType parent, X resourceMapping) {
		super(parent, resourceMapping);
	}


	// ********** key **********

	public String getKey() {
		return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY;
	}


	// ********** id class **********

	public JavaPersistentType getIdClass() {
		return null;
	}


	// ********** tables **********

	public Iterable<ReadOnlyTable> getAssociatedTables() {
		return EmptyIterable.instance();
	}

	public Iterable<ReadOnlyTable> getAllAssociatedTables() {
		return EmptyIterable.instance();
	}

	public Iterable<String> getAllAssociatedTableNames() {
		return EmptyIterable.instance();
	}

	public boolean tableNameIsInvalid(String tableName) {
		return false;
	}


	// ********** Java **********

	@Override
	public JavaEmbeddable getJavaTypeMapping() {
		return (JavaEmbeddable) super.getJavaTypeMapping();
	}

	@Override
	public JavaEmbeddable getJavaTypeMappingForDefaults() {
		return (JavaEmbeddable) super.getJavaTypeMappingForDefaults();
	}


	// ********** entity mappings **********

	public int getXmlSequence() {
		return 2;
	}

	public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) {
		entityMappings.getEmbeddables().add(this.xmlTypeMapping);
	}

	public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) {
		entityMappings.getEmbeddables().remove(this.xmlTypeMapping);
	}


	// ********** queries **********

	public Iterable<Query> getQueries() {
		return EmptyIterable.instance();
	}


	// ********** validation **********

	@Override
	public boolean validatesAgainstDatabase() {
		return false;
	}
}

Back to the top