Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/core.ecore8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGeneratedValue.java12
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/InheritanceTranslator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SequenceGeneratorTranslator.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/GenerationType.java32
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGeneratedValue.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java1
14 files changed, 55 insertions, 37 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/core.ecore b/jpa/plugins/org.eclipse.jpt.core/model/core.ecore
index 6e0ea29f5f..0a9e3d5bae 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/core.ecore
+++ b/jpa/plugins/org.eclipse.jpt.core/model/core.ecore
@@ -521,10 +521,10 @@
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="GenerationType">
<eLiterals name="Default" literal="Default (Auto)"/>
- <eLiterals name="Auto" value="1"/>
- <eLiterals name="Identity" value="2"/>
- <eLiterals name="Sequence" value="3"/>
- <eLiterals name="Table" value="4"/>
+ <eLiterals name="AUTO" value="1" literal="Auto"/>
+ <eLiterals name="IDENTITY" value="2" literal="Identity"/>
+ <eLiterals name="SEQUENCE" value="3" literal="Sequence"/>
+ <eLiterals name="TABLE" value="4" literal="Table"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EEnum" name="EnumType">
<eLiterals name="Default" literal="Default (Ordinal)"/>
diff --git a/jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel b/jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel
index 46170d1128..9c2f77885c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel
+++ b/jpa/plugins/org.eclipse.jpt.core/model/coreModels.genmodel
@@ -136,10 +136,10 @@
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="core.ecore#//mappings/GenerationType">
<genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/Default"/>
- <genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/Auto"/>
- <genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/Identity"/>
- <genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/Sequence"/>
- <genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/Table"/>
+ <genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/AUTO"/>
+ <genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/IDENTITY"/>
+ <genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/SEQUENCE"/>
+ <genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/GenerationType/TABLE"/>
</genEnums>
<genEnums typeSafeEnumCompatible="false" ecoreEnum="core.ecore#//mappings/EnumType">
<genEnumLiterals ecoreEnumLiteral="core.ecore#//mappings/EnumType/Default"/>
diff --git a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties
index ae6ef1b93d..d347705981 100644
--- a/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties
+++ b/jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties
@@ -61,6 +61,6 @@ VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME=In virtual association
JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME=Referenced column \"{0}\" in join column \"{1}\" cannot be resolved
VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME=In virtual attribute \"{0}\", referenced column \"{1}\" in join column \"{2}\" cannot be resolved
VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME=In virtual association override \"{0}\", referenced column \"{1}\" in join column \"{2}\" cannot be resolved
-GENERATED_VALUE_UNRESOLVED_GENERATOR=No generator named \"{0}\" is defined in persistence unit
+GENERATED_VALUE_UNRESOLVED_GENERATOR=No generator named \"{0}\" is defined in the persistence unit
PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME=Primary key join column \"{0}\" cannot be resolved
PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=Referenced Column \"{0}\" in primary key join column \"{1}\" cannot be resolved
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java
index 6dbce3992e..17cd499080 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/java/mappings/JavaGeneratedValue.java
@@ -326,6 +326,10 @@ public class JavaGeneratedValue extends JavaEObject implements IGeneratedValue
return this.member.annotationTextRange(DECLARATION_ANNOTATION_ADAPTER);
}
+ public ITextRange generatorTextRange() {
+ return elementTextRange(this.member.annotationElementTextRange(GENERATOR_ADAPTER));
+ }
+
// ********** java annotations -> persistence model **********
public void updateFromJava(CompilationUnit astRoot) {
setStrategy(GenerationType.fromJavaAnnotationValue(this.strategyAdapter.getValue(astRoot)));
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java
index e902f248c0..74b03f749c 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlEntityInternal.java
@@ -1136,15 +1136,9 @@ public class XmlEntityInternal extends XmlTypeMapping
}
}
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model
- * @generated NOT
- */
public boolean discriminatorValueIsAllowed() {
Type type = getPersistentType().findType();
- return (type == null) ? false : type.isAbstract();
+ return (type == null) ? false : !type.isAbstract();
}
public IEntity parentEntity() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGeneratedValue.java
index 2975cf96d7..f0aa80d772 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGeneratedValue.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/XmlGeneratedValue.java
@@ -12,10 +12,14 @@ package org.eclipse.jpt.core.internal.content.orm;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
+import org.eclipse.jpt.core.internal.ITextRange;
import org.eclipse.jpt.core.internal.XmlEObject;
+import org.eclipse.jpt.core.internal.content.orm.resource.OrmXmlMapper;
+import org.eclipse.jpt.core.internal.emfutility.DOMUtilities;
import org.eclipse.jpt.core.internal.mappings.GenerationType;
import org.eclipse.jpt.core.internal.mappings.IGeneratedValue;
import org.eclipse.jpt.core.internal.mappings.JpaCoreMappingsPackage;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
/**
* <!-- begin-user-doc -->
@@ -282,4 +286,12 @@ public class XmlGeneratedValue extends XmlEObject implements IGeneratedValue
result.append(')');
return result.toString();
}
+
+ public ITextRange generatorTextRange() {
+ if (node == null) {
+ return ((XmlEObject) eContainer()).validationTextRange();
+ }
+ IDOMNode nameNode = (IDOMNode) DOMUtilities.getChildAttributeNode(node, OrmXmlMapper.GENERATED_VALUE__GENERATOR);
+ return (nameNode == null) ? validationTextRange() : buildTextRange(nameNode);
+ }
} // XmlGeneratedValue
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java
index 64734dfd2e..e44adb6175 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/GeneratedValueTranslator.java
@@ -27,7 +27,7 @@ public class GeneratedValueTranslator extends Translator implements OrmXmlMapper
private Translator[] children;
public GeneratedValueTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature);
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
public Translator[] getChildren(Object target, int versionID) {
@@ -46,7 +46,7 @@ public class GeneratedValueTranslator extends Translator implements OrmXmlMapper
}
protected Translator createStrategyTranslator() {
- return new Translator(GENERATED_VALUE__STRATEGY, MAPPINGS_PKG.getIGeneratedValue_Strategy(), DOM_ATTRIBUTE);
+ return new EnumeratorTranslator(GENERATED_VALUE__STRATEGY, MAPPINGS_PKG.getIGeneratedValue_Strategy(), DOM_ATTRIBUTE);
}
protected Translator createGeneratorTranslator() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/InheritanceTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/InheritanceTranslator.java
index 2373d91e8c..ee3a823835 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/InheritanceTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/InheritanceTranslator.java
@@ -24,7 +24,7 @@ public class InheritanceTranslator extends Translator implements OrmXmlMapper
private Translator[] children;
public InheritanceTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature);
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
public Translator[] getChildren(Object target, int versionID) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SequenceGeneratorTranslator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SequenceGeneratorTranslator.java
index e9b3d69c4a..054a61078a 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SequenceGeneratorTranslator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/content/orm/resource/SequenceGeneratorTranslator.java
@@ -18,7 +18,7 @@ public class SequenceGeneratorTranslator extends GeneratorTranslator
{
public SequenceGeneratorTranslator(String domNameAndPath, EStructuralFeature aFeature) {
- super(domNameAndPath, aFeature, NO_STYLE);
+ super(domNameAndPath, aFeature, END_TAG_NO_INDENT);
}
protected Translator[] createChildren() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/GenerationType.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/GenerationType.java
index f3156c7b79..d767fcc20f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/GenerationType.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/GenerationType.java
@@ -40,41 +40,41 @@ public enum GenerationType implements Enumerator {
*/
DEFAULT(0, "Default", "Default (Auto)"),
/**
- * The '<em><b>Auto</b></em>' literal object.
+ * The '<em><b>AUTO</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #AUTO_VALUE
* @generated
* @ordered
*/
- AUTO(1, "Auto", "Auto"),
+ AUTO(1, "AUTO", "Auto"),
/**
- * The '<em><b>Identity</b></em>' literal object.
+ * The '<em><b>IDENTITY</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #IDENTITY_VALUE
* @generated
* @ordered
*/
- IDENTITY(2, "Identity", "Identity"),
+ IDENTITY(2, "IDENTITY", "Identity"),
/**
- * The '<em><b>Sequence</b></em>' literal object.
+ * The '<em><b>SEQUENCE</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #SEQUENCE_VALUE
* @generated
* @ordered
*/
- SEQUENCE(3, "Sequence", "Sequence"),
+ SEQUENCE(3, "SEQUENCE", "Sequence"),
/**
- * The '<em><b>Table</b></em>' literal object.
+ * The '<em><b>TABLE</b></em>' literal object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #TABLE_VALUE
* @generated
* @ordered
*/
- TABLE(4, "Table", "Table");
+ TABLE(4, "TABLE", "Table");
/**
* The '<em><b>Default</b></em>' literal value.
* <!-- begin-user-doc -->
@@ -91,7 +91,7 @@ public enum GenerationType implements Enumerator {
public static final int DEFAULT_VALUE = 0;
/**
- * The '<em><b>Auto</b></em>' literal value.
+ * The '<em><b>AUTO</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>Auto</b></em>' literal object isn't clear,
@@ -99,14 +99,14 @@ public enum GenerationType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #AUTO
- * @model name="Auto"
+ * @model literal="Auto"
* @generated
* @ordered
*/
public static final int AUTO_VALUE = 1;
/**
- * The '<em><b>Identity</b></em>' literal value.
+ * The '<em><b>IDENTITY</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>Identity</b></em>' literal object isn't clear,
@@ -114,14 +114,14 @@ public enum GenerationType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #IDENTITY
- * @model name="Identity"
+ * @model literal="Identity"
* @generated
* @ordered
*/
public static final int IDENTITY_VALUE = 2;
/**
- * The '<em><b>Sequence</b></em>' literal value.
+ * The '<em><b>SEQUENCE</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>Sequence</b></em>' literal object isn't clear,
@@ -129,14 +129,14 @@ public enum GenerationType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #SEQUENCE
- * @model name="Sequence"
+ * @model literal="Sequence"
* @generated
* @ordered
*/
public static final int SEQUENCE_VALUE = 3;
/**
- * The '<em><b>Table</b></em>' literal value.
+ * The '<em><b>TABLE</b></em>' literal value.
* <!-- begin-user-doc -->
* <p>
* If the meaning of '<em><b>Table</b></em>' literal object isn't clear,
@@ -144,7 +144,7 @@ public enum GenerationType implements Enumerator {
* </p>
* <!-- end-user-doc -->
* @see #TABLE
- * @model name="Table"
+ * @model literal="Table"
* @generated
* @ordered
*/
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGeneratedValue.java
index fd4ad5b0ca..48627ea1d9 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGeneratedValue.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/mappings/IGeneratedValue.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.internal.mappings;
import org.eclipse.jpt.core.internal.IJpaSourceObject;
+import org.eclipse.jpt.core.internal.ITextRange;
/**
* <!-- begin-user-doc -->
@@ -84,4 +85,9 @@ public interface IGeneratedValue extends IJpaSourceObject
* @generated
*/
void setGenerator(String value);
+
+ /**
+ * Return the (best guess) text location of the generator.
+ */
+ ITextRange generatorTextRange();
} // IGeneratedValue
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java
index 31deab705f..a976dd953f 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaEntityContext.java
@@ -105,6 +105,7 @@ public class JavaEntityContext extends JavaTypeContext
* in the java
*/
protected void populateGeneratorRepository(GeneratorRepository generatorRepository) {
+ super.populateGeneratorRepository(generatorRepository);
ITableGenerator tableGenerator = getEntity().getTableGenerator();
if (tableGenerator != null) {
generatorRepository.addGenerator(tableGenerator);
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java
index 6000fbfee3..29861389f2 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/JavaIdContext.java
@@ -110,7 +110,7 @@ public class JavaIdContext extends JavaAttributeContext
IMessage.HIGH_SEVERITY,
IJpaValidationMessages.GENERATED_VALUE_UNRESOLVED_GENERATOR,
new String[] {generatorName},
- generatedValue, generatedValue.validationTextRange())
+ generatedValue, generatedValue.generatorTextRange())
);
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java
index d6fe50fa10..11c211ea80 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/platform/XmlIdContext.java
@@ -97,6 +97,7 @@ public class XmlIdContext extends XmlAttributeContext
if (entityOwned()) {
addColumnMessages(messages);
}
+ addGeneratorMessages(messages);
}
protected void addColumnMessages(List<IMessage> messages) {

Back to the top