Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkmoore2010-08-25 12:42:13 -0400
committerkmoore2010-08-25 12:42:13 -0400
commit891e1b8ae8148ec95f8fff19e436e6a0a3da66b5 (patch)
tree0e84fa8cbe7191873cfefd1b78332d0c1ba977bd
parent3959074e70db1f75079132e998106a68859a1e54 (diff)
downloadwebtools.dali-891e1b8ae8148ec95f8fff19e436e6a0a3da66b5.tar.gz
webtools.dali-891e1b8ae8148ec95f8fff19e436e6a0a3da66b5.tar.xz
webtools.dali-891e1b8ae8148ec95f8fff19e436e6a0a3da66b5.zip
132216 - type mapping class validation errors and validation preferences
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/property_files/jpa_validation.properties8
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Entity.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTextRangeResolver.java21
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java1
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMappingTextRangeResolver.java33
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java16
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java28
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java29
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTypeMappingValidator.java (renamed from jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractEntityValidator.java)27
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericEntityValidator.java56
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericTypeMappingValidator.java44
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java11
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java9
-rw-r--r--jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties2
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java2
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java7
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java6
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/AbstractEclipseLinkTypeMappingValidator.java (renamed from jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkEntityValidator.java)25
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassValidator.java35
-rw-r--r--jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkTypeMappingValidator.java23
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_validation_preferences.properties13
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiValidationPreferenceMessages.java5
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/preferences/JpaProblemSeveritiesPage.java19
-rw-r--r--jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java9
33 files changed, 356 insertions, 160 deletions
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 f75f6c0dfe..29804c8a29 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
@@ -56,10 +56,10 @@ TYPE_MAPPING_ID_CLASS_ATTRIBUTE_TYPE_DOES_NOT_AGREE=The attribute matching the I
ENTITY_NON_ROOT_ID_CLASS_SPECIFIED=An ID class should only be defined on the root entity or a mapped superclass
ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED=A primary key attribute should only be defined on the root entity or a mapped superclass
ENTITY_NO_PK=The entity has no primary key attribute defined
-ENTITY_FINAL_CLASS=The java class for entity \"{0}\" is final
-ENTITY_MEMBER_CLASS=The java class for entity \"{0}\" is a member type
-ENTITY_CLASS_MISSING_NO_ARG_CONSTRUCTOR=The java class for entity \"{0}\" has no no-arg constructor defined
-ENTITY_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR=The java class for entity \"{0}\" has a private no-arg constructor; it must be public or protected.
+TYPE_MAPPING_FINAL_CLASS=The java class for mapped type \"{0}\" is final
+TYPE_MAPPING_MEMBER_CLASS=The java class for mapped type \"{0}\" is a member class
+TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR=The java class for mapped type \"{0}\" has no no-arg constructor defined
+TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR=The java class for mapped type \"{0}\" has a private no-arg constructor; it must be public or protected.
ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE=No table should be defined for non-root entity \"{0}\" using single-table inheritance
ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE=No table should be defined for abstract entity \"{0}\" using table-per-concrete-class inheritance
ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED=No discriminator value should be defined for abstract entity \"{0}\"
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Entity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Entity.java
index 094511a7c7..fb3c46bacc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Entity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/Entity.java
@@ -20,7 +20,7 @@ import java.util.ListIterator;
* pioneering adopters on the understanding that any code that uses this API
* will almost certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public interface Entity
@@ -29,11 +29,6 @@ public interface Entity
// **************** name **************************************
/**
- * Return the name, specified or default if not specified.
- */
- String getName();
-
- /**
* Return the specified name.
*/
String getSpecifiedName();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java
index f9979cf5b8..8af558b144 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/context/TypeMapping.java
@@ -20,7 +20,7 @@ import org.eclipse.jpt.db.Schema;
* adopters on the understanding that any code that uses this API will almost
* certainly be broken (repeatedly) as the API evolves.
*
- * @version 2.3
+ * @version 3.0
* @since 2.0
*/
public interface TypeMapping
@@ -31,6 +31,11 @@ public interface TypeMapping
*/
String getKey();
+ /**
+ * Return the name, specified or default if not specified.
+ */
+ String getName();
+
PersistentType getPersistentType();
boolean isMapped();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java
index b49f38ba14..9af7a2ceaa 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/PrimaryKeyTextRangeResolver.java
@@ -15,9 +15,8 @@ import org.eclipse.jpt.core.utility.TextRange;
/**
* Interface to resolve text ranges on persistent type mappings that can define primary keys
*/
-public interface PrimaryKeyTextRangeResolver
+public interface PrimaryKeyTextRangeResolver extends TypeMappingTextRangeResolver
{
- TextRange getTypeMappingTextRange();
TextRange getIdClassTextRange();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTextRangeResolver.java
new file mode 100644
index 0000000000..850f0a6caa
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/TypeMappingTextRangeResolver.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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;
+
+import org.eclipse.jpt.core.utility.TextRange;
+
+/**
+ * Interface to resolve text ranges on persistent type mappings
+ */
+public interface TypeMappingTextRangeResolver
+{
+ TextRange getTypeMappingTextRange();
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
index 014d5f0076..eca14755fc 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaEntity.java
@@ -426,6 +426,7 @@ public abstract class AbstractJavaEntity
// **************** name **************************************************
+ @Override
public String getName() {
return (this.getSpecifiedName() == null) ? this.getDefaultName() : this.getSpecifiedName();
}
@@ -1349,7 +1350,6 @@ public abstract class AbstractJavaEntity
public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
super.validate(messages, reporter, astRoot);
- validateType(messages, reporter, astRoot);
validatePrimaryKey(messages, reporter, astRoot);
validateTable(messages, reporter, astRoot);
for (Iterator<JavaSecondaryTable> stream = this.specifiedSecondaryTables(); stream.hasNext();) {
@@ -1370,15 +1370,10 @@ public abstract class AbstractJavaEntity
return new GenericEntityPrimaryKeyValidator(this, buildTextRangeResolver(astRoot));
}
+ @Override
protected EntityTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
return new JavaEntityTextRangeResolver(this, astRoot);
}
-
- protected void validateType(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
- this.buildEntityValidator(astRoot).validate(messages, reporter);
- }
-
- protected abstract JptValidator buildEntityValidator(CompilationUnit astRoot);
protected void validateTable(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
if (isAbstractTablePerClass()) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
index 01400a3313..7cc51ed495 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaMappedSuperclass.java
@@ -123,6 +123,7 @@ public abstract class AbstractJavaMappedSuperclass extends AbstractJavaTypeMappi
// TODO - JPA 2.0 validation
}
+ @Override
protected PrimaryKeyTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
return new JavaMappedSuperclassTextRangeResolver(this, astRoot);
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
index 1dfc6ac68d..17a6b06938 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/AbstractJavaTypeMapping.java
@@ -10,6 +10,7 @@
package org.eclipse.jpt.core.internal.context.java;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.AttributeMapping;
import org.eclipse.jpt.core.context.Column;
@@ -21,6 +22,9 @@ import org.eclipse.jpt.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.core.context.java.JavaPersistentAttribute;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
import org.eclipse.jpt.core.context.java.JavaTypeMapping;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.GenericTypeMappingValidator;
import org.eclipse.jpt.core.resource.java.Annotation;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.utility.TextRange;
@@ -32,6 +36,8 @@ import org.eclipse.jpt.utility.internal.iterables.TransformationIterable;
import org.eclipse.jpt.utility.internal.iterators.CompositeIterator;
import org.eclipse.jpt.utility.internal.iterators.EmptyIterator;
import org.eclipse.jpt.utility.internal.iterators.TransformationIterator;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+import org.eclipse.wst.validation.internal.provisional.core.IReporter;
public abstract class AbstractJavaTypeMapping extends AbstractJavaJpaContextNode
@@ -59,6 +65,10 @@ public abstract class AbstractJavaTypeMapping extends AbstractJavaJpaContextNode
//***************** TypeMapping impl ***************************************
+ public String getName() {
+ return getPersistentType().getName();
+ }
+
public JavaPersistentType getPersistentType() {
return getParent();
}
@@ -229,6 +239,24 @@ public abstract class AbstractJavaTypeMapping extends AbstractJavaJpaContextNode
}
//******************** validation *********************
+
+ @Override
+ public void validate(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ super.validate(messages, reporter, astRoot);
+ validateType(messages, reporter, astRoot);
+ }
+
+ protected void validateType(List<IMessage> messages, IReporter reporter, CompilationUnit astRoot) {
+ this.buildTypeMappingValidator(astRoot).validate(messages, reporter);
+ }
+
+ protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) {
+ return new GenericTypeMappingValidator(this, this.javaResourcePersistentType, buildTextRangeResolver(astRoot));
+ }
+
+ protected TypeMappingTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) {
+ return new JavaTypeMappingTextRangeResolver(this, astRoot);
+ }
public boolean shouldValidateAgainstDatabase() {
return getPersistenceUnit().shouldValidateAgainstDatabase();
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMappingTextRangeResolver.java
new file mode 100644
index 0000000000..5cf551e98b
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/java/JavaTypeMappingTextRangeResolver.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.java.JavaTypeMapping;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class JavaTypeMappingTextRangeResolver
+ implements TypeMappingTextRangeResolver
+{
+ private JavaTypeMapping typeMapping;
+
+ private CompilationUnit astRoot;
+
+ public JavaTypeMappingTextRangeResolver(JavaTypeMapping typeMapping, CompilationUnit astRoot) {
+ this.typeMapping = typeMapping;
+ this.astRoot = astRoot;
+ }
+
+ public TextRange getTypeMappingTextRange() {
+ return this.typeMapping.getValidationTextRange(this.astRoot);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
index f7ec68b615..2527e54927 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmEntity.java
@@ -411,6 +411,7 @@ public abstract class AbstractOrmEntity
// **************** name **************************************************
+ @Override
public String getName() {
return (this.getSpecifiedName() == null) ? getDefaultName() : this.getSpecifiedName();
}
@@ -1374,13 +1375,6 @@ public abstract class AbstractOrmEntity
return this.getDiscriminatorColumn().getDiscriminatorType();
}
- protected JavaResourcePersistentType getJavaResourcePersistentType() {
- if (getPersistentType().getJavaPersistentType() != null) {
- return getPersistentType().getJavaPersistentType().getResourcePersistentType();
- }
- return null;
- }
-
protected boolean buildSpecifiedDiscriminatorValueIsAllowed() {
return !isTablePerClass() && !isAbstract();
}
@@ -1634,7 +1628,6 @@ public abstract class AbstractOrmEntity
public void validate(List<IMessage> messages, IReporter reporter) {
super.validate(messages, reporter);
- validateType(messages, reporter);
validatePrimaryKey(messages, reporter);
validateTable(messages, reporter);
for (Iterator<OrmSecondaryTable> stream = this.secondaryTables(); stream.hasNext(); ) {
@@ -1656,16 +1649,11 @@ public abstract class AbstractOrmEntity
// TODO - JPA 2.0 validation
}
+ @Override
protected EntityTextRangeResolver buildTextRangeResolver() {
return new OrmEntityTextRangeResolver(this);
}
- protected void validateType(List<IMessage> messages, IReporter reporter) {
- this.buildEntityValidator().validate(messages, reporter);
- }
-
- protected abstract JptValidator buildEntityValidator();
-
protected void validateTable(List<IMessage> messages, IReporter reporter) {
if (isAbstractTablePerClass()) {
if (this.table.isResourceSpecified()) {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
index 98f1120a6f..4ffb0f12ff 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/AbstractOrmTypeMapping.java
@@ -24,8 +24,12 @@ import org.eclipse.jpt.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.core.context.orm.OrmPersistentAttribute;
import org.eclipse.jpt.core.context.orm.OrmPersistentType;
import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.GenericTypeMappingValidator;
import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.core.resource.orm.XmlTypeMapping;
import org.eclipse.jpt.core.utility.TextRange;
import org.eclipse.jpt.db.Schema;
@@ -71,6 +75,10 @@ public abstract class AbstractOrmTypeMapping<T extends XmlTypeMapping>
return (OrmPersistentType) super.getParent();
}
+ public String getName() {
+ return getPersistentType().getName();
+ }
+
public OrmPersistentType getPersistentType() {
return this.getParent();
}
@@ -309,6 +317,13 @@ public abstract class AbstractOrmTypeMapping<T extends XmlTypeMapping>
// *************************************************************************
+ protected JavaResourcePersistentType getJavaResourcePersistentType() {
+ if (getPersistentType().getJavaPersistentType() != null) {
+ return getPersistentType().getJavaPersistentType().getResourcePersistentType();
+ }
+ return null;
+ }
+
public JpaStructureNode getStructureNode(int offset) {
if (this.resourceTypeMapping.containsOffset(offset)) {
return getPersistentType();
@@ -337,10 +352,10 @@ public abstract class AbstractOrmTypeMapping<T extends XmlTypeMapping>
@Override
public void validate(List<IMessage> messages, IReporter reporter) {
super.validate(messages, reporter);
- this.validateClass(messages);
+ this.validateClass(messages, reporter);
}
- protected void validateClass(List<IMessage> messages) {
+ protected void validateClass(List<IMessage> messages, IReporter reporter) {
if (StringTools.stringIsEmpty(this.class_)) {
messages.add(
DefaultJpaValidationMessages.buildMessage(
@@ -352,6 +367,15 @@ public abstract class AbstractOrmTypeMapping<T extends XmlTypeMapping>
);
return;
}
+ this.buildTypeMappingValidator().validate(messages, reporter);
+ }
+
+ protected JptValidator buildTypeMappingValidator() {
+ return new GenericTypeMappingValidator(this, this.getJavaResourcePersistentType(), buildTextRangeResolver());
+ }
+
+ protected TypeMappingTextRangeResolver buildTextRangeResolver() {
+ return new OrmTypeMappingTextRangeResolver(this);
}
public boolean shouldValidateAgainstDatabase() {
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java
new file mode 100644
index 0000000000..76ad266db2
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.orm;
+
+import org.eclipse.jpt.core.context.orm.OrmTypeMapping;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.utility.TextRange;
+
+public class OrmTypeMappingTextRangeResolver
+ implements TypeMappingTextRangeResolver
+{
+ private OrmTypeMapping typeMapping;
+
+ public OrmTypeMappingTextRangeResolver(OrmTypeMapping typeMapping) {
+ this.typeMapping = typeMapping;
+ }
+
+ public TextRange getTypeMappingTextRange() {
+ return this.typeMapping.getValidationTextRange();
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractEntityValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTypeMappingValidator.java
index 8e09d71718..e8bcdbb445 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractEntityValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/AbstractTypeMappingValidator.java
@@ -11,26 +11,27 @@
package org.eclipse.jpt.core.internal.jpa1.context;
import java.util.List;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.internal.context.EntityTextRangeResolver;
+import org.eclipse.jpt.core.context.TypeMapping;
import org.eclipse.jpt.core.internal.context.JptValidator;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-public abstract class AbstractEntityValidator
+public abstract class AbstractTypeMappingValidator<T extends TypeMapping>
implements JptValidator
{
- protected Entity entity;
+ protected T typeMapping;
protected JavaResourcePersistentType jrpt;
- protected EntityTextRangeResolver textRangeResolver;
+ protected TypeMappingTextRangeResolver textRangeResolver;
- protected AbstractEntityValidator(
- Entity entity, JavaResourcePersistentType jrpt, EntityTextRangeResolver textRangeResolver) {
- this.entity = entity;
+ protected AbstractTypeMappingValidator(
+ T typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
+ this.typeMapping = typeMapping;
this.jrpt = jrpt;
this.textRangeResolver = textRangeResolver;
}
@@ -76,4 +77,14 @@ public abstract class AbstractEntityValidator
}
return this.jrpt.hasNoArgConstructor();
}
+
+ protected IMessage buildTypeMessage(String msgID) {
+ return DefaultJpaValidationMessages.buildMessage(
+ IMessage.HIGH_SEVERITY,
+ msgID,
+ new String[] {this.typeMapping.getName()},
+ this.typeMapping,
+ this.textRangeResolver.getTypeMappingTextRange()
+ );
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericEntityValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericEntityValidator.java
deleted file mode 100644
index 67bffd3085..0000000000
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericEntityValidator.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 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.jpa1.context;
-
-import java.util.List;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.internal.context.EntityTextRangeResolver;
-import org.eclipse.jpt.core.internal.validation.DefaultJpaValidationMessages;
-import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
-import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-
-public class GenericEntityValidator
- extends AbstractEntityValidator
-{
- public GenericEntityValidator(Entity entity, JavaResourcePersistentType jrpt, EntityTextRangeResolver textRangeResolver) {
- super(entity, jrpt, textRangeResolver);
- }
-
- @Override
- protected void validateType(List<IMessage> messages) {
- if (this.isFinalType()) {
- messages.add(this.buildTypeMessage(JpaValidationMessages.ENTITY_FINAL_CLASS));
- }
- if (this.isMemberType()) {
- messages.add(this.buildTypeMessage(JpaValidationMessages.ENTITY_MEMBER_CLASS));
- }
- if (this.hasNoArgConstructor()) {
- if (this.hasPrivateNoArgConstructor()) {
- messages.add(this.buildTypeMessage(JpaValidationMessages.ENTITY_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR));
- }
- }
- else {
- messages.add(this.buildTypeMessage(JpaValidationMessages.ENTITY_CLASS_MISSING_NO_ARG_CONSTRUCTOR));
- }
- }
-
- protected IMessage buildTypeMessage(String msgID) {
- return DefaultJpaValidationMessages.buildMessage(
- IMessage.HIGH_SEVERITY,
- msgID,
- new String[] {this.entity.getName()},
- this.entity,
- this.textRangeResolver.getTypeMappingTextRange()
- );
- }
-
-}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericTypeMappingValidator.java
new file mode 100644
index 0000000000..02f664ef1f
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/GenericTypeMappingValidator.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.jpa1.context;
+
+import java.util.List;
+import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class GenericTypeMappingValidator
+ extends AbstractTypeMappingValidator<TypeMapping>
+{
+ public GenericTypeMappingValidator(TypeMapping typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
+ super(typeMapping, jrpt, textRangeResolver);
+ }
+
+ @Override
+ protected void validateType(List<IMessage> messages) {
+ if (this.isFinalType()) {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_FINAL_CLASS));
+ }
+ if (this.isMemberType()) {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_MEMBER_CLASS));
+ }
+ if (this.hasNoArgConstructor()) {
+ if (this.hasPrivateNoArgConstructor()) {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR));
+ }
+ }
+ else {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR));
+ }
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java
index 20ea4b7c8a..33ef727feb 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/java/GenericJavaEntity.java
@@ -9,11 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.core.internal.jpa1.context.java;
-import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericEntityValidator;
import org.eclipse.jpt.core.internal.jpa2.context.java.NullJavaCacheable2_0;
import org.eclipse.jpt.core.jpa2.JpaFactory2_0;
import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0;
@@ -63,12 +60,4 @@ public class GenericJavaEntity
}
return ((PersistenceUnit2_0) getPersistenceUnit()).calculateDefaultCacheable();
}
-
-
- //********** Validation ********************************************
-
- @Override
- protected JptValidator buildEntityValidator(CompilationUnit astRoot) {
- return new GenericEntityValidator(this, this.javaResourcePersistentType, buildTextRangeResolver(astRoot));
- }
}
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java
index 2604582cc9..6d2e83fee8 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/jpa1/context/orm/GenericOrmEntity.java
@@ -10,9 +10,7 @@
package org.eclipse.jpt.core.internal.jpa1.context.orm;
import org.eclipse.jpt.core.context.orm.OrmPersistentType;
-import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEntity;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericEntityValidator;
import org.eclipse.jpt.core.jpa2.context.CacheableHolder2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmCacheable2_0;
import org.eclipse.jpt.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory;
@@ -56,11 +54,4 @@ public class GenericOrmEntity
getCacheable().update();
}
-
- //********** Validation ********************************************
-
- @Override
- protected JptValidator buildEntityValidator() {
- return new GenericEntityValidator(this, getJavaResourcePersistentType(), buildTextRangeResolver());
- }
} \ No newline at end of file
diff --git a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
index 5e4c7d0c0d..d38e3f8992 100644
--- a/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.core/src/org/eclipse/jpt/core/internal/validation/JpaValidationMessages.java
@@ -62,10 +62,10 @@ public interface JpaValidationMessages {
public static final String ENTITY_NON_ROOT_ID_CLASS_SPECIFIED = "ENTITY_NON_ROOT_ID_CLASS_SPECIFIED";
public static final String ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED = "ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED";
public static final String ENTITY_NO_PK = "ENTITY_NO_PK";
- public static final String ENTITY_FINAL_CLASS = "ENTITY_FINAL_CLASS";
- public static final String ENTITY_MEMBER_CLASS = "ENTITY_MEMBER_CLASS";
- public static final String ENTITY_CLASS_MISSING_NO_ARG_CONSTRUCTOR = "ENTITY_CLASS_MISSING_NO_ARG_CONSTRUCTOR";
- public static final String ENTITY_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR = "ENTITY_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR";
+ public static final String TYPE_MAPPING_FINAL_CLASS = "TYPE_MAPPING_FINAL_CLASS";
+ public static final String TYPE_MAPPING_MEMBER_CLASS = "TYPE_MAPPING_MEMBER_CLASS";
+ public static final String TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR = "TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR";
+ public static final String TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR = "TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR";
public static final String ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE = "ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE";
public static final String ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE = "ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE";
public static final String ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED = "ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED";
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties
index 362cd9a066..8b622e1c83 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/property_files/eclipselink_jpa_validation.properties
@@ -16,4 +16,4 @@ PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING=\"{0}\" is a legacy entity caching proper
PERSISTENCE_UNIT_CACHING_PROPERTY_IGNORED=Property \"{0}\" will be ignored as shared-cache-mode is set to NONE
BASIC_COLLECTION_MAPPING_DEPRECATED=The type basic-collection is deprecated
BASIC_MAP_MAPPING_DEPRECATED=The type basic-map is deprecated
-ENTITY_MEMBER_CLASS_NOT_STATIC=The java class for entity \"{0}\" is a non-static member type
+TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC=The java class for mapped type \"{0}\" is a non-static member class
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java
index e3253e7ae7..9aa644c1e3 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java
@@ -29,6 +29,6 @@ public interface EclipseLinkJpaValidationMessages {
public static final String BASIC_COLLECTION_MAPPING_DEPRECATED = "BASIC_COLLECTION_MAPPING_DEPRECATED";
public static final String BASIC_MAP_MAPPING_DEPRECATED = "BASIC_MAP_MAPPING_DEPRECATED";
- public static final String ENTITY_MEMBER_CLASS_NOT_STATIC = "ENTITY_MEMBER_CLASS_NOT_STATIC";
+ public static final String TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC = "TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC";
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java
index fd5a3844e8..14a8e13b9f 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java
@@ -12,12 +12,14 @@ package org.eclipse.jpt.eclipselink.core.internal.context.java;
import java.util.List;
import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaEmbeddable;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer;
import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkConverterHolder;
import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkEmbeddable;
+import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkTypeMappingValidator;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -82,4 +84,9 @@ public class JavaEclipseLinkEmbeddableImpl
this.customizer.validate(messages, reporter, astRoot);
this.changeTracking.validate(messages, reporter, astRoot);
}
+
+ @Override
+ protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) {
+ return new EclipseLinkTypeMappingValidator(this, this.javaResourcePersistentType, this.buildTextRangeResolver(astRoot));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java
index 4a6c7863ef..1c6dc98ac2 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java
@@ -24,7 +24,7 @@ import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkCaching;
import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkConverterHolder;
import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkEntity;
import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkEntityPrimaryKeyValidator;
-import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkEntityValidator;
+import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkTypeMappingValidator;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
import org.eclipse.jpt.eclipselink.core.v2_0.resource.java.EclipseLinkClassExtractorAnnotation2_1;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
@@ -139,7 +139,7 @@ public class JavaEclipseLinkEntityImpl
}
@Override
- protected JptValidator buildEntityValidator(CompilationUnit astRoot) {
- return new EclipseLinkEntityValidator(this, this.javaResourcePersistentType, buildTextRangeResolver(astRoot));
+ protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) {
+ return new EclipseLinkTypeMappingValidator(this, this.javaResourcePersistentType, buildTextRangeResolver(astRoot));
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java
index 92ee91c0fd..ae72d431e3 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java
@@ -24,6 +24,7 @@ import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkCaching;
import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkConverterHolder;
import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkMappedSuperclass;
import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkMappedSuperclassPrimaryKeyValidator;
+import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkMappedSuperclassValidator;
import org.eclipse.jpt.eclipselink.core.resource.java.EclipseLink;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
@@ -122,4 +123,9 @@ public class JavaEclipseLinkMappedSuperclassImpl
protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) {
return new EclipseLinkMappedSuperclassPrimaryKeyValidator(this, buildTextRangeResolver(astRoot));
}
+
+ @Override
+ protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) {
+ return new EclipseLinkMappedSuperclassValidator(this, this.javaResourcePersistentType, this.buildTextRangeResolver(astRoot));
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java
index 4efde7245c..37bd5f5964 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java
@@ -13,6 +13,7 @@ import java.util.List;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
import org.eclipse.jpt.core.context.orm.OrmPersistentType;
+import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.orm.AbstractOrmEmbeddable;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkChangeTracking;
import org.eclipse.jpt.eclipselink.core.context.EclipseLinkCustomizer;
@@ -20,6 +21,7 @@ import org.eclipse.jpt.eclipselink.core.context.java.JavaEclipseLinkEmbeddable;
import org.eclipse.jpt.eclipselink.core.context.orm.EclipseLinkConverterHolder;
import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkEmbeddable;
import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkCustomizer;
+import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkTypeMappingValidator;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCustomizerHolder;
@@ -160,4 +162,9 @@ public class OrmEclipseLinkEmbeddableImpl
this.customizer.validate(messages, reporter);
this.changeTracking.validate(messages, reporter);
}
+
+ @Override
+ protected JptValidator buildTypeMappingValidator() {
+ return new EclipseLinkTypeMappingValidator(this, getJavaResourcePersistentType(), buildTextRangeResolver());
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
index cbdb5f3756..865d3f032b 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java
@@ -32,7 +32,7 @@ import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkCaching;
import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkEntity;
import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkCustomizer;
import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkEntityPrimaryKeyValidator;
-import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkEntityValidator;
+import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkTypeMappingValidator;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCacheHolder;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder;
@@ -310,7 +310,7 @@ public class OrmEclipseLinkEntityImpl
}
@Override
- protected JptValidator buildEntityValidator() {
- return new EclipseLinkEntityValidator(this, getJavaResourcePersistentType(), buildTextRangeResolver());
+ protected JptValidator buildTypeMappingValidator() {
+ return new EclipseLinkTypeMappingValidator(this, getJavaResourcePersistentType(), buildTextRangeResolver());
}
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
index 85cbc2f97f..19b6906e0f 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java
@@ -28,6 +28,7 @@ import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkCaching;
import org.eclipse.jpt.eclipselink.core.context.orm.OrmEclipseLinkMappedSuperclass;
import org.eclipse.jpt.eclipselink.core.internal.context.java.JavaEclipseLinkCustomizer;
import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkMappedSuperclassPrimaryKeyValidator;
+import org.eclipse.jpt.eclipselink.core.internal.v1_1.context.EclipseLinkMappedSuperclassValidator;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlCacheHolder;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlChangeTrackingHolder;
import org.eclipse.jpt.eclipselink.core.resource.orm.XmlConvertersHolder;
@@ -215,4 +216,9 @@ public class OrmEclipseLinkMappedSuperclassImpl
protected JptValidator buildPrimaryKeyValidator() {
return new EclipseLinkMappedSuperclassPrimaryKeyValidator(this, buildTextRangeResolver());
}
+
+ @Override
+ protected JptValidator buildTypeMappingValidator() {
+ return new EclipseLinkMappedSuperclassValidator(this, getJavaResourcePersistentType(), buildTextRangeResolver());
+ }
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkEntityValidator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/AbstractEclipseLinkTypeMappingValidator.java
index 61677584f1..dbde0534e0 100644
--- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkEntityValidator.java
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/AbstractEclipseLinkTypeMappingValidator.java
@@ -11,41 +11,40 @@
package org.eclipse.jpt.eclipselink.core.internal.v1_1.context;
import java.util.List;
-import org.eclipse.jpt.core.context.Entity;
-import org.eclipse.jpt.core.internal.context.EntityTextRangeResolver;
-import org.eclipse.jpt.core.internal.jpa1.context.AbstractEntityValidator;
+import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.internal.jpa1.context.AbstractTypeMappingValidator;
import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-public class EclipseLinkEntityValidator
- extends AbstractEntityValidator
+public abstract class AbstractEclipseLinkTypeMappingValidator<T extends TypeMapping>
+ extends AbstractTypeMappingValidator<T>
{
- public EclipseLinkEntityValidator(Entity entity, JavaResourcePersistentType jrpt, EntityTextRangeResolver textRangeResolver) {
- super(entity, jrpt, textRangeResolver);
+ public AbstractEclipseLinkTypeMappingValidator(T typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
+ super(typeMapping, jrpt, textRangeResolver);
}
@Override
protected void validateType(List<IMessage> messages) {
if (this.isMemberType() && !this.isStaticType()) {
- messages.add(this.buildTypeMessage(EclipseLinkJpaValidationMessages.ENTITY_MEMBER_CLASS_NOT_STATIC));
+ messages.add(this.buildEclipseLinkTypeMessage(EclipseLinkJpaValidationMessages.TYPE_MAPPING_MEMBER_CLASS_NOT_STATIC));
}
if (!this.hasNoArgConstructor()) {
- messages.add(this.buildTypeMessage(JpaValidationMessages.ENTITY_CLASS_MISSING_NO_ARG_CONSTRUCTOR));
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR));
}
}
- protected IMessage buildTypeMessage(String msgID) {
+ protected IMessage buildEclipseLinkTypeMessage(String msgID) {
return DefaultEclipseLinkJpaValidationMessages.buildMessage(
IMessage.HIGH_SEVERITY,
msgID,
- new String[] {this.entity.getName()},
- this.entity,
+ new String[] {this.typeMapping.getName()},
+ this.typeMapping,
this.textRangeResolver.getTypeMappingTextRange()
);
}
-
}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassValidator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassValidator.java
new file mode 100644
index 0000000000..7a46f73448
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassValidator.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.v1_1.context;
+
+import java.util.List;
+import org.eclipse.jpt.core.context.MappedSuperclass;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.internal.validation.JpaValidationMessages;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
+
+public class EclipseLinkMappedSuperclassValidator
+ extends AbstractEclipseLinkTypeMappingValidator<MappedSuperclass>
+{
+ public EclipseLinkMappedSuperclassValidator(MappedSuperclass mappedSuperclass, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
+ super(mappedSuperclass, jrpt, textRangeResolver);
+ }
+
+
+ @Override
+ protected void validateType(List<IMessage> messages) {
+ if (this.isFinalType()) {
+ messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_FINAL_CLASS));
+ }
+ super.validateType(messages);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkTypeMappingValidator.java
new file mode 100644
index 0000000000..956f4d6ad4
--- /dev/null
+++ b/jpa/plugins/org.eclipse.jpt.eclipselink.core/src/org/eclipse/jpt/eclipselink/core/internal/v1_1/context/EclipseLinkTypeMappingValidator.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.v1_1.context;
+
+import org.eclipse.jpt.core.context.TypeMapping;
+import org.eclipse.jpt.core.internal.context.TypeMappingTextRangeResolver;
+import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
+
+public class EclipseLinkTypeMappingValidator
+ extends AbstractEclipseLinkTypeMappingValidator<TypeMapping>
+{
+ public EclipseLinkTypeMappingValidator(TypeMapping typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) {
+ super(typeMapping, jrpt, textRangeResolver);
+ }
+}
diff --git a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_validation_preferences.properties b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_validation_preferences.properties
index 93aa07eb93..c38d05c8a1 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_validation_preferences.properties
+++ b/jpa/plugins/org.eclipse.jpt.ui/property_files/jpt_ui_validation_preferences.properties
@@ -49,10 +49,14 @@ PERSISTENT_TYPE_UNRESOLVED_CLASS=Class in orm.xml cannot be resolved to a java c
ENTITY_NO_PK=Entity has no primary key:
ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE=No table should be defined for non-root entity using single-table inheritance:
ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE=No table should be defined for abstract entity using table-per-concrete-class inheritance:
-ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED = No discriminator value should be defined for abstract entity:
-ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED = No discriminator value should be defined for entity using table-per-concrete-class inheritance:
-ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED =No discriminator column should be defined for non-root entity:
-ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED = No discriminator column should be defined for entity using table-per-concrete-class inheritance:
+ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED=No discriminator value should be defined for abstract entity:
+ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED=No discriminator value should be defined for entity using table-per-concrete-class inheritance:
+ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED=No discriminator column should be defined for non-root entity:
+ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED=No discriminator column should be defined for entity using table-per-concrete-class inheritance:
+TYPE_MAPPING_FINAL_CLASS=Mapped Java class is final:
+TYPE_MAPPING_MEMBER_CLASS=Mapped Java class is a member class:
+TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR=Mapped Java class has no no-arg constructor:
+TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR=Mapped Java class has a private no-arg constructor:
ATTRIBUTE_LEVEL_CATEGORY=Attribute
@@ -61,6 +65,7 @@ PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME=Attribute in orm.xml cannot be resolved in
PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED=In orm.xml referenced inherited attribute may not be supported:
PERSISTENT_ATTRIBUTE_INVALID_MAPPING=Attribute has invalid mapping type:
PERSISTENT_ATTRIBUTE_FINAL_FIELD=The java field for attribute is final:
+PERSISTENT_ATTRIBUTE_FINAL_GETTER=The java getter for attribute is final:
PERSISTENT_ATTRIBUTE_PUBLIC_FIELD=The java field for attribute is public:
MAPPING_UNRESOLVED_MAPPED_BY=Cannot resolve attribute name:
MAPPING_INVALID_MAPPED_BY=Attribute has invalid mapping for this relationship:
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiValidationPreferenceMessages.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiValidationPreferenceMessages.java
index 4a3fb3bad4..b1a9929a55 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiValidationPreferenceMessages.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/JptUiValidationPreferenceMessages.java
@@ -56,11 +56,16 @@ public class JptUiValidationPreferenceMessages {
public static String ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED;
public static String ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED;
public static String ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED;
+ public static String TYPE_MAPPING_FINAL_CLASS;
+ public static String TYPE_MAPPING_MEMBER_CLASS;
+ public static String TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR;
+ public static String TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR;
public static String PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME;
public static String PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME;
public static String PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED;
public static String PERSISTENT_ATTRIBUTE_INVALID_MAPPING;
public static String PERSISTENT_ATTRIBUTE_FINAL_FIELD;
+ public static String PERSISTENT_ATTRIBUTE_FINAL_GETTER;
public static String PERSISTENT_ATTRIBUTE_PUBLIC_FIELD;
public static String ATTRIBUTE_LEVEL_CATEGORY;
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/preferences/JpaProblemSeveritiesPage.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/preferences/JpaProblemSeveritiesPage.java
index ac3bff430b..0802194a75 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/preferences/JpaProblemSeveritiesPage.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/preferences/JpaProblemSeveritiesPage.java
@@ -67,7 +67,7 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
* Severity level state is stored in this Map and is either committed or discarded
* based on user action.
* <br> key is the preferenceKey which is also the validation message key @see JpaValidationMessages.
- * <br> value is a severity level - @see JpaValidationPreferences#ERROR WANRING INFO IGNORE
+ * <br> value is a severity level - @see JpaValidationPreferences#ERROR WARNING INFO IGNORE
*/
private Map<String, String> severityLevels;
@@ -76,7 +76,7 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
* to include WARNING, INFO, IGNORE in this Map. These will be displayed if neither the project
* or workspace preference applies.
* <br> key is the preferenceKey which is also the validation message key @see JpaValidationMessages.
- * <br> value is a severity level - @see JpaValidationPreferences#ERROR WANRING INFO IGNORE
+ * <br> value is a severity level - @see JpaValidationPreferences#ERROR WARNING INFO IGNORE
*/
private Map<String, String> defaultSeverities;
@@ -318,6 +318,18 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
addLabeledCombo(
parent, JptUiValidationPreferenceMessages.ENTITY_NO_PK,
JpaValidationMessages.ENTITY_NO_PK);
+ addLabeledCombo(
+ parent, JptUiValidationPreferenceMessages.TYPE_MAPPING_FINAL_CLASS,
+ JpaValidationMessages.TYPE_MAPPING_FINAL_CLASS);
+ addLabeledCombo(
+ parent, JptUiValidationPreferenceMessages.TYPE_MAPPING_MEMBER_CLASS,
+ JpaValidationMessages.TYPE_MAPPING_MEMBER_CLASS);
+ addLabeledCombo(
+ parent, JptUiValidationPreferenceMessages.TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR,
+ JpaValidationMessages.TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR);
+ addLabeledCombo(
+ parent, JptUiValidationPreferenceMessages.TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR,
+ JpaValidationMessages.TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR);
}
private void addAttributeLevelCategory(Composite parent) {
@@ -340,6 +352,9 @@ public class JpaProblemSeveritiesPage extends PropertyAndPreferencePage {
parent, JptUiValidationPreferenceMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD,
JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD);
addLabeledCombo(
+ parent, JptUiValidationPreferenceMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER,
+ JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER);
+ addLabeledCombo(
parent, JptUiValidationPreferenceMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD,
JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD);
addLabeledCombo(
diff --git a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java
index 9ce3957c46..7d23f9b9ac 100644
--- a/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java
+++ b/jpa/tests/org.eclipse.jpt.core.tests.extension.resource/src/org/eclipse/jpt/core/tests/extension/resource/TestJavaEntity.java
@@ -9,11 +9,8 @@
******************************************************************************/
package org.eclipse.jpt.core.tests.extension.resource;
-import org.eclipse.jdt.core.dom.CompilationUnit;
import org.eclipse.jpt.core.context.java.JavaPersistentType;
-import org.eclipse.jpt.core.internal.context.JptValidator;
import org.eclipse.jpt.core.internal.context.java.AbstractJavaEntity;
-import org.eclipse.jpt.core.internal.jpa1.context.GenericEntityValidator;
import org.eclipse.jpt.core.jpa2.context.java.JavaCacheable2_0;
public class TestJavaEntity extends AbstractJavaEntity
@@ -30,10 +27,4 @@ public class TestJavaEntity extends AbstractJavaEntity
return false;
}
- //********** Validation ********************************************
-
- @Override
- protected JptValidator buildEntityValidator(CompilationUnit astRoot) {
- return new GenericEntityValidator(this, this.javaResourcePersistentType, buildTextRangeResolver(astRoot));
- }
}

Back to the top