blob: 4c19c303242264869189c343b83acd1f2db60457 (
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
|
/*******************************************************************************
* 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.core.internal.context.java;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.Converter;
import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.core.context.java.JavaLobConverter;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.core.resource.java.LobAnnotation;
import org.eclipse.jpt.core.resource.java.TemporalAnnotation;
import org.eclipse.jpt.core.utility.TextRange;
public class GenericJavaLobConverter extends AbstractJavaJpaContextNode
implements JavaLobConverter
{
private JavaResourcePersistentAttribute resourcePersistentAttribute;
public GenericJavaLobConverter(JavaAttributeMapping parent, JavaResourcePersistentAttribute jrpa) {
super(parent);
this.initialize(jrpa);
}
@Override
public JavaAttributeMapping getParent() {
return (JavaAttributeMapping) super.getParent();
}
public String getType() {
return Converter.LOB_CONVERTER;
}
protected String getAnnotationName() {
return LobAnnotation.ANNOTATION_NAME;
}
public void addToResourceModel() {
this.resourcePersistentAttribute.addAnnotation(getAnnotationName());
}
public void removeFromResourceModel() {
this.resourcePersistentAttribute.removeAnnotation(getAnnotationName());
}
protected TemporalAnnotation getResourceLob() {
return (TemporalAnnotation) this.resourcePersistentAttribute.getAnnotation(getAnnotationName());
}
protected void initialize(JavaResourcePersistentAttribute jrpa) {
this.resourcePersistentAttribute = jrpa;
}
public void update(JavaResourcePersistentAttribute jrpa) {
this.resourcePersistentAttribute = jrpa;
}
public TextRange getValidationTextRange(CompilationUnit astRoot) {
return getResourceLob().getTextRange(astRoot);
}
}
|