blob: 2c7d97f16d300d10b1f4e8b3c606463964c0dd03 (
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
110
111
112
113
114
115
116
|
/*******************************************************************************
* Copyright (c) 2008 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.eclipselink.core.internal.context.orm;
import java.util.List;
import org.eclipse.jpt.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.core.internal.context.orm.GenericOrmEntity;
import org.eclipse.jpt.core.resource.orm.XmlEntity;
import org.eclipse.jpt.core.resource.orm.XmlEntityMappings;
import org.eclipse.jpt.eclipselink.core.context.Caching;
import org.eclipse.jpt.eclipselink.core.context.ChangeTracking;
import org.eclipse.jpt.eclipselink.core.context.Customizer;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkEntity;
import org.eclipse.jpt.eclipselink.core.context.java.EclipseLinkJavaEntity;
import org.eclipse.jpt.eclipselink.core.context.java.JavaCustomizer;
import org.eclipse.jpt.eclipselink.core.context.java.JavaReadOnly;
import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaFactory;
import org.eclipse.jpt.eclipselink.core.resource.orm.EclipseLinkOrmFactory;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlReadOnly;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
public class EclipseLinkOrmEntity extends GenericOrmEntity
implements EclipseLinkEntity
{
protected final EclipseLinkOrmReadOnly readOnly;
protected final EclipseLinkOrmCustomizer customizer;
public EclipseLinkOrmEntity(OrmPersistentType parent) {
super(parent);
this.readOnly = getJpaFactory().buildOrmReadOnly(this);
this.customizer = getJpaFactory().buildOrmCustomizer(this);
}
@Override
protected EclipseLinkJpaFactory getJpaFactory() {
return (EclipseLinkJpaFactory) super.getJpaFactory();
}
public Caching getCaching() {
// TODO Auto-generated method stub
return null;
}
public ChangeTracking getChangeTracking() {
// TODO Auto-generated method stub
return null;
}
public Customizer getCustomizer() {
return this.customizer;
}
public EclipseLinkOrmReadOnly getReadOnly() {
return this.readOnly;
}
// **************** resource-context interaction ***************************
@Override
public XmlEntity addToResourceModel(XmlEntityMappings entityMappings) {
XmlEntity entity = EclipseLinkOrmFactory.eINSTANCE.createXmlEntity();
getPersistentType().initialize(entity);
entityMappings.getEntities().add(entity);
return entity;
}
@Override
public void initialize(XmlEntity entity) {
super.initialize(entity);
this.readOnly.initialize((XmlReadOnly) entity, getJavaReadOnly());
this.customizer.initialize((XmlCustomizerHolder) entity, getJavaCustomizer());
}
@Override
public void update(XmlEntity entity) {
super.update(entity);
this.readOnly.update((XmlReadOnly) entity, getJavaReadOnly());
this.customizer.update((XmlCustomizerHolder) entity, getJavaCustomizer());
}
@Override
protected EclipseLinkJavaEntity getJavaEntityForDefaults() {
return (EclipseLinkJavaEntity) super.getJavaEntityForDefaults();
}
protected JavaReadOnly getJavaReadOnly() {
EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults();
return (javaEntity == null) ? null : javaEntity.getReadOnly();
}
protected JavaCustomizer getJavaCustomizer() {
EclipseLinkJavaEntity javaEntity = getJavaEntityForDefaults();
return (javaEntity == null) ? null : javaEntity.getCustomizer();
}
// **************** validation **************************************
@Override
public void validate(List<IMessage> messages) {
super.validate(messages);
this.readOnly.validate(messages);
this.customizer.validate(messages);
}
}
|