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
|
/*******************************************************************************
* Copyright (c) 2009, 2012 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.jpa1.context.orm;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable;
import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride;
import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn;
import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship;
import org.eclipse.jpt.jpa.core.context.ReadOnlyTable;
import org.eclipse.jpt.jpa.core.context.RelationshipMapping;
import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride;
import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer;
import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAssociationOverride;
import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride;
import org.eclipse.jpt.jpa.core.internal.context.JptValidator;
import org.eclipse.jpt.jpa.core.internal.context.MappingTools;
import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmAssociationOverrideContainer2_0;
import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory;
import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride;
/**
* <code>orm.xml</code> association override container
*/
public class GenericOrmAssociationOverrideContainer
extends AbstractOrmOverrideContainer<
OrmAssociationOverrideContainer.Owner,
OrmReadOnlyAssociationOverride,
OrmAssociationOverride,
OrmVirtualAssociationOverride,
XmlAssociationOverride
>
implements OrmAssociationOverrideContainer2_0
{
public GenericOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner) {
super(parent, owner);
}
public RelationshipMapping getRelationshipMapping(String attributeName) {
return MappingTools.getRelationshipMapping(attributeName, this.owner.getOverridableTypeMapping());
}
public ReadOnlyRelationship resolveOverriddenRelationship(String associationOverrideName) {
return this.owner.resolveOverriddenRelationship(associationOverrideName);
}
protected OrmAssociationOverrideContainer2_0.Owner getOwner2_0() {
return (OrmAssociationOverrideContainer2_0.Owner) this.owner;
}
public JptValidator buildJoinTableJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner columnOwner) {
return this.getOwner2_0().buildJoinTableJoinColumnValidator(override, column, columnOwner);
}
public JptValidator buildJoinTableInverseJoinColumnValidator(ReadOnlyAssociationOverride override, ReadOnlyJoinColumn column, ReadOnlyJoinColumn.Owner columnOwner) {
return this.getOwner2_0().buildJoinTableInverseJoinColumnValidator(override, column, columnOwner);
}
public JptValidator buildJoinTableValidator(ReadOnlyAssociationOverride override, ReadOnlyTable table) {
return this.getOwner2_0().buildJoinTableValidator(override, table);
}
@Override
protected Iterable<XmlAssociationOverride> getXmlOverrides_() {
// clone to reduce chance of concurrency problems
return new LiveCloneIterable<XmlAssociationOverride>(this.owner.getXmlOverrides());
}
@Override
protected XmlAssociationOverride buildXmlOverride() {
return OrmFactory.eINSTANCE.createXmlAssociationOverride();
}
@Override
protected OrmAssociationOverride buildSpecifiedOverride(XmlAssociationOverride xmlOverride) {
return this.getContextNodeFactory().buildOrmAssociationOverride(this, xmlOverride);
}
@Override
protected void initializeSpecifiedOverride(OrmAssociationOverride specifiedOverride, OrmVirtualAssociationOverride virtualOverride) {
specifiedOverride.initializeFromVirtual(virtualOverride);
}
@Override
protected OrmVirtualAssociationOverride buildVirtualOverride(String name) {
return this.getContextNodeFactory().buildOrmVirtualAssociationOverride(this, name);
}
}
|