Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context')
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java22
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java50
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java4
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java548
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/Entity.java144
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java3
-rw-r--r--jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/Entity.java107
14 files changed, 49 insertions, 855 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java
index 1d3a2a1cd9..1179c5057f 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 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.
@@ -29,9 +29,9 @@ import org.eclipse.jpt.jpa.core.resource.java.Annotation;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkConvertAnnotation;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java
index bcc7117880..d077109fc3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 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.
@@ -20,9 +20,9 @@ import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkNamedConverterAnnotation;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java
index 3b9ce8f6c1..5e09887e05 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 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.
@@ -15,7 +15,7 @@ import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping;
import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode;
import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.java.EclipseLinkMutableAnnotation;
public class JavaEclipseLinkMutable
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java
index a90aa52f1c..17d4214da3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 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.
@@ -12,7 +12,7 @@ package org.eclipse.jpt.jpa.eclipselink.core.internal.context.java;
import java.util.List;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools;
+import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode;
@@ -120,23 +120,13 @@ public class JavaEclipseLinkStructConverter
}
private boolean converterClassExists(IJavaProject javaProject) {
- if (this.converterClass != null)
- {
- if (JDTTools.getJDTType(javaProject, this.converterClass) != null) {
- return true;
- }
- }
- return false;
+ return (this.converterClass != null) &&
+ (JDTTools.findType(javaProject, this.converterClass) != null);
}
private boolean converterClassImplementsInterface(IJavaProject javaProject, String interfaceName) {
- if (this.converterClass != null)
- {
- if (JDTTools.typeNamedImplementsInterfaceNamed(javaProject, this.converterClass, interfaceName)) {
- return true;
- }
- }
- return false;
+ return (this.converterClass != null) &&
+ JDTTools.typeNamedImplementsInterfaceNamed(javaProject, this.converterClass, interfaceName);
}
protected TextRange getConverterClassTextRange(CompilationUnit astRoot) {
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java
index 47099016dd..a12dfbd05c 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 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.
@@ -26,9 +26,9 @@ import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.AbstractOrmConverter;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConvert;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConvertibleMapping;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedConverter;
import org.eclipse.text.edits.ReplaceEdit;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java
index 4d33d9ec04..72c669ccaf 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 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.
@@ -21,10 +21,10 @@ import org.eclipse.jpt.jpa.core.context.XmlContextNode;
import org.eclipse.jpt.jpa.core.context.orm.EntityMappings;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkConverter;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlConverterHolder;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlNamedConverter;
import org.eclipse.text.edits.ReplaceEdit;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java
index 32d6e79f9b..f7bbe2056a 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java
@@ -13,7 +13,7 @@ import java.util.List;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools;
+import org.eclipse.jpt.common.core.internal.utility.JDTTools;
import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.common.utility.internal.StringTools;
import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable;
@@ -28,10 +28,10 @@ import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-public abstract class OrmEclipseLinkConverterClassConverter<X extends XmlNamedConverter> extends OrmEclipseLinkConverter<X>
+public abstract class OrmEclipseLinkConverterClassConverter<X extends XmlNamedConverter>
+ extends OrmEclipseLinkConverter<X>
implements EclipseLinkCustomConverter
{
-
protected String converterClass;
protected JavaResourcePersistentType converterPersistentType;
@@ -108,33 +108,33 @@ public abstract class OrmEclipseLinkConverterClassConverter<X extends XmlNamedCo
}
private boolean converterClassExists(IJavaProject javaProject) {
- if (this.converterClass != null)
- {
- String globalPackage = getEntityMappings().getPackage();
- IType type = JDTTools.getJDTType(javaProject, this.converterClass);
- if (type != null) {
- return true;
- } else if (StringTools.stringIsNotEmpty(globalPackage)) {
- type = JDTTools.getJDTType(javaProject, globalPackage + "." + this.converterClass);
- if (type != null) {
- return true;
- }
- }
+ if (this.converterClass == null) {
+ return false;
+ }
+
+ if (JDTTools.findType(javaProject, this.converterClass) != null) {
+ return true;
}
- return false;
+
+ String globalPackage = this.getEntityMappings().getPackage();
+ if (StringTools.stringIsEmpty(globalPackage)) {
+ return false;
+ }
+ return JDTTools.findType(javaProject, globalPackage + '.' + this.converterClass) != null;
}
private boolean converterClassImplementsInterface(IJavaProject javaProject, String interfaceName) {
- if (this.converterClass != null)
- {
- String globalPackage = getEntityMappings().getPackage();
- boolean implementFound = JDTTools.typeNamedImplementsInterfaceNamed(javaProject, this.converterClass, interfaceName);
- if (!implementFound && StringTools.stringIsNotEmpty(globalPackage)) {
- implementFound = JDTTools.typeNamedImplementsInterfaceNamed(javaProject, globalPackage + "." + this.converterClass, interfaceName);
- }
- return implementFound;
+ if (this.converterClass == null) {
+ return false;
+ }
+ if (JDTTools.typeNamedImplementsInterfaceNamed(javaProject, this.converterClass, interfaceName)) {
+ return true;
+ }
+ String globalPackage = this.getEntityMappings().getPackage();
+ if (StringTools.stringIsEmpty(globalPackage)) {
+ return false;
}
- return false;
+ return JDTTools.typeNamedImplementsInterfaceNamed(javaProject, globalPackage + '.' + this.converterClass, interfaceName);
}
public abstract TextRange getConverterClassTextRange();
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java
index 58120c55fc..cf85bd89de 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 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.
@@ -13,8 +13,8 @@ import org.eclipse.jpt.common.core.utility.TextRange;
import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping;
import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode;
import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkMutable;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.java.JavaEclipseLinkPersistentAttribute;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.resource.orm.XmlMutable;
public class OrmEclipseLinkMutable
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
deleted file mode 100644
index 8a208487f2..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java
+++ /dev/null
@@ -1,548 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 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.jpa.eclipselink.core.internal.context.persistence;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.Set;
-import java.util.Vector;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jpt.common.utility.internal.CollectionTools;
-import org.eclipse.jpt.common.utility.internal.NotNullFilter;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable;
-import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
-import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator;
-import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
-import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef;
-import org.eclipse.jpt.jpa.core.context.persistence.Persistence;
-import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit;
-import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.ImpliedMappingFileRef;
-import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode;
-import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
-import org.eclipse.jpt.jpa.eclipselink.core.EclipseLinkJpaProject;
-import org.eclipse.jpt.jpa.eclipselink.core.JptJpaEclipseLinkCorePlugin;
-import org.eclipse.jpt.jpa.eclipselink.core.context.EclipseLinkConverter;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceXmlContextNodeFactory;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Caching;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.connection.Connection;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Customization;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.general.GeneralProperties;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.logging.Logging;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.options.Options;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.schema.generation.SchemaGeneration;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.DefaultEclipseLinkJpaValidationMessages;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.EclipseLinkJpaValidationMessages;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.caching.EclipseLinkCaching;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.customization.EclipseLinkCustomization;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.general.EclipseLinkGeneralProperties;
-import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.schema.generation.EclipseLinkSchemaGeneration;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.eclipse.wst.validation.internal.provisional.core.IMessage;
-import org.eclipse.wst.validation.internal.provisional.core.IReporter;
-
-/**
- * EclipseLink persistence unit
- */
-public class EclipseLinkPersistenceUnit
- extends AbstractPersistenceUnit
-{
- protected MappingFileRef impliedEclipseLinkMappingFileRef;
- /**
- * String constant associated with changes to the implied eclipselink mapping file ref
- */
- public static final String IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY = "impliedEclipseLinkMappingFileRef"; //$NON-NLS-1$
-
-
- private/*final*/ GeneralProperties generalProperties;
- private Customization customization;
- private Caching caching;
- private Logging logging;
- private SchemaGeneration schemaGeneration;
-
- /* global converter definitions, defined elsewhere in model */
- protected final Vector<EclipseLinkConverter> converters = new Vector<EclipseLinkConverter>();
-
-
- public EclipseLinkPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) {
- super(parent, xmlPersistenceUnit);
- }
-
-
- // ********** synchronize/update **********
-
- // TODO bjv calculate converters directly...
- @Override
- public void update() {
- this.converters.clear();
- super.update();
- this.fireCollectionChanged(CONVERTERS_COLLECTION, this.converters);
- }
-
-
- // ********** properties **********
-
- public GeneralProperties getGeneralProperties() {
- return this.generalProperties;
- }
-
- @Override
- public Connection getConnection() {
- return (Connection) super.getConnection();
- }
-
- public Customization getCustomization() {
- return this.customization;
- }
-
- public Caching getCaching() {
- return this.caching;
- }
-
- public Logging getLogging() {
- return this.logging;
- }
-
- @Override
- public Options getOptions() {
- return (Options) super.getOptions();
- }
-
- public SchemaGeneration getSchemaGeneration() {
- return this.schemaGeneration;
- }
-
- protected GeneralProperties buildEclipseLinkGeneralProperties() {
- return new EclipseLinkGeneralProperties(this);
- }
-
- protected Connection buildEclipseLinkConnection() {
- return (Connection) this.getContextNodeFactory().buildConnection(this);
- }
-
- protected Customization buildEclipseLinkCustomization() {
- return new EclipseLinkCustomization(this);
- }
-
- protected Caching buildEclipseLinkCaching() {
- return new EclipseLinkCaching(this);
- }
-
- protected Logging buildEclipseLinkLogging() {
- return (Logging) this.getContextNodeFactory().buildLogging(this);
- }
-
- protected Options buildEclipseLinkOptions() {
- return (Options) this.getContextNodeFactory().buildOptions(this);
- }
-
- protected SchemaGeneration buildEclipseLinkSchemaGeneration() {
- return new EclipseLinkSchemaGeneration(this);
- }
-
- @Override
- protected void initializeProperties() {
- super.initializeProperties();
- this.generalProperties = this.buildEclipseLinkGeneralProperties();
- this.customization = this.buildEclipseLinkCustomization();
- this.caching = this.buildEclipseLinkCaching();
- this.logging = this.buildEclipseLinkLogging();
- this.schemaGeneration = this.buildEclipseLinkSchemaGeneration();
- }
-
- @Override
- public void propertyValueChanged(String propertyName, String newValue) {
- super.propertyValueChanged(propertyName, newValue);
- this.generalProperties.propertyValueChanged(propertyName, newValue);
- this.customization.propertyValueChanged(propertyName, newValue);
- this.caching.propertyValueChanged(propertyName, newValue);
- this.logging.propertyValueChanged(propertyName, newValue);
- this.schemaGeneration.propertyValueChanged(propertyName, newValue);
- }
-
- @Override
- public void propertyRemoved(String propertyName) {
- super.propertyRemoved(propertyName);
- this.generalProperties.propertyRemoved(propertyName);
- this.customization.propertyRemoved(propertyName);
- this.caching.propertyRemoved(propertyName);
- this.logging.propertyRemoved(propertyName);
- this.schemaGeneration.propertyRemoved(propertyName);
- }
-
-
- // ********** mapping file refs **********
-
- @Override
- protected ListIterable<MappingFileRef> getMappingFileRefs() {
- return (this.impliedEclipseLinkMappingFileRef == null) ?
- super.getMappingFileRefs() :
- new CompositeListIterable<MappingFileRef>(super.getMappingFileRefs(), this.impliedEclipseLinkMappingFileRef);
- }
-
- @Override
- public int mappingFileRefsSize() {
- return (this.impliedEclipseLinkMappingFileRef == null) ?
- super.mappingFileRefsSize() :
- super.mappingFileRefsSize() + 1;
- }
-
-
- // ********** implied eclipselink mapping file ref **********
-
- public MappingFileRef getImpliedEclipseLinkMappingFileRef() {
- return this.impliedEclipseLinkMappingFileRef;
- }
-
- protected MappingFileRef addImpliedEclipseLinkMappingFileRef() {
- if (this.impliedEclipseLinkMappingFileRef != null) {
- throw new IllegalStateException("The implied EclipseLink mapping file ref is already present: " + this.impliedEclipseLinkMappingFileRef); //$NON-NLS-1$
- }
- MappingFileRef mappingFileRef = this.buildEclipseLinkImpliedMappingFileRef();
- this.impliedEclipseLinkMappingFileRef = mappingFileRef;
- this.firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, null, mappingFileRef);
- return mappingFileRef;
- }
-
- private ImpliedMappingFileRef buildEclipseLinkImpliedMappingFileRef() {
- return new ImpliedMappingFileRef(this, JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
- }
-
- protected void removeImpliedEclipseLinkMappingFileRef() {
- if (this.impliedEclipseLinkMappingFileRef == null) {
- throw new IllegalStateException("The implied EclipseLink mapping file ref is null."); //$NON-NLS-1$
- }
- MappingFileRef mappingFileRef = this.impliedEclipseLinkMappingFileRef;
- this.impliedEclipseLinkMappingFileRef.dispose();
- this.impliedEclipseLinkMappingFileRef = null;
- this.firePropertyChanged(IMPLIED_ECLIPSELINK_MAPPING_FILE_REF_PROPERTY, mappingFileRef, null);
- }
-
- @Override
- protected void syncImpliedMappingFileRef() {
- super.syncImpliedMappingFileRef();
- if (this.impliedEclipseLinkMappingFileRef != null) {
- this.impliedEclipseLinkMappingFileRef.synchronizeWithResourceModel();
- }
- }
-
- @Override
- protected void updateImpliedMappingFileRef() {
- super.updateImpliedMappingFileRef();
-
- if (this.buildsImpliedEclipseLinkMappingFile()) {
- if (this.impliedEclipseLinkMappingFileRef == null) {
- this.addImpliedEclipseLinkMappingFileRef();
- } else {
- this.impliedEclipseLinkMappingFileRef.update();
- }
- } else {
- if (this.impliedEclipseLinkMappingFileRef != null) {
- this.removeImpliedEclipseLinkMappingFileRef();
- }
- }
- }
-
- /**
- * Build a virtual EclipseLink mapping file if all the following are true:<ul>
- * <li>the properties do not explicitly exclude it
- * <li>it is not specified explicitly in the persistence unit
- * <li>the file actually exists
- * </ul>
- */
- private boolean buildsImpliedEclipseLinkMappingFile() {
- return this.impliedEclipseLinkMappingFileIsNotExcluded() &&
- this.impliedEclipseLinkMappingFileIsNotSpecified() &&
- this.impliedEclipseLinkMappingFileExists();
- }
-
- protected boolean impliedEclipseLinkMappingFileIsNotExcluded() {
- return ! this.impliedEclipseLinkMappingFileIsExcluded();
- }
-
- protected boolean impliedEclipseLinkMappingFileIsExcluded() {
- return this.getGeneralProperties().getExcludeEclipselinkOrm() == Boolean.TRUE;
- }
-
- protected boolean impliedEclipseLinkMappingFileIsNotSpecified() {
- return ! this.impliedEclipseLinkMappingFileIsSpecified();
- }
-
- protected boolean impliedEclipseLinkMappingFileIsSpecified() {
- return this.mappingFileIsSpecified(JptJpaEclipseLinkCorePlugin.DEFAULT_ECLIPSELINK_ORM_XML_RUNTIME_PATH.toString());
- }
-
- protected boolean impliedEclipseLinkMappingFileExists() {
- return this.getJpaProject().getDefaultEclipseLinkOrmXmlResource() != null;
- }
-
-
- // ********** converters **********
-
- /**
- * Identifier for changes to the list of global converter definitions.
- * Note that there are no granular changes to this list. There is only
- * notification that the entire list has changed.
- */
- public static final String CONVERTERS_COLLECTION = "converters"; //$NON-NLS-1$
-
- /**
- * Add the converter definition (defined elsewhere) to the list of converters
- * defined within this persistence unit.
- * Note that this should only be called during the process of updating the
- * local converter definition.
- * No change notification accompanies this action specifically.
- */
- public void addConverter(EclipseLinkConverter converter) {
- this.converters.add(converter);
- }
-
- /**
- * Return an iterator on all converters defined within this persistence unit,
- * included duplicately named converters definitions.
- */
- public ListIterator<EclipseLinkConverter> allConverters() {
- return new CloneListIterator<EclipseLinkConverter>(this.converters);
- }
-
- public int convertersSize() {
- return this.converters.size();
- }
-
- /**
- * Return the names of the converters defined in the persistence
- * unit, with duplicates removed.
- */
- public Iterable<String> getUniqueConverterNames() {
- return CollectionTools.set(this.allNonNullConverterNames(), this.converters.size());
- }
-
- protected Iterator<String> allNonNullConverterNames() {
- return new FilteringIterator<String>(this.allConverterNames(), NotNullFilter.<String>instance());
- }
-
- protected Iterator<String> allConverterNames() {
- return new TransformationIterator<EclipseLinkConverter, String>(this.allConverters()) {
- @Override
- protected String transform(EclipseLinkConverter converter) {
- return converter.getName();
- }
- };
- }
-
-
- // ********** misc **********
-
- @Override
- public EclipseLinkJpaProject getJpaProject() {
- return (EclipseLinkJpaProject) super.getJpaProject();
- }
-
- @Override
- public EclipseLinkPersistenceXmlContextNodeFactory getContextNodeFactory() {
- return (EclipseLinkPersistenceXmlContextNodeFactory) super.getContextNodeFactory();
- }
-
- @Override
- protected void addNonUpdateAspectNamesTo(Set<String> nonUpdateAspectNames) {
- super.addNonUpdateAspectNamesTo(nonUpdateAspectNames);
- nonUpdateAspectNames.add(CONVERTERS_COLLECTION);
- }
-
- @Override
- public void setSpecifiedSharedCacheMode(SharedCacheMode specifiedSharedCacheMode) {
- super.setSpecifiedSharedCacheMode(specifiedSharedCacheMode);
-
- if(specifiedSharedCacheMode == SharedCacheMode.NONE) {
- this.caching.removeDefaultCachingProperties();
- }
- }
-
- @Override
- protected SharedCacheMode buildDefaultSharedCacheMode() {
- return SharedCacheMode.DISABLE_SELECTIVE;
- }
-
- @Override
- public boolean calculateDefaultCacheable() {
- SharedCacheMode sharedCacheMode = this.getSharedCacheMode();
- if (sharedCacheMode == null) {
- return true;
- }
- switch (sharedCacheMode) {
- case NONE:
- case ENABLE_SELECTIVE:
- return false;
- case ALL:
- case DISABLE_SELECTIVE:
- case UNSPECIFIED:
- return true;
- }
- return true;
- }
-
-
- // ********** validation **********
-
- @Override
- protected void validateProperties(List<IMessage> messages, IReporter reporter) {
-
- if(this.isJpa2_0Compatible()) {
- for(Property property: this.getLegacyEntityCachingProperties()) {
- messages.add(
- DefaultEclipseLinkJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- EclipseLinkJpaValidationMessages.PERSISTENCE_UNIT_LEGACY_ENTITY_CACHING,
- new String[] {property.getName()},
- this.getPersistenceUnit(),
- property.getValidationTextRange()
- )
- );
- }
- for(Property property: this.getLegacyDescriptorCustomizerProperties()) {
- messages.add(
- DefaultEclipseLinkJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- EclipseLinkJpaValidationMessages.PERSISTENCE_UNIT_LEGACY_DESCRIPTOR_CUSTOMIZER,
- new String[] {property.getName()},
- this.getPersistenceUnit(),
- property.getValidationTextRange()
- )
- );
- }
- this.validateDefaultCachingProperty(this.getCacheTypeDefaultProperty(), messages);
- this.validateDefaultCachingProperty(this.getCacheSizeDefaultProperty(), messages);
- this.validateDefaultCachingProperty(this.getFlushClearCacheProperty(), messages);
- }
- }
-
- protected void validateDefaultCachingProperty(Property cachingProperty, List<IMessage> messages) {
-
- if(this.getSharedCacheMode() == SharedCacheMode.NONE) {
- if(cachingProperty != null) {
- messages.add(
- DefaultEclipseLinkJpaValidationMessages.buildMessage(
- IMessage.NORMAL_SEVERITY,
- EclipseLinkJpaValidationMessages.PERSISTENCE_UNIT_CACHING_PROPERTY_IGNORED,
- new String[] {cachingProperty.getName()},
- this.getPersistenceUnit(),
- cachingProperty.getValidationTextRange()
- )
- );
- }
- }
- }
-
- protected ArrayList<Property> getLegacyDescriptorCustomizerProperties() {
- ArrayList<Property> result = new ArrayList<Property>();
- CollectionTools.addAll(result, this.getDescriptorCustomizerProperties());
- return result;
- }
-
- protected ArrayList<Property> getLegacyEntityCachingProperties() {
- ArrayList<Property> result = new ArrayList<Property>();
- CollectionTools.addAll(result, this.getSharedCacheProperties());
- CollectionTools.addAll(result, this.getEntityCacheTypeProperties());
- CollectionTools.addAll(result, this.getEntityCacheSizeProperties());
- return result;
- }
-
- private Property getCacheTypeDefaultProperty() {
- return this.getProperty(Caching.ECLIPSELINK_CACHE_TYPE_DEFAULT);
- }
-
- private Property getCacheSizeDefaultProperty() {
- return this.getProperty(Caching.ECLIPSELINK_CACHE_SIZE_DEFAULT);
- }
-
- private Property getFlushClearCacheProperty() {
- return this.getProperty(Caching.ECLIPSELINK_FLUSH_CLEAR_CACHE);
- }
-
- /**
- * Returns all Shared Cache Properties, including Entity and default.
- */
- private Iterable<Property> getSharedCacheProperties() {
- return CollectionTools.iterable(this.propertiesWithNamePrefix(Caching.ECLIPSELINK_SHARED_CACHE));
- }
-
- /**
- * Returns Entity Cache Size Properties, excluding default.
- */
- private Iterable<Property> getEntityCacheSizeProperties() {
- return this.getEntityPropertiesWithPrefix(Caching.ECLIPSELINK_CACHE_SIZE);
- }
-
- /**
- * Returns Entity Cache Type Properties, excluding default.
- */
- private Iterable<Property> getEntityCacheTypeProperties() {
- return this.getEntityPropertiesWithPrefix(Caching.ECLIPSELINK_CACHE_TYPE);
- }
-
- /**
- * Returns Descriptor Customizer Properties.
- */
- private Iterable<Property> getDescriptorCustomizerProperties() {
- return this.getEntityPropertiesWithPrefix(Customization.ECLIPSELINK_DESCRIPTOR_CUSTOMIZER);
- }
-
- /**
- * Returns Entity Properties with the given prefix,
- * excluding Entity which name equals "default".
- */
- private Iterable<Property> getEntityPropertiesWithPrefix(String prefix) {
- return new FilteringIterable<Property>(
- CollectionTools.iterable(this.propertiesWithNamePrefix(prefix))) {
- @Override
- protected boolean accept(Property next) {
- return ! next.getName().endsWith("default"); //$NON-NLS-1$
- }
- };
- }
-
-
- // ********** refactoring **********
-
- @Override
- @SuppressWarnings("unchecked")
- protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenameTypeEdits(IType originalType, String newName) {
- return new CompositeIterable<ReplaceEdit>(
- super.createPersistenceUnitPropertiesRenameTypeEdits(originalType, newName),
- this.customization.createRenameTypeEdits(originalType, newName),
- this.logging.createRenameTypeEdits(originalType, newName)
- );
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesMoveTypeEdits(IType originalType, IPackageFragment newPackage) {
- return new CompositeIterable<ReplaceEdit>(
- super.createPersistenceUnitPropertiesMoveTypeEdits(originalType, newPackage),
- this.customization.createMoveTypeEdits(originalType, newPackage),
- this.logging.createMoveTypeEdits(originalType, newPackage)
- );
- }
-
- @Override
- @SuppressWarnings("unchecked")
- protected Iterable<ReplaceEdit> createPersistenceUnitPropertiesRenamePackageEdits(IPackageFragment originalPackage, String newName) {
- return new CompositeIterable<ReplaceEdit>(
- super.createPersistenceUnitPropertiesRenamePackageEdits(originalPackage, newName),
- this.customization.createRenamePackageEdits(originalPackage, newName),
- this.logging.createRenamePackageEdits(originalPackage, newName)
- );
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java
index 17b158b84c..9f0a21deb3 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2009, 2011 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.
@@ -16,6 +16,7 @@ import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties;
import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef;
import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.EclipseLinkPersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.connection.EclipseLinkConnection;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.logging.EclipseLinkLogging;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.options.EclipseLinkOptions;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
index 3f47ccb4eb..d198b41c44 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Oracle. All rights reserved.
+ * Copyright (c) 2008, 2011 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.
@@ -22,6 +22,7 @@ import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.CacheType;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Caching;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Entity;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.FlushClearCache;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/Entity.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/Entity.java
deleted file mode 100644
index 92bd933fe6..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/Entity.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 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.jpa.eclipselink.core.internal.context.persistence.caching;
-
-import java.io.Serializable;
-
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.CacheType;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.caching.Caching;
-
-/**
- * Entity
- */
-public class Entity extends AbstractModel implements Cloneable, Serializable
-{
- private String name;
- private Caching parent;
-
- public static final String CACHE_TYPE_PROPERTY = Caching.CACHE_TYPE_PROPERTY;
- public static final String CACHE_SIZE_PROPERTY = Caching.CACHE_SIZE_PROPERTY;
- public static final String SHARED_CACHE_PROPERTY = Caching.SHARED_CACHE_PROPERTY;
-
- // ********** EclipseLink properties **********
- private CacheType cacheType;
- private Integer cacheSize;
- private Boolean cacheIsShared;
-
- private static final long serialVersionUID = 1L;
-
- // ********** constructors **********
- public Entity(Caching parent, String name) {
- this(parent);
- this.initialize(name);
- }
-
- private Entity(Caching parent) {
- this.parent = parent;
- }
-
- private void initialize(String name) {
- if(StringTools.stringIsEmpty(name)) {
- throw new IllegalArgumentException();
- }
- this.name = name;
- }
-
- // ********** behaviors **********
- @Override
- public boolean equals(Object o) {
- if(o == null) {
- return false;
- }
- Entity entity = (Entity) o;
- return (
- (this.cacheType == null ?
- entity.cacheType == null : this.cacheType.equals(entity.cacheType)) &&
- (this.cacheIsShared == null ?
- entity.cacheIsShared == null : this.cacheIsShared.equals(entity.cacheIsShared)) &&
- (this.cacheSize == null ?
- entity.cacheSize == null : this.cacheSize.equals(entity.cacheSize)));
- }
-
- @Override
- public Entity clone() {
- try {
- return (Entity)super.clone();
- }
- catch (CloneNotSupportedException ex) {
- throw new InternalError();
- }
- }
-
- public boolean isEmpty() {
- return (this.cacheType == null) &&
- (this.cacheSize == null) &&
- (this.cacheIsShared == null);
- }
-
- public boolean entityNameIsValid() {
- return ! StringTools.stringIsEmpty(this.name);
- }
-
- public Caching getParent() {
- return this.parent;
- }
-
- // ********** name **********
- public String getName() {
- return this.name;
- }
-
- // ********** cacheType **********
- protected CacheType getCacheType() {
- return this.cacheType;
- }
-
- protected void setCacheType(CacheType cacheType) {
- CacheType old = this.cacheType;
- this.cacheType = cacheType;
- this.firePropertyChanged(CACHE_TYPE_PROPERTY, old, cacheType);
- }
-
- // ********** cacheSize **********
- protected Integer getCacheSize() {
- return this.cacheSize;
- }
-
- protected void setCacheSize(Integer cacheSize) {
- Integer old = this.cacheSize;
- this.cacheSize = cacheSize;
- this.firePropertyChanged(CACHE_SIZE_PROPERTY, old, cacheSize);
- }
-
- // ********** cacheIsShared **********
- protected Boolean cacheIsShared() {
- return this.cacheIsShared;
- }
-
- protected void setSharedCache(Boolean isShared) {
- Boolean old = this.cacheIsShared;
- this.cacheIsShared = isShared;
- this.firePropertyChanged(SHARED_CACHE_PROPERTY, old, isShared);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append("name: "); //$NON-NLS-1$
- sb.append(this.name);
- sb.append(", cacheType: "); //$NON-NLS-1$
- sb.append(this.cacheType);
- sb.append(", cacheSize: "); //$NON-NLS-1$
- sb.append(this.cacheSize);
- sb.append(", cacheIsShared: "); //$NON-NLS-1$
- sb.append(this.cacheIsShared);
- }
-}
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
index 5aa80c0529..1878ff7080 100644
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
+++ b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2008, 2010 Oracle. All rights reserved.
+* Copyright (c) 2008, 2011 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.
@@ -27,6 +27,7 @@ import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator;
import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator;
import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Customization;
+import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Entity;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Profiler;
import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Weaving;
import org.eclipse.jpt.jpa.eclipselink.core.internal.context.persistence.EclipseLinkPersistenceUnitProperties;
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/Entity.java b/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/Entity.java
deleted file mode 100644
index 17847182e1..0000000000
--- a/jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/Entity.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
-* Copyright (c) 2009 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.jpa.eclipselink.core.internal.context.persistence.customization;
-
-import java.io.Serializable;
-
-import org.eclipse.jpt.common.utility.internal.StringTools;
-import org.eclipse.jpt.common.utility.internal.model.AbstractModel;
-import org.eclipse.jpt.jpa.eclipselink.core.context.persistence.customization.Customization;
-
-/**
- * Entity
- */
-public class Entity extends AbstractModel implements Cloneable, Serializable
-{
- private String name;
- private Customization parent;
-
- public static final String DESCRIPTOR_CUSTOMIZER_PROPERTY = Customization.DESCRIPTOR_CUSTOMIZER_PROPERTY;
-
- // ********** EclipseLink properties **********
- private String descriptorCustomizer;
-
- private static final long serialVersionUID = 1L;
-
- // ********** constructors **********
- public Entity(Customization parent, String name) {
- this(parent);
- this.initialize(name);
- }
-
- private Entity(Customization parent) {
- this.parent = parent;
- }
-
- private void initialize(String name) {
- if(StringTools.stringIsEmpty(name)) {
- throw new IllegalArgumentException();
- }
- this.name = name;
- }
-
- // ********** behaviors **********
- @Override
- public boolean equals(Object o) {
- if(o == null) {
- return false;
- }
- Entity customizer = (Entity) o;
- return (
- (this.descriptorCustomizer == null ?
- customizer.descriptorCustomizer == null :
- this.descriptorCustomizer.equals(customizer.descriptorCustomizer)));
- }
-
- @Override
- public Entity clone() {
- try {
- return (Entity)super.clone();
- }
- catch (CloneNotSupportedException ex) {
- throw new InternalError();
- }
- }
-
- public boolean isEmpty() {
- return this.descriptorCustomizer == null;
- }
-
- public boolean entityNameIsValid() {
- return ! StringTools.stringIsEmpty(this.name);
- }
-
- public Customization getParent() {
- return this.parent;
- }
-
- // ********** getter/setter **********
- public String getName() {
- return this.name;
- }
-
- protected String getDescriptorCustomizer() {
- return this.descriptorCustomizer;
- }
-
- protected void setDescriptorCustomizer(String descriptorCustomizer) {
- String old = this.descriptorCustomizer;
- this.descriptorCustomizer = descriptorCustomizer;
- this.firePropertyChanged(DESCRIPTOR_CUSTOMIZER_PROPERTY, old, descriptorCustomizer);
- }
-
- @Override
- public void toString(StringBuilder sb) {
- sb.append("name: "); //$NON-NLS-1$
- sb.append(this.name);
- sb.append(", descriptorCustomizer: "); //$NON-NLS-1$
- sb.append(this.descriptorCustomizer);
- }
-}

Back to the top