blob: d3d0efd2652d281c6c55bf0ce0dbd33cb3b6ce03 (
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
|
/*******************************************************************************
* 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.platform;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jpt.core.internal.IJpaPlatform;
import org.eclipse.jpt.core.internal.mappings.IPrimaryKeyJoinColumn;
import org.eclipse.jpt.core.internal.mappings.ISecondaryTable;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class XmlSecondaryTableContext extends SecondaryTableContext
{
public XmlSecondaryTableContext(ParentContext parentContext, ISecondaryTable secondaryTable) {
super(parentContext, secondaryTable);
}
@Override
protected PrimaryKeyJoinColumnContext buildPrimaryKeyJoinColumnContext(IPrimaryKeyJoinColumn pkJoinColumn) {
return new XmlPrimaryKeyJoinColumnContext(buildJoinColumnParentContext(), pkJoinColumn);
}
protected XmlPrimaryKeyJoinColumnContext.ParentContext buildJoinColumnParentContext() {
return new XmlPrimaryKeyJoinColumnContext.ParentContext() {
public void refreshDefaults(DefaultsContext defaults, IProgressMonitor monitor) {
XmlSecondaryTableContext.this.refreshDefaults(defaults, monitor);
}
public IJpaPlatform getPlatform() {
return XmlSecondaryTableContext.this.getPlatform();
}
public IContext getParentContext() {
return XmlSecondaryTableContext.this.getParentContext();
}
public void addToMessages(List<IMessage> messages) {
XmlSecondaryTableContext.this.addToMessages(messages);
}
public IPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn(int index) {
if (getSecondaryTable().isVirtual()) {
return javaSecondaryTable(index).getSpecifiedPrimaryKeyJoinColumns().get(index);
}
return null;
}
};
}
@Override
public ParentContext getParentContext() {
return (ParentContext) super.getParentContext();
}
private ISecondaryTable javaSecondaryTable(int index) {
return getParentContext().javaSecondaryTable(index);
}
public interface ParentContext extends IContext {
/**
* Return the JavaSecondaryTable at the given index. Return null if it does not exist
*/
ISecondaryTable javaSecondaryTable(int index);
}
}
|